-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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: The num_classes
(3) in Shared2FCBBoxHead of MMDataParallel does not matches the length of CLASSES
80) in CocoDataset
#4828
Comments
num_classes
(3) in Shared2FCBBoxHead of MMDataParallel does not matches the length of CLASSES
80) in CocoDataset
Please check cfg. It's like: model = dict(
pretrained=None,
roi_head=dict(
bbox_head=dict(
type='Shared2FCBBoxHead',
num_classes=3 ####### |
bbox_head=[ Thanks for you answer. i modified, but it's not work |
Please post all your configuration files |
model = dict( this is cascade_rcnn_r50_fpn.py content |
I think your changes have not taken effect. Please refer to funtine |
Please check your dataset number or classes names in "mmdet/datasets/coco.py" and "mmdet/core/evaluation/class_names.py" . You must change with your class name in these codes. |
2021-03-25 16:23:29,621 - mmdet - INFO - Environment info:sys.platform: linux
TorchVision: 0.8.0
|
Don't write like that; You must class name like that; If you have one class; you should use a comma after the class name. |
It seems that only num_classes is modified but the class names are not modified in dataset. The config should specify classes in dataset. |
Have you solved the problem?AssertionError: The |
You should check number of classes parameter in your model config.In addition,your number of classes parameter is should be same as some of files that in mmdetection dataset folder. |
It doesn't work,I did follow this https://mmdetection.readthedocs.io/en/latest/2_new_data_model.html. |
Hi i solve with before you build datasets, you must run this: |
The solution provided here may be a more elegant one, as it only requires modifications in the configuration file. One should mind that not only the |
This worked for me too, it overrides the CLASSES in dataset instead of using configs |
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
2021-03-24 16:40:44,706 - mmdet - INFO - Start running, host: jingduo@jingduo-laptop, work_dir: /media/jingduo/8aeddfe4-d52c-4516-85ec-aa500a9390d1/jingduo/mmdetection/work_dirs/cascade_rcnn_x101_32x4d_fpn_1x_coco
2021-03-24 16:40:44,707 - mmdet - INFO - workflow: [('train', 1)], max: 12 epochs
Traceback (most recent call last):
File "./tools/train.py", line 190, in
main()
File "./tools/train.py", line 186, in main
meta=meta)
File "/home/jingduo/anaconda3/envs/mmdet/lib/python3.7/site-packages/mmdet/apis/train.py", line 170, in train_detector
runner.run(data_loaders, cfg.workflow)
File "/home/jingduo/mmcv/mmcv/runner/epoch_based_runner.py", line 125, in run
epoch_runner(data_loaders[i], **kwargs)
File "/home/jingduo/mmcv/mmcv/runner/epoch_based_runner.py", line 45, in train
self.call_hook('before_train_epoch')
File "/home/jingduo/mmcv/mmcv/runner/base_runner.py", line 307, in call_hook
getattr(hook, fn_name)(self)
File "/home/jingduo/anaconda3/envs/mmdet/lib/python3.7/site-packages/mmdet/datasets/utils.py", line 150, in before_train_epoch
self._check_head(runner)
File "/home/jingduo/anaconda3/envs/mmdet/lib/python3.7/site-packages/mmdet/datasets/utils.py", line 137, in _check_head
(f'The
num_classes
({module.num_classes}) in 'AssertionError: The
num_classes
(3) in Shared2FCBBoxHead of MMDataParallel does not matches the length ofCLASSES
80) in CocoDatasetCan you help answer the question ? thanks
The text was updated successfully, but these errors were encountered: