# A Study on Small-Scale Snake Image Classification Based on Improved SimCLR
## 2 Materials and Methods  
### Snake Image Classification  
This dataset originates from the iNaturalist website. We independently collected image data for 17 snake species. The images were acquired under natural conditions and exhibit characteristics of field collection, such as complex backgrounds and varying lighting conditions, resulting in a certain degree of noise and distribution that reflects real-world scenarios. During the data collection process, we manually filtered the images to remove those that were blurry or heavily occluded, ensuring clarity and completeness to enhance overall image quality. Despite these efforts, the dataset presents challenges, notably background interference, limited sample size, and subtle interspecies differences. First, background interference is a significant issue. Snake images are typically taken in natural environments with diverse and complex backgrounds, such as grass, rocks, soil, and other terrain, which often share similar colors and textures with the snake's body. This resemblance can blur the distinction between the foreground and background, complicating visual recognition and making conventional CNN models more susceptible to background noise, thereby reducing classification performance. Second, the limited dataset size constitutes a significant constraint. Although the number of images per species ranges from 30 to 120, this quantity is generally insufficient for training deep learning models, particularly convolutional neural networks, and may easily lead to overfitting. The scarcity of training data makes it difficult for models to learn representative and robust features, negatively affecting classification accuracy. This issue becomes even more pronounced when dealing with many visually similar species, as the limited data exacerbate the complexity of the task. Finally, the presence of minor interspecies variations poses a critical challenge. Many snake species exhibit only subtle differences in appearance, and distinguishing features such as color and texture are often not distinguishable, especially among species belonging to the same genus or family. This high degree of visual similarity increases the difficulty of classification. Traditional deep learning methods may struggle to capture these nuanced differences effectively, thereby hindering improvements in classification accuracy. The composition of the snake image dataset used in this study is summarized in Table 1. The dataset was divided into training and testing sets in a 4:1 ratio, and hierarchical partitioning was used to maintain consistency in the distribution of each category in different subsets. This experiment applied multiple strategies to alleviate the problem of overfitting under small-sample conditions. During the model training phase, a pre-trained Swin Transformer model was employed as the encoder network, with its parameters kept trainable to extract discriminative features suited to snake images through contrastive learning. At this stage, extensive data augmentation was applied, combined with the AdamW optimizer, weight decay, and gradient clipping, enhancing the model's robustness and helping prevent overfitting. In the linear evaluation phase, to mitigate overfitting on limited data, the parameters of the Swin Transformer were frozen, and only a linear classification head was trained, thereby improving the model's generalization ability.