gemx_soma_diffusers / README.md
OzzyGT's picture
OzzyGT HF Staff
Upload README.md
83071f4 verified
|
Raw History Blame Contribute Delete
3.25 kB
---
language:
- en
license: other
license_name: nvidia-open-model-license
license_link: https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/
base_model:
- nvidia/GEM-X
- PekingU/rtdetr_r101vd_coco_o365
library_name: diffusers
tags:
- gem-x
- modular-diffusers
- motion-capture
- pose-estimation
- video
- soma
---
# GEM-X SOMA Diffusers
<video controls autoplay loop muted playsinline src="https://huggingface.co/datasets/OzzyGT/diffusers-examples/resolve/main/gem-x/gemx_soma_karate_foot_lock_v2.mp4"></video>
*Left: the camera-space skeleton and 2D keypoints. Right: the world motion. The clip is AI-generated, the first frame with MiniMax-H3-Image and the video with MiniMax-H3.*
A Diffusers conversion of the native77 body model of [nvidia/GEM-X](https://huggingface.co/nvidia/GEM-X), which reconstructs the 3D motion of one person in a video. This repository holds the weights, configs and model code: the RT-DETR person detector, GEM-X's keypoint model, pose encoder and motion transformer, and Kimodo's neutral SOMA77 skeleton.
For model details, see the [original model card](https://huggingface.co/nvidia/GEM-X) and the [GEM-X repository](https://github.com/NVlabs/GEM-X).
## Usage
Install PyTorch for your GPU, then:
```bash
pip install "diffusers>=0.41.0" "transformers>=5.3.0" "torchvision>=0.25" "opencv-python-headless>=4.10" "scipy>=1.11" imageio imageio-ffmpeg
```
The model runs with the [GEM-X SOMA Modular Diffusers](https://huggingface.co/OzzyGT/gemx_soma_custom_blocks) blocks.
> **Note:** `trust_remote_code=True` runs the code of the blocks repository and `trust_components_code=True` the model code in this one, both downloaded from the Hub. Only use them with repositories you trust.
```python
import numpy as np
import torch
from diffusers import ModularPipelineBlocks
from diffusers.utils import load_video
blocks = ModularPipelineBlocks.from_pretrained(
"OzzyGT/gemx_soma_custom_blocks",
trust_remote_code=True,
components_repo="OzzyGT/gemx_soma_diffusers",
trust_components_code=True,
)
pipe = blocks.init_pipeline()
pipe.load_components(dtype=torch.float32)
pipe.to("cuda")
video = load_video("clip_30fps.mp4")
motion = pipe(video=video, output="motion")
np.savez_compressed("motion.npz", **{key: value.cpu().numpy() for key, value in motion.items()})
```
The clip must be at 30 FPS. The result is a SOMA77 motion in meters, +Y up, with Kimodo's joint order and rotation convention; the blocks can also return the SOMA body parameters. The feet are locked in place while they touch the floor; pass `foot_lock=False` for GEM-X's raw prediction. Use float32, which matches GEM-X. See the [blocks](https://huggingface.co/OzzyGT/gemx_soma_custom_blocks) for the inputs and outputs.
## Licenses
- GEM-X weights: [NVIDIA Open Model License](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/), from [nvidia/GEM-X](https://huggingface.co/nvidia/GEM-X). See [NOTICE](NOTICE).
- Person detector: Apache-2.0, from [PekingU/rtdetr_r101vd_coco_o365](https://huggingface.co/PekingU/rtdetr_r101vd_coco_o365), unchanged.
- Model code and the skeleton from [NVIDIA Kimodo](https://github.com/nv-tlabs/kimodo): [Apache-2.0](LICENSE).