• Home
  • Resources
    Education Techs Posts Kitab Kuning Blog Journey
  • Portfolios

Tutorial I3D Tensorflow

There a lot of questions about the detail of the implementation of I3D network. Hence, in this week, I would like to give a short tutorial on how to install and use this network on your computer.

Implementation

In this post, I would like to explain about the implementation of I3D in TensorFlow. First, you need to clone the network by
$ git clone https://github.com/LossNAN/I3D-Tensorflow
Next, you need to satisfy with the requirements, such as, the sonnet. For me, I prefer to use TensorFlow 1.10.0, hence the satisfied Sonnet is version 1.23. You can follow the instruction on the here to install those modules
$ pip install tensorflow-gpu==1.10.0
$ pip install tensorflow-gpu tensorflow-probability
$ https://github.com/deepmind/sonnet or
$ pip install dm-sonnet==1.23

To verify, you can simply run:
$ python
>> import tensorflow as tf
>> import sonnet as snt
>> tf.__version__
>> snt.__version__

For the other dependency, you can install it when you see some errors during running the training code. It should be not that hard by the helping of StackOverflow. :-)

Talk to more detail, we will have some folders, such as, lists, experiments, and checkpoints. Your list of videos for both training and testing will be stored under lists folder, such as:
/media/ee401_2/Datasets1/ucf_crime/UCF_Crimes/Frames_Anomaly/Abuse/Abuse011_x264 0
/media/ee401_2/Datasets1/ucf_crime/UCF_Crimes/Frames_Anomaly/Abuse/Abuse008_x264 0
/media/ee401_2/Datasets1/ucf_crime/UCF_Crimes/Frames_Anomaly/Abuse/Abuse009_x264 0
/media/ee401_2/Datasets1/ucf_crime/UCF_Crimes/Frames_Anomaly/Abuse/Abuse010_x264 0
/media/ee401_2/Datasets1/ucf_crime/UCF_Crimes/Frames_Anomaly/Abuse/Abuse011_x264 0
/media/ee401_2/Datasets1/ucf_crime/UCF_Crimes/Frames_Anomaly/Abuse/Abuse012_x264 0
/media/ee401_2/Datasets1/ucf_crime/UCF_Crimes/Frames_Anomaly/Arrest/Arrest001_x264 1
/media/ee401_2/Datasets1/ucf_crime/UCF_Crimes/Frames_Anomaly/Arrest/Arrest002_x264 1
/media/ee401_2/Datasets1/ucf_crime/UCF_Crimes/Frames_Anomaly/Arrest/Arrest003_x264 1


In this path, we should provide three folders, which are one rgb folder: i, and two optical flows: x and y.
Note, you can use DenseFlow to produce the optical flow information. The tutorial is on
https://github.com/yangwangx/denseFlow_gpu

For training the network, we can simply run the code by
$ python train_rgb.py
Or if we want to test the network, simple run:
$ python test_rgb.py
Note, we can modify some hyperparameters, such as, learning rate, max iterations, batch size, crop size, number of gpu, and number of classes.

Related posts: Breaking Down the I3D Network

Let's Connect