addons icon indicating copy to clipboard operation
addons copied to clipboard

Adding Sigmoid Asymmetric Loss to TFA losses

Open dongyups opened this issue 3 years ago • 2 comments

Describe the feature and the current behavior/state.

The paper's abstract:

In a typical multi-label setting, a picture contains on average few positive labels, and many negative ones. This positive-negative imbalance dominates the optimization process, and can lead to under-emphasizing gradients from positive labels during training, resulting in poor accuracy. In this paper, we introduce a novel asymmetric loss (”ASL”), which operates differently on positive and negative samples. The loss enables to dynamically down-weights and hard-thresholds easy negative samples, while also discarding possibly mislabeled samples. We demonstrate how ASL can balance the probabilities of different samples, and how this balancing is translated to better mAP scores. With ASL, we reach state-of-the-art results on multiple popular multi-label datasets: MS-COCO, Pascal-VOC, NUS-WIDE and Open Images. We also demonstrate ASL applicability for other tasks, such as single-label classification and object detection. ASL is effective, easy to implement, and does not increase the training time or complexity. Implementation is available at: https://github.com/Alibaba-MIIL/ASL.

Relevant information

Are you willing to contribute it (yes/no): yes

Are you willing to maintain it going forward? (yes/no): yes

Is there a relevant academic paper? (if so, where): yes, https://arxiv.org/pdf/2009.14119.pdf

Is there already an implementation in another framework? (if so, where): yes

In Pytorch (original): https://github.com/Alibaba-MIIL/ASL/tree/main/src/loss_functions

Implementation in tf.keras.loss: https://github.com/dongyups/asymmetric-loss-tf2-keras/blob/main/test.ipynb

Was it part of tf.contrib? (if so, where): No

Which API type would this fall under (layer, metric, optimizer, etc.) Loss

Who will benefit with this feature? People who want to try out loss for their multi-label classification tasks.

dongyups avatar Aug 19 '22 06:08 dongyups

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Aug 19 '22 06:08 google-cla[bot]

As it was mainly applied to vision tasks can you open a ticket in https://github.com/keras-team/keras-cv to check if they are interested?

bhack avatar Aug 26 '22 13:08 bhack

Thank you for your contribution. We sincerely apologize for any delay in reviewing, but TensorFlow Addons is transitioning to a minimal maintenance and release mode. New features will not be added to this repository. For more information, please see our public messaging on this decision: TensorFlow Addons Wind Down

Please consider sending feature requests / contributions to other repositories in the TF community with a similar charters to TFA: Keras Keras-CV Keras-NLP

seanpmorgan avatar Mar 01 '23 04:03 seanpmorgan