Coder Social home page Coder Social logo

ffn-pytorch's Introduction

Frame Flexible Network (CVPR2023)

arXiv | Primary contact: Yitian Zhang

@article{zhang2023frame,
  title={Frame Flexible Network},
  author={Zhang, Yitian and Bai, Yue and Liu, Chang and Wang, Huan and Li, Sheng and Fu, Yun},
  journal={arXiv preprint arXiv:2303.14817},
  year={2023}
}

TL,DR

  • Motivation: Existing video recognition algorithms always conduct separated training pipelines for inputs with different frame numbers, which requires repetitive training operations and multiplying storage costs.
  • Observation: If we evaluate the model at frames which are not used in training, the performance will drop significantly (see Figure above), which is summarized as Temporal Frequency Deviation phenomenon.
  • Solution: We propose a general framework, named Frame Flexible Network (FFN), which not only enables the model to be evaluated at different frames to adjust its computation, but also reduces the memory costs of storing multiple models significantly.
  • Strength: (1) One-shot Training (2) Obvious Performance Gain (3) Significant Parameter Saving (4) Flexible Computation Adjustment (5) Easy Installation and Strong Compatibility.

Datasets

Please follow the instruction of TSM to prepare the Something-Something V1/V2, Kinetics400, HMDB51 datasets.

Support Models

FFN is a general framework and can be easily applied to existing methods for stronger performance and higher flexibility during inference. Currently, FFN supports the implementation of 2D Network: TSM, TEA; 3D Network: SlowFast; Transformer Network: Uniformer. Please feel free to contact us if you want to contribute the implementation of other methods.

Result

  • Validation Across Architectures

FFN can obviously outperform Separated Training (ST) at all frames on different architectures with significant less parameters on Something-Something V1 dataset.

Here we provide the pretrained models on all these architectures:

Model Acc1.($v_{L}$) Acc1.($v_{M}$) Acc1.($v_{H}$) Weight
TSM 20.60% 37.36% 48.55% link
TSM-ST 39.71% 45.63% 48.55% -
TSM-FFN 42.85% 48.20% 50.79% link
TEA 21.78% 41.49% 51.23% link
TEA-ST 41.36% 48.37% 51.23% -
TEA-FFN 44.97% 51.61% 54.04% link
SlowFast 15.08% 35.08% 45.88% link
SlowFast-ST 39.91% 44.12% 45.88% -
SlowFast-FFN 43.90% 47.11% 47.27% link
Uniformer 22.38% 47.98% 56.71% link
Uniformer-ST 44.33% 51.49% 56.71% -
Uniformer-FFN 51.41% 56.64% 58.88% link
  • Validation Across Datasets

FFN can obviously outperform Separated Training (ST) at all frames on different datasets with significant less parameters.

Here we provide the pretrained models on Something-Something V2:

Model Parameters Acc1.($v_{L}$) Acc1.($v_{M}$) Acc1.($v_{H}$) Weight
TSM 25.6M 31.52% 51.55% 61.02% link
TSM-ST 25.6x3M 53.38% 59.29% 61.02% -
TSM-FFN 25.7M 56.07% 61.86% 63.61% link

and Kinetics400:

Model Parameters Acc1.($v_{L}$) Acc1.($v_{M}$) Acc1.($v_{H}$) Weight
TSM 25.6M 64.10% 69.77% 73.16% link
TSM-ST 25.6x3M 66.25% 70.38% 73.16% -
TSM-FFN 25.7M 68.96% 72.33% 74.35% link
  • Inference At Any Frame

FFN can be evaluated at any frame and outperform Seperated Training (ST) even at frames which are not used in training.

Get Started

We provide a comprehensive codebase for video recognition which contains the implementation of 2D Network, 3D Network and Transformer Network. Please go to the folders for specific docs.

Acknowledgment

Our codebase is heavily build upon TSM, SlowFast and Uniformer. We gratefully thank the authors for their wonderful works. The README file format is heavily based on the GitHub repos of my colleague Huan Wang, Xu Ma and Yizhou Wang. Great thanks to them! We also greatly thank the anounymous CVPR'23 reviewers for the constructive comments to help us improve the paper.

ffn-pytorch's People

Contributors

bespontaneous avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ffn-pytorch's Issues

Are there more experimental results?

I noticed that Uniformer made a significant improvement on SSv1, I wonder if there is a similar situation on SSv2, and can it be improved on a larger model such as Uniformer B?

Fig 3 in paper

I have some doubts about Fig 3 in paper. How is the layer index defined in resnet50 and how to calculate the value of Mean and Variance. Thank you.

Questions on TSM_FFN

Hi, thanks for sharing your work first! I am interested in FFN for TSM. As I see in your code resnet_TSM_FFN.py, in the class Bottleneck(nn.Module) ..., self.tsm is defined as TSM(num_segments_H), which is desinated for the high frequency input. But in the forward function, you still use out_4 = self.tsm(x_4), out_8 = self.tsm(x_8) for the low and medium frequency. Is this a mistake? Or I miss something here?

Many thanks for helping me.

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.