Download droid/scripts/inspect_camera_data.py from zhicao/openpi: direct link, hf CLI and curl.
- Browser
- Download file 2.31 kB
-
https://huggingface.co/datasets/zhicao/openpi/resolve/main/droid/scripts/inspect_camera_data.py
- Command line
-
hf download hf://datasets/zhicao/openpi/droid/scripts/inspect_camera_data.py
-
curl -L -o inspect_camera_data.py https://huggingface.co/datasets/zhicao/openpi/resolve/main/droid/scripts/inspect_camera_data.py
2.31 kB
| """ | |
| Inspect actual camera data structure to find wrist camera. | |
| """ | |
| import sys | |
| from pathlib import Path | |
| sys.path.append(str(Path(__file__).parent.parent)) | |
| import json | |
| import numpy as np | |
| calib_dir = Path('/root/workspace/code/wmrl/Dual-Dynamics-Models/DROID-main/vision/u/wenlongh/datasets/droid_v4/cameras') | |
| # Load first calibration file | |
| calib_files = sorted(calib_dir.glob("*_cameras.json")) | |
| calib_file = calib_files[0] | |
| print("=" * 80) | |
| print(f"File: {calib_file.name}") | |
| print("=" * 80) | |
| with open(calib_file, 'r') as f: | |
| calib = json.load(f) | |
| serials = [k for k in calib.keys() if k not in ['uuid', 'scene_path', 'optimization_summary', 'error_info']] | |
| print(f"\nFound {len(serials)} cameras: {serials}") | |
| for serial in serials: | |
| cam_data = calib[serial] | |
| print(f"\n{'='*80}") | |
| print(f"Camera: {serial}") | |
| print(f"{'='*80}") | |
| print(f"Keys: {list(cam_data.keys())}") | |
| for key, value in cam_data.items(): | |
| if isinstance(value, (list, np.ndarray)): | |
| value_array = np.array(value) | |
| print(f" {key}: shape={value_array.shape}, dtype={value_array.dtype}") | |
| if value_array.size <= 20: # Print small arrays | |
| print(f" {value_array}") | |
| elif isinstance(value, dict): | |
| print(f" {key}: dict with keys {list(value.keys())}") | |
| else: | |
| print(f" {key}: {value}") | |
| print("\n" + "=" * 80) | |
| print("Checking how CameraCalibrationLoader identifies wrist camera:") | |
| print("=" * 80) | |
| from utils.load_camera_calibration import CameraCalibrationLoader | |
| calib_loader = CameraCalibrationLoader(str(calib_dir)) | |
| # Get UUID | |
| uuid = calib['uuid'] | |
| print(f"UUID: {uuid}") | |
| # Try to get dual view params | |
| try: | |
| dual_params = calib_loader.get_dual_view_params(uuid, param_type='refined', require_refined=False) | |
| if dual_params: | |
| print(f"\nDual view params found!") | |
| print(f" exterior_1: K shape={dual_params['exterior_1'][0].shape}, E shape={dual_params['exterior_1'][1].shape}") | |
| print(f" wrist: K shape={dual_params['wrist'][0].shape}, E shape={dual_params['wrist'][1].shape}") | |
| K_wrist = dual_params['wrist'][0] | |
| E_wrist = dual_params['wrist'][1] | |
| print(f"\nWrist K:\n{K_wrist}") | |
| print(f"\nWrist E:\n{E_wrist}") | |
| except Exception as e: | |
| print(f"Error: {e}") | |