@@ -185,6 +185,20 @@ class BOPDataset(SceneDataset):
185
185
186
186
# TODO: Document whats happening with the per-view annotations.
187
187
# TODO: Remove per-view annotations, recommend using WebDataset for performance ?
188
+
189
+ Args:
190
+ ----
191
+ ds_dir (Path): path to the BOP dataset directory
192
+ label_format (str): format of the object label, e.g. "ycbv-{label}"
193
+ split (str): split of the dataset to use, e.g. "test",
194
+ load_depth (bool): when loading an observation, load also the depth image
195
+ use_raw_object_id (bool): if True, object id is {label}, otherwise obj_{label} (e.g. "000021" vs "obj_000021")
196
+ allow_cache (bool): _description_,
197
+ per_view_annotations (bool): _description_,
198
+ models_dir (str): name of the object directory in bop dataset directory (e.g. "models", "models_eval", "models_cad"...)
199
+ Returns:
200
+ -------
201
+ List[SceneData]: _description_
188
202
"""
189
203
190
204
def __init__ (
@@ -196,9 +210,10 @@ def __init__(
196
210
use_raw_object_id : bool = False ,
197
211
allow_cache : bool = False ,
198
212
per_view_annotations : bool = False ,
213
+ models_dir : str = "models"
199
214
):
200
- self .ds_dir = ds_dir
201
215
assert ds_dir .exists (), "Dataset does not exists."
216
+ self .ds_dir = ds_dir
202
217
203
218
self .split = split
204
219
self .base_dir = ds_dir / split
@@ -231,7 +246,9 @@ def __init__(
231
246
load_depth = load_depth ,
232
247
load_segmentation = True ,
233
248
)
234
- models_infos = json .loads ((ds_dir / "models" / "models_info.json" ).read_text ())
249
+ models_path = ds_dir / models_dir
250
+ assert models_path .exists (), f"models_dir={ models_dir } might not be the correct object model dir name"
251
+ models_infos = json .loads ((models_path / "models_info.json" ).read_text ())
235
252
self .all_labels = [f"obj_{ int (obj_id ):06d} " for obj_id in models_infos .keys ()]
236
253
237
254
def _load_scene_observation (
0 commit comments