open-mmlab / mmdetection

OpenMMLab Detection Toolbox and Benchmark
https://mmdetection.readthedocs.io
Apache License 2.0
29.67k stars 9.47k forks source link

Detectors loss_rpn_bbox: 0.0000 #3357

Closed smkim17 closed 3 years ago

smkim17 commented 4 years ago

When I train Detectors using my custom dataset(COCO format), config file detectors_cascade_rcnn_r50_1x_coco.py, loss_rpn_bbox is 0 in firtst step.

logs: 2020-07-20 17:31:41,512 - mmdet - INFO - Epoch [1][50/3432] lr: 1.978e-03, eta: 10:32:10, time: 0.922, data_time: 0.045, memory: 9624, loss_rpn_cls: 0.2120, loss_rpn_bbox: 0.0000, s0.loss_cls: 3.2076, s0.acc: 89.0410, s0.loss_bbox: 0.0000, s1.loss_cls: 1.7237, s1.acc: 86.9980, s1.loss_bbox: 0.0000, s2.loss_cls: 0.9378, s2.acc: 82.0234, s2.loss_bbox: 0.0000, loss: 6.0811 2020-07-20 17:32:25,639 - mmdet - INFO - Epoch [1][100/3432] lr: 3.976e-03, eta: 10:17:51, time: 0.883, data_time: 0.002, memory: 9624, loss_rpn_cls: 0.0000, loss_rpn_bbox: 0.0000, s0.loss_cls: 1.2311, s0.acc: 100.0000, s0.loss_bbox: 0.0000, s1.loss_cls: 1.6859, s1.acc: 100.0000, s1.loss_bbox: 0.0000, s2.loss_cls: 1.0309, s2.acc: 100.0000, s2.loss_bbox: 0.0000, loss: 3.9479

version: mmcv-full 1.0.2 mmdet 2.3.0rc0+12a5a3b /home/ubuntu/mmdetection

using file: tool/trian.py

example of annotation file COCO: {'segmentation': [[147.76, 396.11, 158.48, 355.91, 153.12, 347.87, 137.04, 346.26, 125.25, 339.29, 124.71, 301.77, 139.18, 262.64, 159.55, 232.63, 185.82, 209.04, 226.01, 196.72, 244.77, 196.18, 251.74, 202.08, 275.33, 224.59, 283.9, 232.63, 295.16, 240.67, 315.53, 247.1, 327.85, 249.78, 338.57, 253.0, 354.12, 263.72, 379.31, 276.04, 395.39, 286.23, 424.33, 304.99, 454.95, 336.93, 479.62, 387.02, 491.58, 436.36, 494.57, 453.55, 497.56, 463.27, 493.08, 511.86, 487.02, 532.62, 470.4, 552.99, 401.26, 552.99, 399.65, 547.63, 407.15, 535.3, 389.46, 536.91, 374.46, 540.13, 356.23, 540.13, 354.09, 536.91, 341.23, 533.16, 340.15, 526.19, 342.83, 518.69, 355.7, 512.26, 360.52, 510.65, 374.46, 510.11, 375.53, 494.03, 369.1, 497.25, 361.06, 491.89, 361.59, 488.67, 354.63, 489.21, 346.05, 496.71, 343.37, 492.42, 335.33, 495.64, 333.19, 489.21, 327.83, 488.67, 323.0, 499.39, 312.82, 520.83, 304.24, 531.02, 291.91, 535.84, 273.69, 536.91, 269.4, 533.7, 261.36, 533.7, 256.0, 531.02, 254.93, 524.58, 268.33, 509.58, 277.98, 505.82, 287.09, 505.29, 301.56, 481.7, 302.1, 462.41, 294.06, 481.17, 289.77, 488.14, 277.98, 489.74, 261.36, 489.21, 254.93, 488.67, 254.93, 484.38, 244.75, 482.24, 247.96, 473.66, 260.83, 467.23, 276.37, 464.02, 283.34, 446.33, 285.48, 431.32, 287.63, 412.02, 277.98, 407.74, 260.29, 403.99, 257.61, 401.31, 255.47, 391.12, 233.8, 389.37, 220.18, 393.91, 210.65, 393.91, 199.76, 406.61, 187.51, 417.96, 178.43, 420.68, 167.99, 420.68, 163.45, 418.41, 158.01, 419.32, 148.47, 418.41, 145.3, 413.88, 146.66, 402.53]], 'area': 78969.31690000003, 'iscrowd': 0, 'image_id': 472375, 'bbox': [124.71, 196.18, 372.85, 356.81], 'category_id': 18, 'id': 2551}

