Skip to content

Commit

Permalink
[Fix]: Fix the error of TTA when there is no prediction results and s…
Browse files Browse the repository at this point in the history
…upport vis (open-mmlab#9840)
  • Loading branch information
hhaAndroid authored Feb 27, 2023
1 parent 28b1d34 commit 13aa724
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions configs/centernet/centernet_tta.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
test_pad_mode=['logical_or', 31],
test_pad_add_pix=1),
],
[dict(type='LoadAnnotations', with_bbox=True)],
[
dict(
type='PackDetInputs',
Expand Down
2 changes: 1 addition & 1 deletion configs/retinanet/retinanet_tta.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
], [
dict(type='RandomFlip', prob=1.),
dict(type='RandomFlip', prob=0.)
],
], [dict(type='LoadAnnotations', with_bbox=True)],
[
dict(
type='PackDetInputs',
Expand Down
1 change: 1 addition & 0 deletions configs/yolox/yolox_tta.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
pad_to_square=True,
pad_val=dict(img=(114.0, 114.0, 114.0))),
],
[dict(type='LoadAnnotations', with_bbox=True)],
[
dict(
type='PackDetInputs',
Expand Down
7 changes: 2 additions & 5 deletions mmdet/models/test_time_augs/det_tta.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _merge_single_sample(
to one prediction.
Args:
data_samples_list (List[DetDataSample]): List of predictions
data_samples (List[DetDataSample]): List of predictions
of enhanced data which come form one image.
Returns:
List[DetDataSample]: Merged prediction.
Expand All @@ -126,10 +126,7 @@ def _merge_single_sample(
merged_labels = torch.cat(aug_labels, dim=0)

if merged_bboxes.numel() == 0:
det_bboxes = torch.cat([merged_bboxes, merged_scores[:, None]], -1)
return [
(det_bboxes, merged_labels),
]
return data_samples[0]

det_bboxes, keep_idxs = batched_nms(merged_bboxes, merged_scores,
merged_labels, self.tta_cfg.nms)
Expand Down

0 comments on commit 13aa724

Please sign in to comment.