TSD icon indicating copy to clipboard operation
TSD copied to clipboard

I transfer the code to mmdetection v2.0, but the result is much worse than general training pipeline. What might be the reason?

Open clw5180 opened this issue 4 years ago • 3 comments

I already modified the key of pretrained models, and load it into the model.

clw5180 avatar Feb 16 '21 07:02 clw5180

Hello, can you share the code of TSD in mmdetection v2.0, thank you!

hq03 avatar Feb 19 '21 08:02 hq03

Here is the result of epoch 1, I don't know why the prediction is nearly all class 1, how to fix the problem? +------------+-----+-------+--------+-------+ | class | gts | dets | recall | ap | +------------+-----+-------+--------+-------+ | 1 | 14 | 79331 | 0.929 | 0.001 | | 2 | 42 | 139 | 0.000 | 0.000 | | 3 | 229 | 119 | 0.009 | 0.004 | | 4 | 131 | 67 | 0.000 | 0.000 | | 5 | 338 | 190 | 0.000 | 0.000 | | 6 | 13 | 16 | 0.000 | 0.000 | | 7 | 74 | 346 | 0.135 | 0.073 | | 8 | 177 | 0 | 0.000 | 0.000 | +------------+-----+-------+--------+-------+ | mAP | | | | 0.010 | +------------+-----+-------+--------+-------+

and the normal one: +------------+-----+-------+--------+-------+ | class | gts | dets | recall | ap | +------------+-----+-------+--------+-------+ | 1 | 14 | 2270 | 0.500 | 0.020 | | 2 | 42 | 9170 | 0.786 | 0.240 | | 3 | 229 | 8333 | 0.581 | 0.154 | | 4 | 131 | 4723 | 0.702 | 0.176 | | 5 | 338 | 10087 | 0.669 | 0.382 | | 6 | 13 | 2571 | 0.538 | 0.233 | | 7 | 74 | 12703 | 0.811 | 0.492 | | 8 | 177 | 25845 | 0.469 | 0.089 | +------------+-----+-------+--------+-------+ | mAP | | | | 0.223 | +------------+-----+-------+--------+-------+

and the log of TSD:

2021-02-20 15:48:19,719 - mmdet - INFO - load model from: torchvision://resnet50 2021-02-20 15:48:19,869 - mmdet - WARNING - The model and loaded state dict do not match exactly

unexpected key in source state_dict: fc.weight, fc.bias

loading annotations into memory... Done (t=0.02s) creating index... index created! fatal: not a git repository (or any parent up to mount point /) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). loading annotations into memory... Done (t=0.00s) creating index... index created! 2021-02-20 15:48:22,193 - mmdet - INFO - load checkpoint from /home/user/.cache/torch/mmdetection/r50-FPN-1x_classsampling_TSD_publish.pth 2021-02-20 15:48:22,374 - mmdet - WARNING - The model and loaded state dict do not match exactly

