Abstract: Contrastive learning has been extensively exploited in self-supervised and supervised learning due to its effectiveness in learning representations that distinguish between similar and dissimilar images. It offers a robust alternative to cross-entropy by yielding more semantically meaningful image embeddings. However, most contrastive losses rely on pairwise measures to assess the similarity between elements, ignoring more general neighborhood information that can be leveraged to enhance model robustness and generalization. In this paper, we propose the Contextual Contrastive Loss (CCL) to replace pairwise image comparison by introducing a new contextual similarity measure using neighboring elements. The CCL yields a more semantically meaningful image embedding ensuring better separability of classes in the latent space. Experimental evaluation on three datasets (Food101, MiniImageNet, and CIFAR-100) has shown that CCL yields superior results by achieving up to 10.76% relative gains in classification accuracy, particularly for fewer training epochs and limited training data. This demonstrates the potential of our approach, especially in resource-constrained scenarios.
You can access the supplementary material PDF, which includes comprehensive results and detailed illustrations. The code for our proposed approach is also available for download through GitHub.
If you use this work, please cite it as follows:
@inproceedings{Valem2024CCL, author = {Lucas Pascotti Valem and Daniel Carlos GuimarĂ£es Pedronette and Mohand Said Allili}, title = {Contrastive Loss based on Contextual Similarity for Image Classification}, booktitle = {19th International Symposium on Visual Computing (ISVC)}, year = {2024}, address = {Lake Tahoe, NV, USA}, }