An Asymmetric Contrastive Loss for Handling Imbalanced Datasets

Valentino Vito, Lim Yohanes Stefanus
7/14/2022
cs.LGcs.CVcs.IT

No official code found. Best implementation: valentinovito/Asymmetric-CL (7 stars, last commit 2023-06-13).

Abstract

Contrastive learning is a representation learning method performed by contrasting a sample to other similar samples so that they are brought closely together, forming clusters in the feature space. The learning process is typically conducted using a two-stage training architecture, and it utilizes the contrastive loss (CL) for its feature learning. Contrastive learning has been shown to be quite successful in handling imbalanced datasets, in which some classes are overrepresented while some others are underrepresented. However, previous studies have not specifically modified CL for imbalanced datasets. In this work, we introduce an asymmetric version of CL, referred to as ACL, in order to directly address the problem of class imbalance. In addition, we propose the asymmetric focal contrastive loss (AFCL) as a further generalization of both ACL and focal contrastive loss (FCL). Results on the FMNIST and ISIC 2018 imbalanced datasets show that AFCL is capable of outperforming CL and FCL in terms of both weighted and unweighted classification accuracies. In the appendix, we provide a full axiomatic treatment on entropy, along with complete proofs.

View on arXivView PDF

Code Implementations(1)

A PyTorch implementation of an asymmetric version of the (focal) contrastive loss

72PythonJul 6, 20223 years ago

Cite this paper

@article{vito2022asymmetric,
  title  = {An Asymmetric Contrastive Loss for Handling Imbalanced Datasets},
  author = {Valentino Vito and Lim Yohanes Stefanus},
  year   = {2022},
  eprint = {2207.07080},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2207.07080v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2207.07080.svg)](https://codeofpaper.com/paper/2207.07080)

Discussion