Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Aruen24 opened this issue Jan 28, 2022 · 2 comments
Labels
question Further information is requested

Comments

@Aruen24
Copy link

Aruen24 commented Jan 28, 2022

[01/28 02:49:28 d2.data.datasets.coco]: Loading datasets/coco/annotations/instances_train2017.json takes 4.76 seconds.
Traceback (most recent call last):
File "projects/SparseRCNN/train_net.py", line 159, in
args=(args,),
File "/home/wyw/SparseR-CNN/detectron2/engine/launch.py", line 62, in launch
main_func(*args)
File "projects/SparseRCNN/train_net.py", line 145, in main
trainer = Trainer(cfg)
File "/home/wyw/SparseR-CNN/detectron2/engine/defaults.py", line 284, in init
data_loader = self.build_train_loader(cfg)
File "projects/SparseRCNN/train_net.py", line 52, in build_train_loader
return build_detection_train_loader(cfg, mapper=mapper)
File "/home/wyw/SparseR-CNN/detectron2/config/config.py", line 201, in wrapped
explicit_args = _get_args_from_config(from_config, *args, **kwargs)
File "/home/wyw/SparseR-CNN/detectron2/config/config.py", line 236, in _get_args_from_config
ret = from_config_func(*args, **kwargs)
File "/home/wyw/SparseR-CNN/detectron2/data/build.py", line 309, in _train_loader_from_config
proposal_files=cfg.DATASETS.PROPOSAL_FILES_TRAIN if cfg.MODEL.LOAD_PROPOSALS else None,
File "/home/wyw/SparseR-CNN/detectron2/data/build.py", line 222, in get_detection_dataset_dicts
dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names]
File "/home/wyw/SparseR-CNN/detectron2/data/build.py", line 222, in
dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names]
File "/home/wyw/SparseR-CNN/detectron2/data/catalog.py", line 58, in get
return f()
File "/home/wyw/SparseR-CNN/detectron2/data/datasets/coco.py", line 469, in
DatasetCatalog.register(name, lambda: load_coco_json(json_file, image_root, name))
File "/home/wyw/SparseR-CNN/detectron2/data/datasets/coco.py", line 71, in load_coco_json
meta.thing_classes = thing_classes
File "/home/wyw/SparseR-CNN/detectron2/data/catalog.py", line 150, in setattr
"to a different value!\n{} != {}".format(key, self.name, oldval, val)
AssertionError: Attribute 'thing_classes' in the metadata of 'coco_2017_train' cannot be set to a different value!

@PeizeSun PeizeSun added the question Further information is requested label Mar 30, 2022
@chenyiming-start
Copy link

I ran into a similar problem:

