Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 4fddaa8

Browse files
stephenyan1231facebook-github-bot
authored andcommitted
update INJECTED_COCO_DATASETS_LUT when registering AdhocCOCODataset
Summary: Pull Request resolved: #584 When registering AdhocCOCODataset, INJECTED_COCO_DATASETS_LUT needs to be updated as well. For example, if a dataset uses custom registering function, it can be only retrieved from INJECTED_COCO_DATASETS_LUT. Otherwise, it uses the default registering function as in branch `register_dataset_split`. Reviewed By: antonrigner Differential Revision: D46826507 fbshipit-source-id: 31bc5c79e3b82a20cb798dec37b18d9271040cdf
1 parent 7f17bbf commit 4fddaa8

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

d2go/data/utils.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
ANN_FN,
2121
IM_DIR,
2222
INJECTED_COCO_DATASETS_LUT,
23+
InjectedCocoEntry,
2324
register_dataset_split,
2425
)
2526
from detectron2.data import DatasetCatalog, MetadataCatalog
@@ -168,9 +169,10 @@ def register_catalog(self):
168169
DatasetCatalog.register(self.new_ds_name, new_func)
169170
elif self.src_ds_name in INJECTED_COCO_DATASETS_LUT:
170171
_src_func, _src_dict = INJECTED_COCO_DATASETS_LUT[self.src_ds_name]
171-
_src_func(
172-
self.new_ds_name,
173-
split_dict={**_src_dict, ANN_FN: tmp_file, IM_DIR: metadata.image_root},
172+
split_dict = {**_src_dict, ANN_FN: tmp_file, IM_DIR: metadata.image_root}
173+
_src_func(self.new_ds_name, split_dict=split_dict)
174+
INJECTED_COCO_DATASETS_LUT[self.new_ds_name] = InjectedCocoEntry(
175+
func=_src_func, split_dict=split_dict
174176
)
175177
else:
176178
# NOTE: only supports COCODataset as DS_TYPE since we cannot reconstruct

0 commit comments

Comments
 (0)