my: {'segmentation': [[88.0, 82.0, 186.0, 82.0, 186.0, 126.0, 88.0, 126.0]], 'bbox': [88.0, 82.0, 98.0, 44.0], 'category_id': 1, 'id': 1000000, 'iscrowd': 0, 'area': 4312.0, 'image_id': 1000000}

I only chaneged num_class 90 to 1

COCO dataset is works fine. I think my custom data format is wrong, but I don't know the difference.

aimhabo commented 4 years ago

similar problem in traning of retinanet_free_anchor_r50_fpn_1x_coco.py

2020-07-20 16:47:58,848 - mmdet - INFO - Epoch [2][650/6470] lr: 1.000e-02, eta: 5:20:28, time: 0.271, data_time: 0.002, memory: 6484, positive_bag_loss: 2.6950, negative_bag_loss: 0.1050, loss: 2.8000, grad_norm: 5.7043 2020-07-20 16:48:12,489 - mmdet - INFO - Epoch [2][700/6470] lr: 1.000e-02, eta: 5:20:14, time: 0.273, data_time: 0.002, memory: 6484, positive_bag_loss: 2.5064, negative_bag_loss: 0.1714, loss: 2.6778, grad_norm: 6.3550 2020-07-20 16:48:26,237 - mmdet - INFO - Epoch [2][750/6470] lr: 1.000e-02, eta: 5:20:02, time: 0.275, data_time: 0.002, memory: 6484, positive_bag_loss: 31.9414, negative_bag_loss: 1989.1235, loss: 2021.0649, grad_norm: 23450.8454 2020-07-20 16:48:39,894 - mmdet - INFO - Epoch [2][800/6470] lr: 1.000e-02, eta: 5:19:48, time: 0.273, data_time: 0.002, memory: 6484, positive_bag_loss: 50.0000, negative_bag_loss: 3331.1347, loss: 3381.1347, grad_norm: 0.0000 2020-07-20 16:48:53,590 - mmdet - INFO - Epoch [2][850/6470] lr: 1.000e-02, eta: 5:19:35, time: 0.274, data_time: 0.002, memory: 6484, positive_bag_loss: 50.0000, negative_bag_loss: 1967.0521, loss: 2017.0521, grad_norm: 0.0000

This can be delayed by "reducing the learning rate", but it still occurs

ghost commented 4 years ago

Same here! how did you resolve this?

ghost commented 4 years ago

Anyone?

SophiusYou commented 4 years ago

same problem, with the mAP almost 0 and even -1

SophiusYou commented 4 years ago

got low loss and high acc(over 99.9), but the loss_rpn_bbox is 0.0000 from the beginning the APs and ARs are: Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000

