-
Notifications
You must be signed in to change notification settings - Fork 19.5k
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
Add CategoricalFocalCrossentropy to Losses API #17651
Add CategoricalFocalCrossentropy to Losses API #17651
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I had a quick review of the docstring styles. Will look into the logics later.
@haifeng-jin Thanks for the feedback! I ran the format.sh but I guess it does not indentation into account. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update!
I have provided some more comments on the docstrings format.
The rest of the code LGTM.
Prefer to have @qlzh727 approval before merging.
@qlzh727 Re-requesting a review removed Francois, can you add him again? Also fixed the docstrings in terms of clarity. Can you check once more? Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thank you.
@Frightera Here is what would happen next. After @qlzh727 approval, I will start to help you migrate it. It would take some work to adapt to our internal system for anything that changes the APIs. One more thing we need your help is to update the (tensorflow/tensorflow RELEASE.md)[https://github.com/tensorflow/tensorflow/blob/master/RELEASE.md] to include your changes in the release notes. You may start this after this PR is completely merged. Thanks! |
Imported from GitHub PR #17651 Implements the `CategoricalFocalCrossentropy()` loss based on the paper [Focal Loss for Dense Object Detection](https://arxiv.org/pdf/1708.02002.pdf) (Lin et al., 2018). Feature request was made in #17583. Copybara import of the project: -- 5696b5a by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Add pure logic of CFCE -- 40e547f by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Add support for ragged tensors -- d3dd32f by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Make sure output sum equals 1 -- 16adf85 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Raise shape mismatch / update tests -- bc38e33 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Add categorical_focal_loss tests -- 363baaf by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Add documentation / minor fix. -- c267fa0 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Reformatting after focal loss implementation -- 3c33117 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Fix linting. -- 3538622 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Fix docstring style. -- 6b4fa6b by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Update the docstrings. -- 49c03a2 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Fix linting issues -- f560336 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Address comments from code-review. Merging this change closes #17651 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17651 from Frightera:frightera_categorical_focal_loss_v2 f560336 PiperOrigin-RevId: 518880861
Imported from GitHub PR #17651 Implements the `CategoricalFocalCrossentropy()` loss based on the paper [Focal Loss for Dense Object Detection](https://arxiv.org/pdf/1708.02002.pdf) (Lin et al., 2018). Feature request was made in #17583. Copybara import of the project: -- 5696b5a by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Add pure logic of CFCE -- 40e547f by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Add support for ragged tensors -- d3dd32f by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Make sure output sum equals 1 -- 16adf85 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Raise shape mismatch / update tests -- bc38e33 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Add categorical_focal_loss tests -- 363baaf by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Add documentation / minor fix. -- c267fa0 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Reformatting after focal loss implementation -- 3c33117 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Fix linting. -- 3538622 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Fix docstring style. -- 6b4fa6b by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Update the docstrings. -- 49c03a2 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Fix linting issues -- f560336 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Address comments from code-review. Merging this change closes #17651 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17651 from Frightera:frightera_categorical_focal_loss_v2 f560336 PiperOrigin-RevId: 519824695
Imported from GitHub PR #17651 Implements the `CategoricalFocalCrossentropy()` loss based on the paper [Focal Loss for Dense Object Detection](https://arxiv.org/pdf/1708.02002.pdf) (Lin et al., 2018). Feature request was made in #17583. Copybara import of the project: -- 5696b5a by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Add pure logic of CFCE -- 40e547f by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Add support for ragged tensors -- d3dd32f by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Make sure output sum equals 1 -- 16adf85 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Raise shape mismatch / update tests -- bc38e33 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Add categorical_focal_loss tests -- 363baaf by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Add documentation / minor fix. -- c267fa0 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Reformatting after focal loss implementation -- 3c33117 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Fix linting. -- 3538622 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Fix docstring style. -- 6b4fa6b by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Update the docstrings. -- 49c03a2 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Fix linting issues -- f560336 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Address comments from code-review. Merging this change closes #17651 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17651 from Frightera:frightera_categorical_focal_loss_v2 f560336 PiperOrigin-RevId: 519824695
@Frightera I have added the release notes altogether. |
@haifeng-jin Thanks, appreciate it 👍🏼 |
Imported from GitHub PR keras-team/keras#17651 Implements the `CategoricalFocalCrossentropy()` loss based on the paper [Focal Loss for Dense Object Detection](https://arxiv.org/pdf/1708.02002.pdf) (Lin et al., 2018). Feature request was made in #17583. Copybara import of the project: -- 5696b5ab7dd401ca15b7e6ffba17ef05b1bb012a by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Add pure logic of CFCE -- 40e547feaf8a505e559fac6818780c985963f8cc by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Add support for ragged tensors -- d3dd32f0a6fe7f5d90cf579677c905ebb2597328 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Make sure output sum equals 1 -- 16adf8571a5f6415e3adb54415bf09d351fdf3af by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Raise shape mismatch / update tests -- bc38e33153715846c5faaacb02f4e354a22b0561 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Add categorical_focal_loss tests -- 363baaf4c8c508de5a333b1e75a8cf6bbb9b6183 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Add documentation / minor fix. -- c267fa0a118dc748707e50c36d33838a9f55776d by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Reformatting after focal loss implementation -- 3c33117f62a7580b4a17f394c797edf2f80b6972 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Fix linting. -- 3538622ace799cf1d9a5dd279af90098965665c3 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Fix docstring style. -- 6b4fa6b0dbba7351aa98fa2b39b74e82b85f5b54 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Update the docstrings. -- 49c03a2e1214cd7057dd5381c9602eebeaa4ff18 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Fix linting issues -- f56033645287df77f6fd0c0741bb16b74090f0eb by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Address comments from code-review. Merging this change closes #17651 PiperOrigin-RevId: 520482950
Imported from GitHub PR #17746 Small changes in backend.py, some of were discussed in the PR #17651 Copybara import of the project: -- 0f89165 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Small fixes on focal losses and cat.crossentropy -- 3c193de by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Fix linting and sigmoid func -- b87b656 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Revert the redirection of the internal function Merging this change closes #17746 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17746 from Frightera:frightera_small_loss_fixes b87b656 PiperOrigin-RevId: 522179031
Imported from GitHub PR #17746 Small changes in backend.py, some of were discussed in the PR #17651 Copybara import of the project: -- 0f89165 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Small fixes on focal losses and cat.crossentropy -- 3c193de by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Fix linting and sigmoid func -- b87b656 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Revert the redirection of the internal function Merging this change closes #17746 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17746 from Frightera:frightera_small_loss_fixes b87b656 PiperOrigin-RevId: 522179031
Imported from GitHub PR #17746 Small changes in backend.py, some of were discussed in the PR #17651 Copybara import of the project: -- 0f89165 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Small fixes on focal losses and cat.crossentropy -- 3c193de by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Fix linting and sigmoid func -- b87b656 by Kaan Bıçakcı <kaan.dvlpr@gmail.com>: Revert the redirection of the internal function Merging this change closes #17746 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17746 from Frightera:frightera_small_loss_fixes b87b656 PiperOrigin-RevId: 522179031
Implements the
CategoricalFocalCrossentropy()
loss based on the paper Focal Loss for Dense Object Detection (Lin et al., 2018).Feature request was made in keras-team/tf-keras#259.