Giter Club home page Giter Club logo

xrmogen's Introduction



Introduction

English | 简体中文

mogen_demo.mp4

XRMoGen is a codebase for motion generation. Currently, it contains two dance generation algorithms

  • Bailando: Siyao et al., Bailando: 3D Dance Generation by Actor-Critic GPT with Choreographic Memory, CVPR 2022
  • DanceRevolution: Huang et al., Dance Revolution: Long-Term Dance Generation with Music via Curriculum Learning, ICLR 2021

For environment settings, see installation.md.

Datasets

We recommend using pre-extracted features for music and motion data, see dataset_preparation.md. After downloading, extract it to $PROJECT/data. In order to facilitate the synthesis of a video with music after the dance is generated, it is needed to download the original music (.mov) to the musics folder in the same directory:

xrmogen
├── mogen
├── docs
├── configs
├── data
│   ├── aistpp_train_wav
│   ├── aistpp_test_full_wav
│   ├── aistpp_music_feat_7.5fps
│   ├── aist_features_zero_start
│   ├── musics
├── ...

Build a Model

Write a new dance generation model

The model structure can be customized through config files. To implement a new method, your model need to contain following functions/medhotds to fit the training/test pipeline:

  • train_step(): forward method of the training mode.
  • val_step(): forward method of the testing mode.
  • registered as a dance model

To be specific, if we want to implement a new model, there are several things to do.

  1. create a new file in mogen/models/dance_models/my_model.py.

    from ..builder import NETWORKS
    from ...builder import DANCE_MODELS
    
    @DANCE_MODELS.register_module()
    class MyDanceModel(nn.Module):
    
        def __init__(self, model_config):
            super().__init__()
    
        def forward(self, ...):
            ....
    
        def train_step(self, data, optimizer, **kwargs):
            ....
    
        def val_step(self, data, optimizer=None, **kwargs):
            ....
  2. import the model in mogen/models/__init__.py

    from .my_model import MyDanceModel
  3. write a config file that defines the model as

    model = dict(
        type='MyDanceModel',
        ....

Train a Model

Epoch Controls

XRMoGen uses mmcv.runner.EpochBasedRunner to control training and test.

In the training mode, the max_epochs in config file decide how many epochs to train. In test mode, max_epochs is forced to change to 1, which represents only 1 epoch to test.

Validation frequency is set as workflow of config file:

 workflow = [('train', 20), ('val', 1)]

Train

For example, to train Bailando (Dance Revolution),

python main.py --config configs/dance_rev.py

Arguments are:

  • --config: config file path.

Test

To test relevant model, add --test_only tag after the config path. We provide some pretrained weights to test (see pretrained_model_list.md. Download the pretrained weights under a folder ./example, and run

python main.py --config configs/bailando_test.py --test_only

to generate the dance poses. The poses will be stored under the workdir ("./bailando_test" in this case) set in config file.

To Compute the quantitative scores:

python tools/eval_quantitative_scores.py --pkl_root ./bailando_test/test/epoch0 --gt_root data/aist_features_zero_start --music_feature_root data/aistpp_test_full_wav

The results should be aligned with benchmark.md.

Visualize

python tools/visualize_dance_from_pkl.py --pkl_root ./bailando_test/test/epoch0  --audio_path data/musics/

Tutorials

Currently, we provide some tutorials for users to learn about

Other Documents

Except for that,The document also includes the following

License

The license of our codebase is Apache-2.0. Note that this license only applies to code in our library, the dependencies of which are separate and individually licensed. We would like to pay tribute to open-source implementations to which we rely on. Please be aware that using the content of dependencies may affect the license of our codebase. Refer to LICENSE to view the full license.

Citation

If you find this project useful in your research, please consider cite:

@misc{xrmogen,
    title={OpenXRLab Motion Generation Codebase},
    author={XRMoGen Contributors},
    howpublished = {\url{https://github.com/openxrlab/xrmogen}},
    year={2022}
}

Contributing

We appreciate all contributions to improve XRMoGen. Please refer to CONTRIBUTING.md for the contributing guideline.

Acknowledgement

XRMoGen is an open source project that is contributed by researchers and engineers from both the academia and the industry. We appreciate all the contributors who implement their methods or add new features, as well as users who give valuable feedbacks. We wish that the framework and benchmark could serve the growing research community by providing a flexible framework to reimplement existing methods and develop their own new models.

Projects in OpenXRLab

  • XRPrimer: OpenXRLab foundational library for XR-related algorithms.
  • XRSLAM: OpenXRLab Visual-inertial SLAM Toolbox and Benchmark.
  • XRSfM: OpenXRLab Structure-from-Motion Toolbox and Benchmark.
  • XRLocalization: OpenXRLab Visual Localization Toolbox and Server.
  • XRMoCap: OpenXRLab Multi-view Motion Capture Toolbox and Benchmark.
  • XRMoGen: OpenXRLab Human Motion Generation Toolbox and Benchmark.
  • XRNeRF: OpenXRLab Neural Radiance Field (NeRF) Toolbox and Benchmark.

xrmogen's People

Contributors

lisiyao21 avatar lazybusyyang avatar yl-1993 avatar

Stargazers

 avatar  avatar Hailin Yu avatar  avatar Coder-chen avatar lemonlikelihood avatar Chongshan avatar Nan Wang avatar  avatar  avatar  avatar  avatar Jidong Jia avatar  avatar  avatar  avatar Jeff Carpenter avatar Xinjian Zhang avatar  avatar  avatar 胡良校 avatar li-ronghui avatar  avatar Kyle avatar  avatar Stoney Kang avatar MagicSource avatar  avatar universe avatar  avatar  avatar Cunjun Yu avatar Jiawei Ren avatar Snow avatar Huang Xin avatar Pavel Samoylenko avatar  avatar Zinnia avatar  avatar 明昌 avatar yujingxiacai avatar  avatar  avatar Yuan-Man avatar aaronchen avatar bigpo avatar Jiong WANG avatar Haiyi avatar Pearson Zhao avatar Ge Yongtao avatar Wendell avatar Tianpei Gu avatar  avatar fun_dl avatar 爱可可-爱生活 avatar Guanglin Li avatar Zhongang Cai avatar  avatar  avatar BCH avatar Ceyuan Yang avatar Zhaoxi Chen avatar Wentao Zhu avatar Ziwei Liu avatar

Watchers

 avatar Snow avatar  avatar

xrmogen's Issues

The problem of `setup.py`

I find if setup.py is used to compile .whl, the xrmogen directory will not be contained. I find two ways to solve this problem,

  • modify the find_packages in setup.py to find_namespace_pakcages

image

  • add __init__.py to the xrmogen directory

It is better to use both of these ways.

Question about self.lambda_v

Hello, I am reimplementing your dance revolution code. I found that in your config file, you set lambda_v to 0.01. In that case, all your mask in training forward become 1 in a 40 epochs setting, and there is no prediction_mask at all. Could you tell me the purpose of doing this? Thank you

groundtruth_mask = torch.ones(seq_len, self.condition_step)
prediction_mask = torch.zeros(seq_len, int(epoch_i * self.lambda_v)) this line
mask = torch.cat([prediction_mask, groundtruth_mask], 1).view(-1)[:seq_len] # for random

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.