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

[Enhancement] Support ignore_index for sigmoid BCE #210

Merged
merged 3 commits into from
Nov 17, 2020

Conversation

xvjiarui
Copy link
Collaborator

Fixed #162
Fixed #201

@xvjiarui xvjiarui requested a review from hellock October 25, 2020 23:31
@codecov
Copy link

codecov bot commented Oct 25, 2020

Codecov Report

Merging #210 (02ac5e6) into master (3d18775) will increase coverage by 0.02%.
The diff coverage is 73.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #210      +/-   ##
==========================================
+ Coverage   84.26%   84.28%   +0.02%     
==========================================
  Files          90       90              
  Lines        4315     4322       +7     
  Branches      684      685       +1     
==========================================
+ Hits         3636     3643       +7     
- Misses        537      538       +1     
+ Partials      142      141       -1     
Flag Coverage Δ
unittests 84.28% <73.33%> (+0.02%) ⬆️

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

Impacted Files Coverage Δ
mmseg/models/decode_heads/decode_head.py 91.66% <ø> (ø)
mmseg/models/losses/cross_entropy_loss.py 78.12% <73.33%> (+2.68%) ⬆️

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 3d18775...f560849. Read the comment docs.

@JinxiaoWang
Copy link

Hi, I changed files as https://github.com/open-mmlab/mmsegmentation/pull/210/commits/0f316127623a32c65585b3d10e80bb770ea17789 did.
When I set use_sigmoid=True , AssertError : BCE loss does not support ignore_index.
Then I add 'ignore_index = None ' to binary_cross_entropy function.
I meet a new error : IndexError: shape mismatch: indexing tensors could not be broadcast together with shapes [591, 3], [591, 3, 256, 256]
I think a more detailed tutorial for add custom loss contained by pytorch should added to mmsegmentation.
And, mmseg/models/losses should contain more custom losses.

@hellock
Copy link
Member

hellock commented Oct 28, 2020

Task linked: CU-f6t2qg fix BCE loss

@hellock
Copy link
Member

hellock commented Nov 7, 2020

Hi, I changed files as https://github.com/open-mmlab/mmsegmentation/pull/210/commits/0f316127623a32c65585b3d10e80bb770ea17789 did.
When I set use_sigmoid=True , AssertError : BCE loss does not support ignore_index.
Then I add 'ignore_index = None ' to binary_cross_entropy function.
I meet a new error : IndexError: shape mismatch: indexing tensors could not be broadcast together with shapes [591, 3], [591, 3, 256, 256]
I think a more detailed tutorial for add custom loss contained by pytorch should added to mmsegmentation.
And, mmseg/models/losses should contain more custom losses.

@xvjiarui Could you have a look?

@xvjiarui xvjiarui changed the title [Enhancement] Add args check for ignore_index [Enhancement] Support ignore_index for sigmoid BCE Nov 8, 2020
@xvjiarui
Copy link
Collaborator Author

xvjiarui commented Nov 8, 2020

Hi @DreamerWangDr
You may try it again.

@hellock hellock merged commit 61e1d5c into open-mmlab:master Nov 17, 2020
bowenroom pushed a commit to bowenroom/mmsegmentation that referenced this pull request Feb 25, 2022
* [Enhancement] Add args check for ignore_index

* Support ignore_index
aravind-h-v pushed a commit to aravind-h-v/mmsegmentation that referenced this pull request Mar 27, 2023
* Implement `pipeline.to(device)`

* DiffusionPipeline.to() decides best device on None.

* Breaking change: torch_device removed from __call__

`pipeline.to()` now has PyTorch semantics.

* Use kwargs and deprecation notice

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>

* Apply torch_device compatibility to all pipelines.

* style

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
Co-authored-by: anton-l <anton@huggingface.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants