Long-tail distribution and open-set recognition remain significant challenges in sonar image classification. This study introduces Dynamic Margin Contrastive Learning (DMCL), a novel framework that simultaneously addresses both issues through adaptive margin adjustment and uncertainty-aware feature learning. DMCL incorporates three key components: a class-frequency-based dynamic margin mechanism, a contrastive learning strategy for robust feature representation, and an uncertainty estimation module for unknown class detection. Experimental results on the NKSID sonar image dataset demonstrate DMCL's superior performance compared to existing methods like PLUD, achieving improvements of 5.79% in Macro-F1 (89.47% vs. 83.68%), 3.38% in Normalized Accuracy (81.90% vs. 78.52%), 3.53% in OSCRmac (91.01% vs. 87.48%), and 5.87% in OSFM (93.21% vs. 87.34%). These results validate DMCL's effectiveness in handling both long-tail distribution and open-set recognition challenges in sonar image classification, offering potential applications in similar domains requiring robust classification under data imbalance and unknown class scenarios. The code is publicly available at https://github.com/gmgslinyu/Sonar-OLTR.
Keywords: Contrastive learning; Dynamic margin; Long-tailed distribution; Open-set recognition; Sonar image classification; Uncertainty estimation.
© 2025. The Author(s).