(the images I'm using in my dataset are extremely small, from 193x193 to 54x54, I don't know if the poor results have something to do with my images' sizes)

ghost commented 4 years ago

Nonene?

sunnyisabaster commented 4 years ago

same as yours

SophiusYou commented 4 years ago

I noticed that I had changed the img_scale to fit my own data. After changing it back, everything went fine, except for the AP and AR in large area they are still -1. (I've decided to ignore them cuz my data images are relatively small)

sunnyisabaster commented 4 years ago

got low loss and high acc(over 99.9), but the loss_rpn_bbox is 0.0000 from the beginning the APs and ARs are: Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000

(the images I'm using in my dataset are extremely small, from 193x193 to 54x54, I don't know if the poor results have something to do with my images' sizes)

Could I see your configs and logs?

SophiusYou commented 4 years ago

sure

model = dict( type='FasterRCNN', pretrained='torchvision://resnet50', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, style='pytorch'), neck=dict( type='FPN', in_channels=[256, 512, 1024, 2048], out_channels=256, num_outs=5), rpn_head=dict( type='RPNHead', in_channels=256, feat_channels=256, anchor_generator=dict( type='AnchorGenerator', scales=[8], ratios=[0.5, 1.0, 2.0], strides=[4, 8, 16, 32, 64]), bbox_coder=dict( type='DeltaXYWHBBoxCoder', target_means=[0.0, 0.0, 0.0, 0.0], target_stds=[1.0, 1.0, 1.0, 1.0]), loss_cls=dict( type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0), loss_bbox=dict(type='L1Loss', loss_weight=1.0)), roi_head=dict( type='StandardRoIHead', bbox_roi_extractor=dict( type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', output_size=7, sampling_ratio=0), out_channels=256, featmap_strides=[4, 8, 16, 32]), bbox_head=dict( type='Shared2FCBBoxHead', in_channels=256, fc_out_channels=1024, roi_feat_size=7, num_classes=11, bbox_coder=dict( type='DeltaXYWHBBoxCoder', target_means=[0.0, 0.0, 0.0, 0.0], target_stds=[0.1, 0.1, 0.2, 0.2]), reg_class_agnostic=False, loss_cls=dict( type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0), loss_bbox=dict(type='L1Loss', loss_weight=1.0)))) train_cfg = dict( rpn=dict( assigner=dict( type='MaxIoUAssigner', pos_iou_thr=0.7, neg_iou_thr=0.3, min_pos_iou=0.3, match_low_quality=True, ignore_iof_thr=-1), sampler=dict( type='RandomSampler', num=256, pos_fraction=0.5, neg_pos_ub=-1, add_gt_as_proposals=False), allowed_border=-1, pos_weight=-1, debug=False), rpn_proposal=dict( nms_across_levels=False, nms_pre=2000, nms_post=1000, max_num=1000, nms_thr=0.7, min_bbox_size=0), rcnn=dict( assigner=dict( type='MaxIoUAssigner', pos_iou_thr=0.5, neg_iou_thr=0.5, min_pos_iou=0.5, match_low_quality=False, ignore_iof_thr=-1), sampler=dict( type='RandomSampler', num=512, pos_fraction=0.25, neg_pos_ub=-1, add_gt_as_proposals=True), pos_weight=-1, debug=False)) test_cfg = dict( rpn=dict( nms_across_levels=False, nms_pre=1000, nms_post=1000, max_num=1000, nms_thr=0.7, min_bbox_size=0), rcnn=dict( score_thr=0.05, nms=dict(type='nms', iou_threshold=0.5), max_per_img=100)) dataset_type = 'CocoDataset' Classes = ('2s1_gun', 'bmp2_tank', 'brdm2_truck', 'btr60_transport', 'btr70_transport', 'd7_bulldozer', 'slicey', 't62_tank', 't72_tank', 'zil131_truck', 'zsu23-4_gun') data_root = 'data/coco/' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', with_bbox=True), dict(type='Resize', img_scale=(1333, 800), keep_ratio=True), dict(type='RandomFlip', flip_ratio=0.5), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='Pad', size_divisor=32), dict(type='DefaultFormatBundle'), dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']) ] test_pipeline = [ dict(type='LoadImageFromFile'), dict( type='MultiScaleFlipAug', img_scale=(1333, 800), flip=False, transforms=[ dict(type='Resize', keep_ratio=True), dict(type='RandomFlip'), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='Pad', size_divisor=32), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img']) ]) ] data = dict( samples_per_gpu=2, workers_per_gpu=2, train=dict( type='CocoDataset', classes=('2s1_gun', 'bmp2_tank', 'brdm2_truck', 'btr60_transport', 'btr70_transport', 'd7_bulldozer', 'slicey', 't62_tank', 't72_tank', 'zil131_truck', 'zsu23-4_gun'), ann_file='data/coco/annotations/instances_train2017.json', img_prefix='data/coco/train2017/', pipeline=[ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', with_bbox=True), dict(type='Resize', img_scale=(1333, 800), keep_ratio=True), dict(type='RandomFlip', flip_ratio=0.5), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='Pad', size_divisor=32), dict(type='DefaultFormatBundle'), dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']) ]), val=dict( type='CocoDataset', classes=('2s1_gun', 'bmp2_tank', 'brdm2_truck', 'btr60_transport', 'btr70_transport', 'd7_bulldozer', 'slicey', 't62_tank', 't72_tank', 'zil131_truck', 'zsu23-4_gun'), ann_file='data/coco/annotations/instances_val2017.json', img_prefix='data/coco/val2017/', pipeline=[ dict(type='LoadImageFromFile'), dict( type='MultiScaleFlipAug', img_scale=(1333, 800), flip=False, transforms=[ dict(type='Resize', keep_ratio=True), dict(type='RandomFlip'), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='Pad', size_divisor=32), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img']) ]) ]), test=dict( type='CocoDataset', classes=('2s1_gun', 'bmp2_tank', 'brdm2_truck', 'btr60_transport', 'btr70_transport', 'd7_bulldozer', 'slicey', 't62_tank', 't72_tank', 'zil131_truck', 'zsu23-4_gun'), ann_file='data/coco/annotations/instances_test2017.json', img_prefix='data/coco/test2017/', pipeline=[ dict(type='LoadImageFromFile'), dict( type='MultiScaleFlipAug', img_scale=(1333, 800), flip=False, transforms=[ dict(type='Resize', keep_ratio=True), dict(type='RandomFlip'), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='Pad', size_divisor=32), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img']) ]) ])) evaluation = dict(interval=1, metric='bbox') optimizer = dict(type='SGD', lr=0.0025, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=None) lr_config = dict( policy='step', warmup='linear', warmup_iters=500, warmup_ratio=0.001, step=[6, 8]) total_epochs = 10 checkpoint_config = dict(interval=1) log_config = dict(interval=50, hooks=[dict(type='TextLoggerHook')]) dist_params = dict(backend='nccl') log_level = 'INFO' load_from = None resume_from = None workflow = [('train', 1)] work_dir = './work_dirs/faster_rcnn_r50_fpn_2x_coco' gpu_ids = range(0, 1)

