microsoft / SoftTeacher

Semi-Supervised Learning, Object Detection, ICCV2021
MIT License
904 stars 123 forks source link

DynamicRoIHead Issue #147

Open gouthamkallempudi opened 2 years ago

gouthamkallempudi commented 2 years ago

Hello,

The fasterRCNN by default uses roi_head=dict( type='StandardRoIHead') . However if I change thetype to DynamicRoIHead the softTeacher fails. Could you help me with this issue?

Traceback (most recent call last): File "tools/train.py", line 200, in main() File "tools/train.py", line 195, in main meta=meta, File "/content/SoftTeacher/ssod/apis/train.py", line 206, in train_detector runner.run(data_loaders, cfg.workflow) File "/usr/local/lib/python3.7/dist-packages/mmcv/runner/iter_based_runner.py", line 133, in run iter_runner(iter_loaders[i], kwargs) File "/usr/local/lib/python3.7/dist-packages/mmcv/runner/iter_based_runner.py", line 60, in train outputs = self.model.train_step(data_batch, self.optimizer, kwargs) File "/usr/local/lib/python3.7/dist-packages/mmcv/parallel/distributed.py", line 52, in train_step output = self.module.train_step(inputs[0], kwargs[0]) File "/usr/local/lib/python3.7/dist-packages/mmdet/models/detectors/base.py", line 238, in train_step losses = self(data) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(input, *kwargs) File "/usr/local/lib/python3.7/dist-packages/mmcv/runner/fp16_utils.py", line 128, in new_func output = old_func(new_args, new_kwargs) File "/usr/local/lib/python3.7/dist-packages/mmdet/models/detectors/base.py", line 172, in forward return self.forward_train(img, img_metas, kwargs) File "/content/SoftTeacher/ssod/models/soft_teacher.py", line 50, in forward_train data_groups["unsup_teacher"], data_groups["unsup_student"] File "/content/SoftTeacher/ssod/models/soft_teacher.py", line 77, in foward_unsup_train return self.compute_pseudo_label_loss(student_info, teacher_info) File "/content/SoftTeacher/ssod/models/soft_teacher.py", line 136, in compute_pseudo_label_loss student_info=student_info, File "/content/SoftTeacher/ssod/models/soft_teacher.py", line 295, in unsup_rcnn_reg_loss **kwargs, File "/usr/local/lib/python3.7/dist-packages/mmdet/models/roi_heads/dynamic_roi_head.py", line 92, in forward_train img_metas) File "/usr/local/lib/python3.7/dist-packages/mmdet/models/roi_heads/dynamic_roi_head.py", line 125, in _bbox_forward_train cur_target = torch.kthvalue(cur_target, beta_topk)[0].item() IndexError: kth_value(): Expected reduction dim 0 to have non-zero size.

MendelXu commented 2 years ago

I am not familiar with it and do not have enough time to look into it recently. If you are in an emergency, I think you can try to debug it step by step. Or I will try to debug it several days later.