How to Predict Human Motion Using Recurrent Neural Networks

Jun 26, 2022 | Data Science

Welcome to this comprehensive guide on human motion prediction! In this article, we’ll break down the process of using recurrent neural networks (RNNs) for predicting human motion, as proposed in the paper by Julieta Martinez, Michael J. Black, and Javier Romero at CVPR 2017.

What You Need to Start

Before diving into the code, ensure you have the following dependencies installed:

  • h5py – This helps in saving samples.
  • TensorFlow (version 1.2 or later) – Essential for running the models.

Getting the Code and Data

Ready to start? Follow these steps to clone the repository and download the necessary dataset:

bash
git clone https://github.com/una-dinosauria/human-motion-prediction.git
cd human-motion-prediction
mkdir data
cd data
wget http://www.cs.stanford.edu/people/ashesh/h3.6m.zip
unzip h3.6m.zip
rm h3.6m.zip
cd ..

Quick Demo and Visualization

You can train your model for a few iterations and visualize the outputs quite easily. Here’s how:

bash
# Train the model 
python src/translate.py --action walking --seq_length_out 25 --iterations 10000

# To save samples of the model
python src/translate.py --action walking --seq_length_out 25 --iterations 10000 --sample --load 10000

# Visualize the samples
python src/forward_kinematics.py

Once you run the visualization command, it will produce an animated GIF similar to the one below:

Running Average Baselines

To reproduce the running average baseline results outlined in the paper, execute the following:

python src/baselines.py

Training RNN Models

Once you’re geared up, training the RNN models is straightforward. Here are the commands needed:

  • Sampling-based loss (SA): python src/translate.py --action walking --seq_length_out 25 (Training time: 45 seconds, 1000 iterations)
  • Residual (SA): python src/translate.py --residual_velocities --action walking (Training time: 35 seconds, 1000 iterations)
  • Residual unsupervised (MA): python src/translate.py --residual_velocities --learning_rate 0.005 --omit_one_hot (Training time: 65 seconds, 1000 iterations)
  • Residual supervised (MA): python src/translate.py --residual_velocities --learning_rate 0.005 (Training time: 65 seconds, 1000 iterations)
  • Untied: python src/translate.py --residual_velocities --learning_rate 0.005 --architecture basic (Training time: 70 seconds, 1000 iterations)

You can replace the walking action with any of the following: directions, discussion, eating, greeting, phoning, posing, purchases, sitting, sittingdown, smoking, takingphoto, waiting, walking, walkingdog, walkingtogether, or simply use --action all to train on all actions.

Tracking Progress with TensorBoard

Monitor your model’s performance in real-time using TensorBoard:

tensorboard --logdir experiments

Then open your browser at http://127.0.1.1:6006 to check the visual progress.

Troubleshooting

While following this guide, you may run into some hiccups. Here are a few troubleshooting ideas to help you out:

  • Ensure all dependencies are correctly installed and up to date.
  • If the clone command fails, check your internet connection or repository URL.
  • For visual output issues, verify that all data files are unpacked correctly in the designated folder.
  • In case TensorBoard doesn’t display, check the logdir path for accuracy.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Wrapping Up

By now you should have a firm grasp on how to utilize recurrent neural networks for predicting human motion. This framework opens a myriad of innovative possibilities in motion analysis and prediction.

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox