# Research on Image Feature Extraction and Environment Inference Based on Invariant Learning
## 1 Introduction
However, for complex datasets, using invariant representations to partition environments is inappropriate, as features related to the environment are gradually discarded, leading to the disappearance of potential environment features and making it difficult for the model to distinguish data from different latent environments. [PERSON] et al. [11] proposed a heterogeneity risk minimization (HRM) framework, which derives spurious features from invariant features, assigns environment labels based on spurious features, and learns a new set of invariant features across different environments. This process iterates, ultimately achieving invariant feature extraction and dataset environment partitioning. However, it can only be capable of addressing situations where invariant and variant characteristics are separated at the initial feature level and cannot process data that require decomposition in the representation space. Building on previous work. [PERSON] et al. [12] propose invariant causal imitation learning (ICIL), a technique that learns a domain-invariant feature representation to develop an imitation policy that aligns with expert behavior while addressing transition dynamics mismatch through a shared representation of causal features independent of noise variables in different environments. [PERSON] et al. [13] present an environment-agnostic approach to developing generalizable models for classification tasks in sequential datasets without needing prior knowledge of environments. [PERSON] et al. [14] propose a novel methodology leveraging modular neural networks within the IRM framework. Our approach aims to generate more diverse data representations, thereby enhancing the generalization performance of models trained with IRM. [PERSON] et al. [15] formulate causal estimation as an optimization problem. Utilizing directional derivatives, it introduces the CoCo objective. However, this representsmerely a computationally tractable optimization approach for estimating causal coefficients from datasets originating from multiple environments. [PERSON] et al. [16] investigate how to improve invariant risk minimization under spurious correlations to address the performance degradation of deep neural networks in out-of-distribution predictions. However, it lacks validation of its effectiveness. [PERSON] et al. [17] extended HRM's applicability to the kernel space. This algorithm achieves both the exploration of latent heterogeneity and invariant learning in the kernel space. However, its computational complexity is relatively high, and its performance in more complex tasks, such as high-pixel image classification and invariant feature extraction, remains unverified. In natural environments, the terrain and lighting conditions surrounding the target of interest are diverse, and the acquired photos often exhibit different shooting angles and motion blur. These environmental factors, unrelated to the target, can create spurious correlations with the model's prediction results during training, hindering the model's ability to generalize to different environments. This paper aims to propose an image-invariant feature extraction method that combines invariant learning with the ResNet18 network to address the decline in prediction accuracy caused by environmental feature influences in image classification tasks. First, we investigate the integration of invariant learning with the ResNet18 network, designing a method to extract invariant features from images that are unaffected by environmental variations, thereby overcoming the instability in model performance induced by environmental factors. Next, the extracted invariant features are compared with those obtained using traditional empirical risk minimization methods, inputting them into models such as support vector machines (SVM) and random forests. By comparing prediction accuracy, we validate the effectiveness of the invariant feature extraction method in classification tasks.