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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binary focal loss: Use pre-computed probs and increase readability #1848

Merged
merged 2 commits into from
Sep 6, 2022

Conversation

klieret
Copy link
Contributor

@klieret klieret commented Aug 30, 2022

Changes

  • Use pre-computed probs_pos and probs_neg rather than calling sigmoid function again (performance boost by skipping two calls to torch.sigmoid)
  • Standardize use of tensor method vs torch function to increase readability (make symmetry in code more apparent)

Type of change

Performance / code readability

  • 馃摎 Documentation Update
  • 馃И Tests Cases
  • 馃悶 Bug fix (non-breaking change which fixes an issue)
  • 馃敩 New feature (non-breaking change which adds functionality)
  • 馃毃 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 馃摑 This change requires a documentation update

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Did you update CHANGELOG in case of a major change?

Use pre-computed probs_pos and probs_neg rather than calling sigmoid function again,
Standardize use of tensor method vs torch function to increase readability
@klieret klieret changed the title Use pre-computed probs and increase readability Binary focal loss: Use pre-computed probs and increase readability Aug 30, 2022
kornia/losses/focal.py Outdated Show resolved Hide resolved
@edgarriba edgarriba added enhancement 馃殌 Improvement over an existing functionality module: losses labels Sep 6, 2022
@edgarriba edgarriba merged commit 0e9d795 into kornia:master Sep 6, 2022
@klieret klieret deleted the patch-1 branch September 6, 2022 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 馃殌 Improvement over an existing functionality module: losses
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants