video video 19 82.8 | label class label 3
classes |
|---|---|
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left | |
0observation.images.ego_left |
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Data Filter — jerk analysis, smoothing, kinematic replay
Cleans up the jittery teleop trajectories in ../red_green_blue_cube_sorting_in_sim
so a diffusion/BC policy trained on it outputs continuous, human-like joint
motion instead of reproducing teleop jitter — without breaking the 1:1
alignment between each recorded video frame and its joint state.
Scope decisions (agreed before building this)
- Kinematic replay only. "Replay in sim" here means pushing joint angles
through the same validated forward-kinematics chain the rest of this repo
uses (
scripts/fk.py, <1 mm mean error vs. the dataset's own recorded end-effector state), animated as a stick figure — not a physics simulation. A full physics scene (contacts, a tuned controller, cubes and baskets) would be needed to prove a smoothed trajectory still completes the task, but that's a much bigger project; see "What this doesn't cover" below. - Vision stays untouched. No frame is added, dropped, or retimed — every
episode keeps its exact original timestamps and frame count, so
observation.images.*still lines up index-for-index with the (now smoothed)observation.state/action. Nothing needed re-rendering.
Pipeline
01_analyze_jerk.py— jerk (3rd derivative of joint position) per episode per joint, on either dataset. Run against the raw data first to find what's actually jittery before touching anything.02_build_smoothed_dataset.py— buildsred_green_blue_cube_sorting_in_sim_smoothed/, a full copy of the dataset withobservation.stateandactionreplaced by a smoothed version (see below), andobservation.eef_state/action.eefrecomputed via FK from the smoothed angles so those derived columns don't go stale. Also recomputesmeta/stats.jsonandmeta/episodes_stats.jsonl(used by LeRobot to normalize inputs during training) — leaving the old stats in place would quietly mis-normalize every joint. Videos and everything else inmeta/are copied byte-for-byte.01_analyze_jerk.pyagain, pointed at the smoothed dataset, to measure the before/after difference.04_build_replay_viewer.py— buildsreplay_viewer.html, a self-contained kinematic-replay viewer (same no-server/no-internet convention as the repo'sg1_wrist_trajectories.html): a full-body stick figure including fingers (thumb/index/middle on both hands, not just a single palm dot) for a curated set of episodes, original vs. smoothed overlaid, with play/scrub controls and a synced jerk-over-time chart. Defaults to the 5 worst-jerk episodes + episode 0; pass--episodesfor any others.
How the smoothing works (scripts/smoothing.py)
Legs/waist/arms and hands move in qualitatively different ways in this
task, so they get two different treatments, both feeding into the same
safety backstops. Everything is applied identically to observation.state
and action so they stay mutually consistent, at the same 20fps
timestamps (nothing is resampled, ever).
Legs / waist / arms — zero-phase low-pass filter
(scipy.signal.filtfilt, 6th-order Butterworth). Zero-phase means no
time-shift/lag — it can't desync the trajectory from the video. These
joints move roughly continuously in this tabletop task, so a frequency-
domain filter is the right tool. Cutoff is set per joint group (from
meta/modality.json):
- legs / waist: 2.2 Hz — the lower body carries almost no fast intentional motion here, so it's filtered hardest.
- arms: 3.2 Hz — covers human reaching bandwidth (~1–2 Hz) with headroom.
Hands — hold/move segmentation + minimum-jerk transitions. A finger doesn't move continuously: it sits at a resting value, then snaps open or closed in a fast, genuinely intentional grasp transition (confirmed against the URDF's velocity limit — see below). A low-pass filter can't reduce the jerk at those transitions without also blurring/delaying them relative to the still-unchanged video. So instead, per finger joint:
- Classify each frame as "hold" or "move" from its own velocity relative to its own peak speed (each finger has a different natural range/speed).
- Flatten each hold run to its median — removes jitter around the resting value.
- Replace each move run with the textbook minimum-jerk quintic between the two flanking hold values, over the same time span (Flash & Hogan 1985 — the bell-shaped-velocity profile human reaching motion actually follows). The grasp still completes at the same frame; only the jagged acceleration onset/offset of the raw transition changes.
- If a move isn't a simple point-to-point transition (e.g. the finger overshoots and comes back), a monotonicity check catches it and falls back to light denoising instead of blending straight between the endpoints — collapsing a real excursion into a straight line would erase real motion, not smooth it.
- Per-joint-per-episode safety net: if this whole procedure would somehow leave a joint jerkier than the raw signal (it can happen on a joint that doesn't actually fit the hold/snap model, e.g. a slow continuous drift), fall back to a plain low-pass instead. Nothing ships worse than not touching it.
- A joint whose entire range of motion in an episode is under 0.03 rad is treated as idle (e.g. the left hand, which never grasps anything in this task) and flattened outright — that's not "motion" to preserve, it's noise on a resting pose.
Both groups — slew-rate ("ramping") limiter. Clamps frame-to-frame joint
movement to 90% of that joint's actual velocity limit, parsed straight out
of g1_29dof_with_hand.urdf. A hard backstop independent of either smoother
above: whatever comes out can't ask a joint to move faster than the real G1
can.
Results
| column | mean RMS jerk, before | after | reduction |
|---|---|---|---|
observation.state |
12.19 | 8.73 | 28% |
action |
73.07 | 22.13 | 70% |
action (the teleop command) was far jerkier than observation.state (what
the robot actually did) — expected, since the physical robot's own
inertia/low-level control already smooths the state a little. action is
also what a policy is trained to predict, so that's the column that matters
most for training-data smoothness — and it's where the win is largest.
Per-joint-group breakdown (report/jerk_before_*_summary.json /
jerk_after_*_summary.json), observation.state / action:
- legs / waist: 55–70% / 55–72% jerk reduction
- arms: 23–33% / 37–50% jerk reduction
- right hand (the hand that actually grasps things): 11–31% / 70–76%
jerk reduction —
actionimproves far more thanstatehere because the commanded target has a cleaner hold/snap structure than the physically- damped executed state, which the segmentation exploits well. - left hand (idle in this task): flattened to ~0 — no joint's jerk increased anywhere in the dataset (checked programmatically after every change).
Why the right hand doesn't drop as far as everything else: its finger joints legitimately close/open ~0.15–0.2 rad within a single 50 ms frame while grasping a cube — well inside the URDF's velocity limit, so it's real motion, not a data glitch. The minimum-jerk reshaping above cuts the jagged edges off those transitions but deliberately keeps the same start frame, end frame, and start/end values, so it can't "cheat" by just slowing the grasp down. That's a ceiling on how much jerk can be removed without changing when the grasp happens relative to the still-unchanged video.
The largest per-frame correction across the whole dataset is now ~0.55 rad, on a fast finger joint mid-transition (up from ~0.11 rad in the previous, gentler pass) — see "mid-transition frames" below for what that trade-off actually means.
Running it
Uses the repo's existing venv (../traj_env) — no new dependencies.
cd /home/rahul/data_info/g1
traj_env/bin/python3 data_filter_new_project/scripts/01_analyze_jerk.py --dataset red_green_blue_cube_sorting_in_sim --tag before --column observation.state
traj_env/bin/python3 data_filter_new_project/scripts/01_analyze_jerk.py --dataset red_green_blue_cube_sorting_in_sim --tag before --column action
traj_env/bin/python3 data_filter_new_project/scripts/02_build_smoothed_dataset.py
traj_env/bin/python3 data_filter_new_project/scripts/01_analyze_jerk.py --dataset data_filter_new_project/red_green_blue_cube_sorting_in_sim_smoothed --tag after --column observation.state
traj_env/bin/python3 data_filter_new_project/scripts/01_analyze_jerk.py --dataset data_filter_new_project/red_green_blue_cube_sorting_in_sim_smoothed --tag after --column action
traj_env/bin/python3 data_filter_new_project/scripts/04_build_replay_viewer.py
xdg-open data_filter_new_project/replay_viewer.html
To inspect a specific episode's skeleton in isolation:
traj_env/bin/python3 data_filter_new_project/scripts/03_export_skeleton_episode.py --episode N
writes report/skeleton_epNNN.json (used internally by the replay viewer
builder too).
red_green_blue_cube_sorting_in_sim_smoothed/ is a full ~1.6GB dataset
copy (videos included) — point your training config at it directly, it's a
drop-in replacement with the same LeRobot v2.1 layout.
What this doesn't cover — other ways to improve data quality
- Task-success validation. This dataset has no per-episode success/failure label. Smoothing a trajectory that actually failed the task (dropped a cube, wrong basket) just gives you a smoother bad demonstration. Worth a manual or heuristic pass (e.g. check final cube positions from the video) to filter or flag bad episodes before training — that matters more for policy quality than jerk does.
- Episode-length outliers. Lengths range from 379 to 1655 frames (mean ~950). That's plausibly just natural task-completion-time variance, but it's worth spot-checking the shortest few episodes (e.g. via the replay viewer or the original video) to confirm they're complete demonstrations and not truncated recordings.
- Physics-validated replay. This pass only proves the smoothed trajectory is kinematically close to the original and respects joint velocity limits — it does not prove the robot can still physically execute it and complete the task (contact with the cubes, grasp stability, balance). If you want that guarantee, the natural next step is loading a handful of smoothed episodes into a physics sim (MuJoCo/Isaac) with a joint-position controller and checking task success — a meaningfully bigger project than this one (scene authoring, controller tuning), which is why it was scoped out here.
- Mid-transition frames. The minimum-jerk hand reshaping guarantees the
start and end of a grasp transition match the original timing and
values exactly, but a frame in the middle of a ~5–8 frame transition can
now differ from the raw recording by up to ~0.55 rad on that one
finger joint (the minimum-jerk profile front-loads less motion than the
raw ramp did). That's the direct cost of the bigger jerk reduction on
hands in this pass. Check a transition-heavy episode in
replay_viewer.htmlif you want to eyeball whether that trade-off looks acceptable before training on it — the two skeletons visibly diverge for a few frames at each grasp, then re-converge. - Head/camera-vs-state mismatch. Because video wasn't re-rendered,
smoothing the waist joints changes the reported head pose slightly
without changing what the (unsmoothed)
ego_viewcamera actually shows. Waist/head use the gentle low-pass path (not the hand reshaping), so the deviation there is small, but it's a real, if small, residual inconsistency inherent to "smooth the data, don't touch the video." - Per-joint-group action heads / loss weighting. Since hand-finger jerk is largely irreducible real motion, consider giving hands a separate, lighter-weight loss term (or a separate small action head) in the diffusion model rather than one uniform loss across all 43 joints — so the model isn't implicitly penalized for reproducing fast, correct grasp transitions.
- Temporal ensembling at inference time (as in ACT / Diffusion Policy) — action-chunking with overlapping-chunk averaging smooths execution regardless of training-data smoothness, and is a standard complementary fix alongside cleaning the data itself.
- Downloads last month
- 30