0

I work with Detectron for panoptic segmentation.

I would like to change the metadata values to values that I have chosen. In particular, I would like to replace one dictionary with another dictionary that I have written.

but I got an error:

AssertionError: Attribute 'stuff_dataset_id_to_contiguous_id' in the metadata of 'coco_2017_train_panoptic_separated' cannot be set to a different value!

Here are the metadata I would like to change:

MetadataCatalog.get(cfg.DATASETS.TRAIN[0]) -->

--> out:

Metadata(evaluator_type='coco_panoptic_seg', image_root='datasets/coco/train2017',
json_file='datasets/coco/annotations/instances_train2017.json', 
name='coco_2017_train_panoptic_separated', 
panoptic_json='datasets/coco/annotations/panoptic_train2017.json' 
[...]
stuff_dataset_id_to_contiguous_id={92: 1, 93: 2, 95: 3, 100: 4, 107: 5, 109: 6,
112: 7, 118: 8, 119: 9, 122: 10, 125: 11, 128: 12, 130: 13, 133: 14, 138: 15,
141: 16, [... etc etc]

I would like to change stuff_dataset_id_to_contiguous_id to another dictionary.

What can I do? Thank you so much.

mad_
  • 1
  • 1

1 Answers1

0

You could try to remove the metadata you've registered before like this:

MetadataCatalog.remove("coco_2017_train_panoptic_separated")

You can then print all the registered metadata to check that you removed what you wanted:

detectron2.data.MetadataCatalog

And after that register new changed metadata as usual using register_coco_instances().

By the way, you can use the same syntax for DatasetCatalog as well:

DatasetCatalog.remove("coco_2017_train_panoptic_separated")
detectron2.data.DatasetCatalog
Kami
  • 164
  • 11