# Research on Image Feature Extraction and Environment Inference Based on Invariant Learning
## 2 Adaptive Environment Partitioning Invariant Learning Framework
### Resnet18  
Deep residual network (ResNet) was proposed by [PERSON] in 2015, and has delivered excellent performance in several visual recognition modeling competitions in recent years [19]. Studies have shown that as the number of layers in the CNN increases, the network's accuracy on the training set and the test set will gradually saturate and then decline [20]. For the degradation of deep network, ResNet effectively reduces the learning difficulty of network parameters of each layer by learning residuals instead of original features. Therefore, it can avoid the gradient explosion and disappearance problems that may occur in deep network, and further optimize network performance [21].  
Compared with the traditional deep network, ResNet adds a residual unit through a short-circuit mechanism, and its fundamental structure is depicted in Figure 1. In this diagram, represents the input feature, and Conv refers to the convolutional layer. \(F(x)\) is the residual function, ReLU represents the activation function, defined as:  
\[f(x)=\left\{\begin{array}{ll}0,&x\leq 0\\ x,&x>0\end{array}\right. \tag{3}\]  
The final output is obtained by adding the residual mapping to the identity mapping, as follows:  
\[\hat{y}=F(x)+x \tag{4}\]  
Figure 1: The residual learning module of ResNet.  
With one fully connected layer and seventeen convolutional layers, ResNet18 is a deep residual network. Its network architecture is illustrated in Figure 2[22], of which, image is the input image information; Avg pool represents average pooling; /2 represents halving the number of convolution channels; and Fully connection refers to a fully connected layer (FC).  
The advantages of ResNet18 include its support for training deep networks, and addressing the vanishing gradient problem through residual connections, which enhances the model's expressive capacity and performance. This architecture effectively avoids issues of vanishing and exploding gradients, thereby increasing training stability and ultimately improving the model's accuracy and generalization ability.  
In the context of deep learning facing challenges of out-of-distribution generalization, it is essential to leverage the advantages of ResNet18's deep network architecture and residual connections to propose a deep network optimized based on the principle of invariant risk minimization. This approach enables the network to effectively capture key invariant features within the input data.  
There is a strong complementarity between ResNet18 and the IRM method; the deep structure of ResNet18 provides a rich feature representation capability, while IRM enhances ResNet18's generalization ability in unknown environments. This robust integration offers an effective solution to the out-of-distribution generalization problem. By combining both approaches, a more powerful feature extractor can be constructed that focuses on identifying robust features relevant to the target task. This not only improves the model's predictive accuracy but also enhances its adaptability in unfamiliar environments.