Binary Segmentation with Mask Cross Entropy #2955
Unanswered
qritive-saran
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was trying to use mask_cross_entropy function for a binary segmentation problem.
But I was getting errors related to the tensor datatype. The output tensor was float32 , but the target tensor was integer.
From the implementation, we see that the binary_cross_entropy function has converted the label to float tensor ,but the mask_cross_entropy function has not.
Can someone throw more light on why there is this difference or is it a bug ?
https://github.com/open-mmlab/mmsegmentation/blob/e64548fda0221ad708f5da29dc907e51a644c345/mmseg/models/losses/cross_entropy_loss.py#L157
`def binary_cross_entropy(pred,
label,
weight=None,
reduction='mean',
avg_factor=None,
class_weight=None,
ignore_index=-100,
avg_non_ignore=False,
**kwargs):
"""Calculate the binary CrossEntropy loss.
`def mask_cross_entropy(pred,
target,
label,
reduction='mean',
avg_factor=None,
class_weight=None,
ignore_index=None,
**kwargs):
"""Calculate the CrossEntropy loss for masks.
Beta Was this translation helpful? Give feedback.
All reactions