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 the error of BCE loss when batch size is 1. #1629

Merged
merged 1 commit into from
May 31, 2022

Conversation

274869388
Copy link
Contributor

Motivation

The motivation of this PR is to fix the error of binary_cross_entropy when the batch size is 1.

Modification

  • binary_cross_entropy
    Modify the pred.squeeze() to pred.squeeze(1) to avoid the error caused by squeeze dimension 0 when batch size is 1.

BC-breaking (Optional)

No

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.

@CLAassistant
Copy link

CLAassistant commented May 31, 2022

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented May 31, 2022

Codecov Report

Merging #1629 (d0c9a52) into master (ef90522) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1629   +/-   ##
=======================================
  Coverage   90.25%   90.25%           
=======================================
  Files         142      142           
  Lines        8477     8477           
  Branches     1428     1428           
=======================================
  Hits         7651     7651           
  Misses        586      586           
  Partials      240      240           
Flag Coverage Δ
unittests 90.25% <100.00%> (ø)

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%> (ø)

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 ef90522...d0c9a52. Read the comment docs.

@MeowZheng MeowZheng merged commit 63fa985 into open-mmlab:master May 31, 2022
ZhimingNJ pushed a commit to AetrexTechnology/mmsegmentation that referenced this pull request Jun 29, 2022
huajiangjiangLi pushed a commit to pytorchuser/HDB-Seg that referenced this pull request Apr 12, 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.

5 participants