Closed Y969882566 closed 2 years ago
Seems you use a quite old version of mmdetection, you can update the code or add score_thr
to test_cfg
in your config
Seems you use a quite old version of mmdetection, you can update the code or add
score_thr
totest_cfg
in your config
Thank you. I have fixed the below error by updating the mmdetection version from 2.11.0 to 2.17.0 but I met a new error is
Traceback (most recent call last):
File "tools/train.py", line 189, in num_classes
(1) in RankBasedRPNHead of MMDataParallel does not matches the length of CLASSES
5) in CocoDataset
I'm getting the same error when attempting to use a anything other than the default Faster R-CNN in the MMDet Tutorial.
from mmdet.apis import set_random_seed
cfg.dataset_type = 'KittiTinyDataset' cfg.data_root = 'kitti_tiny/'
cfg.data.test.type = 'KittiTinyDataset' cfg.data.test.data_root = 'kitti_tiny/' cfg.data.test.ann_file = 'train.txt' cfg.data.test.img_prefix = 'training/image_2'
cfg.data.train.type = 'KittiTinyDataset' cfg.data.train.data_root = 'kitti_tiny/' cfg.data.train.ann_file = 'train.txt' cfg.data.train.img_prefix = 'training/image_2'
cfg.data.val.type = 'KittiTinyDataset' cfg.data.val.data_root = 'kitti_tiny/' cfg.data.val.ann_file = 'val.txt' cfg.data.val.img_prefix = 'training/image_2'
cfg.model.roi_head.bbox_head.num_classes = 3
cfg.load_from = 'checkpoints/mask_rcnn_r50_fpn_random_seesaw_loss_mstrain_2x_lvis_v1-a698dd3d.pth'
Thanks for your bug reporting, we want to help users to check whether the number of classes of heads is consistent with the num_class in the dataset, the corresponding implementation is in https://github.com/open-mmlab/mmdetection/blob/1a90fa80a761fe15e69111a625d82874ed783f7b/mmdet/datasets/utils.py#L116 Seems this hook is not robust enough when you add a new head, I will help to improve it, and you can disable this hook for the time being.@quaid281 @Y969882566
Thanks for your bug reporting, we want to help users to check whether the number of classes of heads is consistent with the num_class in the dataset, the corresponding implementation is in
Seems this hook is not robust enough when you add a new head, I will help to improve it, and you can disable this hook for the time being.@quaid281 @Y969882566
hi i fix the error by disable this hook class NumClassCheckHook(Hook) but then raise old error:
Traceback (most recent call last):
File "tools/train.py", line 189, in
It seems that the problem has nothing to do with the version of mmdetection. I hope you can give me a detailed solution. Thank you @jshilong
Seems you use a quite old version of mmdetection, you can update the code or add
score_thr
totest_cfg
in your config
Hello, is there a place where I can see a complete list of available argument for the configs files ? I looked here https://mmdetection.readthedocs.io/en/latest/tutorials/config.html but it does not seems to be complete.
Said for example I wanna add nms to centernet, I dont really see how to do that based on the documentation.
Seems you use a quite old version of mmdetection, you can update the code or add
score_thr
totest_cfg
in your configHello, is there a place where I can see a complete list of available argument for the configs files ? I looked here https://mmdetection.readthedocs.io/en/latest/tutorials/config.html but it does not seems to be complete.
Said for example I wanna add nms to centernet, I dont really see how to do that based on the documentation.
Hello i just follow the step of https://mmdetection.readthedocs.io/en/latest/tutorials/customize_models.html . What config file do you want to see . Please be more specific
Could you provide your config?
As far as I know, you can solve it by adding score_thr
to a test_cfg
such as
https://github.com/open-mmlab/mmdetection/blob/a7a16afbf2a4bdb4d023094da73d325cb864838b/configs/_base_/models/retinanet_r50_fpn.py#L58
It seems to work. Thanks for your help.
When I train a MaskRCNN using my own custom dataset, it raised the following error: Traceback (most recent call last): File "tools/train.py", line 187, in
main()
File "tools/train.py", line 176, in main
train_detector(
File "D:\anaconda3\envs\S\lib\site-packages\mmdet-2.11.0-py3.8.egg\mmdet\apis\train.py", line 185, in train_detector
runner.run(data_loaders, cfg.workflow)
File "e:\ystudy\paper code\swin-transformer-object-detection-master\mmcv-1.3.1\mmcv\runner\epoch_based_runner.py", line 125, in run
epoch_runner(data_loaders[i], kwargs)
File "e:\ystudy\paper code\swin-transformer-object-detection-master\mmcv-1.3.1\mmcv\runner\epoch_based_runner.py", line 50, in train
self.run_iter(data_batch, train_mode=True, kwargs)
File "e:\ystudy\paper code\swin-transformer-object-detection-master\mmcv-1.3.1\mmcv\runner\epoch_based_runner.py", line 29, in run_iter
outputs = self.model.train_step(data_batch, self.optimizer,
File "e:\ystudy\paper code\swin-transformer-object-detection-master\mmcv-1.3.1\mmcv\parallel\data_parallel.py", line 67, in train_step
return self.module.train_step(inputs[0], kwargs[0])
File "D:\anaconda3\envs\S\lib\site-packages\mmdet-2.11.0-py3.8.egg\mmdet\models\detectors\base.py", line 247, in train_step
losses = self(data)
File "D:\anaconda3\envs\S\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
result = self.forward(input, *kwargs)
File "e:\ystudy\paper code\swin-transformer-object-detection-master\mmcv-1.3.1\mmcv\runner\fp16_utils.py", line 110, in new_func
output = old_func(new_args, new_kwargs)
File "D:\anaconda3\envs\S\lib\site-packages\mmdet-2.11.0-py3.8.egg\mmdet\models\detectors\base.py", line 181, in forward
return self.forward_train(img, img_metas, kwargs)
File "D:\anaconda3\envs\S\lib\site-packages\mmdet-2.11.0-py3.8.egg\mmdet\models\detectors\two_stage.py", line 150, in forward_train
rpn_losses, proposal_list = self.rpn_head.forward_train(
File "D:\anaconda3\envs\S\lib\site-packages\mmdet-2.11.0-py3.8.egg\mmdet\models\dense_heads\base_dense_head.py", line 58, in forward_train
proposal_list = self.get_bboxes(outs, img_metas, cfg=proposal_cfg)
File "e:\ystudy\paper code\swin-transformer-object-detection-master\mmcv-1.3.1\mmcv\runner\fp16_utils.py", line 189, in new_func
output = old_func(new_args, **new_kwargs)
File "D:\anaconda3\envs\S\lib\site-packages\mmdet-2.11.0-py3.8.egg\mmdet\models\dense_heads\anchor_head.py", line 582, in get_bboxes
result_list = self._get_bboxes(mlvl_cls_scores, mlvl_bbox_preds,
File "D:\anaconda3\envs\S\lib\site-packages\mmdet-2.11.0-py3.8.egg\mmdet\models\dense_heads\anchor_head.py", line 725, in _get_bboxes
cfg.score_thr, cfg.nms,
File "e:\ystudy\paper code\swin-transformer-object-detection-master\mmcv-1.3.1\mmcv\utils\config.py", line 47, in getattr
raise ex
AttributeError: 'ConfigDict' object has no attribute 'score_thr'
config file:
model = dict( backbone=dict( embed_dim=96, depths=[2, 2, 6, 2], num_heads=[3, 6, 12, 24], window_size=7, ape=False, drop_path_rate=0.2, patch_norm=True, use_checkpoint=False ), neck=dict(in_channels=[96, 192, 384, 768]), rpn_head=dict( type='RankBasedRPNHead', bbox_coder=dict( type='DeltaXYWHBBoxCoder', target_means=[.0, .0, .0, .0], target_stds=[0.1, 0.1, 0.2, 0.2]), loss_bbox=dict(type='GIoULoss', reduction='none'), head_weight=0.20), roi_head=dict( type='RankBasedStandardRoIHead', bbox_head=dict( type='RankBasedShared2FCBBoxHead', reg_decoded_bbox=True, bbox_coder=dict( type='DeltaXYWHBBoxCoder', target_means=[.0, .0, .0, .0], target_stds=[0.1, 0.1, 0.2, 0.2]), loss_bbox=dict(type='GIoULoss', reduction='none'), loss_cls=dict(use_sigmoid=True)), mask_head=dict(type='RankBasedFCNMaskHead')))
img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
augmentation strategy originates from DETR / Sparse RCNN
train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='RandomFlip', flip_ratio=0.5), dict(type='AutoAugment', policies=[ [ dict(type='Resize', img_scale=[(480, 1333), (512, 1333), (544, 1333), (576, 1333), (608, 1333), (640, 1333), (672, 1333), (704, 1333), (736, 1333), (768, 1333), (800, 1333)], multiscale_mode='value', keep_ratio=True) ], [ dict(type='Resize', img_scale=[(400, 1333), (500, 1333), (600, 1333)], multiscale_mode='value', keep_ratio=True), dict(type='RandomCrop', crop_type='absolute_range', crop_size=(384, 600), allow_negative_crop=True), dict(type='Resize', img_scale=[(480, 1333), (512, 1333), (544, 1333), (576, 1333), (608, 1333), (640, 1333), (672, 1333), (704, 1333), (736, 1333), (768, 1333), (800, 1333)], multiscale_mode='value', override=True, keep_ratio=True) ] ]), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='DefaultFormatBundle'), dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels', 'gt_masks']), ] data = dict(train=dict(pipeline=train_pipeline))
optimizer = dict(delete=True, type='AdamW', lr=0.0001, betas=(0.9, 0.999), weight_decay=0.05, paramwise_cfg=dict(custom_keys={'absolute_pos_embed': dict(decay_mult=0.), 'relative_position_bias_table': dict(decay_mult=0.), 'norm': dict(decay_mult=0.)})) lr_config = dict(step=[27, 33]) runner = dict(type='EpochBasedRunnerAmp', max_epochs=350)
I think the problem is caused by the replacement of RPNHead to RankBasedRPNHead.
Please give me some advice to fix it. Thanks.