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 [Link]
$ 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 [Link] import bvh
BVH_FILENAME = “PATH_TO_BVH_FILE”
motion = [Link](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 mocap_proceessing.ops import motion as motion_ops
translated_motion = motion_ops.translate(motion, [Link]([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 [Link] import Motion
# motion_matrix has shape (num_frames, num_joints, 4, 4) where 4x4 is
transformation matrix
motion_matrix = motion.to_matrix()
translation_matrix = [Link]((4, 4))
translation_matrix[3, :3] = [Link]([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, [Link])
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"
[Link](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.
Motion Prediction
Motion Graph
Clustering of motion capture dataset
Changepoint Detection
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
License
fairmotion is released under the BSD-3-Clause License.