# A Study on Small-Scale Snake Image Classification Based on Improved SimCLR
## 2 Materials and Methods
### Related Network  
#### 2.3.1 SimCLR  
Contrastive learning is a representation learning method widely adopted in deep learning in recent years [26]. This method focuses on learning. Contrastive learning is a representation learning method commonly adopted in deep learning in recent years [26]. This method focuses on learning standard features and distinguishing differences between non-similar instances. The fundamental premise is to map similar instances closer in the learning embedding space while mapping dissimilar instances farther away. This supports migration learning, which applies to small sample data. The process of contrast learning is shown in Figure 2, which demonstrates features between similar instances and distinguishing differences between non-similar instances. The fundamental premise is to map similar instances closer in the learning embedding space while mapping dissimilar instances farther away. This supports migration learning, which applies to small sample data. Figure 1: Demonstration of different data augmentation strategies: (**a**) original, (**b**) random resized crop, (**c**) color jitter, (**d**) RandomGrayscale, (**e**) random erasing. SimCLR (Simulation of Contrast-Based Learning) is an unsupervised contrast learning framework proposed by Google [27]. It achieves efficient feature learning through data augmentation, projection headers, and contrast loss. Its core goal is to optimize the representation of images in feature space through contrast learning so that similar samples are closer together and different samples are more distinguishable from each other. As illustrated in the accompanying Figure 3, the contrast learning algorithm under the SimCLR framework comprises four primary components: an image enhancement module, an encoder network, a projection network, and a contrast loss function. Contrastive learning is typically initiated with data augmentation, the objective of which is to enhance the variability of the data. Data augmentation techniques include cropping, flipping, rotating, random cropping, and color transformations. Subsequently, an encoder network is trained, into which the enhanced data are fed, with the encoder network mapping them to a latent representation space in which meaningful features and similarities are captured. The encoder network is typically a deep neural network architecture, such as a CNN for image data or a recurrent neural network (RNN) for sequential data. The network learns to extract and encode high-level representations from the augmented instances, which helps to distinguish between similar and dissimilar instances in subsequent steps. The projection network is then employed to refine the learned representation. It takes the output of the encoder network and projects it into a lower-dimensional space. This process reduces the complexity of the data and facilitates better separation of similar and dissimilar instances. The contrast learning objective is applied once the augmented instances have been encoded and projected into the embedding space. Figure 3: SimCLR framework. Figure 2: Contrastive learning process. Contrast learning aims to maximize the agreement between positive samples and minimize the agreement between negative samples. The similarity between instances is typically measured using a distance metric, such as the Euclidean distance or the cosine similarity. Models are trained to minimize the distance between positive pairs and maximize the distance between antagonistic pairs in the embedding space. Contrastive learning employs a range of loss functions to define the objective of the learning process, with the loss function playing a pivotal role in guiding the model to capture significant representations and differentiate between similar and dissimilar instances. The specific process is shown in Algorithm 1 below.