Skip to content

Commit

Permalink
Fix image typing
Browse files Browse the repository at this point in the history
  • Loading branch information
aliberts committed Feb 13, 2025
1 parent 0c01d6c commit cf9f800
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/port_datasets/pusht_zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ def main(raw_dir: Path, repo_id: str, mode: str = "video", push_to_hub: bool = T
action = zarr_data["action"][:]
image = zarr_data["img"] # (b, h, w, c)

if image.dtype == np.float32 and image.max() == np.float32(255):
# HACK: images are loaded as float32 but they actually encode uint8 data
image = image.astype(np.uint8)

episode_data_index = {
"from": np.concatenate(([0], zarr_data.meta["episode_ends"][:-1])),
"to": zarr_data.meta["episode_ends"],
Expand Down

0 comments on commit cf9f800

Please sign in to comment.