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] Fix ignore class id from -1 to 255 in BaseSegDataset in 1.x #2332

Merged

Conversation

MengzhangLI
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Nov 21, 2022

Codecov Report

Base: 83.65% // Head: 83.66% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (524d4aa) compared to base (c56a299).
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head 524d4aa differs from pull request most recent head cfab5b3. Consider uploading reports for the commit cfab5b3 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           dev-1.x    #2332      +/-   ##
===========================================
+ Coverage    83.65%   83.66%   +0.01%     
===========================================
  Files          141      141              
  Lines         7973     7973              
  Branches      1193     1193              
===========================================
+ Hits          6670     6671       +1     
+ Misses        1115     1113       -2     
- Partials       188      189       +1     
Flag Coverage Δ
unittests 83.66% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmseg/datasets/basesegdataset.py 98.97% <100.00%> (-1.03%) ⬇️
mmseg/models/backbones/timm_backbone.py 45.83% <0.00%> (+8.33%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@MeowZheng MeowZheng added the 1.x Related issue of 1.x version label Nov 22, 2022
@MeowZheng MeowZheng merged commit 6d7af07 into open-mmlab:dev-1.x Nov 22, 2022
@MengzhangLI MengzhangLI deleted the fix_basesegdataset_ignoreid branch November 22, 2022 15:19
MeowZheng pushed a commit that referenced this pull request Jan 28, 2023
## Motivation

This fixes #2493. When the `label_map` is created, the index for ignored
classes was being set to -1, whereas the index that is actually ignored
is 255. This worked indirectly since -1 was underflowed to 255 when
converting to uint8.

The same fix was made in the 1.x by #2332 but this fix was never made to
`master`.

## Modification

The only small modification is setting the index of ignored classes to
255 instead of -1.

## Checklist

- [x] Pre-commit or other linting tools are used to fix the potential
lint issues.
  - _I've fixed all linting/pre-commit errors._
- [x] The modification is covered by complete unit tests. If not, please
add more unit test to ensure the correctness.
- _No unit tests need to be added. Unit tests that are affected were
modified.
- [x] If the modification has potential influence on downstream
projects, this PR should be tested with downstream projects, like MMDet
or MMDet3D.
  - _I don't think this change affects MMDet or MMDet3D._
- [x] The documentation has been modified accordingly, like docstring or
example tutorials.
- _This change fixes an existing bug and doesn't require modifying any
documentation/docstring._
MeowZheng pushed a commit that referenced this pull request Jan 30, 2023
## Motivation

This is motivated by a previously unfinished PR (#2332). In that PR, the
label -1 was changed to 255 in `BaseSegDataset`, which is correct.
However, it was changed at only one location. There is another location
in `mmseg/datasets/basesegdataset.py` where -1 was still being used that
was not converted to 255. I have now converted it to 255.

This is exactly same as a similar fix to the `master` branch via #2515 .

## Modification

I've simply converted the snipped

```python
if new_id != -1:
    new_palette.append(palette[old_id])
```
to 
```python
if new_id != 255:
    new_palette.append(palette[old_id])
```

## Checklist

- [x] Pre-commit or other linting tools are used to fix the potential
lint issues.
  - _I've fixed all linting/pre-commit errors._
- [x] The modification is covered by complete unit tests. If not, please
add more unit test to ensure the correctness.
  - _No unit tests need to be added or were affected.
- [x] If the modification has potential influence on downstream
projects, this PR should be tested with downstream projects, like MMDet
or MMDet3D.
  - _I don't think this change affects MMDet or MMDet3D._
- [x] The documentation has been modified accordingly, like docstring or
example tutorials.
- _This change fixes an existing bug and doesn't require modifying any
documentation/docstring._
nahidnazifi87 pushed a commit to nahidnazifi87/mmsegmentation_playground that referenced this pull request Apr 5, 2024
…t_ignoreid

[Fix] Fix ignore class id from -1 to 255 in BaseSegDataset in 1.x
nahidnazifi87 pushed a commit to nahidnazifi87/mmsegmentation_playground that referenced this pull request Apr 5, 2024
…ab#2516)

## Motivation

This is motivated by a previously unfinished PR (open-mmlab#2332). In that PR, the
label -1 was changed to 255 in `BaseSegDataset`, which is correct.
However, it was changed at only one location. There is another location
in `mmseg/datasets/basesegdataset.py` where -1 was still being used that
was not converted to 255. I have now converted it to 255.

This is exactly same as a similar fix to the `master` branch via open-mmlab#2515 .

## Modification

I've simply converted the snipped

```python
if new_id != -1:
    new_palette.append(palette[old_id])
```
to 
```python
if new_id != 255:
    new_palette.append(palette[old_id])
```

## Checklist

- [x] Pre-commit or other linting tools are used to fix the potential
lint issues.
  - _I've fixed all linting/pre-commit errors._
- [x] The modification is covered by complete unit tests. If not, please
add more unit test to ensure the correctness.
  - _No unit tests need to be added or were affected.
- [x] If the modification has potential influence on downstream
projects, this PR should be tested with downstream projects, like MMDet
or MMDet3D.
  - _I don't think this change affects MMDet or MMDet3D._
- [x] The documentation has been modified accordingly, like docstring or
example tutorials.
- _This change fixes an existing bug and doesn't require modifying any
documentation/docstring._
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x Related issue of 1.x version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants