A method for detecting out-of-distribution abnormal samples based on data enhancement
By generating a data set of out-of-distribution abnormal samples and retraining the classifier based on the data augmentation method, the overconfidence prediction problem of the machine learning model under different distribution situations is solved, and the security of the model and the ability to identify wrong predictions are improved.
Patent Information
- Application Number
- CN202110635014.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-08
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2041-06-08
AI Technical Summary
Machine learning classifiers are prone to provide incorrect predictions with overconfidence when the training and test data set distributions are different, leading to unlabeled incorrect diagnosis, limiting their application in real-world tasks, especially in the medical field, and making it difficult to detect distribution outliers. Samples affect model security.
Using a method based on data augmentation, feature vectors are extracted through autoencoders to generate a sufficient number of out-of-distribution abnormal sample data sets containing semantic information, and the prediction accuracy of the original classifier is used as the soft label value, combining hard labels and soft labels. Carry out classifier retraining to improve model security.
Without accessing out-of-distribution abnormal sample data, an auxiliary out-of-distribution abnormal sample data set is generated through data enhancement, which improves the prediction accuracy and security of the deep neural network model and enhances the model's ability to identify wrong predictions.
Smart Images

Figure CN113392890B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of trusted machine learning, and in particular relates to a method for detecting out-of-distribution abnormal samples based on data enhancement. Background Art
[0002] When machine learning classifiers are applied to real-world tasks, they often fail when the distributions of the training and test datasets differ. Worse, these classifiers often fail silently while providing highly confident predictions that, unfortunately, are incorrect. If classifiers cannot indicate when they may be wrong, it can limit their usefulness and even lead to serious accidents. For example, a medical disease diagnosis model may consistently make highly confident classifications even though it should flag difficult examples that require human intervention. The resulting unlabeled misdiagnoses could hinder the future development of machine learning techniques in the medical field. More generally and importantly, estimating when a model makes a mistake is a critical problem for AI safety.
[0003] These overconfident predictions often come from the softmax layer because the softmax layer probabilities are calculated using a rapidly growing exponential function. Therefore, a small increase in the input to the softmax layer can lead to a large change in the output distribution. Since the softmax function is a smooth approximation of the indicator function, it is difficult to see a uniform distribution of outputs for out-of-distribution samples. Summary of the invention
[0004] The present invention aims to provide a method for detecting out-of-distribution abnormal samples based on data enhancement to solve the technical problems of uncertainty in model prediction and low model security.
[0005] In order to solve the above technical problems, the specific technical solutions of the present invention are as follows:
[0006] A method for detecting out-of-distribution abnormal samples based on data enhancement includes the following steps:
[0007] Step 1: Feature extraction: Use the autoencoder algorithm to extract the feature vector of the sample in the input distribution;
[0008] Step 2: Data augmentation and reconstruction. The features extracted in the feature extraction stage are transformed using a feature-based data augmentation method. Then, the decoding part of the autoencoder is used to generate a sufficient number of auxiliary out-of-distribution abnormal sample data sets containing semantic information from the enhanced feature vectors. Sufficient number means that the soft label information corresponding to the feature vector is evenly distributed in the output space.
[0009] Step 3: Sample labeling: the prediction accuracy of the original classifier for the reconstructed sample is used as the soft label value of the out-of-distribution abnormal sample;
[0010] Step 4: Retrain the classifier by combining the in-distribution training data set containing hard label supervision signals and the out-of-distribution abnormal sample data set containing soft label supervision signals to retrain the classifier.
[0011] Furthermore, step 1 includes the following steps:
[0012] Step 1.1: Map the input sample to the feature space through the encoder to obtain the abstract feature;
[0013] Step 1.2, map the abstract features back to the original space to obtain the reconstructed samples;
[0014] Step 1.3: Optimize the encoder and decoder simultaneously by minimizing the reconstruction error to obtain the optimal model parameters;
[0015] Step 1.4: Output the abstract feature representation for the sample input.
[0016] Further, step 2 includes the following steps:
[0017] Step 2.1, correspond the abstract feature representation of the sample to a point in the feature space, and find the K nearest neighbor samples of the point according to the Euclidean distance;
[0018] Step 2.2: Linearly interpolate these K samples and the original sample in the feature space to obtain the abstract feature representation of the new sample;
[0019] Step 2.3: Repeat the above steps until a sufficient number of abstract feature representations are generated;
[0020] Step 2.4: Based on the enhanced abstract features, the decoder part of the automatic encoder corresponding to the original abstract features is used to reconstruct samples.
[0021] The present invention provides a method for detecting out-of-distribution abnormal samples based on data enhancement, which has the following advantages: without accessing the out-of-distribution abnormal sample data, the present invention combines the feature-based data enhancement method to generate an auxiliary abstract feature representation from the feature space, and uses the decoder corresponding to the original in-distribution sample to map the abstract feature back to the input space to achieve the purpose of data enhancement. After that, the original classifier is used to predict the generated auxiliary out-of-distribution abnormal sample data set, and the prediction accuracy is used as the soft label value of the abnormal sample, and the classifier is retrained in combination with the in-distribution sample data to improve the security of the deep neural network model. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 The figure is an overall flow chart of a method for detecting out-of-distribution abnormal samples based on data enhancement according to the present invention; DETAILED DESCRIPTION
[0023] In order to better understand the purpose, structure and function of the present invention, the following is a further detailed description of a method for detecting out-of-distribution abnormal samples based on data enhancement of the present invention in conjunction with the accompanying drawings.
[0024] like Figure 1 As shown, the present invention comprises the following steps:
[0025] Step 1: Feature extraction. Use the autoencoder algorithm to extract the feature vector of the sample image within the input distribution.
[0026] Step 1.1, map the input sample image to the feature space Z through the encoder to obtain the abstract feature z;
[0027] Step 1.2, map the abstract feature z back to the input space X to obtain the reconstructed sample;
[0028] Step 1.3: Optimize the encoder and decoder simultaneously by minimizing the reconstruction error to obtain the optimal model parameters;
[0029] Step 1.4: Output the abstract feature representation z* for the sample input;
[0030] Step 2, data enhancement and reconstruction, uses feature-based data enhancement methods to transform the features extracted in the feature extraction stage, and then uses the decoding part of the autoencoder to generate a sufficient number of auxiliary out-of-distribution anomaly sample data sets containing semantic information from the enhanced feature vectors, where sufficient number means that the soft label information corresponding to the feature vector is evenly distributed in the output space.
[0031] Step 2.1, map the abstract feature representation z* of the sample image to a point in the feature space Z, and find the K nearest neighbor samples of the point according to the Euclidean distance;
[0032] Step 2.2: Linearly interpolate these K samples and the original sample image in the feature space Z to obtain abstract feature representations of several new samples;
[0033] Step 2.3: Repeat the above steps until a sufficient number of abstract feature representations are generated;
[0034] Step 2.4: Based on the enhanced abstract features, the decoder part of the automatic encoder corresponding to the original abstract features is used to reconstruct samples.
[0035] Step 3: Sample labeling: The prediction accuracy of the original classifier for the reconstructed sample is used as the soft label value of the out-of-distribution abnormal sample.
[0036] Step 4: Retrain the classifier by combining the in-distribution training data set containing hard label supervision signals and the out-of-distribution abnormal sample data set containing soft label supervision signals to retrain the classifier.
[0037] It is to be understood that the present invention is described by some embodiments, and it is known to those skilled in the art that various changes or equivalent substitutions may be made to these features and embodiments without departing from the spirit and scope of the present invention. In addition, under the teachings of the present invention, these features and embodiments may be modified to adapt to specific circumstances and materials without departing from the spirit and scope of the present invention. Therefore, the present invention is not limited by the specific embodiments disclosed herein, and all embodiments falling within the scope of the claims of this application are within the scope of protection of the present invention.
Claims
1. A method for detecting out-of-distribution abnormal samples based on data enhancement, characterized in that: The following steps are involved: Step 1: Feature extraction: Use the autoencoder algorithm to extract the feature vector of the sample image in the input distribution; Step 1.1, map the input sample image to the feature space Z through the encoder to obtain the abstract feature z; Step 1.2, map the abstract feature z back to the input space X to obtain the reconstructed sample; Step 1.3: Optimize the encoder and decoder simultaneously by minimizing the reconstruction error to obtain the optimal model parameters; Step 1.4: Output the abstract feature representation z* for the sample input; Step 2: Data augmentation and reconstruction. The features extracted in the feature extraction stage are transformed using a feature-based data augmentation method. Then, the decoding part of the autoencoder is used to generate a sufficient number of auxiliary out-of-distribution abnormal sample data sets containing semantic information from the enhanced feature vectors. Sufficient number means that the soft label information corresponding to the feature vector is evenly distributed in the output space. The step 2 comprises the following steps: Step 2.1, map the abstract feature representation z* of the sample image to a point in the feature space Z, and find the K nearest neighbor samples of the point according to the Euclidean distance; Step 2.2: Linearly interpolate these K samples and the original sample image in the feature space Z to obtain abstract feature representations of several new samples; Step 2.3: Repeat the above steps until a sufficient number of abstract feature representations are generated; Step 2.4, based on the enhanced abstract features, the decoder part of the automatic encoder corresponding to the original abstract features is used to reconstruct the samples; Step 3: Sample labeling: the prediction accuracy of the original classifier for the reconstructed sample is used as the soft label value of the out-of-distribution abnormal sample; Step 4: Retrain the classifier by combining the in-distribution training data set containing hard label supervision signals and the out-of-distribution abnormal sample data set containing soft label supervision signals to retrain the classifier.
