### Install and Download OmniWorld Dataset Source: https://github.com/yangzhou24/omniworld/blob/main/README.md Installs the huggingface_hub library and downloads the full OmniWorld dataset to a specified local directory. Ensure you have the CLI installed. ```bash # 1. Install (if you haven't yet) pip install --upgrade "huggingface_hub[cli]" # 2. Full download hf download InternRobotics/OmniWorld \ --repo-type dataset \ --local-dir /path/to/DATA_PATH ``` -------------------------------- ### Install and Download Full OmniWorld Dataset Source: https://context7.com/yangzhou24/omniworld/llms.txt Installs the Hugging Face CLI and downloads the entire OmniWorld dataset to a specified local directory. ```bash pip install --upgrade "huggingface_hub[cli]" hf download InternRobotics/OmniWorld \ --repo-type dataset \ --local-dir /path/to/DATA_PATH ``` -------------------------------- ### Camera JSON Format Example Source: https://context7.com/yangzhou24/omniworld/llms.txt Defines the JSON format for camera pose files, including focal lengths, principal points (cx, cy), quaternion rotations, and translation vectors. ```json { "focals": [525.0, 525.0, 525.0], "cx": [320.0, 320.0, 320.0], "cy": [240.0, 240.0, 240.0], "quats": [ [1.0, 0.0, 0.0, 0.0], [0.999, 0.01, 0.0, 0.0], [0.998, 0.02, 0.0, 0.0] ], "trans": [ [0.0, 0.0, 0.0], [0.1, 0.0, 0.0], [0.2, 0.0, 0.0] ] } ``` -------------------------------- ### Visualize Scene as Point Cloud (Metric Scale) Source: https://github.com/yangzhou24/omniworld/blob/main/README.md Converts a scene from the OmniWorld-Game dataset into a metric-scaled 3D point cloud using the provided script and metadata. The output is saved as a .ply file. ```python python scripts/visualize_pcd.py /b04f88d1f85a --split_idx 0 --metadata_csv metadata/omniworld_game_metadata.csv ``` -------------------------------- ### Project Depth Maps to 3D Coordinates Source: https://context7.com/yangzhou24/omniworld/llms.txt Projects depth maps to 3D world coordinates using camera intrinsics and extrinsics. Returns global 3D point positions for each pixel. Requires loading camera poses and depth maps. ```python import numpy as np from scripts.utils import project, load_camera_poses, load_depth # Load camera data scene_dir = Path("/path/to/scene_data/b04f88d1f85a") intrinsics, extrinsics, frame_indices = load_camera_poses(scene_dir, split_idx=0) # Load depth maps for each frame depths = [] for idx in frame_indices: depth, _ = load_depth(f"{scene_dir}/depth/{idx:06d}.png") depths.append(depth) depths = np.stack(depths, axis=0) # (N, H, W) # Project to 3D world coordinates points = project(intrinsics, extrinsics, depths) print(f"Points shape: {points.shape}") # (N, H, W, 3) - 3D coords for each pixel ``` -------------------------------- ### Load Camera Poses (Intrinsics and Extrinsics) Source: https://context7.com/yangzhou24/omniworld/llms.txt Loads camera intrinsics and extrinsics for a specific split within a scene directory. Optionally rescales poses to metric scale using provided metadata. ```python from pathlib import Path from scripts.utils import load_camera_poses scene_dir = Path("/path/to/scene_data/b04f88d1f85a") split_idx = 0 metric_scale = 1.25 # Optional: from metadata CSV # Load camera poses intrinsics, extrinsics, frame_indices = load_camera_poses( scene_dir, split_idx=split_idx, metric_scale=metric_scale ) print(f"Loaded {len(frame_indices)} frames") print(f"Intrinsics shape: {intrinsics.shape}") # (S, 3, 3) pixel-space K matrices print(f"Extrinsics shape: {extrinsics.shape}") # (S, 4, 4) OpenCV world-to-camera matrices print(f"Frame indices: {frame_indices}") ``` -------------------------------- ### Visualize Scene as Point Cloud (Relative Scale) Source: https://github.com/yangzhou24/omniworld/blob/main/README.md Converts a scene from the OmniWorld-Game dataset into a relative-scaled 3D point cloud using the provided script. This version does not use external metadata for scaling. ```python python scripts/visualize_pcd.py /b04f88d1f85a --split_idx 0 ``` -------------------------------- ### Generate Point Cloud from Scene Data Source: https://context7.com/yangzhou24/omniworld/llms.txt Converts a scene's depth maps and camera poses into a 3D point cloud. Supports generation with relative scale or metric scale using metadata. ```bash # Generate point cloud with relative scale (no metadata) python scripts/visualize_pcd.py /path/to/scene_data/b04f88d1f85a --split_idx 0 # Output: split0_points.ply # Generate point cloud with metric scale (real-world units) python scripts/visualize_pcd.py /path/to/scene_data/b04f88d1f85a \ --split_idx 0 \ --metadata_csv metadata/omniworld_game_metadata.csv # Output: split0_points_metric.ply ``` -------------------------------- ### Load Depth Map with Validity Mask Source: https://context7.com/yangzhou24/omniworld/llms.txt Loads a 16-bit depth map from a PNG file, returning depth values and a validity mask. Optionally converts depth to metric scale. ```python import os from scripts.utils import load_depth depth_path = "/path/to/scene_data/b04f88d1f85a/depth/000001.png" metric_scale = 1.25 # Optional: from metadata CSV # Load depth map depthmap, valid_mask = load_depth(depth_path, metric_scale=metric_scale) print(f"Depth shape: {depthmap.shape}") # (H, W) float32 print(f"Valid mask shape: {valid_mask.shape}") # (H, W) bool print(f"Valid pixels: {valid_mask.sum()}") print(f"Depth range (valid): {depthmap[valid_mask].min():.2f} - {depthmap[valid_mask].max():.2f}") # Invalid pixels (too close, sky, far areas) are set to -1 ``` -------------------------------- ### OmniWorld Scene Directory Structure Source: https://context7.com/yangzhou24/omniworld/llms.txt Illustrates the expected directory structure for a scene within the OmniWorld dataset, detailing the types of annotation files available. ```plaintext /b04f88d1f85a/ ├── color/ # RGB frames (.png) ├── depth/ # 16-bit depth maps (.png) ├── flow/ # Optical flow: flow_u_16.png, flow_v_16.png, flow_vis.png ├── camera/ # split_*.json (intrinsics + extrinsics per split) ├── subject_masks/ # Foreground masks (per split) ├── gdino_mask/ # Dynamic-object masks (per frame) ├── text/ # Structured captions (81-frame segments) ├── droidclib/ # Coarse camera poses (optional) ├── fps.txt # Source video framerate └── split_info.json # Frame groupings into splits ``` -------------------------------- ### Load Metric Scale from CSV Source: https://context7.com/yangzhou24/omniworld/llms.txt Loads the per-scene metric scale factor from a metadata CSV file. Requires scene directory and metadata CSV path. Handles KeyError if the scene is not found. ```python from pathlib import Path from scripts.utils import load_metric_scale scene_dir = Path("/path/to/scene_data/b04f88d1f85a") metadata_csv = Path("metadata/omniworld_game_metadata.csv") try: metric_scale = load_metric_scale(scene_dir, metadata_csv) print(f"Metric scale for {scene_dir.name}: {metric_scale}") except KeyError as e: print(f"Scene not found in metadata: {e}") ``` -------------------------------- ### Extract Scene Data (RGB, Depth, Flow, Annotations) Source: https://context7.com/yangzhou24/omniworld/llms.txt Extracts RGB frames, depth maps, optical flow, and other annotations from downloaded tar archives for a specific scene ID. Ensure the root path points to your OmniWorld data directory. ```bash scene_id=1e527547f893 root=/path/to/DATA_PATH # where you store OmniWorld mkdir -p ${scene_id} # Extract RGB frames (may span multiple parts) for rgb_tar in ${root}/videos/OmniWorld-Game/${scene_id}/${scene_id}_rgb_*.tar.gz do echo "Extracting $(basename $rgb_tar)…" tar -xzf "$rgb_tar" -C ${scene_id} done # Extract depth maps for d_tar in ${root}/annotations/OmniWorld-Game/${scene_id}/${scene_id}_depth_*.tar.gz do echo "Extracting $(basename $d_tar)…" tar -xzf "$d_tar" -C ${scene_id} done # Extract optical flow for f_tar in ${root}/annotations/OmniWorld-Game/${scene_id}/${scene_id}_flow_*.tar.gz do echo "Extracting $(basename $f_tar)…" tar -xzf "$f_tar" -C ${scene_id} done # Extract all other annotations (camera poses, masks, text captions) tar -xzf ${root}/annotations/OmniWorld-Game/${scene_id}/${scene_id}_others.tar.gz -C ${scene_id} ``` -------------------------------- ### Download Specific Scenes from OmniWorld-Game Source: https://context7.com/yangzhou24/omniworld/llms.txt Downloads specific scenes from the OmniWorld-Game subset using either a metadata CSV file or by directly providing scene UIDs. Supports authentication for private repositories. ```python # Download specific rows from metadata CSV python scripts/download_specific.py \ --csv omniworld_game_metadata.csv \ --repo InternRobotics/OmniWorld \ --local_dir ./OmniWorld_subset \ --rows 0 1 # Or specify UIDs directly (bypassing CSV) python scripts/download_specific.py \ --uids 0b3caf48b79d 0c3cefcf3a15 \ --local_dir ./OmniWorld_subset # For private repos, include authentication token python scripts/download_specific.py \ --uids 0b3caf48b79d \ --local_dir ./OmniWorld_subset \ --token YOUR_HF_TOKEN ``` -------------------------------- ### Export 3D Point Cloud to PLY Source: https://context7.com/yangzhou24/omniworld/llms.txt Exports 3D point cloud data to a PLY file. Supports custom RGB colors or auto-generated colors based on spatial coordinates. Requires points and optionally RGB colors. ```python import numpy as np from scripts.utils import write_ply # Points: (N, 3) array of XYZ coordinates points = np.random.randn(10000, 3).astype(np.float32) # RGB colors: (N, 3) array, values 0-255 or 0.0-1.0 colors = np.random.randint(0, 256, (10000, 3)).astype(np.uint8) # Write PLY with custom colors write_ply(points, rgb=colors, path="output_colored.ply") # Write PLY with auto-generated colors based on position write_ply(points, rgb=None, path="output_auto_color.ply") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.