A Motion-Text CLIP model trained on the MotionMillion dataset for motion-text retrieval, zero-shot motion classification, and motion understanding.
⚠️ License Notice: This model is released under CC BY-NC 4.0 (Creative Commons Attribution-NonCommercial 4.0). The training data includes datasets with mixed licensing terms, some of which restrict commercial use. This model is for research and non-commercial use only.
📋 Body Model: This model was trained on motion data using the SMPL body model (22 joints). Input motions must be in SMPL skeleton format.
Model Description
MotionCLIP learns a joint embedding space between human motion sequences and natural language descriptions. Given a motion sequence (272-dimensional features per frame) and text descriptions, the model can:
Retrieve the most relevant text for a motion (and vice versa)
Classify motions in a zero-shot manner using text labels
Compute similarity between motions and text descriptions
Download motion_clip_hf.py from this repository or copy it to your project.
Quick Start
python
1from motion_clip_hf import MotionCLIP
2import numpy as np
34# Load model (auto-downloads from HuggingFace)5model = MotionCLIP.from_pretrained("khania/motion-clip")67# Encode text8text_emb = model.encode_text(["a person walks forward","someone is running fast"])9print(f"Text embeddings: {text_emb.shape}")# (2, 512)1011# Encode motion (272-dim absolute root format, variable length)12motion = np.random.randn(120,272).astype(np.float32)# Replace with real motion13motion_emb = model.encode_motion(motion)14print(f"Motion embedding: {motion_emb.shape}")# (512,)1516# Compute similarity17similarity = model.compute_similarity(motion,["walking","running","jumping","sitting"])18predicted =["walking","running","jumping","sitting"][similarity.argmax()]19print(f"Predicted action: {predicted}")
Text-to-Motion Retrieval
python
1# Find most similar motions for a text query2results = model.retrieve_motion(3 text="a person waves their hand",4 candidate_motions=[motion1, motion2, motion3],# List of (T, 272) arrays5 top_k=36)7for r in results:8print(f"#{r['rank']}: Motion {r['index']} (score: {r['score']:.4f})")
Motion-to-Text Retrieval
python
1# Find most similar texts for a motion2results = model.retrieve_text(3 motion=my_motion,# (T, 272) array4 candidate_texts=["walking","running","jumping","waving","sitting"],5 top_k=36)7for r in results:8print(f"#{r['rank']}: {r['text']} (score: {r['score']:.4f})")