detrex icon indicating copy to clipboard operation
detrex copied to clipboard

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

Open ChenWanger opened this issue 2 years ago • 3 comments

Traceback (most recent call last): File "tools/train_net.py", line 229, in launch( File "/root/detrex/detectron2/detectron2/engine/launch.py", line 82, in launch main_func(*args) File "tools/train_net.py", line 224, in main do_train(args, cfg) File "tools/train_net.py", line 167, in do_train train_loader = instantiate(cfg.dataloader.train) File "/root/detrex/detectron2/detectron2/config/instantiate.py", line 67, in instantiate cfg = {k: instantiate(v) for k, v in cfg.items()} File "/root/detrex/detectron2/detectron2/config/instantiate.py", line 67, in cfg = {k: instantiate(v) for k, v in cfg.items()} File "/root/detrex/detectron2/detectron2/config/instantiate.py", line 83, in instantiate return cls(**cfg) File "/root/detrex/detectron2/detectron2/data/build.py", line 241, in get_detection_dataset_dicts dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in names] File "/root/detrex/detectron2/detectron2/data/build.py", line 241, in dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in names] File "/root/detrex/detectron2/detectron2/data/catalog.py", line 58, in get return f() File "/root/detrex/detectron2/detectron2/data/datasets/coco.py", line 500, in DatasetCatalog.register(name, lambda: load_coco_json(json_file, image_root, name)) File "/root/detrex/detectron2/detectron2/data/datasets/coco.py", line 80, in load_coco_json meta.thing_classes = thing_classes File "/root/detrex/detectron2/detectron2/data/catalog.py", line 148, in setattr assert oldval == val, ( AssertionError: Attribute 'thing_classes' in the metadata of 'coco_2017_train' cannot be set to a different value! ['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light', 'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee', 'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard', 'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple', 'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch', 'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell phone', 'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear', 'hair drier', 'toothbrush'] != ['mouse', 'laptop', 'keyboard']

ChenWanger avatar Oct 23 '22 03:10 ChenWanger

Traceback (most recent call last): File "tools/train_net.py", line 229, in launch( File "/root/detrex/detectron2/detectron2/engine/launch.py", line 82, in launch main_func(*args) File "tools/train_net.py", line 224, in main do_train(args, cfg) File "tools/train_net.py", line 167, in do_train train_loader = instantiate(cfg.dataloader.train) File "/root/detrex/detectron2/detectron2/config/instantiate.py", line 67, in instantiate cfg = {k: instantiate(v) for k, v in cfg.items()} File "/root/detrex/detectron2/detectron2/config/instantiate.py", line 67, in cfg = {k: instantiate(v) for k, v in cfg.items()} File "/root/detrex/detectron2/detectron2/config/instantiate.py", line 83, in instantiate return cls(**cfg) File "/root/detrex/detectron2/detectron2/data/build.py", line 241, in get_detection_dataset_dicts dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in names] File "/root/detrex/detectron2/detectron2/data/build.py", line 241, in dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in names] File "/root/detrex/detectron2/detectron2/data/catalog.py", line 58, in get return f() File "/root/detrex/detectron2/detectron2/data/datasets/coco.py", line 500, in DatasetCatalog.register(name, lambda: load_coco_json(json_file, image_root, name)) File "/root/detrex/detectron2/detectron2/data/datasets/coco.py", line 80, in load_coco_json meta.thing_classes = thing_classes File "/root/detrex/detectron2/detectron2/data/catalog.py", line 148, in setattr assert oldval == val, ( AssertionError: Attribute 'thing_classes' in the metadata of 'coco_2017_train' cannot be set to a different value! ['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light', 'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee', 'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard', 'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple', 'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch', 'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell phone', 'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear', 'hair drier', 'toothbrush'] != ['mouse', 'laptop', 'keyboard']

I was wondering if you're using detrex to train on your custom datasets~

rentainhe avatar Oct 23 '22 04:10 rentainhe

Traceback (most recent call last): File "tools/train_net.py", line 229, in launch( File "/root/detrex/detectron2/detectron2/engine/launch.py", line 82, in launch main_func(*args) File "tools/train_net.py", line 224, in main do_train(args, cfg) File "tools/train_net.py", line 167, in do_train train_loader = instantiate(cfg.dataloader.train) File "/root/detrex/detectron2/detectron2/config/instantiate.py", line 67, in instantiate cfg = {k: instantiate(v) for k, v in cfg.items()} File "/root/detrex/detectron2/detectron2/config/instantiate.py", line 67, in cfg = {k: instantiate(v) for k, v in cfg.items()} File "/root/detrex/detectron2/detectron2/config/instantiate.py", line 83, in instantiate return cls(**cfg) File "/root/detrex/detectron2/detectron2/data/build.py", line 241, in get_detection_dataset_dicts dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in names] File "/root/detrex/detectron2/detectron2/data/build.py", line 241, in dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in names] File "/root/detrex/detectron2/detectron2/data/catalog.py", line 58, in get return f() File "/root/detrex/detectron2/detectron2/data/datasets/coco.py", line 500, in DatasetCatalog.register(name, lambda: load_coco_json(json_file, image_root, name)) File "/root/detrex/detectron2/detectron2/data/datasets/coco.py", line 80, in load_coco_json meta.thing_classes = thing_classes File "/root/detrex/detectron2/detectron2/data/catalog.py", line 148, in setattr assert oldval == val, ( AssertionError: Attribute 'thing_classes' in the metadata of 'coco_2017_train' cannot be set to a different value! ['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light', 'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee', 'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard', 'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple', 'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch', 'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell phone', 'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear', 'hair drier', 'toothbrush'] != ['mouse', 'laptop', 'keyboard']

I was wondering if you're using detrex to train on your custom datasets~

Yes, I am using detrex to train on my custom datasets.

ChenWanger avatar Oct 23 '22 07:10 ChenWanger

@ChenWanger I'm trying to reproducing your problems now and try to solve it~

Maybe you can also refer to detectron2 custom datasets for more details about register your own datasets in d2.

rentainhe avatar Oct 24 '22 13:10 rentainhe

I'm closing this issue~ feel free to reopen it if needed~

rentainhe avatar Feb 15 '23 03:02 rentainhe