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] Support single channel pred for Binary Cross Entropy Loss #1454

Merged
merged 8 commits into from
Apr 14, 2022

Conversation

RockeyCoss
Copy link
Contributor

@RockeyCoss RockeyCoss commented Apr 6, 2022

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 the bug that binary cross entropy loss doesn't support single channel input.
Related Issue: #1430

Modification

  1. When the channel of pred is one, instead of expanding the lebel to one-hot format, binary_cross_entropy_loss only unsqueeze the label to match the shape of the pred.
  2. Add a new test function to cover the new codes.

@codecov
Copy link

codecov bot commented Apr 6, 2022

Codecov Report

Merging #1454 (29475db) into master (3432ea9) will decrease coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1454      +/-   ##
==========================================
- Coverage   90.31%   90.28%   -0.04%     
==========================================
  Files         139      139              
  Lines        8303     8313      +10     
  Branches     1395     1398       +3     
==========================================
+ Hits         7499     7505       +6     
- Misses        567      570       +3     
- Partials      237      238       +1     
Flag Coverage Δ
unittests 90.28% <100.00%> (-0.04%) ⬇️

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

Impacted Files Coverage Δ
mmseg/models/losses/cross_entropy_loss.py 86.90% <100.00%> (+4.18%) ⬆️
mmseg/models/segmentors/cascade_encoder_decoder.py 94.59% <0.00%> (-5.41%) ⬇️
mmseg/core/evaluation/metrics.py 93.61% <0.00%> (-1.07%) ⬇️
mmseg/apis/train.py 19.51% <0.00%> (-1.01%) ⬇️
mmseg/datasets/custom.py 94.73% <0.00%> (ø)
mmseg/datasets/pipelines/loading.py 98.55% <0.00%> (+0.02%) ⬆️

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 4bd32f4...29475db. Read the comment docs.

Copy link
Collaborator

@MeowZheng MeowZheng left a comment

Choose a reason for hiding this comment

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

Please refine pr tittle and pr msg first ref #1438

@RockeyCoss RockeyCoss changed the title [Fix] Fix the bug that binary cross entropy loss doesn't support sing… [Fix] Support single cahnnel pred for Binary Cross Entropy Loss Apr 7, 2022
@MeowZheng MeowZheng merged commit cd18b6d into open-mmlab:master Apr 14, 2022
@MeowZheng MeowZheng changed the title [Fix] Support single cahnnel pred for Binary Cross Entropy Loss [Fix] Support single channel pred for Binary Cross Entropy Loss Apr 29, 2022
ZhimingNJ pushed a commit to AetrexTechnology/mmsegmentation that referenced this pull request Jun 29, 2022
…en-mmlab#1454)

* [Fix] Fix the bug that binary cross entropy loss doesn't support single channel input

* imcrease coverage

* modify implementation

* increase coverage

* add assert

* modify implementation

* enshollow condition judge

* fix
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.

4 participants