I'm currently exploring the ViTDet model in Detectron2 projects and I'm trying to run it on my custom dataset in COCO format. There is an official instruction for using custom dataset but it seems to work on google colab or jupyter notebook but I'm running the evaluation inside the directory terminal (I'm not sure I clearly describe it).
What I did is inserting the code for loading and registering my custom dataset inside the config files and everytime I run the evaluation inside the terminal, it loads and registers my dataset again so it would take a long time when working with thousands of images (cuz u have to load images to get the size). Therefore, I'm wondering is there any way to register my custom data set only once and I can run the model after that?
my code in the config files:
def load_data_in_coco_format(cam_path, name):
...
return images
def register_aic_data():
...
# # 1. register a function which returns dicts
# # TODO: make it general for `cams` currently for testing
DatasetCatalog.register(name, lambda: load_data_in_coco_format(cam_path, name))
# # 2. Optionally, add metadata about this dataset,
# # since they might be useful in evaluation, visualization or logging
MetadataCatalog.get(name).set(
**metadata
)
register_data()
dataloader = OmegaConf.create()
...
What I'm looking for is somewhat like the builtin dataset registration.
Many thanks