Possible bug in mmdet modification?
maitreygram opened this issue · 0 comments
maitreygram commented
Thanks for your error report and we appreciate it a lot.
Checklist
- I have searched related issues but cannot get the expected help.
- I have read the FAQ documentation but cannot get the expected help.
- The bug has not been fixed in the latest version.
Describe the bug
In mmdet/models/detectors/two_stage.py line 244, there is this snippet of code -
if self.with_rpn:
proposal_cfg = self.train_cfg.get('rpn_proposal',
self.test_cfg.rpn)
for i,x in enumerate(xs):
rpn_losses, proposal_list = self.rpn_head.forward_train(
x,
img_metas,
gt_bboxes,
gt_labels=None,
gt_bboxes_ignore=gt_bboxes_ignore,
proposal_cfg=proposal_cfg)
if len(xs) > 1:
rpn_losses = upd_loss(rpn_losses, idx=i, weight=loss_weights[i])
losses.update(rpn_losses)
else:
proposal_list = proposals
for i,x in enumerate(xs):
roi_losses = self.roi_head.forward_train(x, img_metas, proposal_list,
gt_bboxes, gt_labels,
gt_bboxes_ignore, gt_masks,
**kwargs)
if len(xs) > 1:
roi_losses = upd_loss(roi_losses, idx=i, weight=loss_weights[i])
losses.update(roi_losses)
So when self.with_rpn is True and len(xs) > 1, only the proposal list of the last image will be passed to the roi_head repeatedly. Whereas it should be the proposal list of each image respectively.
Bug fix
Please correct me if I am wrong. I think proposal_list should be defined outside the for loop. As the code stands, it can only be used with batch_size=1