## 1 Introduction  
Class imbalance poses a substantial obstacle in machine learning and deep learning, markedly influencing the performance of classifiers. Deep learning methodologies have significantly advanced fields like image processing, natural language processing, and computer vision by proficiently categorizing image datasets, especially those containing natural scenes. These techniques reveal the strength of deep neural networks. However, real-world datasets often show an imbalance where some classes have many samples and others very few [1]. This class imbalance is a significant challenge for image classification, as it tends to bias the model towards the majority classes and affects its ability to generalize. Despite the advanced capabilities of deep learning, its effectiveness is compromised by imbalanced data distributions, thus hampering the full utilization of its potential [2, 3]. Traditional approaches to address this imbalance include modifying the loss function to prioritize minority classes and resampling the training data [4]. While useful, these approaches can cause problems. Adjusting the loss function (either during feature learning or classifier training) can distort the data distribution, which can negatively affect training [5], especially in long-tail recognition scenarios wherein enhancing less frequent classes can hurt performance for more frequent classes. In addition, loss function tuning is a key aspect of classifier tuning. But focusing solely on these adjustments to optimize the classifier while ignoring the quality of the feature representation can result in a model that performs well on the training data but poorly on unseen data due to a finely tuned loss adjustment. The popularity of oversampling methods like SMOTE highlights efforts to mitigate these issues. However, conventional techniques struggle to capture complex features in high-dimensional data, such as images, necessitating innovative resampling strategies. SMOTE's reliance on Euclidean distances in high-dimensional spaces often seen in image and audio data has been critiqued [6], leading to the development of more sophisticated methods such as DeepSMOTE [7] and EOS [8]. DeepSMOTE applies SMOTE within deep networks using an autoencoder mechanism, while EOS generates samples near adversarial instances, both operating within the latent feature space. Although these methods introduce innovative oversampling techniques to enhance data generation in the embedding space, their effectiveness is often not thoroughly tested across diverse and large-scale datasets. Contrastive learning has effectively been utilized to acquire powerful visual representations through unsupervised learning [9; 10]. Several recent studies [11; 12] have discovered that contrastive learning achieves a more equitable distribution of features in comparison to its supervised equivalent. Contrastive learning, which excels in extracting useful features from both labeled and unlabeled data, trains models to distinguish between an image and its variants, thus improving performance in imbalanced datasets [13; 14; 15]. Building on these advancements, we propose an innovative sampling technique that optimizes the oversampling process within the latent feature space. We suggest employing a contrastive learning model to develop feature representations that are not biased towards any particular class. Contrastive learning focuses on learning similarities and differences among data points, which can help ensure that the model's features do not favor any particular class, thereby promoting fair and balanced model performance across diverse datasets. This method involves contrasting pairs of images to learn to discriminate features more universally characteristic of each class, regardless of class imbalance. Our approach involves initially pre-training the image encoder with contrastive learning. We then use this encoder to extract features from the training dataset and perform oversampling within this feature space to better balance minority and majority classes.