# Research on Image Feature Extraction and Environment Inference Based on Invariant Learning
## 1 Introduction  
Recently, machine learning techniques built on the empirical risk minimization (ERM) framework have developed rapidly and demonstrated exceptional capabilities in various fields [1]. However, an increasing number of studies [2] have revealed that the ERM principle can lead models to capture all spurious and causal correlations found in the training data, which may result in poor generalization to test data [3]. For instance, in the field of power transmission, where insulator defect detection is performed, most of the collected insulator backgrounds in forested areas are green trees. When this model is applied to insulator defect detection in desert areas, the performance is often suboptimal. Similarly, in the case of image classification of cows and camels, most cow photos have green pasture backgrounds, while most camel photos have desert backgrounds [4]. Using this dataset to train a convolutional neural network (CNN), it is discovered that the model has difficulty accurately classifying photos of cows shot on beaches, often misidentifying images with green backgrounds as cows and those with beige backgrounds as camels. This is because the network has thoroughly learned the spurious correlation betweenphoto background and image category present in the dataset. Research indicates that the key to addressing such issues lies in forcing the model to focus on learning features that have a causal relationship with the labels in the samples, while ignoring other spurious features [2]. Although many existing deep learning algorithms can achieve end-to-end learning by discarding feature engineering, some tasks, such as pattern recognition and behavior feature extraction, still require feature selection and representation of samples [5]. For classical machine learning methods like naive Bayes, decision trees, and support vector machines, reasonable feature extraction can not only significantly speed up model training but also further improve prediction accuracy [6]. In the context of complex big data, accurately extracting or representing causal (invariant) features from samples has become a focal point for researchers worldwide. [PERSON] et al. [7] suggested a technique for extracting \"deep\" features from data using domain-adversarial neural networks, which jointly optimizes the underlying features to acquire representations that are resistant to changes in the discriminative and domain, ensuring that the extracted features are invariant across different domains. [PERSON] et al. [8] suggest that when evaluating all immediate factors affecting the target variable, the interference of all other variables, except for the target itself, will not alter its conditional distribution. Based on this, they proposed invariant causal prediction, which attempts to infer causal structures based on \"invariance\" for the first time and provides a subset containing the true causal variables. Ref. [9] introduced invariant causal representation learning, which, under the assumption that the prior distribution of data representation is decomposable given the target and environment variables, can achieve out-of-distribution generalization and invariant feature extraction in nonlinear scenarios. Although the out-of-distribution (OOD) generalization performance and learning efficiency of the aforementioned algorithms have been well-validated in both theory and experiments, the training effectiveness of these models depends on pre-defined dataset environment labels. Generally, the higher the quality of available environments, the better the model's invariance learning effect [1]. However, modern datasets are often composed of data from multiple sources without clear environment labels, necessitating research into methods for efficiently partitioning environments in mixed datasets. [PERSON] et al. [10] proposed an invariant learning environment inference framework that infers environments based on given biased models and provides environment labels for the data before performing invariant learning.