--------------------------------------------and here's my environment-------------------

sys.platform: linux Python: 3.7.7 (default, May 7 2020, 21:25:33) [GCC 7.3.0] CUDA available: True CUDA_HOME: /usr/local/cuda-10.1 NVCC: Cuda compilation tools, release 10.1, V10.1.243 GPU 0: GeForce RTX 2080 Ti GCC: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 PyTorch: 1.5.1+cu101 PyTorch compiling details: PyTorch built with:

TorchVision: 0.6.1+cu101 OpenCV: 4.3.0 MMCV: 1.0.3 MMDetection: 2.3.0rc0+3c21dd0 MMDetection Compiler: GCC 7.3 MMDetection CUDA Compiler: 10.1

SophiusYou commented 4 years ago

still, it is strongly recommended to check the data and annotations first cuz the problems are often there

yutao007 commented 4 years ago

是的,版本2目前不能跑detectors,跑就会报bbox loss=0 的错误, 你现在可以用版本1跑起来。

yutao007 commented 4 years ago

sure

model = dict( type='FasterRCNN', pretrained='torchvision://resnet50', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, style='pytorch'), neck=dict( type='FPN', in_channels=[256, 512, 1024, 2048], out_channels=256, num_outs=5), rpn_head=dict( type='RPNHead', in_channels=256, feat_channels=256, anchor_generator=dict( type='AnchorGenerator', scales=[8], ratios=[0.5, 1.0, 2.0], strides=[4, 8, 16, 32, 64]), bbox_coder=dict( type='DeltaXYWHBBoxCoder', target_means=[0.0, 0.0, 0.0, 0.0], target_stds=[1.0, 1.0, 1.0, 1.0]), loss_cls=dict( type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0), loss_bbox=dict(type='L1Loss', loss_weight=1.0)), roi_head=dict( type='StandardRoIHead', bbox_roi_extractor=dict( type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', output_size=7, sampling_ratio=0), out_channels=256, featmap_strides=[4, 8, 16, 32]), bbox_head=dict( type='Shared2FCBBoxHead', in_channels=256, fc_out_channels=1024, roi_feat_size=7, num_classes=11, bbox_coder=dict( type='DeltaXYWHBBoxCoder', target_means=[0.0, 0.0, 0.0, 0.0], target_stds=[0.1, 0.1, 0.2, 0.2]), reg_class_agnostic=False, loss_cls=dict( type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0), loss_bbox=dict(type='L1Loss', loss_weight=1.0)))) train_cfg = dict( rpn=dict( assigner=dict( type='MaxIoUAssigner', pos_iou_thr=0.7, neg_iou_thr=0.3, min_pos_iou=0.3, match_low_quality=True, ignore_iof_thr=-1), sampler=dict( type='RandomSampler', num=256, pos_fraction=0.5, neg_pos_ub=-1, add_gt_as_proposals=False), allowed_border=-1, pos_weight=-1, debug=False), rpn_proposal=dict( nms_across_levels=False, nms_pre=2000, nms_post=1000, max_num=1000, nms_thr=0.7, min_bbox_size=0), rcnn=dict( assigner=dict( type='MaxIoUAssigner', pos_iou_thr=0.5, neg_iou_thr=0.5, min_pos_iou=0.5, match_low_quality=False, ignore_iof_thr=-1), sampler=dict( type='RandomSampler', num=512, pos_fraction=0.25, neg_pos_ub=-1, add_gt_as_proposals=True), pos_weight=-1, debug=False)) test_cfg = dict( rpn=dict( nms_across_levels=False, nms_pre=1000, nms_post=1000, max_num=1000, nms_thr=0.7, min_bbox_size=0), rcnn=dict( score_thr=0.05, nms=dict(type='nms', iou_threshold=0.5), max_per_img=100)) dataset_type = 'CocoDataset' Classes = ('2s1_gun', 'bmp2_tank', 'brdm2_truck', 'btr60_transport', 'btr70_transport', 'd7_bulldozer', 'slicey', 't62_tank', 't72_tank', 'zil131_truck', 'zsu23-4_gun') data_root = 'data/coco/' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', with_bbox=True), dict(type='Resize', img_scale=(1333, 800), keep_ratio=True), dict(type='RandomFlip', flip_ratio=0.5), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='Pad', size_divisor=32), dict(type='DefaultFormatBundle'), dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']) ] test_pipeline = [ dict(type='LoadImageFromFile'), dict( type='MultiScaleFlipAug', img_scale=(1333, 800), flip=False, transforms=[ dict(type='Resize', keep_ratio=True), dict(type='RandomFlip'), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='Pad', size_divisor=32), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img']) ]) ] data = dict( samples_per_gpu=2, workers_per_gpu=2, train=dict( type='CocoDataset', classes=('2s1_gun', 'bmp2_tank', 'brdm2_truck', 'btr60_transport', 'btr70_transport', 'd7_bulldozer', 'slicey', 't62_tank', 't72_tank', 'zil131_truck', 'zsu23-4_gun'), ann_file='data/coco/annotations/instances_train2017.json', img_prefix='data/coco/train2017/', pipeline=[ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', with_bbox=True), dict(type='Resize', img_scale=(1333, 800), keep_ratio=True), dict(type='RandomFlip', flip_ratio=0.5), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='Pad', size_divisor=32), dict(type='DefaultFormatBundle'), dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']) ]), val=dict( type='CocoDataset', classes=('2s1_gun', 'bmp2_tank', 'brdm2_truck', 'btr60_transport', 'btr70_transport', 'd7_bulldozer', 'slicey', 't62_tank', 't72_tank', 'zil131_truck', 'zsu23-4_gun'), ann_file='data/coco/annotations/instances_val2017.json', img_prefix='data/coco/val2017/', pipeline=[ dict(type='LoadImageFromFile'), dict( type='MultiScaleFlipAug', img_scale=(1333, 800), flip=False, transforms=[ dict(type='Resize', keep_ratio=True), dict(type='RandomFlip'), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='Pad', size_divisor=32), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img']) ]) ]), test=dict( type='CocoDataset', classes=('2s1_gun', 'bmp2_tank', 'brdm2_truck', 'btr60_transport', 'btr70_transport', 'd7_bulldozer', 'slicey', 't62_tank', 't72_tank', 'zil131_truck', 'zsu23-4_gun'), ann_file='data/coco/annotations/instances_test2017.json', img_prefix='data/coco/test2017/', pipeline=[ dict(type='LoadImageFromFile'), dict( type='MultiScaleFlipAug', img_scale=(1333, 800), flip=False, transforms=[ dict(type='Resize', keep_ratio=True), dict(type='RandomFlip'), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='Pad', size_divisor=32), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img']) ]) ])) evaluation = dict(interval=1, metric='bbox') optimizer = dict(type='SGD', lr=0.0025, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=None) lr_config = dict( policy='step', warmup='linear', warmup_iters=500, warmup_ratio=0.001, step=[6, 8]) total_epochs = 10 checkpoint_config = dict(interval=1) log_config = dict(interval=50, hooks=[dict(type='TextLoggerHook')]) dist_params = dict(backend='nccl') log_level = 'INFO' load_from = None resume_from = None workflow = [('train', 1)] work_dir = './work_dirs/faster_rcnn_r50_fpn_2x_coco' gpu_ids = range(0, 1)

