Skip to content

Commit

Permalink
[Fix] Force the sigmoid calculation in multi-label head to be full-pr…
Browse files Browse the repository at this point in the history
…ecision. (#1251)

* [CI] Update CI of the master branch. (#1252)

* [Bot] Update assignee schedule. (#1262)

* [Fix] Force the sigmoid calculation in multi-label head to be
full-precision.
  • Loading branch information
mzr1996 authored Dec 15, 2022
1 parent 2495400 commit a7acbaa
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 60 deletions.
30 changes: 0 additions & 30 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,53 +187,23 @@ workflows:
env: LRU_CACHE_CAPACITY=1
requires:
- lint
- build:
name: build_py36_torch1.6
torch: 1.6.0
torchvision: 0.7.0
requires:
- lint
- build:
name: build_py36_torch1.7
torch: 1.7.0
torchvision: 0.8.1
requires:
- lint
- build:
name: build_py36_torch1.8
torch: 1.8.0
torchvision: 0.9.0
requires:
- lint
- build:
name: build_py39_torch1.8
torch: 1.8.0
torchvision: 0.9.0
python: "3.9.0"
requires:
- lint
- build:
name: build_py39_torch1.9
torch: 1.9.0
torchvision: 0.10.0
python: "3.9.0"
requires:
- lint
- build:
name: build_py39_torch1.10
torch: 1.10.0
torchvision: 0.11.1
python: "3.9.0"
requires:
- lint
- build_with_cuda:
name: build_py36_torch1.6_cu101
requires:
- build_with_timm
- build_py36_torch1.5
- build_py36_torch1.6
- build_py36_torch1.7
- build_py36_torch1.8
- build_py39_torch1.8
- build_py39_torch1.9
- build_py39_torch1.10
37 changes: 9 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
UBUNTU_VERSION: ubuntu1804
strategy:
matrix:
python-version: [3.6]
python-version: [3.8]
torch: [1.8.0]
include:
- torch: 1.8.0
Expand Down Expand Up @@ -84,43 +84,24 @@ jobs:
UBUNTU_VERSION: ubuntu1804
strategy:
matrix:
python-version: [3.7]
torch: [1.5.0, 1.6.0, 1.7.0, 1.8.0, 1.9.0]
torch: [1.5.0, 1.8.0, 1.10.0, 1.13.0]
include:
- torch: 1.5.0
torchvision: 0.6.0
torch_major: 1.5.0
- torch: 1.6.0
torchvision: 0.7.0
torch_major: 1.6.0
- torch: 1.7.0
torchvision: 0.8.1
torch_major: 1.7.0
- torch: 1.8.0
torchvision: 0.9.0
torch_major: 1.8.0
- torch: 1.8.0
torchvision: 0.9.0
torch_major: 1.8.0
python-version: 3.8
python-version: '3.7'
- torch: 1.8.0
torchvision: 0.9.0
torch_major: 1.8.0
python-version: 3.9
- torch: 1.9.0
torchvision: 0.10.0
torch_major: 1.9.0
- torch: 1.10.0
torchvision: 0.11.1
torch_major: 1.10.0
- torch: 1.10.0
torchvision: 0.11.1
torch_major: 1.10.0
python-version: 3.8
python-version: '3.8'
- torch: 1.10.0
torchvision: 0.11.1
torch_major: 1.10.0
python-version: 3.9
python-version: '3.9'
- torch: 1.13.0
torchvision: 0.14.0
torch_major: 1.13.0
python-version: '3.10'

steps:
- uses: actions/checkout@v2
Expand Down
18 changes: 18 additions & 0 deletions .owners.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# assign issues to owners automatically
assign:
issues: enabled # or disabled
pull_requests: enabled # or disabled
# assign strategy, both issues and pull requests follow the same strategy
strategy:
# random
# round-robin
daily-shift-based
schedule:
'*/1 * * * *'
# assignees
assignees:
- mzr1996
- tonysy
- Ezra-Yu
- techmonsterwang
- yingfhu
3 changes: 2 additions & 1 deletion mmcls/models/heads/multi_label_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ def simple_test(self, x, sigmoid=True, post_process=True):
x = x[-1]

if sigmoid:
pred = torch.sigmoid(x) if x is not None else None
# Convert to full precision because sigmoid is sensitive.
pred = torch.sigmoid(x.float()) if x is not None else None
else:
pred = x

Expand Down
4 changes: 3 additions & 1 deletion mmcls/models/heads/multi_label_linear_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ def simple_test(self, x, sigmoid=True, post_process=True):
cls_score = self.fc(x)

if sigmoid:
pred = torch.sigmoid(cls_score) if cls_score is not None else None
# Convert to full precision because sigmoid is sensitive.
pred = torch.sigmoid(
cls_score.float()) if cls_score is not None else None
else:
pred = cls_score

Expand Down

0 comments on commit a7acbaa

Please sign in to comment.