Shakerato

Video Action Classification using 3D ResNet 본문

Research

Video Action Classification using 3D ResNet

Shakeratto 2019. 2. 18. 12:13

Reference:

https://github.com/kenshohara/video-classification-3d-cnn-pytorch


(Linux)

1. Install Anaconda and Setup Pytorch (GPU)

2. Download code from Github (https://github.com/kenshohara/video-classification-3d-cnn-pytorch)

3. Download Pre-trained Model and copy to source code folder (resnext-101-kinetics.pth)

   https://drive.google.com/drive/folders/1zvl89AgFAApbH0At-gMuZSeQB_LpNP-M

4. Install FFmpeg

   conda install -c anaconda ffmpeg

5. Run a code
python main.py --input ./input --video_root ./videos --output ./output.json --model ./resnext-101-kinetics.pth --resnet_shortcut B  --mode score --model_name resnext --model_depth 101

6. You can get result file (output.json) "segment": [start frame number, end frame number], "label": " "

7. Generate labeled video (Option)
python generate_result_video/generate_result_video.py ../output.json ../videos ./videos_pred ../class_names_list 5



(Windows) -- Not Recommend

1. Install Anaconda and Setup Pytorch (GPU)

2. Download code from Github (https://github.com/kenshohara/video-classification-3d-cnn-pytorch)

3. Download Pre-trained Model and copy to source code folder (resnext-101-kinetics.pth)

   https://drive.google.com/drive/folders/1zvl89AgFAApbH0At-gMuZSeQB_LpNP-M

4. Download FFmpeg and copy to source code folder

5. Change code (subprocess.call() is for removing and creating folders in linux)

(shutil is need for windows)

import shutil


subprocess.call('rm -rf tmp', shell=True)

 --> (Change like this)

  if os.path.exists('tmp'):

     shutil.rmtree('tmp')


subprocess.call('mkdir tmp', shell=True)

 --> (Change like this)

os.makedirs('tmp') 

6. Run a code

python main.py --input ./input --video_root ./videos --output ./output.json --model ./resnext-101-kinetics.pth --resnet_shortcut B  --mode score --model_name resnext --model_depth 101


7. You can get result file (output.json) "segment": [start frame number, end frame number], "label": " "


8. Generate labeled video (Option) (It's not easy to change the code to run on Windows
   --> You'd better to run a code on Linux


Comments