All Projects → Alibaba-MIIL → Asl

Alibaba-MIIL / Asl

Licence: mit
Official Pytorch Implementation of: "Asymmetric Loss For Multi-Label Classification"(2020) paper

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Asl

All About The Gan
All About the GANs(Generative Adversarial Networks) - Summarized lists for GAN
Stars: ✭ 630 (+223.08%)
Mutual labels:  classification, detection
Caffe Model
Caffe models (including classification, detection and segmentation) and deploy files for famouse networks
Stars: ✭ 1,258 (+545.13%)
Mutual labels:  classification, detection
Pytorchinsight
a pytorch lib with state-of-the-art architectures, pretrained models and real-time updated results
Stars: ✭ 713 (+265.64%)
Mutual labels:  classification, detection
3d Pointcloud
Papers and Datasets about Point Cloud.
Stars: ✭ 179 (-8.21%)
Mutual labels:  classification, detection
Simpsonrecognition
Detect and recognize The Simpsons characters using Keras and Faster R-CNN
Stars: ✭ 131 (-32.82%)
Mutual labels:  classification, detection
Gfocal
Generalized Focal Loss: Learning Qualified and Distributed Bounding Boxes for Dense Object Detection, NeurIPS2020
Stars: ✭ 376 (+92.82%)
Mutual labels:  classification, detection
Dlcv for beginners
《深度学习与计算机视觉》配套代码
Stars: ✭ 1,244 (+537.95%)
Mutual labels:  classification, detection
covid-mask-detector
Detect whether a person is wearing a mask or not
Stars: ✭ 102 (-47.69%)
Mutual labels:  detection, classification
Pytorch Imagenet Cifar Coco Voc Training
Training examples and results for ImageNet(ILSVRC2012)/CIFAR100/COCO2017/VOC2007+VOC2012 datasets.Image Classification/Object Detection.Include ResNet/EfficientNet/VovNet/DarkNet/RegNet/RetinaNet/FCOS/CenterNet/YOLOv3.
Stars: ✭ 130 (-33.33%)
Mutual labels:  classification, detection
Model Quantization
Collections of model quantization algorithms
Stars: ✭ 118 (-39.49%)
Mutual labels:  classification, detection
Paddle2onnx
PaddlePaddle to ONNX model converter
Stars: ✭ 185 (-5.13%)
Mutual labels:  classification, detection
Paddlex
PaddlePaddle End-to-End Development Toolkit(『飞桨』深度学习全流程开发工具)
Stars: ✭ 3,399 (+1643.08%)
Mutual labels:  classification, detection
Franc
Natural language detection
Stars: ✭ 3,605 (+1748.72%)
Mutual labels:  classification, detection
Tensorflow object tracking video
Object Tracking in Tensorflow ( Localization Detection Classification ) developed to partecipate to ImageNET VID competition
Stars: ✭ 491 (+151.79%)
Mutual labels:  classification, detection
Cvpods
All-in-one Toolbox for Computer Vision Research.
Stars: ✭ 277 (+42.05%)
Mutual labels:  classification, detection
Kaggle Rsna
Deep Learning for Automatic Pneumonia Detection, RSNA challenge
Stars: ✭ 74 (-62.05%)
Mutual labels:  classification, detection
volkscv
A Python toolbox for computer vision research and project
Stars: ✭ 58 (-70.26%)
Mutual labels:  detection, classification
mri-deep-learning-tools
Resurces for MRI images processing and deep learning in 3D
Stars: ✭ 56 (-71.28%)
Mutual labels:  detection, classification
Tabi
BGP Hijack Detection
Stars: ✭ 90 (-53.85%)
Mutual labels:  classification, detection
Luna16 Lung Nodule Analysis 2016 Challenge
LUNA16-Lung-Nodule-Analysis-2016-Challenge
Stars: ✭ 133 (-31.79%)
Mutual labels:  classification, detection

Asymmetric Loss For Multi-Label Classification

PWC
PWC
PWC

Paper | Pretrained models

Official PyTorch Implementation

Emanuel Ben-Baruch, Tal Ridnik, Nadav Zamir, Asaf Noy, Itamar Friedman, Matan Protter, Lihi Zelnik-Manor
DAMO Academy, Alibaba Group

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.

Training Code Now Available !

With great collaboration by @GhostWnd, we now provide a script for fully reproducing the article results, and finally a modern multi-label training code is available for the community.

Frequently Asked Questions

Some questions are repeatedly asked in the issues section. make sure to review them before starting a new issue:

  • Regarding combining ASL with other techniques, see link
  • Regarding implementation of asymmetric clipping, see link
  • Regarding disable_torch_grad_focal_loss option, see link
  • Regarding squish Vs crop resizing, see link
  • Regarding training tricks, see link
  • How to apply ASL to your own dataset, see link

Asymmetric Loss (ASL) Implementation

In this PyTorch file, we provide implementations of our new loss function, ASL, that can serve as a drop-in replacement for standard loss functions (Cross-Entropy and Focal-Loss)

For the multi-label case (sigmoids), the two implementations are:

  • class AsymmetricLoss(nn.Module)
  • class AsymmetricLossOptimized(nn.Module)

The two losses are bit-accurate. However, AsymmetricLossOptimized() contains a more optimized (and complicated) way of implementing ASL, which minimizes memory allocations, gpu uploading, and favors inplace operations.

For the single-label case (softmax), the implementations is called:

  • class ASLSingleLabel(nn.Module)

Pretrained Models

In this link, we provide pre-trained models on various dataset.

Validation Code

Thanks to external contribution of @hellbell, we now provide a validation code that repdroduces the article results on MS-COCO:

python validate.py  \
--model_name=tresnet_l \
--model_path=./models_local/MS_COCO_TRresNet_L_448_86.6.pth

Inference Code

We provide inference code, that demonstrate how to load our model, pre-process an image and do actuall inference. Example run of MS-COCO model (after downloading the relevant model):

python infer.py  \
--dataset_type=MS-COCO \
--model_name=tresnet_l \
--model_path=./models_local/MS_COCO_TRresNet_L_448_86.6.pth \
--pic_path=./pics/000000000885.jpg \
--input_size=448

which will result in:

Example run of OpenImages model:

python infer.py  \
--dataset_type=OpenImages \
--model_name=tresnet_l \
--model_path=./models_local/Open_ImagesV6_TRresNet_L_448.pth \
--pic_path=./pics/000000000885.jpg \
--input_size=448

Citation

 @misc{benbaruch2020asymmetric, 
        title={Asymmetric Loss For Multi-Label Classification}, 
        author={Emanuel Ben-Baruch and Tal Ridnik and Nadav Zamir and Asaf Noy and Itamar Friedman and Matan Protter and Lihi Zelnik-Manor}, 
        year={2020}, 
        eprint={2009.14119},
        archivePrefix={arXiv}, 
        primaryClass={cs.CV} }

Contact

Feel free to contact if there are any questions or issues - Emanuel Ben-Baruch ([email protected]) or Tal Ridnik ([email protected]).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].