GithubHelp home page GithubHelp logo

naive0409 / ltcontext Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ltcontext/ltcontext

0.0 0.0 0.0 355 KB

[ICCV 2023] How Much Temporal Long-Term Context is Needed for Action Segmentation?

Home Page: https://arxiv.org/abs/2308.11358

License: Other

Python 100.00%

ltcontext's Introduction

LTContext

LTContext is an approach for temporal action segmentation, where it leverages sparse attention to capture the long-term context of a video and windowed attention to model the local information in the neighboring frames.

Here is an overview of the architecture:

LTContext

The attention mechanism consist of Windowed Attention and Long-term Context Attention:

Attentions

Citation

If you use this code or our model, please cite our paper:

@inproceedings{ltc2023bahrami,
    author    = {Emad Bahrami and Gianpiero Francesca and Juergen Gall},
    title     = {How Much Temporal Long-Term Context is Needed for Action Segmentation?},
    booktitle = {IEEE International Conference on Computer Vision (ICCV)},
    year      = {2023}
}

Installation

To create the conda environment run the following command:

conda env create --name ltc --file environment.yml
source activate ltc 

Dataset Preparation

The features and annotations of the Breakfast dataset can be downloaded from link 1 or link 2.

Assembly101

Follow the instructions at Assembly101-Download-Scripts to download the .lmdb TSM features. The annotations for action segmentation can be downloaded from assembly101-annotations. After downloading the annotation put coarse-annotations inside data/assembly101 folder. We noticed loading from numpy can be faster, you can convert the .lmdb features to numpy and use LTContext_Numpy.yaml config.

Training and Evaluating the model

Here is an example of the command to train the model.

python run_net.py \
  --cfg configs/Breakfast/LTContext.yaml \
  DATA.PATH_TO_DATA_DIR [path_to_your_dataset] \
  OUTPUT_DIR [path_to_logging_dir]

For more options look at ltc/config/defaults.py.

The value of DATA.PATH_TO_DATA_DIR for assembly101 should be the path to the folder containing the TSM features.

If you want to evaluate a pretrained model use the following command.

python run_net.py \
  --cfg configs/Breakfast/LTContext.yaml \
  DATA.PATH_TO_DATA_DIR [path_to_your_dataset] \
  TRAIN.ENABLE False \
  TEST.ENABLE True \
  TEST.DATASET 'breakfast' \
  TEST.CHECKPOINT_PATH  [path_to_trained_model] \
  TEST.SAVE_RESULT_PATH [path_to_save_result]

Check the model card to download the pretrained models.

Acknowledgement

The structure of the code is inspired by SlowFast. The MultiHeadAttention is based on xFormers. We thank the authors of these codebases.

License

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

ltcontext's People

Contributors

emadrad avatar naive0409 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.