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 bug when loading class name form file in custom dataset #923

Merged
merged 5 commits into from
Oct 7, 2021

Conversation

ShoupingShan
Copy link
Contributor

expection occurs when classes variable is a string file path

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

fix a bug in custom.py, Exception occurs when classes is a string type file path .

Modification

modify classes to class_names in https://github.com/ShoupingShan/mmsegmentation/blob/396070e8d2ab96d21a798907f0139fc99ba66e5c/mmseg/datasets/custom.py#L322 and https://github.com/ShoupingShan/mmsegmentation/blob/396070e8d2ab96d21a798907f0139fc99ba66e5c/mmseg/datasets/custom.py#L333

add unit test in test.dataset.py https://github.com/ShoupingShan/mmsegmentation/blob/396070e8d2ab96d21a798907f0139fc99ba66e5c/tests/test_data/test_dataset.py#L29

BC-breaking (Optional)

Does the modification introduce changes that break the backward-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

No

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  3. If the modification has potential influence on downstream projects, this PR should be tested with downstream projects, like MMDet or MMDet3D.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

@Junjun2016 Junjun2016 changed the title [Fix] #916 expection string type classes [Fix] loading class name form file in custom dataset Sep 29, 2021
@Junjun2016
Copy link
Collaborator

Hi @ShoupingShan
Please fix the CI error.

@Junjun2016 Junjun2016 changed the title [Fix] loading class name form file in custom dataset [Fix] Fix bug when loading class name form file in custom dataset Sep 29, 2021
@codecov
Copy link

codecov bot commented Sep 29, 2021

Codecov Report

Merging #923 (d26c078) into master (85227b4) will increase coverage by 0.22%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #923      +/-   ##
==========================================
+ Coverage   89.67%   89.90%   +0.22%     
==========================================
  Files         114      117       +3     
  Lines        6431     6555     +124     
  Branches     1007     1019      +12     
==========================================
+ Hits         5767     5893     +126     
+ Misses        462      461       -1     
+ Partials      202      201       -1     
Flag Coverage Δ
unittests 89.90% <100.00%> (+0.22%) ⬆️

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

Impacted Files Coverage Δ
mmseg/datasets/custom.py 94.59% <100.00%> (+2.16%) ⬆️
mmseg/models/backbones/swin.py 83.73% <0.00%> (-0.30%) ⬇️
mmseg/models/necks/__init__.py 100.00% <0.00%> (ø)
mmseg/models/backbones/__init__.py 100.00% <0.00%> (ø)
mmseg/models/necks/jpu.py 100.00% <0.00%> (ø)
mmseg/models/backbones/icnet.py 97.50% <0.00%> (ø)
mmseg/models/necks/ic_neck.py 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 85227b4...d26c078. Read the comment docs.

Copy link
Collaborator

@Junjun2016 Junjun2016 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Thanks for your contribution again.
Looking forward to your new PR.

Comment on lines 30 to 31
import os
import tempfile
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may move the import to the top of the file.

@xvjiarui
Copy link
Collaborator

LGTM except for one comment.
Thanks for your contribution.

@Junjun2016
Copy link
Collaborator

Hi @ShoupingShan
Could you please resolve the comment?

@Junjun2016
Copy link
Collaborator

Hi @ShoupingShan
Could you please fix the lint error?

fix isort lint error when move the import to the top of the file
@ShoupingShan
Copy link
Contributor Author

Sorry about that, I have fixed the isort lint error.

@Junjun2016
Copy link
Collaborator

Hi @ShoupingShan
Thanks for your contribution again.
Looking forward to your new PR.

@Junjun2016 Junjun2016 merged commit 796d5ed into open-mmlab:master Oct 7, 2021
bowenroom pushed a commit to bowenroom/mmsegmentation that referenced this pull request Feb 25, 2022
…en-mmlab#923)

* [Fix] open-mmlab#916 expection string type classes

* add unittests for string path classes

* fix double quote string in test_dataset.py

* move the import to the top of the file

* fix isort lint error

fix isort lint error when move the import to the top of the file
aravind-h-v pushed a commit to aravind-h-v/mmsegmentation that referenced this pull request Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants