Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] add Ci of pytorch 1.10 and comments for bbox clamp (#7081) #7083

Merged
merged 6 commits into from
Feb 13, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.0
- torch: 1.10.1
torchvision: 0.11.2
mmcv: 1.10.0
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.0
- torch: 1.10.1+cu102
torch_version: torch1.10.1
torchvision: 0.11.2+cu102
mmcv: 1.10.0

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