--------------------------------------------and here's my environment-------------------

sys.platform: linux Python: 3.7.7 (default, May 7 2020, 21:25:33) [GCC 7.3.0] CUDA available: True CUDA_HOME: /usr/local/cuda-10.1 NVCC: Cuda compilation tools, release 10.1, V10.1.243 GPU 0: GeForce RTX 2080 Ti GCC: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 PyTorch: 1.5.1+cu101 PyTorch compiling details: PyTorch built with:

  • GCC 7.3
  • C++ Version: 201402
  • Intel(R) Math Kernel Library Version 2019.0.5 Product Build 20190808 for Intel(R) 64 architecture applications
  • Intel(R) MKL-DNN v0.21.1 (Git Hash 7d2fd500bc78936d1d648ca713b901012f470dbc)
  • OpenMP 201511 (a.k.a. OpenMP 4.5)
  • NNPACK is enabled
  • CPU capability usage: AVX2
  • CUDA Runtime 10.1
  • NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_37,code=compute_37
  • CuDNN 7.6.3
  • Magma 2.5.2
  • Build settings: BLAS=MKL, BUILD_TYPE=Release, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -fopenmp -DNDEBUG -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_INTERNAL_THREADPOOL_IMPL -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, USE_CUDA=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_STATIC_DISPATCH=OFF,

