GithubHelp home page GithubHelp logo

palmerkuo / fairmotion Goto Github PK

View Code? Open in Web Editor NEW

This project forked from facebookresearch/fairmotion

0.0 0.0 0.0 35.14 MB

Tools to load, process and visualize motion capture data

License: Other

Python 100.00%

fairmotion's Introduction

fairmotion

fairmotion provides easy-to-use interfaces and tools to work with motion capture data. The objective of the library is to manage the complexity of motion representation, 3D transformations, file formats and visualization, and let users focus on high level learning tasks.

Users can take advantage of large high-quality motion capture datasets like the CMU and AMASS datasets without deep knowledge of the domain or handling the idiosyncrasies of individual datasets. We implement baselines for research tasks using building blocks from the library to demonstrate its utility.

Getting Started

Installation

farmotion is available on PyPI for easy installation

pip install fairmotion

To install fairmotion from source, first clone the git repository, use pip to download dependencies and build the project.

$ git clone https://github.com/facebookresearch/fairmotion.git
$ cd fairmotion
$ pip install -e .

Data Loading

Here, we load a motion capture file in the BVH file format in a python console. Similarly, there are loaders to import files from ASF/AMC, AMASS and AMASS DIP formats.

from fairmotion.data import bvh

BVH_FILENAME = “PATH_TO_BVH_FILE”
motion = bvh.load(BVH_FILENAME)

Motion manipulation

The motion object can be manipulated in both modular and matrix forms. Here, we translate the object to a fixed global position [1, 1, 1] and select a time slice from frame 20 to frame 30.

from fairmotion.ops import motion as motion_ops

translated_motion = motion_ops.translate(motion, np.array([1, 1, 1]))
sliced_motion = motion_ops.cut(translated_motion, 10, 20)

We can perform the same operations in the matrix representation of motion.

from fairmotion.core.motion import Motion

# motion_matrix has shape (num_frames, num_joints, 4, 4) where 4x4 is transformation matrix
motion_matrix = motion.to_matrix()

translation_matrix = np.zeros((4, 4))
translation_matrix[3, :3] = np.array([1, 1, 1])

translated_motion_matrix = motion_matrix + translation_matrix
sliced_motion_matrix = translated_motion_matrix[10:20]
sliced_motion = Motion.from_matrix(sliced_motion_matrix, motion.skel)

Data saving

We can save the manipulated motion object back into the bvh file format for us to visualize the result.

NEW_BVH_FILENAME = "PATH_TO_NEW_BVH_FILE"
bvh.save(sliced_motion, NEW_BVH_FILENAME)

Visualization

We visualize the results using the bvh_visualizer tool.

$ python fairmotion/viz/bvh_visualizer.py --bvh-files $NEW_BVH_FILENAME

Tasks

The tasks module showcases practical usage of fairmotion modules as building blocks in developing projects.

fairmotion has been used in some form in the following works:

  • Jungdam Won, Deepak Gopinath, and Jessica Hodgins. “A Scalable Approach to Control Diverse Behaviors for Physically Simulated Characters” to be presented at SIGGRAPH 2020 [Project page with code and paper]
  • Tanmay Shankar, and Abhinav Gupta. "Learning Robot Skills with Temporal Variational Inference." ICML 2020
  • Jungdam Won, and Jehee Lee. "Learning body shape variation in physics-based characters." ACM Transactions on Graphics (TOG) 2019

Citation

If you find fairmotion useful in your research, please cite our repository using the following BibTeX entry.

@Misc{gopinath2020fairmotion,
  author =       {Gopinath, Deepak and Won, Jungdam},
  title =        {fairmotion - Tools to load, process and visualize motion capture data},
  howpublished = {Github},
  year =         {2020},
  url =          {https://github.com/facebookresearch/fairmotion}
}

License

fairmotion is released under the BSD-3-Clause License.

fairmotion's People

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.