Ronaldo-GOAT/pose6daug
pose6daug Real-world Franka manipulation episodes with object-swap and action augmentation artifacts. 120 training episodes over 4 objects (blue_cup, green_pear, kanu, white_spray), dual ZED cameras (exo static + ego wrist-mounted). Layout Per-frame PNGs are packed into uncompressed tars per episode — the dataset has ~427k mask/plate frames and loose files hit Hugging Face's per-repo file recommendation and API rate limits hard. data/<object>/<NNNN>/ masks.tar… See the full description on the dataset page: https://huggingface.co/datasets/Ronaldo-GOAT/pose6daug.
0633
1#!/usr/bin/env python32"""f02_render_check.py -- render the swap object at the grasp frame, all sides.3 4Usage: f02_render_check.py <tag> [ep ...]5 6Writes `.debug/simfix/_shot_<tag>_<ep>.png`: the exo_pp grasp-frame view (crop on7the object) plus four orbit views of the object alone, so the texture can be8judged from every side. Run once before and once after `f01_fix_texture.py`;9`f03_texture_panel.py` stitches the pair into the before/after figure.10"""11from __future__ import annotations12 13import sys14from pathlib import Path15 16import numpy as np17 18sys.path.insert(0, "/lp-dev/jonghoon/sim_action_aug/code/scene")19from s00_common import ASSETS, WS, ep_dir, load_traj # noqa: E40220 21DEBUG = Path("/lp-dev/jonghoon/sim_action_aug/.debug/simfix")22ORBIT_W = ORBIT_H = 320 # 4 tiles * 320 = 1280 = the exo width23 24 25def object_orbit(ep, n=4, dist=0.55):26 """Render the swap object alone, from `n` yaw angles around it."""27 import mujoco28 import json29 g = json.load(open(Path("/lp-dev/jonghoon/sim_action_aug/work/scene") / f"geom_{ep}.json"))30 swap = json.load(open(ASSETS / "swap_assets.json"))31 info = swap[g["obj"]["swap_mesh"].split("/")[0]]32 mdir = ASSETS / "meshes"33 tex = (f'<texture name="obj_tex" type="2d" file="{mdir/info["tex"]}"/>'34 f'<material name="obj_mat" texture="obj_tex" specular="0.3" shininess="0.2"/>'35 ) if info["tex"] else '<material name="obj_mat" rgba="0.85 0.85 0.88 1"/>'36 xml = f"""<mujoco>37 <visual><global offwidth="{ORBIT_W}" offheight="{ORBIT_H}"/></visual>38 <asset>39 <texture name="sky" type="skybox" builtin="flat" rgb1="0.25 0.25 0.28"40 width="64" height="64"/>41 <mesh name="obj_vis" file="{mdir/info['vis']}"/>42 {tex}43 </asset>44 <worldbody>45 <light pos="0.4 0.4 1.2" dir="-0.3 -0.3 -1" diffuse="0.8 0.8 0.8"/>46 <light pos="-0.5 -0.3 0.8" dir="0.5 0.3 -0.5" diffuse="0.45 0.45 0.45" castshadow="false"/>47 <body name="obj"><geom type="mesh" mesh="obj_vis" material="obj_mat"/></body>48 </worldbody>49</mujoco>"""50 m = mujoco.MjModel.from_xml_string(xml)51 d = mujoco.MjData(m)52 mujoco.mj_forward(m, d)53 h = float(m.stat.extent)54 ren = mujoco.Renderer(m, ORBIT_H, ORBIT_W)55 cam = mujoco.MjvCamera()56 cam.type = mujoco.mjtCamera.mjCAMERA_FREE57 cam.lookat[:] = [0, 0, h * 0.35]58 cam.distance = max(dist, h * 1.6)59 cam.elevation = -1260 out = []61 for i in range(n):62 cam.azimuth = 360.0 * i / n63 ren.update_scene(d, camera=cam)64 out.append(ren.render())65 ren.close()66 return out67 68 69def main():70 import imageio.v2 as iio71 sys.path.insert(0, "/lp-dev/jonghoon/sim_action_aug/code/scene")72 from render_cam import SceneRenderer73 74 tag = sys.argv[1]75 eps = sys.argv[2:] or ["0004", "0007"]76 DEBUG.mkdir(parents=True, exist_ok=True)77 for ep in eps:78 tr = load_traj(ep)79 gf = int(tr["grasp_frame"])80 with SceneRenderer(ep) as R:81 R.set_frame(gf)82 exo = R.exo()83 orb = object_orbit(ep)84 row = np.concatenate(orb, axis=1)85 # pad the orbit strip to the exo width86 if row.shape[1] < exo.shape[1]:87 pad = np.zeros((row.shape[0], exo.shape[1] - row.shape[1], 3), np.uint8)88 row = np.concatenate([row, pad], axis=1)89 else:90 row = row[:, :exo.shape[1]]91 img = np.concatenate([exo, row], axis=0)92 p = DEBUG / f"_shot_{tag}_{ep}.png"93 iio.imwrite(p, img)94 print("[simfix/shot]", p, img.shape, flush=True)95 96 97if __name__ == "__main__":98 main()99 