The example code will not run, since dataset type is missing. When running python tools/train.py configs/_custom_/mask_rcnn_r50_fpn.py getting an error:
2022-07-31 01:30:31,069 - mmdet - INFO - initialize FPN with init_cfg {'type': 'Xavier', 'layer': 'Conv2d', 'distribution': 'uniform'}
2022-07-31 01:30:31,107 - mmdet - INFO - initialize RPNHead with init_cfg {'type': 'Normal', 'layer': 'Conv2d', 'std': 0.01}
2022-07-31 01:30:31,114 - 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 64, in build_dataset
elif cfg['type'] == 'ConcatDataset':
File "/opt/conda/envs/icevision/lib/python3.9/site-packages/mmcv/utils/config.py", line 38, in __missing__
raise KeyError(name)
KeyError: 'type'
I add type=dataset_type,, but then I get another error:
2022-07-31 01:33:12,997 - mmdet - INFO - initialize FPN with init_cfg {'type': 'Xavier', 'layer': 'Conv2d', 'distribution': 'uniform'}
2022-07-31 01:33:13,022 - mmdet - INFO - initialize RPNHead with init_cfg {'type': 'Normal', 'layer': 'Conv2d', 'std': 0.01}
2022-07-31 01:33:13,027 - 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'
# We also need to change the num_classes in head to match the dataset's annotation
model = dict(
roi_head=dict(
bbox_head=dict(num_classes=7),
mask_head=dict(num_classes=7)))
dataset_type = 'COCODataset'
data_root = '/home/jupyter/data/Unity/03-segm-test-100-images/converted/'
img_prefix = data_root + "images"
data = dict(
_delete_=True,
samples_per_gpu=2,
workers_per_gpu=2,
train=dict(
type=dataset_type,
ann_file=data_root + 'annotations/train.json',
img_prefix=img_prefix,),
val=dict(
type=dataset_type,
ann_file=data_root + 'annotations/test.json',
img_prefix=img_prefix,),
test=dict(
type=dataset_type,
ann_file=data_root + 'annotations/test.json',
img_prefix=img_prefix)
)
Following the tutorial under https://mmdetection.readthedocs.io/en/latest/2_new_data_model.html
The example code will not run, since dataset type is missing. When running
python tools/train.py configs/_custom_/mask_rcnn_r50_fpn.py
getting an error:I add
type=dataset_type,
, but then I get another error:My config: