Kavin60606 commited on
Commit
b3d1d70
·
verified ·
1 Parent(s): c6064aa

Upload prep_lerobot.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. prep_lerobot.py +6 -1
prep_lerobot.py CHANGED
@@ -56,12 +56,17 @@ def main():
56
  ci, fi = r["data/chunk_index"], r["data/file_index"]
57
  fyy = f"file-{fi:03d}"
58
 
 
 
 
 
 
59
  dst = Path(a.retgt_out) / cat / f"clip_{fyy}_ep{ep}"
60
  dst.mkdir(parents=True, exist_ok=True)
61
  link = dst / "retargeted.hdf5"
62
  if link.is_symlink() or link.exists():
63
  link.unlink()
64
- os.symlink(os.path.abspath(hp), link)
65
 
66
  vid_rel = f"{tb.PREFIX}{cat}/videos/observation.images.camera/chunk-{ci:03d}/{fyy}.mp4"
67
  items.append(vid_rel)
 
56
  ci, fi = r["data/chunk_index"], r["data/file_index"]
57
  fyy = f"file-{fi:03d}"
58
 
59
+ # Prefer the VALIDATED+CORRECTED trajectory if Data Validation wrote one (clamp+smooth);
60
+ # fall back to the raw retarget. This is what makes the pushed dataset the corrected one.
61
+ corrected = str(Path(hp).with_name("corrected.hdf5"))
62
+ src = corrected if os.path.exists(corrected) else hp
63
+
64
  dst = Path(a.retgt_out) / cat / f"clip_{fyy}_ep{ep}"
65
  dst.mkdir(parents=True, exist_ok=True)
66
  link = dst / "retargeted.hdf5"
67
  if link.is_symlink() or link.exists():
68
  link.unlink()
69
+ os.symlink(os.path.abspath(src), link)
70
 
71
  vid_rel = f"{tb.PREFIX}{cat}/videos/observation.images.camera/chunk-{ci:03d}/{fyy}.mp4"
72
  items.append(vid_rel)