Git Product home page Git Product logo

mgsampler's Introduction

Overview

This repo is the implementation of MGSampler. The code is based on mmaction2

Dependencies

  • GPU: TITAN Xp
  • GCC: 7.3
  • Python: 3.7.4
  • Pytorch: 1.6.0+cu101
  • TorchVision: 0.7.0+cu101
  • OpenCV: 4.4.0
  • MMCV: 1.3.6
  • MMaction2: 0.15.0+

Installation:

a. Create a conda virtual environment and activate it.

conda create -n open-mmlab python=3.7 -y
conda activate open-mmlab

b. Install PyTorch and torchvision following the official instructions, e.g.,

conda install pytorch torchvision -c pytorch

Note: Make sure that your compilation CUDA version and runtime CUDA version match. You can check the supported CUDA version for precompiled packages on the PyTorch website.

c. Install mmcv, we recommend you to install the pre-build mmcv as below.

pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html

d. Clone the MGSampler repository.

git clone https://github.com/MCG-NJU/MGSampler.git

e. Install build requirements and then install MMAction2.

pip install -r requirements/build.txt
pip install -v -e .  # or "python setup.py develop"

Data Preparation:

Pleasr refer to the default MMAction2 dataset setup to set datasets correctly.

Training

MGSampler is a sampling strategy to guide the model to choose motion-salient frames. It is very easy to be inserted into the original codes. Here we explain three places we have mainly changed in mmaction2.

For training the model, run the following the code(take sthv1 dataset and tsm model as an example):

bash tools/dist_train.sh configs/recognition/tsm/tsm_r50_1x1x8_50e_sthv1_rgb.py 8 --validate

License

See Apache-2.0 License

Acknowledgement

In addition to the MMAction2 codebase, this repo contains modified codes from:

  • PAN-Pytorch: for implement of generating feature-level differences.

mgsampler's People

Contributors

castle971005 avatar yztongzhan 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

Watchers

 avatar  avatar  avatar

mgsampler's Issues

about train

Hello, I reported these two problems after running the script file, what is the reason?

KeyError: 'SampleFrames is already registered in pipeline'
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 1525602) of binary: /home/zhouyx/anaconda3/envs/open-mmlab/bin/python

Question about the way to compute image difference.

Thank you for your great work.
My question is that why you use the function skimage.measure.compare_ssim to compute the similarity of two adjacent frames instead of subtracting directly as your paper says.

what are the img_diff_sthv1_train.json and img_diff_sthv1_val.json?

Hi! I have a doubt when I inserted MGSampler into the original codes. What are the img_diff_sthv1_train.json and img_diff_sthv1_val.json in ./MGSampler/mmaction/datasets? How can I get them?

with open('/home/zhiyuan/img_diff_sthv1_train.json', 'r') as f:
img_train = json.load(f)
with open('/home/zhiyuan/img_diff_sthv1_val.json', 'r') as f:
img_val = json.load(f)

Thank you!

trained model

Is there a trained model could be provided. I just want to do a test. Thanks.

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.