Repository navigation
Add binary focal cross entropy loss function - #498
Closed
ZJUGuoShuai wants to merge 1 commit into
Closed
ZJUGuoShuai wants to merge 1 commit into
ZJUGuoShuai wants to merge 1 commit into
Conversation
Stealeristaken
approved these changes
Jan 19, 2024
Member
|
Thanks for the contribution! We decided against adding this to MLX core in #336 and #324 as it's a bit niche. We may revisit in the future. For future reference, it's a good idea to open an issue about possible new features before or in tandem to starting a PR so we can let you know if there is ongoing work / plans already / not for core. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
This PR adds the Binary Focal Cross-entropy Loss, which is introduced by Lin et al., 2018 and often used in object detection tasks.
The interface is nearly the same with TensorFlow's tf.keras.losses.BinaryFocalCrossentropy and the test ground-truth values are calculated by it to ensure correctness.
This implementation supports both logits and probabilities as input (like the normal
binary_cross_entropy). It also supports class balancing in Lin et al., 2018, like TF'sBinaryFocalCrossentropy.Checklist
Put an
xin the boxes that apply.pre-commit run --all-filesto format my code / installed pre-commit prior to committing changes