GithubHelp home page GithubHelp logo

pancakeawesome / tsn_pytorch_gesture_recognition Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 1.0 43.65 MB

use TSN pytorch model to discern driver gesture when driving

License: BSD 2-Clause "Simplified" License

Python 70.39% Lua 1.43% Shell 1.43% Jupyter Notebook 1.65% C++ 24.87% Makefile 0.24%
tsn pytorch

tsn_pytorch_gesture_recognition's Introduction

TSN-Pytorch-gesture-recognition

This a gesture recognition experiment in vedio for a logitics project.We use TSN model to discern action from a video in trunk.We can get driver's driving video by camera in the trunk to judge whether the driver has illegal manner when driving.The origin paper can be found here. For more detail about the paper and code, see this [blog][1]


setup

  • requirements: pytorch1.0, opencv-python, opencv-c++ we use opencv-c++ to extract optical flow

demo

  • put your images in data/demo, the results will be saved in data/results, and run demo in the root
python ..//tools/demo.py

training

prepare data

  • We use own private data to train tsn model, but sorry we couldn't open these data. You can use International public dataset,such as UFC101,hmdb51 e.g.
  • Second, you need to download pretrain models adn put it in models.
  • We use three input modes to train our models,for RGB mode, optical mode, RGB-Diff mode.

for RGB mode:

python main.py ucf101 RGB <ucf101_rgb_train_list> <ucf101_rgb_val_list> \
   --arch BNInception --num_segments 3 \
   --gd 20 --lr 0.001 --lr_steps 30 60 --epochs 80 \
   -b 128 -j 8 --dropout 0.8 \
   --snapshot_pref ucf101_bninception_ 

For flow models:

python main.py ucf101 Flow <ucf101_flow_train_list> <ucf101_flow_val_list> \
   --arch BNInception --num_segments 3 \
   --gd 20 --lr 0.001 --lr_steps 190 300 --epochs 340 \
   -b 128 -j 8 --dropout 0.7 \
   --snapshot_pref ucf101_bninception_ --flow_pref flow_  

For RGB-diff models:

python main.py ucf101 RGBDiff <ucf101_rgb_train_list> <ucf101_rgb_val_list> \
   --arch BNInception --num_segments 7 \
   --gd 40 --lr 0.001 --lr_steps 80 160 --epochs 180 \
   -b 128 -j 8 --dropout 0.8 \
   --snapshot_pref ucf101_bninception_ 

Testing

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

Use the following command to test its performance in the standard TSN testing protocol:

python test_models.py ucf101 RGB <ucf101_rgb_val_list> ucf101_bninception_rgb_checkpoint.pth \
   --arch BNInception --save_scores <score_file_name>

Or for flow models:

python test_models.py ucf101 Flow <ucf101_rgb_val_list> ucf101_bninception_flow_checkpoint.pth \
   --arch BNInception --save_scores <score_file_name> --flow_pref flow_

tsn_pytorch_gesture_recognition's People

Contributors

pancakeawesome avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

panna19951227

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.