Skip to content

Commit

Permalink
[FIX] add Ci of pytorch 1.10 and comments for bbox clamp (#7081) (#7083)
Browse files Browse the repository at this point in the history
* add comments for bbox clamp

* add CI of pytorch1.10

* add ci of pytorch1.10.1

* mmcv1.9.0->mmcv1.9

* add ci of pytorch1.10
  • Loading branch information
chhluo authored Feb 13, 2022
1 parent 5368965 commit cb9884e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
strategy:
matrix:
python-version: [3.7]
torch: [1.5.1, 1.6.0, 1.7.0, 1.8.0, 1.9.0]
torch: [1.5.1, 1.6.0, 1.7.0, 1.8.0, 1.9.0, 1.10.1]
include:
- torch: 1.5.1
torchvision: 0.6.1
Expand All @@ -50,6 +50,9 @@ jobs:
- torch: 1.9.0
torchvision: 0.10.0
mmcv: 1.9
- torch: 1.10.1
torchvision: 0.11.2
mmcv: 1.10
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -160,12 +163,16 @@ jobs:
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
torch: [1.9.0+cu102]
torch: [1.9.0+cu102, 1.10.1+cu102]
include:
- torch: 1.9.0+cu102
torch_version: torch1.9.0
torchvision: 0.10.0+cu102
mmcv: 1.9
- torch: 1.10.1+cu102
torch_version: torch1.10.1
torchvision: 0.11.2+cu102
mmcv: 1.10

steps:
- uses: actions/checkout@v2
Expand Down
3 changes: 3 additions & 0 deletions mmdet/models/dense_heads/autoassign_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ def forward_single(self, x, scale, stride):
# scale the bbox_pred of different level
# float to avoid overflow when enabling FP16
bbox_pred = scale(bbox_pred).float()
# bbox_pred needed for gradient computation has been modified
# by F.relu(bbox_pred) when run with PyTorch 1.10. So replace
# F.relu(bbox_pred) with bbox_pred.clamp(min=0)
bbox_pred = bbox_pred.clamp(min=0)
bbox_pred *= stride
return cls_score, bbox_pred, centerness
Expand Down
3 changes: 3 additions & 0 deletions mmdet/models/dense_heads/fcos_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ def forward_single(self, x, scale, stride):
# float to avoid overflow when enabling FP16
bbox_pred = scale(bbox_pred).float()
if self.norm_on_bbox:
# bbox_pred needed for gradient computation has been modified
# by F.relu(bbox_pred) when run with PyTorch 1.10. So replace
# F.relu(bbox_pred) with bbox_pred.clamp(min=0)
bbox_pred = bbox_pred.clamp(min=0)
if not self.training:
bbox_pred *= stride
Expand Down

0 comments on commit cb9884e

Please sign in to comment.