Skip to content

PPPrior/i3d-pytorch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

I3D-PyTorch

This is a simple and crude implementation of Inflated 3D ConvNet Models (I3D) in PyTorch. Different from models reported in "Quo Vadis, Action Recognition? A New Model and the Kinetics Dataset" by Joao Carreira and Andrew Zisserman, this implementation uses ResNet as backbone.

This implementation is based on OpenMMLab's MMAction2.

Data Preparation

For optical flow extraction and video list generation, please refer to TSN for details.

Training

To train a new model, use the main.py script.

For example, command to train models with RGB modality on UCF101 can be

python main.py ucf101 RGB <root_path> \
    <ucf101_rgb_train_list> <ucf101_rgb_val_list> \
    --arch i3d_resnet50 --clip_length 64 \
    --lr 0.001 --lr_steps 30 60 --epochs 80 \
    -b 32 -j 8 --dropout 0.8 \
    --snapshot_pref ucf101_i3d_resnet50

For flow models:

python main.py ucf101 Flow <root_path> \
    <ucf101_flow_train_list> <ucf101_flow_val_list> \
    --arch i3d_resnet50 --clip_length 64 \
    --lr 0.001 --lr_steps 15 30 --epochs 40 \
    -b 64 -j 8 --dropout 0.8 \
    --snapshot_pref ucf101_i3d_resnet50

Please refer to main.py for more details.

Testing

After training, there will checkpoints saved by pytorch, for example ucf101_i3d_resnet50_rgb_model_best.pth.tar.

Use the following command to test its performance:

python test_models.py ucf101 RGB <root_path> \
    <ucf101_rgb_val_list> ucf101_i3d_resnet50_rgb_model_best.pth.tar \
    --arch i3d_resnet50 --save_scores <score_file_name>

Or for flow models:

python test_models.py ucf101 Flow <root_path> \
    <ucf101_flow_val_list> ucf101_i3d_resnet50_flow_model_best.pth.tar \
    --arch i3d_resnet50 --save_scores <score_file_name>

Please refer to test_models.py for more details.

Releases

No releases published

Packages

No packages published

Languages