[04/25 14:33:54 d2.data.datasets.coco]: Loading datasets/coco/annotations/instances_train2017.json takes 3.33 seconds.
Traceback (most recent call last):
File "projects/SparseRCNN/train_net.py", line 159, in
args=(args,),
File "/hdd2T_1/chenym/SparseR-CNN/detectron2/engine/launch.py", line 62, in launch
main_func(*args)
File "projects/SparseRCNN/train_net.py", line 145, in main
trainer = Trainer(cfg)
File "/hdd2T_1/chenym/SparseR-CNN/detectron2/engine/defaults.py", line 284, in init
data_loader = self.build_train_loader(cfg)
File "projects/SparseRCNN/train_net.py", line 52, in build_train_loader
return build_detection_train_loader(cfg, mapper=mapper)
File "/hdd2T_1/chenym/SparseR-CNN/detectron2/config/config.py", line 201, in wrapped
explicit_args = _get_args_from_config(from_config, *args, **kwargs)
File "/hdd2T_1/chenym/SparseR-CNN/detectron2/config/config.py", line 236, in _get_args_from_config
ret = from_config_func(*args, **kwargs)
File "/hdd2T_1/chenym/SparseR-CNN/detectron2/data/build.py", line 309, in _train_loader_from_config
proposal_files=cfg.DATASETS.PROPOSAL_FILES_TRAIN if cfg.MODEL.LOAD_PROPOSALS else None,
File "/hdd2T_1/chenym/SparseR-CNN/detectron2/data/build.py", line 222, in get_detection_dataset_dicts
dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names]
File "/hdd2T_1/chenym/SparseR-CNN/detectron2/data/build.py", line 222, in
dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names]
File "/hdd2T_1/chenym/SparseR-CNN/detectron2/data/catalog.py", line 58, in get
return f()
File "/hdd2T_1/chenym/SparseR-CNN/detectron2/data/datasets/coco.py", line 469, in
DatasetCatalog.register(name, lambda: load_coco_json(json_file, image_root, name))
File "/hdd2T_1/chenym/SparseR-CNN/detectron2/data/datasets/coco.py", line 71, in load_coco_json
meta.thing_classes = thing_classes
File "/hdd2T_1/chenym/SparseR-CNN/detectron2/data/catalog.py", line 150, in setattr
"to a different value!\n{} != {}".format(key, self.name, 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'] != ['banner', 'blanket', 'branch', 'bridge', 'building-other', 'bush', 'cabinet', 'cage', 'cardboard', 'carpet', 'ceiling-other', 'ceiling-tile', 'cloth', 'clothes', 'clouds', 'counter', 'cupboard', 'curtain', 'desk-stuff', 'dirt', 'door-stuff', 'fence', 'floor-marble', 'floor-other', 'floor-stone', 'floor-tile', 'floor-wood', 'flower', 'fog', 'food-other', 'fruit', 'furniture-other', 'grass', 'gravel', 'ground-other', 'hill', 'house', 'leaves', 'light', 'mat', 'metal', 'mirror-stuff', 'moss', 'mountain', 'mud', 'napkin', 'net', 'paper', 'pavement', 'pillow', 'plant-other', 'plastic', 'platform', 'playingfield', 'railing', 'railroad', 'river', 'road', 'rock', 'roof', 'rug', 'salad', 'sand', 'sea', 'shelf', 'sky-other', 'skyscraper', 'snow', 'solid-other', 'stairs', 'stone', 'straw', 'structural-other', 'table', 'tent', 'textile-other', 'towel', 'tree', 'vegetable', 'wall-brick', 'wall-concrete', 'wall-other', 'wall-panel', 'wall-stone', 'wall-tile', 'wall-wood', 'water-other', 'waterdrops', 'window-blind', 'window-other', 'wood', 'other']

I'm trying to figure it out, have you solved this problem?

@chenyiming-start
Copy link

I ran into a similar problem:

[04/25 14:33:54 d2.data.datasets.coco]: Loading datasets/coco/annotations/instances_train2017.json takes 3.33 seconds. Traceback (most recent call last): File "projects/SparseRCNN/train_net.py", line 159, in args=(args,), File "/hdd2T_1/chenym/SparseR-CNN/detectron2/engine/launch.py", line 62, in launch main_func(*args) File "projects/SparseRCNN/train_net.py", line 145, in main trainer = Trainer(cfg) File "/hdd2T_1/chenym/SparseR-CNN/detectron2/engine/defaults.py", line 284, in init data_loader = self.build_train_loader(cfg) File "projects/SparseRCNN/train_net.py", line 52, in build_train_loader return build_detection_train_loader(cfg, mapper=mapper) File "/hdd2T_1/chenym/SparseR-CNN/detectron2/config/config.py", line 201, in wrapped explicit_args = _get_args_from_config(from_config, *args, **kwargs) File "/hdd2T_1/chenym/SparseR-CNN/detectron2/config/config.py", line 236, in _get_args_from_config ret = from_config_func(*args, **kwargs) File "/hdd2T_1/chenym/SparseR-CNN/detectron2/data/build.py", line 309, in _train_loader_from_config proposal_files=cfg.DATASETS.PROPOSAL_FILES_TRAIN if cfg.MODEL.LOAD_PROPOSALS else None, File "/hdd2T_1/chenym/SparseR-CNN/detectron2/data/build.py", line 222, in get_detection_dataset_dicts dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names] File "/hdd2T_1/chenym/SparseR-CNN/detectron2/data/build.py", line 222, in dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in dataset_names] File "/hdd2T_1/chenym/SparseR-CNN/detectron2/data/catalog.py", line 58, in get return f() File "/hdd2T_1/chenym/SparseR-CNN/detectron2/data/datasets/coco.py", line 469, in DatasetCatalog.register(name, lambda: load_coco_json(json_file, image_root, name)) File "/hdd2T_1/chenym/SparseR-CNN/detectron2/data/datasets/coco.py", line 71, in load_coco_json meta.thing_classes = thing_classes File "/hdd2T_1/chenym/SparseR-CNN/detectron2/data/catalog.py", line 150, in setattr "to a different value!\n{} != {}".format(key, self.name, 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'] != ['banner', 'blanket', 'branch', 'bridge', 'building-other', 'bush', 'cabinet', 'cage', 'cardboard', 'carpet', 'ceiling-other', 'ceiling-tile', 'cloth', 'clothes', 'clouds', 'counter', 'cupboard', 'curtain', 'desk-stuff', 'dirt', 'door-stuff', 'fence', 'floor-marble', 'floor-other', 'floor-stone', 'floor-tile', 'floor-wood', 'flower', 'fog', 'food-other', 'fruit', 'furniture-other', 'grass', 'gravel', 'ground-other', 'hill', 'house', 'leaves', 'light', 'mat', 'metal', 'mirror-stuff', 'moss', 'mountain', 'mud', 'napkin', 'net', 'paper', 'pavement', 'pillow', 'plant-other', 'plastic', 'platform', 'playingfield', 'railing', 'railroad', 'river', 'road', 'rock', 'roof', 'rug', 'salad', 'sand', 'sea', 'shelf', 'sky-other', 'skyscraper', 'snow', 'solid-other', 'stairs', 'stone', 'straw', 'structural-other', 'table', 'tent', 'textile-other', 'towel', 'tree', 'vegetable', 'wall-brick', 'wall-concrete', 'wall-other', 'wall-panel', 'wall-stone', 'wall-tile', 'wall-wood', 'water-other', 'waterdrops', 'window-blind', 'window-other', 'wood', 'other']

I'm trying to figure it out, have you solved this problem?

The problem was that I refered to a wrong annotation file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants