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

我把从coco数据集换成了自己的数据集,但是出现了错误,我应该修改你的代码中的哪几个部分的代码 #98

Open
libingDY opened this issue Nov 11, 2021 · 5 comments

Comments

@libingDY
Copy link

我把从coco数据集换成了自己的数据集,但是出现了错误,我应该修改你的代码中的哪几个部分的代码。
Traceback (most recent call last):
File "projects/SparseRCNN/train_net.py", line 159, in
args=(args,),
File "/home/libing/anaconda3/envs/detectron2/lib/python3.7/site-packages/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/libing/anaconda3/envs/detectron2/lib/python3.7/site-packages/detectron2/engine/defaults.py", line 312, 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/libing/anaconda3/envs/detectron2/lib/python3.7/site-packages/detectron2/config/config.py", line 201, in wrapped
explicit_args = _get_args_from_config(from_config, *args, **kwargs)
File "/home/libing/anaconda3/envs/detectron2/lib/python3.7/site-packages/detectron2/config/config.py", line 238, in _get_args_from_config
ret = from_config_func(*args, **kwargs)
File "/home/libing/anaconda3/envs/detectron2/lib/python3.7/site-packages/detectron2/data/build.py", line 314, in _train_loader_from_config
proposal_files=cfg.DATASETS.PROPOSAL_FILES_TRAIN if cfg.MODEL.LOAD_PROPOSALS else None,
File "/home/libing/anaconda3/envs/detectron2/lib/python3.7/site-packages/detectron2/data/build.py", line 227, in get_detection_dataset_dicts
dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in names]
File "/home/libing/anaconda3/envs/detectron2/lib/python3.7/site-packages/detectron2/data/build.py", line 227, in
dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in names]
File "/home/libing/anaconda3/envs/detectron2/lib/python3.7/site-packages/detectron2/data/catalog.py", line 58, in get
return f()
File "/home/libing/anaconda3/envs/detectron2/lib/python3.7/site-packages/detectron2/data/datasets/coco.py", line 489, in
DatasetCatalog.register(name, lambda: load_coco_json(json_file, image_root, name))
File "/home/libing/anaconda3/envs/detectron2/lib/python3.7/site-packages/detectron2/data/datasets/coco.py", line 80, in load_coco_json
meta.thing_classes = thing_classes
File "/home/libing/anaconda3/envs/detectron2/lib/python3.7/site-packages/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'] != ['ship']
我把SSDD的数据集转换成了coco的格式,然后跑你的代码出现了这个问题,请问怎么解决?

@PeizeSun
Copy link
Owner

PeizeSun commented Dec 9, 2021

Hi~
Our code is based on Detectron2, the way of using custom dataset is the same as detectron2, I guess you could refer to Use Custom Dataset.

@Aruen24
Copy link

Aruen24 commented Jan 28, 2022

@18456432930 你解决了这个问题吗?

@ZhuYuChenNO1
Copy link

It seems you still use 'coco_2017_train' as your dataset name in your config file, you can try to register your dataset use register_coco_instances with from detectron2.data.datasets import register_coco_instances to see if you can solve your question? If not, you should rewrite your register follow register_coco_instances

@higher-hai
Copy link

It seems you still use 'coco_2017_train' as your dataset name in your config file, you can try to register your dataset use register_coco_instances with from detectron2.data.datasets import register_coco_instances to see if you can solve your question? If not, you should rewrite your register follow register_coco_instances
Can you please explain in detail which file should be modified? Thank you very much!

@ZhuYuChenNO1
Copy link

ZhuYuChenNO1 commented Mar 3, 2024

It seems you still use 'coco_2017_train' as your dataset name in your config file, you can try to register your dataset use register_coco_instances with from detectron2.data.datasets import register_coco_instances to see if you can solve your question? If not, you should rewrite your register follow register_coco_instances
Can you please explain in detail which file should be modified? Thank you very much!

in your train_net.py is ok, add sth like this

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

No branches or pull requests

5 participants