Dataset content: https://github.com/apple/ml-hypersim We will load the data to the following convention: For world coordinate: x-axis to right, y-axis to up, and z-axis to us. For image coordinate: u-axis to right, v-axis to down. Origin (0,0,) is at top left of the image. We w
| 89 | |
| 90 | |
| 91 | class HypersimDataset: |
| 92 | """ |
| 93 | Dataset content: https://github.com/apple/ml-hypersim |
| 94 | |
| 95 | We will load the data to the following convention: |
| 96 | For world coordinate: x-axis to right, y-axis to up, and z-axis to us. |
| 97 | For image coordinate: u-axis to right, v-axis to down. Origin (0,0,) is at top left of the image. |
| 98 | We will incorporate the flipping of y->v axis in H_c2w (the camera pose homogeneous matrix |
| 99 | from the camera coordinate to the world coordinate). |
| 100 | """ |
| 101 | |
| 102 | def __init__( |
| 103 | self, |
| 104 | scene_dir: str, |
| 105 | camera_info: T.Dict[str, T.Any], |
| 106 | cam_idx: int = -1, |
| 107 | num_images_per_item: int = None, |
| 108 | image_subsample: int = 1, |
| 109 | tonemap: bool = True, |
| 110 | tonemap_gamma: float = 1. / 2.2, |
| 111 | tonemap_percentile: float = 90, |
| 112 | tonemap_percentile_target: float = 0.7, |
| 113 | tonemap_scale: float = None, |
| 114 | num_hold_out_items: int = 0, |
| 115 | ): |
| 116 | """ |
| 117 | |
| 118 | Args: |
| 119 | scene_dir: |
| 120 | the root dir of the scene, |
| 121 | e.g., /mnt/task_runtime/trove/ml-hypersim-1.0.0/data/raw/ai_001_001. |
| 122 | camera_info: |
| 123 | a dict containing the corresponding row of metadata_camera_parameters.csv |
| 124 | cam_idx: |
| 125 | camera index, e.g., 0, 1. If -1, combine all cameras. |
| 126 | num_images_per_item: |
| 127 | number of images/frame_ids to group and form a single sample. |
| 128 | If None, use all |
| 129 | If negative, it will divide the total samples into `-num_images_per_item` samples. |
| 130 | image_subsample: int = 1 |
| 131 | |
| 132 | tonemap_gamma: |
| 133 | for tone mapping hdr color |
| 134 | tonemap_percentile: |
| 135 | for tone mapping hdr color |
| 136 | tonemap_percentile_target: |
| 137 | for tone mapping hdr color. We will set the n-th percentile brightness to the target. |
| 138 | |
| 139 | num_hold_out_items: |
| 140 | number of hold out items to keep in the last sample |
| 141 | Ref: |
| 142 | https://github.com/apple/ml-hypersim/blob/main/contrib/mikeroberts3000/jupyter/01_casting_rays_that_match_hypersim_images.ipynb |
| 143 | """ |
| 144 | |
| 145 | self.scene_dir = scene_dir |
| 146 | self.camera_info = camera_info |
| 147 | self.cam_idx = cam_idx |
| 148 | self.image_subsample = image_subsample |
nothing calls this directly
no outgoing calls
no test coverage detected