TorchVision: 0.6.1+cu101 OpenCV: 4.3.0 MMCV: 1.0.3 MMDetection: 2.3.0rc0+3c21dd0 MMDetection Compiler: GCC 7.3 MMDetection CUDA Compiler:兄 10.1

兄弟。从你的配置我看出你在跑一个科大讯飞的i竞赛。这个detectors模型要是能够用res2net backbond 效果会不错。可惜就是mmdetectin框架上有bug。

sunnyisabaster commented 4 years ago

Maybe you can check your annotation id, it can same as the image id in your coco dataset.

smkim17 commented 4 years ago

In my opinion, this problem is caused by miswriting'license','categories','info'. So I solved this problem using original coco dataset annotation like this.

file = open('/hdd/mmdetection/data/coco/annotations/instances_val2017.json') coco_original = json.load(file) file.close() out = {} out['info']=coco_original['info'] out['licenses']=coco_original['licenses'] out['categories']=coco_original['categories'] out['images']=[] out['annotations']=[] obj_idx = 0 fns = os.listdir('/hdd/mmdetection/data/coco/image/')

for idx, fn in enumerate(fns): out['images'].append({'license': 4, 'file_name': fn, 'coco_url': 'http://images.cocodataset.org/val2017/000000397133.jpg', 'height': height, 'width': width, 'date_captured': ' 2013-11-14 17:02:52', 'flickr_url': 'http://farm7.staticflickr.com/6116/6255196340_da26cf2c9e_z.jpg', 'id': idx}) out['annotations'].append({'segmentation': [box], 'area': width*height, 'iscrowd': 0, 'image_id': idx, 'bbox': [box[0], box[1], width, height], 'category_id': 1, 'id': obj_idx}) obj_idx+=1

This is the rough code. I hope it helps.

aimhabo commented 4 years ago

Maybe you can check your annotation id, it can same as the image id in your coco dataset.

Or similar: If the categories name in dataset label is different with the tuple elements in the dataset class.py, it would also cause the loss_bbox = 0. It can be checked with print(gt_bboxes[0]), if is empty, in the detector's forward_train().