Open changxin111 opened 1 year ago
运行代码后出现了以下报错:
Traceback (most recent call last):
File "./tools/train.py", line 187, in
File "/home/cx/LD/mmdet/models/detectors/base.py", line 247, in train_step output = self.module.train_step(*inputs[0], kwargs[0]) File "/home/cx/LD/mmdet/models/detectors/base.py", line 247, in train_step output = self.module.train_step(*inputs[0], kwargs[0]) File "/home/cx/LD/mmdet/models/detectors/base.py", line 247, in train_step losses = self(data) File "/home/.conda/envs/cx_ld/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl losses = self(data) File "/home/.conda/envs/cx_ld/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl losses = self(data) File "/home/.conda/envs/cx_ld/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl losses = self(*data) File "/home/.conda/envs/cx_ld/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(input, kwargs) File "/home/.conda/envs/cx_ld/lib/python3.7/site-packages/mmcv/runner/fp16_utils.py", line 84, in new_func result = self.forward(*input, *kwargs)result = self.forward(input, **kwargs)
File "/home/.conda/envs/cx_ld/lib/python3.7/site-packages/mmcv/runner/fp16_utils.py", line 84, in new_func
File "/home/.conda/envs/cx_ld/lib/python3.7/site-packages/mmcv/runner/fp16_utils.py", line 84, in new_func
result = self.forward(*input, kwargs)
File "/home/.conda/envs/cx_ld/lib/python3.7/site-packages/mmcv/runner/fp16_utils.py", line 84, in new_func
return old_func(*args, *kwargs)
File "/home/cx/LD/mmdet/models/detectors/base.py", line 181, in forward
return old_func(args, kwargs)
return old_func(*args, *kwargs)
File "/home/cx/LD/mmdet/models/detectors/base.py", line 181, in forward
File "/home/cx/LD/mmdet/models/detectors/base.py", line 181, in forward
return old_func(args, kwargs)
File "/home/cx/LD/mmdet/models/detectors/base.py", line 181, in forward
return self.forward_train(img, img_metas, kwargs)
File "/home/cx/LD/mmdet/models/detectors/kd_one_stage.py", line 76, in forward_train
return self.forward_train(img, img_metas, kwargs)
return self.forward_train(img, img_metas, kwargs) File "/home/cx/LD/mmdet/models/detectors/kd_one_stage.py", line 76, in forward_train
File "/home/cx/LD/mmdet/models/detectors/kd_one_stage.py", line 76, in forward_train gt_bboxes_ignore) File "/home/cx/LD/mmdet/models/dense_heads/ld_fcos_head.py", line 254, in forward_train gt_bboxes_ignore) File "/home/cx/LD/mmdet/models/dense_heads/ld_fcos_head.py", line 254, in forward_train gt_bboxes_ignore) File "/home/cx/LD/mmdet/models/dense_heads/ld_fcos_head.py", line 254, in forward_train losses = self.loss(loss_inputs, gt_bboxes_ignore=gt_bboxes_ignore) File "/home/.conda/envs/cx_ld/lib/python3.7/site-packages/mmcv/runner/fp16_utils.py", line 164, in new_func losses = self.loss(loss_inputs, gt_bboxes_ignore=gt_bboxes_ignore) File "/home/.conda/envs/cx_ld/lib/python3.7/site-packages/mmcv/runner/fp16_utils.py", line 164, in new_func losses = self.loss(*loss_inputs, gt_bboxes_ignore=gt_bboxes_ignore) File "/home/.conda/envs/cx_ld/lib/python3.7/site-packages/mmcv/runner/fp16_utils.py", line 164, in new_func return self.forward_train(img, img_metas, kwargs) File "/home/cx/LD/mmdet/models/detectors/kd_one_stage.py", line 76, in forward_train return old_func(*args, *kwargs) File "/home/cx/LD/mmdet/models/dense_heads/ld_fcos_head.py", line 204, in loss return old_func(args, kwargs) File "/home/cx/LD/mmdet/models/dense_heads/ld_fcos_head.py", line 204, in loss return old_func(*args, **kwargs)num_pos=num_pos)
File "/home/cx/LD/mmdet/models/dense_heads/ld_fcos_head.py", line 204, in loss
File "/home/cx/LD/mmdet/core/utils/misc.py", line 29, in multi_apply
num_pos=num_pos)
File "/home/cx/LD/mmdet/core/utils/misc.py", line 29, in multi_apply
gt_bboxes_ignore)
File "/home/cx/LD/mmdet/models/dense_heads/ld_fcos_head.py", line 254, in forward_train
num_pos=num_pos)
File "/home/cx/LD/mmdet/core/utils/misc.py", line 29, in multi_apply
losses = self.loss(loss_inputs, gt_bboxes_ignore=gt_bboxes_ignore)
File "/home/.conda/envs/cx_ld/lib/python3.7/site-packages/mmcv/runner/fp16_utils.py", line 164, in new_func
return old_func(args, *kwargs)
File "/home/cx/LD/mmdet/models/dense_heads/ld_fcos_head.py", line 204, in loss
num_pos=num_pos)
File "/home/cx/LD/mmdet/core/utils/misc.py", line 29, in multi_apply
return tuple(map(list, zip(map_results)))return tuple(map(list, zip(map_results)))
return tuple(map(list, zip(map_results)))
File "/home/cx/LD/mmdet/models/dense_heads/ld_fcos_head.py", line 57, in loss_single File "/home/cx/LD/mmdet/models/dense_heads/ld_fcos_head.py", line 57, in loss_single File "/home/cx/LD/mmdet/models/dense_heads/ld_fcos_head.py", line 57, in loss_single return tuple(map(list, zip(map_results))) File "/home/cx/LD/mmdet/models/dense_heads/ld_fcos_head.py", line 57, in loss_single 4 (self.reg_max + 1))4 * (self.reg_max + 1))
4 (self.reg_max + 1))
RuntimeError: shape '[-1, 68]' is invalid for input of size 243200RuntimeError
: shape '[-1, 68]' is invalid for input of size 243200
RuntimeError: shape '[-1, 68]' is invalid for input of size 268800
4 (self.reg_max + 1))
RuntimeError: shape '[-1, 68]' is invalid for input of size 243200
Traceback (most recent call last):
File "/home/.conda/envs/cx_ld/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/home/.conda/envs/cx_ld/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/.conda/envs/cx_ld/lib/python3.7/site-packages/torch/distributed/launch.py", line 260, in
configs/fcos/fcos_r101_caffe_fpn_gn-head_mstrain_640-800_2x_coco.py 和 FCOS-GFL-R101 区别在于一个用FCOSHead,另一个用FCOSGFLHead,这两个除了一般分布没有任何区别 不改成一般分布是没办法用LD的
好的,我试一下,谢谢了
我用FCOS-GFL-R101的配置预训练了一个教师模型,并用教师训练了学生模型,基本达到了您论文的结果。 我想尝试使用其他的预训练模型训练教师,不知道可不可以,另外代码是不是需要修改某些部分,麻烦帮忙看一下,谢谢。
我对 LD/configs/ld/ld_r50_fcos_r101_1x.py 进行了更改, teacher_config='configs/fcos/fcos_r101_caffe_fpn_gn-head_mstrain_640-800_2x_coco.py', teacher_ckpt='configs/ld/fcos_r101_caffe_fpn_gn-head_mstrain_640-800_2x_coco-511424d6.pth' 并下载了mmdetection提供的预训练模型。