Download src/dump_frames.py from Conditiondark/ogbench-cube-rigid-body-artifacts: direct link, hf CLI and curl.
- Browser
- Download file 849 Bytes
-
https://huggingface.co/Conditiondark/ogbench-cube-rigid-body-artifacts/resolve/main/src/dump_frames.py
- Command line
-
hf download hf://Conditiondark/ogbench-cube-rigid-body-artifacts/src/dump_frames.py
-
curl -L -o dump_frames.py https://huggingface.co/Conditiondark/ogbench-cube-rigid-body-artifacts/resolve/main/src/dump_frames.py
849 Bytes
| import numpy as np, json, imageio | |
| from pathlib import Path | |
| root=Path("data/bucket/ogbench-cube-success-1000-v1") | |
| row=json.loads((root/"subsets"/"subset-0010.jsonl").read_text().splitlines()[0]) | |
| with np.load(root/"data"/row["archive_file"], allow_pickle=False) as z: | |
| front=z["pixels.front"]; side=z["pixels.side"] | |
| print("front", front.shape, "side", side.shape) | |
| imageio.imwrite("ds_front_first.png", front[0]) | |
| imageio.imwrite("ds_front_last.png", front[-1]) | |
| imageio.imwrite("ds_side_first.png", side[0]) | |
| # downsample front to 64x64 to compare with env obs | |
| import numpy as np | |
| def ds64(img): | |
| # simple 224->64 area-ish downsample via strided mean on 224/64 blocks is non-integer; use PIL | |
| from PIL import Image | |
| return np.array(Image.fromarray(img).resize((64,64), Image.BILINEAR)) | |
| imageio.imwrite("ds_front_first_64.png", ds64(front[0])) | |