Giter Site home page Giter Site logo

vinhnguyen21 / tsn-rgb-only Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 43.71 MB

Reconstruct training code for Temporal Segment Network in RGB stream

Python 65.78% Jupyter Notebook 5.10% Lua 1.40% Starlark 1.58% Shell 1.41% C++ 24.45% Makefile 0.23% Dockerfile 0.05%

tsn-rgb-only's Introduction

TSN-RGB-OnLy

Description

Our code is reconstructed code from origin github: https://github.com/yjxiong/tsn-pytorch for only RGB stream.

Setup environment

Run the scripts to create a virtual environment and install dependency libraries

$conda create -n tsn python=3.6
$conda activate tsn
$pip install -r requirements.txt

Dataset

wget http://ftp.tugraz.at/pub/feichtenhofer/tsfusion/data/ucf101_jpegs_256.zip.001
wget http://ftp.tugraz.at/pub/feichtenhofer/tsfusion/data/ucf101_jpegs_256.zip.002
wget http://ftp.tugraz.at/pub/feichtenhofer/tsfusion/data/ucf101_jpegs_256.zip.003

cat ucf101_jpegs_256.zip* > ucf101_jpegs_256.zip
unzip ucf101_jpegs_256.zip

Training

To train this project, we just run the command

$python train.py

where train_config.json contains parameters for training:

There is the list of parameters in the config file:

  • dataset : string, choices=['ucf101', 'hmdb51', 'kinetics']
  • modality: string, because of building only for RGB stream so in here we just have 1 option: RGB
  • model_type: string, "resnet18", "resnet34", "resnet50", "resnet101", "vgg16", "BNInception"
  • data_path: string, "path to folder which contains folder videos"
  • class_label: string, "path to class index, txt file"
  • weight_folder: string, "path to folder which contains training'weights"
  • model_path: string, "path to folder which contains weight for testing"
  • num_segments: int, "number of segments that we split the video into"
  • batch_size: int, "number of videos we will load while training"
  • size: int, "size of each frame"
  • consensus_type: string, choices = ['avg', 'attention']. With 'avg', Average all output vector of N segments. With 'attention', find attention-score of each N segments and compute attention-vector.
  • dropout: float, "dropout ratio"
  • loss_type: string, "nll" cross-entropy
  • epochs: integer, number of epochs for training
  • valid_size: float, size of validation for splitting train-test-split
  • lr: float, learning rate
  • lr_steps: int, learning rate step
  • momentum: float, momentum for optimization
  • weight_decay: float, weight decay for optimization
  • clip_grad: int, threshhold of gradient clipping
  • partialbn: boolean, "true": freeze batch-norm2d except last one, "false": unfreeze all batch-norm
  • print_freq: int, "print loss top1 and top5 accuracy after print_freq iterations"
  • eval_freq: int, "Saving weight of model after number of epochs"
  • num_worker: int, "number of worker"
  • gpus: string, "multi": using multiple of gpus, "cuda:0": specific gpu, ...

Testing

Adjust "model_path" in config file for loading training weight to model

Then run:

python test.py

tsn-rgb-only's People

Contributors

vinhnguyen21 avatar

Stargazers

 avatar

Watchers

 avatar

tsn-rgb-only's Issues

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.