Skip to content

Fix pixel weighting in segmentation cross entropy - #3

Open
sylvesterkaczmarek wants to merge 1 commit into
google-research:mainfrom
sylvesterkaczmarek:fix-cross-entropy-pixel-weighting
Open

Fix pixel weighting in segmentation cross entropy#3
sylvesterkaczmarek wants to merge 1 commit into
google-research:mainfrom
sylvesterkaczmarek:fix-cross-entropy-pixel-weighting

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown

Weighted cross entropy broadcasts [B,H,W] losses against [B,1,H,W] weights, coupling different images and scaling the loss with batch size. Entirely masked images can still receive gradients.

Flatten leading batch dimensions into the loss layout and align pixel weights with the unreduced loss. Cover single images, multiple batch axes, soft targets, zero weights and gradients. Correct the metrics tracker test that expected the doubled loss.

Validation: all 31 loss and metrics tests pass; 13 new regression cases fail on unchanged upstream. Syntax and git diff --check pass.

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.

1 participant