Closed yeungkong closed 2 years ago
You should change cocodataset.CLASS and the num_classes in config file. For more details please refer to the tutorials: https://github.com/open-mmlab/mmdetection/blob/master/docs/en/2_new_data_model.md and https://github.com/open-mmlab/mmdetection/blob/master/docs/en/tutorials/customize_dataset.md
It works! Really appreciate your help.
You should change cocodataset.CLASS and the num_classes in config file. For more details please refer to the tutorials: https://github.com/open-mmlab/mmdetection/blob/master/docs/en/2_new_data_model.md and https://github.com/open-mmlab/mmdetection/blob/master/docs/en/tutorials/customize_dataset.md
Following the tutorial I am getting
2022-07-31 01:52:40,722 - mmdet - INFO - initialize FPN with init_cfg {'type': 'Xavier', 'layer': 'Conv2d', 'distribution': 'uniform'}
2022-07-31 01:52:40,759 - mmdet - INFO - initialize RPNHead with init_cfg {'type': 'Normal', 'layer': 'Conv2d', 'std': 0.01}
2022-07-31 01:52:40,766 - mmdet - INFO - initialize Shared2FCBBoxHead with init_cfg [{'type': 'Normal', 'std': 0.01, 'override': {'name': 'fc_cls'}}, {'type': 'Normal', 'std': 0.001, 'override': {'name': 'fc_reg'}}, {'type': 'Xavier', 'distribution': 'uniform', 'override': [{'name': 'shared_fcs'}, {'name': 'cls_fcs'}, {'name': 'reg_fcs'}]}]
Traceback (most recent call last):
File "/home/jupyter/notebooks/Unity/mmdetection/tools/train.py", line 242, in <module>
main()
File "/home/jupyter/notebooks/Unity/mmdetection/tools/train.py", line 218, in main
datasets = [build_dataset(cfg.data.train)]
File "/home/jupyter/notebooks/Unity/mmdetection/mmdet/datasets/builder.py", line 82, in build_dataset
dataset = build_from_cfg(cfg, DATASETS, default_args)
File "/opt/conda/envs/icevision/lib/python3.9/site-packages/mmcv/utils/registry.py", line 61, in build_from_cfg
raise KeyError(
KeyError: 'COCODataset is not in the dataset registry'
My config:
_base_ = ["../mask_rcnn/mask_rcnn_r50_caffe_fpn_mstrain-poly_3x_coco.py",]
load_from = 'https://download.openmmlab.com/mmdetection/v2.0/mask_rcnn/mask_rcnn_r50_caffe_fpn_mstrain-poly_3x_coco/mask_rcnn_r50_caffe_fpn_mstrain-poly_3x_coco_bbox_mAP-0.408__segm_mAP-0.37_20200504_163245-42aa3d00.pth'
model = dict(
roi_head=dict(
bbox_head=dict(num_classes=7),
mask_head=dict(num_classes=7)))
dataset_type = 'COCODataset'
classes = ('hood', 'Door-Front', 'roof', 'tyre', 'Door-Rear', 'Bumper-Front', 'Bumper-Rear')
data_root = '/home/jupyter/data/Unity/03-segm-test-100-images/converted/'
img_prefix = data_root + "images"
data = dict(
train=dict(
type=dataset_type,
ann_file=data_root + 'annotations/train.json',
classes=classes,
img_prefix=img_prefix,),
val=dict(
type=dataset_type,
ann_file=data_root + 'annotations/test.json',
classes=classes,
img_prefix=img_prefix,),
test=dict(
type=dataset_type,
ann_file=data_root + 'annotations/test.json',
classes=classes,
img_prefix=img_prefix)
)
I use mmdet v2.23.0 and I set my own data set and try to train my own model.
But I get something like this.
I check the build_dataset function in /mmdet/datasets/builder.py and find the following lines are run.
It is not loading my own dataset. Could someone please tell me what goes wrong? Thank you very much.