Code Monkey home page Code Monkey logo

ms-tcn2's Introduction

Computer-vision - Final Project

Goal

Suggest a modification to MSTCN++ aiming to improve performances of gesture recognition task over specific data of physicians performing practice surgery operations.

Description

  • Used MSTCN++ pytorch implementation (https://github.com/sj-li/MS-TCN2) of the paper [MS-TCN++: Multi-Stage Temporal Convolutional Network for Action Segmentation](https://arxiv.org/pdf/2006.09220.pdf) to perform gesture recognition over data of physicians performing surgical activity as baseline results.
  • Implementation of modifications to the original architecture such as weighted loss, adding GRU stages and performing down sampling.
  • Reporting evaluation metrics.
  • Tagging videos.

How to run?

Prepare environment

  1. Clone this project
  2. pip/conda install the requirments.txt file

Reproduce results

main.py

The file which does all of the heavy lifting is main.py.
main.py is responsible for running the baseline and modified architectures, performing gesture recognition over the data videos. It also reports loss and accuracy over train and validation sets and generates graphs in clearML.

The script assumes the following paths:

  1. labels are provided in a directory with the absolute path /datashare/APAS/transcriptions_gestures/ where each video has a corresponding text file with the same name as the video, holding the ground truth labels in the following frame format:
0 524 G0
525 662 G1
663 808 G2
809 898 G3
899 970 G4
  1. The video features are provided in the absolute path /datashare/APAS/features/ where the directory tree is the following:
root
|->fold0
|->fold1
|->fold2
|->fold3
|->fold4

and each fold folder contains all the features of all the videos.

  1. The Cross validation splitting methods are provided in the absolute path /datashare/APAS/folds/ where the directory tree is the following:
root
|->valid 0
|->valid 1
|->valid 2
|->valid 3
|->valid 4
|->test 0
|->test 1
|->test 2
|->test 3
|->test 4

each text file contains list of videos relevant to its own fold.

Runing the model:

To reproduce the results use the following commands:

  1. To get baseline results run:
main.py --action baseline 
  1. To train the new architecture (our modification) run:
main.py --action train
  1. To run the tradeoff experiment run:
main.py --action train_tradeoff

All the above commands include performing prediction over the test data.

test_analysis.py

This script assumes the same dir structure as main.py and outputs all of the metrics described in the report such as Accuracy, F1 and Edit Score over the test data (assumes predictions were already generated). Additionally, this scripts plots segmentation plots and metric graphs.

video_creator.py

This script was used to annotate videos with the ground truth labels and their predicted labels.

Annotated videos:

This git also includes 3 anotated videos (mp4 files). Those videos were annotated using our final trained model.

ms-tcn2's People

Contributors

ofekglick avatar sj-li avatar liormotola avatar

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.