Skip to content

Commit 25a95d2

Browse files
authored
[Fix] Fix bbox clamp in pt1.10 (open-mmlab#7074)
1 parent 8644487 commit 25a95d2

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

mmdet/models/dense_heads/autoassign_head.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def forward_single(self, x, scale, stride):
197197
# scale the bbox_pred of different level
198198
# float to avoid overflow when enabling FP16
199199
bbox_pred = scale(bbox_pred).float()
200-
bbox_pred = F.relu(bbox_pred)
200+
bbox_pred = bbox_pred.clamp(min=0)
201201
bbox_pred *= stride
202202
return cls_score, bbox_pred, centerness
203203

mmdet/models/dense_heads/fcos_head.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import torch
55
import torch.nn as nn
6-
import torch.nn.functional as F
76
from mmcv.cnn import Scale
87
from mmcv.runner import force_fp32
98

@@ -155,7 +154,7 @@ def forward_single(self, x, scale, stride):
155154
# float to avoid overflow when enabling FP16
156155
bbox_pred = scale(bbox_pred).float()
157156
if self.norm_on_bbox:
158-
bbox_pred = F.relu(bbox_pred)
157+
bbox_pred = bbox_pred.clamp(min=0)
159158
if not self.training:
160159
bbox_pred *= stride
161160
else:

0 commit comments

Comments
 (0)