Data preparation#
Adapt your own G1 motions to terrain, inspect the results, and pack them for training. Use the full installation and run commands from the repository root.
To explore existing optimization results, start with the motion examples.
Prepare flat-ground robot motions#
Start with robot motions at 50 FPS in this layout:
datasets/g1/flat/
├── manifest.json
├── walk/motion.npz
└── turn/motion.npz
File |
Required contents |
|---|---|
|
float32 |
|
The 29 joint names in the same order as the joint columns |
See Motion format for array shapes and a file-writing example. Human motion must already be retargeted to G1. These commands do not retarget or resample it.
Generate terrain variants#
Run adaptation on a CPU machine. Set --num-workers to fit its CPU and memory
allocation; this example uses 32:
uv run python -m perceptive_bfm.scripts.data_process.adapt_motions \
--input-dir datasets/g1/flat \
--base-dir datasets/g1/flat \
--output-dir datasets/g1/pyramid \
--num-workers 32
Results are saved in four terrain groups:
Output group |
Terrain |
|---|---|
|
Pyramid slope |
|
Inverse pyramid slope |
|
Pyramid stairs |
|
Inverse pyramid stairs |
For example, walk/motion.npz becomes
datasets/g1/pyramid/pyramid_stairs_lv0/walk/motion.npz on stairs.
See Terrains for the scene geometry.
Review failed or skipped clips in the completion summary before continuing. To resume an interrupted run, rerun the same command; compatible existing outputs are skipped.
Add the original motions as the paired flat group once:
ln -s ../flat datasets/g1/pyramid/flat
This shares the original files and their manifest without copying them.
Inspect the references#
uv run python -m perceptive_bfm.scripts.data_process.visualize_motions \
--input-dir datasets/g1/pyramid
Switch Terrain to compare versions of a motion. Use slow playback and the frame slider to check contacts, sliding, penetration and sudden pose changes. See Replay controls.
Pack the training dataset#
uv run python -m perceptive_bfm.scripts.data_process.pack_motions \
--input-dir datasets/g1/pyramid \
--output-dir dataset/g1/pyramid \
--target-fps 50 \
--num-workers 32
Each terrain motion needs a flat counterpart with matching FPS and frame count.
--num-workers controls concurrent discovery, source-path checks and packing
reads. Each motion is read once: format, numeric values, FPS and paired frame
counts are checked during that read. Reads use bounded prefetch; groups are
written sequentially in a stable motion order, with progress shown per stage.
Packing uses a temporary directory beside the requested output. After all
groups pass, a new output is published by renaming that directory, without
copying the memmaps. Data validation errors leave the requested output unchanged
and remove the temporary data. Updating an existing output publishes the validated
groups into its existing destinations; that update is not an atomic replacement
of the entire dataset.
Use a fresh output directory when changing the terrain groups, and keep it separate from the input directory.
Directory |
Use |
|---|---|
|
NPZ motions for reference replay |
|
Packed data for training and policy playback |
Continue with Training.