size mismatch for rpn_head.rpn_cls.weight: copying a param with shape torch.Size([3, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([6, 256, 1, 1]). size mismatch for rpn_head.rpn_cls.bias: copying a param with shape torch.Size([3]) from checkpoint, the shape in current model is torch.Size([6]). size mismatch for rpn_head.rpn_reg.weight: copying a param with shape torch.Size([12, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([24, 256, 1, 1]). size mismatch for rpn_head.rpn_reg.bias: copying a param with shape torch.Size([12]) from checkpoint, the shape in current model is torch.Size([24]). size mismatch for roi_head.bbox_head.fc_cls.weight: copying a param with shape torch.Size([501, 1024]) from checkpoint, the shape in current model is torch.Size([8, 1024]). size mismatch for roi_head.bbox_head.fc_cls.bias: copying a param with shape torch.Size([501]) from checkpoint, the shape in current model is torch.Size([8]). size mismatch for roi_head.bbox_head.fc_reg.weight: copying a param with shape torch.Size([2004, 1024]) from checkpoint, the shape in current model is torch.Size([32, 1024]). size mismatch for roi_head.bbox_head.fc_reg.bias: copying a param with shape torch.Size([2004]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for roi_head.bbox_head.TSD_fc_cls.weight: copying a param with shape torch.Size([501, 1024]) from checkpoint, the shape in current model is torch.Size([8, 1024]). size mismatch for roi_head.bbox_head.TSD_fc_cls.bias: copying a param with shape torch.Size([501]) from checkpoint, the shape in current model is torch.Size([8]). size mismatch for roi_head.bbox_head.TSD_fc_reg.weight: copying a param with shape torch.Size([2004, 1024]) from checkpoint, the shape in current model is torch.Size([32, 1024]). size mismatch for roi_head.bbox_head.TSD_fc_reg.bias: copying a param with shape torch.Size([2004]) from checkpoint, the shape in current model is torch.Size([32]). 2021-02-20 15:48:22,385 - mmdet - INFO - Start running, host: user@x299, work_dir: /home/user/mmdetection/work_dirs/exp11 2021-02-20 15:48:22,385 - mmdet - INFO - workflow: [('train', 1)], max: 12 epochs 2021-02-20 15:49:28,405 - mmdet - INFO - Epoch [1][50/404] lr: 9.890e-04, eta: 1:45:33, time: 1.320, data_time: 0.072, memory: 8626, loss_rpn_cls: 0.1800, loss_rpn_bbox: 0.0420, loss_cls: 0.7300, acc: 94.9678, loss_TSD_cls: 0.3645, TSD_acc: 92.9956, loss_bbox: 0.0066, loss_TSD_bbox: 0.0066, loss_pc_cls: 0.0374, loss_pc_loc: 0.0844, loss: 1.4514 2021-02-20 15:50:38,508 - mmdet - INFO - Epoch [1][100/404] lr: 1.988e-03, eta: 1:47:41, time: 1.402, data_time: 0.015, memory: 8626, loss_rpn_cls: 0.0820, loss_rpn_bbox: 0.0278, loss_cls: 0.1553, acc: 99.2207, loss_TSD_cls: 0.0510, TSD_acc: 99.2207, loss_bbox: 0.0120, loss_TSD_bbox: 0.0116, loss_pc_cls: 0.0060, loss_pc_loc: 0.1106, loss: 0.4564 2021-02-20 15:51:44,957 - mmdet - INFO - Epoch [1][150/404] lr: 2.987e-03, eta: 1:45:43, time: 1.329, data_time: 0.015, memory: 8626, loss_rpn_cls: 0.0515, loss_rpn_bbox: 0.0196, loss_cls: 0.1237, acc: 99.1455, loss_TSD_cls: 0.0513, TSD_acc: 99.1470, loss_bbox: 0.0194, loss_TSD_bbox: 0.0174, loss_pc_cls: 0.0068, loss_pc_loc: 0.1357, loss: 0.4254 2021-02-20 15:52:56,582 - mmdet - INFO - Epoch [1][200/404] lr: 3.986e-03, eta: 1:46:11, time: 1.432, data_time: 0.014, memory: 8626, loss_rpn_cls: 0.0550, loss_rpn_bbox: 0.0267, loss_cls: 0.0689, acc: 98.9194, loss_TSD_cls: 0.0594, TSD_acc: 98.9150, loss_bbox: 0.0274, loss_TSD_bbox: 0.0237, loss_pc_cls: 0.0089, loss_pc_loc: 0.1551, loss: 0.4250 2021-02-20 15:54:08,414 - mmdet - INFO - Epoch [1][250/404] lr: 4.985e-03, eta: 1:46:03, time: 1.437, data_time: 0.014, memory: 8626, loss_rpn_cls: 0.0443, loss_rpn_bbox: 0.0255, loss_cls: 0.0684, acc: 98.7671, loss_TSD_cls: 0.0561, TSD_acc: 98.7754, loss_bbox: 0.0350, loss_TSD_bbox: 0.0297, loss_pc_cls: 0.0092, loss_pc_loc: 0.1624, loss: 0.4308 2021-02-20 15:55:15,653 - mmdet - INFO - Epoch [1][300/404] lr: 5.984e-03, eta: 1:44:24, time: 1.345, data_time: 0.015, memory: 8626, loss_rpn_cls: 0.0411, loss_rpn_bbox: 0.0213, loss_cls: 0.0724, acc: 98.6938, loss_TSD_cls: 0.0587, TSD_acc: 98.7319, loss_bbox: 0.0366, loss_TSD_bbox: 0.0315, loss_pc_cls: 0.0100, loss_pc_loc: 0.1732, loss: 0.4447 2021-02-20 15:56:17,384 - mmdet - INFO - Epoch [1][350/404] lr: 6.983e-03, eta: 1:41:44, time: 1.235, data_time: 0.015, memory: 8626, loss_rpn_cls: 0.0307, loss_rpn_bbox: 0.0176, loss_cls: 0.0658, acc: 98.4468, loss_TSD_cls: 0.0617, TSD_acc: 98.4775, loss_bbox: 0.0431, loss_TSD_bbox: 0.0394, loss_pc_cls: 0.0117, loss_pc_loc: 0.1859, loss: 0.4559 2021-02-20 15:57:24,631 - mmdet - INFO - Epoch [1][400/404] lr: 7.982e-03, eta: 1:40:29, time: 1.345, data_time: 0.014, memory: 8626, loss_rpn_cls: 0.0343, loss_rpn_bbox: 0.0233, loss_cls: 0.0901, acc: 98.7705, loss_TSD_cls: 0.0485, TSD_acc: 98.7856, loss_bbox: 0.0360, loss_TSD_bbox: 0.0335, loss_pc_cls: 0.0098, loss_pc_loc: 0.1903, loss: 0.4658

clw5180 avatar Feb 20 '21 09:02 clw5180

Hi, I also transferred the TSD code to mmdetection v2.0, but the model can be trained but cannot be tested,I am very upset. Can you send me a copy of the code you wrote, it doesn’t matter if the performance is not good, because I also want to explore the reasons, thank you!My email:[email protected]

Wangjing1551 avatar Mar 01 '21 12:03 Wangjing1551