Skip to content

Commit

Permalink
Fix empty bbox error in mask_head of carafe (open-mmlab#5062)
Browse files Browse the repository at this point in the history
* Fix empty bbox error in mask_head of carafe

* add onnx error tips
  • Loading branch information
hhaAndroid authored Apr 26, 2021
1 parent 50a8cee commit 458ffc1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mmdet/models/roi_heads/test_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,14 @@ def simple_test_mask(self,
ori_shapes = tuple(meta['ori_shape'] for meta in img_metas)
scale_factors = tuple(meta['scale_factor'] for meta in img_metas)

if all(det_bbox.shape[0] == 0 for det_bbox in det_bboxes):
if torch.onnx.is_in_onnx_export():
raise RuntimeError('[ONNX Error] Can not record MaskHead '
'as it has not been executed this time')
segm_results = [[[] for _ in range(self.mask_head.num_classes)]
for _ in range(len(det_bboxes))]
return segm_results

# The length of proposals of different batches may be different.
# In order to form a batch, a padding operation is required.
if isinstance(det_bboxes, list):
Expand Down

0 comments on commit 458ffc1

Please sign in to comment.