Feature extractor training method, face recognition method and related device

By simulating the fault state of the feature extractor and using the errors of the training derivative and generator to train the feature extractor, the problem of inaccurate recognition caused by the fault of the feature extractor is solved and the reliability of the face recognition system is improved.

CN118154897BActive Publication Date: 2024-09-03INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410310028.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-19
Publication Date
2024-09-03
Estimated Expiration
2044-03-19

AI Technical Summary

Technical Problem

The feature extractor in deep learning is prone to failure, resulting in inaccurate recognition results of the face recognition system and affecting the reliability of the system.

Method used

By simulating the feature extractor to be in a faulty state, build training derivatives and generators, use the error between source image features and derived image features to train the generator and classifier, and build a fault loss function to update the feature extractor and improve its adversarial fault tolerance performance.

Benefits of technology

It effectively reduces the impact on image classification and target recognition when the feature extractor fails, improves the feature extractor's fault-tolerant performance, and enhances the reliability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118154897B
    Figure CN118154897B
Patent Text Reader

Abstract

The present application relates to the field of deep learning technology, and in particular to a feature extractor training method, a face recognition method, and related devices. The training method includes: using a pre-trained feature extractor to extract features from a sample image to obtain source image features, inputting the source restored image into a generator, and training the image reconstruction performance of the generator; constructing a training derivative; using the training derivative to extract features from a sample image to obtain derivative image features, inputting the derived restored image into a generator, and training the classification performance of a classifier; inputting the source restored image and the derived restored image into a classifier for classification, and obtaining the error between the source restored image and the derived restored image; constructing a fault loss function, and updating the feature extractor. The use of this method can improve the adversarial fault tolerance performance of the feature extractor, and is conducive to reducing the impact of abnormal extracted features on image classification and / or target recognition when the feature extractor fails.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of deep learning technology, and in particular to a feature extractor training method, a face recognition method, a feature extractor training device, a face recognition system, a computer device, and a computer-readable storage medium. Background Art

[0002] During the execution of neural networks such as feature extractors, the main calculations are multiplication and accumulation operations between the weights of each layer and the input activations of the previous layer. However, deep learning accelerators and neuromorphic networks are more prone to failure, resulting in failures and errors in neural networks. For example, in image classification models such as face recognition systems, when the feature extractor fails, it is easy for the image features extracted by the feature extractor to be inaccurate and unreliable. When the face recognizer performs recognition based on unreliable image features, the recognition result of the face recognizer is wrong, affecting the reliability of image classification models such as face recognition systems. Summary of the invention

[0003] Based on this, it is necessary to provide a feature extractor training method, face recognition method, feature extractor training device, face recognition system, computer equipment and computer-readable storage medium to address the above-mentioned technical problems, which can improve the adversarial fault tolerance performance of the feature extractor and help reduce the impact of extracted feature abnormalities on image classification and / or target recognition when the feature extractor fails.

[0004] On the one hand, a method for training a feature extractor is provided, and the method for training a feature extractor comprises: extracting features from a sample image using a pre-trained feature extractor to obtain features of a source image; wherein the features of the source image are used for image classification and / or target recognition; inputting the features of the source image into a generator to obtain a source restored image; using the error between the source restored image and the sample image to train the image reconstruction performance of the generator; constructing a training derivative; wherein the training derivative is used to simulate a feature extractor in a fault state; the fault state comprises setting at least part of the weight parameters used by the feature extractor for feature extraction to zero; extracting features from a sample image using a feature extractor to obtain features of a source image; inputting the features of the source image into a generator to obtain a source restored image; extracting features from the sample image using the training derivative to obtain features of a derivative image; The image features are input into the generator to obtain the derived restored image; the classification performance of the classifier is trained by using the error between the source restored image and the derived restored image; the sample image is input into the feature extractor to obtain the source image features; the source image features are input into the generator for image reconstruction to obtain the source restored image; the sample image is input into the training derivative to obtain the derivative image features; the derivative image features are input into the generator for image reconstruction to obtain the derived restored image; the source restored image and the derived restored image are input into the classifier for classification to obtain the error between the source restored image and the derived restored image; a fault loss function for training the fault-tolerant performance of the feature extractor is constructed, and the feature extractor is updated by using the fault loss function; wherein the fault loss function is obtained based on the error between the source restored image and the derived restored image and the loss in the image reconstruction process of the generator.

[0005] In one embodiment of the present application, the error between the source restored image and the derived restored image includes a classification loss function; the source restored image and the derived restored image are input into a classifier for classification, and obtaining the error between the source restored image and the derived restored image includes: inputting the source restored image and the derived restored image into the classifier, and the classifier classifies the input image as a source restored image or a derived restored image; calculating the error between the derived restored image and the source restored image, and constructing a classification loss function based on the error between the derived restored image and the source restored image.

[0006] In one embodiment of the present application, the error between the derived restored image and the source restored image is calculated, and a classification loss function is constructed based on the error between the derived restored image and the source restored image, including: inputting the derived restored image and the source restored image into a classifier; obtaining the classifier output of its derived classification probability for the derived restored image and the source classification probability for the source restored image; based on the derived classification probability and the source classification probability, measuring the total loss between multiple sample images in one iterative training to construct a classification loss function.

[0007] In one embodiment of the present application, the classification loss function is:

[0008]

[0009] Among them, G D (S img , S' img ) represents the classification loss function; m represents the number of sample images in one iteration training; D k (S' img ) represents the derived classification probability based on the kth sample image; D k (S img ) represents the source classification probability based on the kth sample image.

[0010] In one embodiment of the present application, in one embodiment of the present application, inputting source image features into a generator for image reconstruction to obtain a source restored image includes: inputting source image features into a generator, and using the generator to map the source image features back to the original input space to obtain a source restored image; inputting derived image features into a generator for image reconstruction to obtain a derived restored image includes: inputting derived image features into a generator, and using the generator to map the derived image features back to the original input space to obtain a derived restored image.

[0011] In one embodiment of the present application, the training method of the classifier includes: fixing the model parameters of the generator; inputting the source restored image and the derived restored image into the classifier, constructing a classification loss function based on the classification result of the classifier, and using the classification loss function to update the model parameters of the classifier until the classification loss function converges and / or completes a first preset number of training cycles.

[0012] In one embodiment of the present application, the loss in the image reconstruction process of the generator includes a reconstruction loss function; using the error between the source restored image and the sample image to train the image reconstruction performance of the generator includes: inputting the source image features into the generator to obtain the source restored image generated by the generator; constructing a reconstruction loss function based on the error between the source restored image and the sample image from which the source image features are extracted, and using the reconstruction loss function to update the model parameters of the generator.

[0013] In one embodiment of the present application, the reconstruction loss function is:

[0014] L R (x,x′)=‖xx′‖ 2 ;

[0015] Among them, L R (x, x') represents the reconstruction loss function; x represents the sample image from which the source image features are extracted; x' represents the source restored image; ||x-x'|| 2Represents the mean square error loss between the source restored image and the sample image.

[0016] In one embodiment of the present application, the training method of the generator includes: fixing the model parameters of the feature extractor; cropping the sample images in the sample set to the target size, initializing the number of sample images input for one iterative training; inputting the source image features into the generator to obtain the source restored image, constructing a reconstruction loss function based on the error between the source restored image and the sample image, and using the reconstruction loss function to update the model parameters of the generator until the reconstruction loss function converges and / or completes a second preset number of training cycles; wherein one training cycle includes multiple iterative trainings and traverses the sample images in the sample set.

[0017] In one embodiment of the present application, the fault loss function is obtained based on the error between the source restored image and the derived restored image, and the loss in the image reconstruction process of the generator, including: obtaining the source restored image and the derived restored image obtained by image reconstruction of the source image features and the derived image features; obtaining the reconstruction loss function constructed based on the source restored image and the sample image; obtaining the classification loss function constructed based on the source restored image and the derived restored image; fusing the classification loss function and the reconstruction loss function to obtain the fault loss function.

[0018] In one embodiment of the present application, the fault loss function is:

[0019]

[0020] Where LOSS represents the failure loss function; q φ represents the feature extractor; D represents the classifier; L R (x, x') represents the reconstruction loss function; G D (S img , S' img ) represents the classification loss function.

[0021] In one embodiment of the present application, the training method includes: fixing the model parameters of the feature extractor, training the generator, and updating the model parameters of the generator; in response to the completion of the generator training, fixing the model parameters of the generator, training the classifier, and updating the model parameters of the classifier; in response to the completion of the classifier training, fixing the model parameters of the generator and the classifier, training the feature extractor, and updating the model parameters of the feature extractor.

[0022] In one embodiment of the present application, constructing a training derivative includes: obtaining the failure rate of several functional layers of the feature extractor; wherein the functional layer includes a convolutional layer and a fully connected layer, and the failure rate is the ratio of the number of quasi-fault weight parameters in the functional layer to the number of all weight parameters; constructing a random fault mask that matches the parameter structure and failure rate of the functional layer; and fusing the random fault mask corresponding to each functional layer with the weight parameter of the functional layer.

[0023] In one embodiment of the present application, obtaining the failure rate of several functional layers of the feature extractor includes: obtaining the failure rate of several functional layers that meet the simulated failure conditions; the simulated failure conditions include the functional layers being the first two network layers of the non-feature extractor and the last four network layers of the non-feature extractor; and / or the failure rate is 5% to 30%.

[0024] In one embodiment of the present application, the random fault mask is a binary weight mask, and the ratio of the number of mask parameters that are 0 in the random fault mask to the total number of mask parameters matches the fault rate; fusing the random fault masks corresponding to each functional layer with the weight parameters of the functional layer includes: multiplying each random fault mask with the corresponding weight parameter in the network model of the feature extractor.

[0025] In one embodiment of the present application, the image classification model includes a feature extractor and a recognizer; before using the pre-trained feature extractor to extract features from a sample image, the process includes: training the feature extractor and the recognizer until the image classification model training is completed, and image classification and / or target recognition tasks can be performed; wherein the recognizer is used to perform image classification and / or target recognition based on the features extracted by the feature extractor.

[0026] On the other hand, a face recognition method is provided, which includes: obtaining an image to be recognized of a face to be recognized; extracting facial features of the image to be recognized using a feature extractor; wherein the feature extractor is trained using a training method for the feature extractor in any of the above embodiments; inputting the facial features into the face recognizer, and using the face recognizer for recognition.

[0027] On the other hand, a training device for a feature extractor is provided, and the training device for the feature extractor includes: a fault simulation module and a control module; the fault simulation module is used to construct a training derivative; wherein the training derivative is used to simulate a feature extractor in a fault state; the fault state includes at least part of the weight parameters used by the feature extractor for feature extraction being set to zero; the control module is used to extract features from a sample image using a pre-trained feature extractor to obtain source image features; wherein the source image features are used for image classification and / or target recognition; the source image features are input into a generator to obtain a source restored image; the error between the source restored image and the sample image is used to train the image reconstruction performance of the generator; the feature extractor is used to extract features from the sample image to obtain source image features; the source image features are input into the generator to obtain a source restored image; the training derivative .... The invention discloses a method for extracting derived image features through feature extraction; inputting the derived image features into a generator to obtain a derived restored image; using the error between the source restored image and the derived restored image to train the classification performance of the classifier; inputting the sample image into the feature extractor to obtain the source image features; inputting the source image features into the generator for image reconstruction to obtain the source restored image; inputting the sample image into the training derivative to obtain the derived image features; inputting the derived image features into the generator for image reconstruction to obtain the derived restored image; inputting the source restored image and the derived restored image into the classifier for classification to obtain the error between the source restored image and the derived restored image; constructing a fault loss function for training the fault-tolerant performance of the feature extractor, and using the fault loss function to update the feature extractor; wherein the fault loss function is obtained based on the error between the source restored image and the derived restored image and the loss in the image reconstruction process of the generator.

[0028] On the other hand, a face recognition system is provided, which includes: a feature extractor trained using the training method of the feature extractor in any of the above embodiments, used to extract facial features of an image to be recognized; and a face recognizer connected to the feature extractor, used to receive facial features for recognition.

[0029] On the other hand, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the processor implements the steps of the feature extractor training method in any of the above-mentioned embodiments, or implements the steps of the face recognition method in any of the above-mentioned embodiments.

[0030] On the other hand, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the training method of the feature extractor in any of the above-mentioned embodiments are implemented, or the steps of the face recognition method in any of the above-mentioned embodiments are implemented.

[0031] The above-mentioned feature extractor training method, face recognition method, feature extractor training device, face recognition system, computer equipment and computer-readable storage medium simulate the feature extractor in a fault state to obtain a training derivative, and respectively extract features of the sample image through the feature extractor and the training derivative to obtain source image features and derived image features. The feature extractor is updated based on the fault loss model constructed based on the error of the derived image features relative to the source image features to reduce the difference between the derived image features and the source image features. If the feature extractor is trained, the gap between the image features extracted under the simulated feature extractor fault state and the normal state can be reduced, and the interference of the feature extractor on the image feature extraction when it fails can be reduced, so that the anti-fault tolerance performance of the feature extractor can be improved, which is conducive to reducing the impact of the abnormal extracted features on image classification and / or target recognition when the feature extractor fails. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 It is a flowchart of an embodiment of a training method for a feature extractor of the present application;

[0033] Figure 2 is a flow chart of another embodiment of the method for training a feature extractor of the present application;

[0034] Figure 3 It is a flowchart of an embodiment of a training method of a generator of the present application;

[0035] Figure 4 It is a flow chart of an embodiment of a training method for a classifier of the present application;

[0036] Figure 5 It is a flowchart of another embodiment of the training method of the feature extractor of the present application;

[0037] Figure 6 It is a flowchart of an embodiment of constructing a training derivative of the present application;

[0038] Figure 7 It is a flow chart of an embodiment of a training device for a feature extractor of the present application;

[0039] Figure 8 It is a flowchart of an embodiment of the face recognition method of the present application;

[0040] Fig. 9 This is a schematic diagram of an application scenario of an embodiment of the face recognition method of the present application;

[0041] Fig.10 It is a structural diagram of the face recognition system of the present application;

[0042] Fig.11It is a structural diagram of an embodiment of a computer device of the present application. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0044] In order to solve the problem in the related art that neural network failures are prone to affect the reliability of feature extraction, and even affect the accuracy of image classification and target recognition, the present application provides a training method that can reduce the difference between the image features extracted by the feature extractor in a faulty state and in a normal state by simulating the feature extractor in a faulty state. That is, the present application provides a feature extractor training method, a face recognition method, a feature extractor training device, a face recognition system, a computer device, and a computer-readable storage medium that can improve the adversarial fault tolerance performance of the feature extractor and help reduce the impact of abnormal extracted features on image classification and / or target recognition when the feature extractor fails.

[0045] See also Figure 1 , Figure 1 It is a flowchart of an embodiment of a training method for a feature extractor of the present application.

[0046] S101: extract features from a sample image using a pre-trained feature extractor to obtain source image features; wherein the source image features are used for image classification and / or target recognition; input the source image features into a generator to obtain a source restored image; and use the error between the source restored image and the sample image to train the image reconstruction performance of the generator.

[0047] In this embodiment, the feature extractor can extract features from the image and extract representative features from the image. Feature extraction refers to a method of transforming a group of measured values ​​of a certain pattern to highlight the representative features of the pattern. It is a method of extracting the required features through image analysis and transformation. In other words, feature extraction refers to a method and process of using a computer to extract characteristic information from an image.

[0048] Specifically, when the feature extractor is applied to face recognition, the feature extractor can extract facial features in the image; when the feature extractor is applied to image classification, the feature extractor can extract relevant features in the image for classification, which will not be elaborated here.

[0049] This embodiment is to perform adversarial fault-tolerant training on the feature extractor, so when constructing the training derivative, the feature extractor can be pre-trained in conjunction with other modules such as the identifier, and the feature extractor has a feature extraction function. That is, it is considered that the feature extractor can reliably extract features under normal conditions, and the extracted image features are trustworthy.

[0050] The generator is a model, algorithm, etc. that can restore an image based on the image features input to the generator. The image reconstruction performance of the generator refers to improving the similarity between the source restored image generated by the generator and the sample image.

[0051] The sample image refers to an image used to train the feature extractor. The number of sample images can be multiple, so that the feature extractor can be trained through multiple iterations and multiple cycles of training. For example, the number of sample images can be 1,000, 10,000, etc., which is not limited here.

[0052] The sample image is input into the feature extractor, and the feature extractor is used to extract features of the sample image to obtain source image features. When the feature extractor is applied to specific target recognition or image classification tasks such as faces, gestures, trash cans, etc., the source image features can be used for image classification and / or target recognition, that is, the source image features can be used to perform image classification and / or target recognition tasks.

[0053] S102: Construct a training derivative; wherein the training derivative is used to simulate a feature extractor in a fault state; the fault state includes at least part of the weight parameters used by the feature extractor for feature extraction being set to zero.

[0054] In this embodiment, the model parameters and / or model structure of the feature extractor in a faulty state are simulated to form a model simulating the feature extractor in a faulty state as a training derivative. As the name implies, the faulty state is the state when the feature extractor is faulty. When the feature extractor is in a faulty state, the features of the extracted image may be abnormal, and may even affect the reliability of subsequent recognition, classification, and other operations using the image features.

[0055] The fault state may include that some weight parameters of functional layers such as convolutional layers in the feature extractor are set to zero, and image features cannot be extracted reliably. Generally speaking, the image features extracted by the feature extractor when it is in a faulty state are likely to be very different from the image features extracted when it is in a normal state. If so, the recognizer connected to the feature extractor may not be able to reliably perform target recognition / image classification tasks based on the image features extracted under the fault.

[0056] In other words, the image features extracted by the training derivative constructed in this embodiment in the initial stage are quite different from the image features extracted by the feature extractor. The purpose of fault-tolerance training of the feature extractor in this embodiment is to improve the consistency of the image features extracted by the training derivative and the feature extractor. That is, the image features extracted by the feature extractor in a faulty state can be relatively reliable, reducing the impact on the reliability of the target recognition and / or image classification task execution of the recognizer.

[0057] S103: Use a feature extractor to extract features from a sample image to obtain features of a source image; input the features of the source image into a generator to obtain a source restored image; use a training derivative to extract features from a sample image to obtain features of a derived image; input the features of the derived image into a generator to obtain a derived restored image; use the error between the source restored image and the derived restored image to train the classification performance of the classifier.

[0058] In this embodiment, the sample image is input into the training derivation device, and the training derivation device is used to extract features from the sample image to obtain derived image features. The sample image is input into the feature extractor, and the feature extractor is used to extract features from the sample image to obtain source image features. In other words, the feature extractor and the training derivation device are used to extract features from the sample image to obtain source image features and derived image features.

[0059] The previously trained generator is further used to reconstruct the source image features and the derived image features to obtain the source restored image and the derived restored image. The source restored image and the derived restored image are input into the classifier to train the classification performance of the classifier, that is, the performance of distinguishing the source restored image and the derived restored image.

[0060] S104: Input the sample image into the feature extractor to obtain the source image features; input the source image features into the generator for image reconstruction to obtain the source restored image; input the sample image into the training derivative to obtain the derived image features; input the derived image features into the generator for image reconstruction to obtain the derived restored image; input the source restored image and the derived restored image into the classifier for classification to obtain the error between the source restored image and the derived restored image.

[0061] In this embodiment, in response to the generator and the classifier being trained, it can be considered that the generator has reliable image reconstruction performance and the classifier has reliable classification performance. The feature extractor and the training derivative are used to extract features from the sample image respectively, and the generator is used to reconstruct the image to obtain the source restored image and the derived restored image. The classifier is used to classify the source restored image and the derived restored image.

[0062] S105: Construct a fault loss function for training the fault-tolerant performance of the feature extractor, and use the fault loss function to update the feature extractor; wherein the fault loss function is obtained based on the error between the source restored image and the derived restored image, and the loss of the generator during the image reconstruction process.

[0063] In this embodiment, a fault loss function is constructed based on the error between the source restored image and the derived restored image and the loss in the image reconstruction process of the generator. The feature extractor is updated using the fault loss function to improve the adversarial fault tolerance performance of the feature extractor. In this embodiment, the loss of the image reconstruction process and the classification process can be comprehensively considered, which is conducive to improving the effectiveness and comprehensiveness of the fault loss function.

[0064] At the same time, in this embodiment, the similarity between the source restored image and the derived restored image is used to characterize the similarity between the source image feature and the derived image feature. In addition, the training goal of the feature extractor in this embodiment is to improve the similarity between the source restored image and the derived restored image.

[0065] That is to say, when the similarity between the source restored image and the derived restored image is higher, it can be considered that the important image features in the derived image features are retained to a higher degree. Even if there may still be a large difference between the derived image features and the source image features, it can be considered that the lost features are mostly environmental background features in the image, and the current derived image features can be relatively reliably used for target recognition and image classification tasks. In other words, it can be considered that the feature extractor can relatively reliably extract important features of the input image when it is in a faulty state.

[0066] In layman's terms, in this embodiment, for a sample image, feature extraction can be performed using a feature extractor and a training derivator to obtain derived image features and source image features.

[0067] Among them, the training derivative is a model that simulates the feature extractor in a faulty state, so the derived image features may be different from the extracted derived image features and the error between the derived image features and the source image features can be considered to be caused by the failure of the feature extractor.

[0068] Therefore, constructing a fault loss function based on the error between the derived image features and the source image features, and using the fault loss function to update the feature extractor is conducive to reducing the difference between the derived image features and the source image features in subsequent feature extraction, so as to reduce the difference between the image features extracted by the feature extractor in a normal state and a fault state. In other words, the design in this embodiment can improve the reliability of feature extraction when the feature extractor is in a fault state, that is, it can improve the adversarial fault tolerance performance of the feature extractor.

[0069] For example, the error between the derived image feature and the source image feature can be calculated by Euclidean distance, cosine similarity, etc., which are not limited here. The smaller the error between the derived image feature and the source image feature, the less interference the feature extractor has on the feature extraction function when in a fault state, that is, the better the adversarial fault tolerance performance of the feature extractor.

[0070] It can be seen that in this embodiment, the feature extractor in a fault state is simulated to obtain a training derivative, and the feature extractor and the training derivative respectively extract features of the sample image to obtain source image features and derived image features. The feature extractor is updated based on the fault loss model constructed based on the error of the derived image features relative to the source image features to reduce the difference between the derived image features and the source image features.

[0071] When a feature extractor that has not been trained for adversarial fault tolerance is in a fault state, the extracted image features may be significantly different from those extracted in a normal state. In this embodiment, in order to reduce the difference between the image features extracted in the fault state and the normal state of the feature extractor, a training derivative is constructed to perform adversarial fault tolerance training on the feature extractor, thereby improving the reliability of the image features extracted by the feature extractor in a fault state and significantly optimizing the performance of the feature extractor.

[0072] In other words, by training the feature extractor in the present embodiment, the gap between the image features extracted under the simulated feature extractor fault state and the normal state can be narrowed, and the interference on the image feature extraction when the feature extractor fails can be reduced, thereby improving the adversarial fault tolerance performance of the feature extractor, which is beneficial to reducing the impact of the extracted feature anomalies on image classification and / or target recognition when the feature extractor fails.

[0073] In one embodiment, when calculating the errors of source image features and derived image features, the present application can first restore the two to a source restored image and a derived restored image respectively, and characterize the adversarial fault-tolerant performance of the feature extractor based on the similarity between the source restored image and the derived restored image.

[0074] In this way, even if there may be a large difference between the source image features and the derived image features, when the source restored image and the derived restored image are relatively similar, it can be considered that the more important image features of the sample image have not been lost, and when the target recognition or image classification task is performed based on the derived image features, the task result can be considered relatively reliable. At the same time, compared with the training result that the expected source image features and the derived image features are consistent, the important image features are retained as much as possible, and the similarity between the source image features and the derived image features may decrease, but it can reduce the computational cost of the training process to a certain extent, and it can also be conducive to the successful adversarial fault-tolerant training of the feature extractor.

[0075] Optionally, the source image features and the derived image features can be reconstructed using a generator, and / or the source restored image and the derived restored image can be classified using a classifier. In an alternative embodiment, image reconstruction and image classification can also be performed using other neural network models, algorithms, etc., which are not limited here.

[0076] See also Figure 2 , Figure 2 It is a flowchart of another embodiment of the training method of the feature extractor of the present application.

[0077] S201: Fix the model parameters of the feature extractor.

[0078] In this embodiment, fixing the model parameters of the feature extractor means that, during the training process of the generator, the model parameters of the feature extractor can be frozen during the gradient back propagation process, so that when the model parameters of the generator are updated during the gradient back propagation, the model parameters of the feature extractor will not change accordingly.

[0079] The model parameters of the pre-trained feature model that has the feature extraction capability are fixed, thereby reducing the impact on the feature extraction performance of the feature extractor during the training of the generator and classifier.

[0080] Optionally, fixing the model parameters of the feature extractor can set the feature extractor to a non-trainable state. For example, the feature extractor can be set to a variable that does not require a gradient.

[0081] Furthermore, the model parameters of the classification can also be fixed at the same time, so as to allocate training resources to the generator as much as possible during the training process of the generator.

[0082] S202: Train the generator and update the model parameters of the generator.

[0083] In this embodiment, in response to the fixed model parameters of the feature extractor, the generator can be trained to update the model parameters of the generator, thereby optimizing the image reconstruction performance of the generator. The specific generator training method will be described later and will not be repeated here.

[0084] S203: Determine whether the generator training is complete.

[0085] In this embodiment, in response to the generator training being completed, step S204 is executed; in response to the generator training not being completed, step S202 is executed.

[0086] For example, the generator may complete a preset number of iterative trainings or a preset number of training cycles; and / or, a convergence value of a reconstruction loss function may be preset. When the reconstruction loss function currently being trained by the generator converges, it may be considered that the generator has good image reconstruction performance, and the generated source restored image is similar to the sample image, then it may be determined that the generator has completed training.

[0087] S204: Fix the model parameters of the generator.

[0088] In this embodiment, in response to the completion of the generator training, the classifier can be trained.

[0089] At the same time, the model parameters of the generator can be fixed and the model parameters of the generator can be used in the gradient back propagation process so that the model parameters of the generator will not change during the subsequent gradient back propagation, which is conducive to reducing the risk of weakening the image reconstruction performance of the generator. Such a design can simplify the zero and non (maximum and minimum) game between models during the training process and reasonably allocate training resources.

[0090] Optionally, fixing the model parameters of the generator can set the generator to a non-trainable state. For example, the generator can be set to a variable that does not require gradients.

[0091] Furthermore, when training the classifier, the model parameters of the generator and the feature extractor can be fixed at the same time.

[0092] S205: Train the classifier and update the model parameters of the classifier.

[0093] In this embodiment, in response to fixing the model parameters of the generator, the classifier may be trained and the model parameters of the classifier may be updated, thereby optimizing the classification performance of the classifier on the source restored image and the derived restored image.

[0094] For example, the classifier can be composed of multiple two-dimensional convolutional networks, nonlinear activation functions, and a one-dimensional convolution with a binary output. Optionally, the classifier training can be performed using an Adam (Adaptive Moment Estimation) optimizer, an SGD (Stochastic Gradient Descent) optimizer, etc. The initial learning rate can be set to 0.1, the number of iterations can be set to 40 times, and the learning decay rate can be set to 0.5, and decay is performed every 10 iterations, that is, the decay rate is multiplied by the current learning rate.

[0095] The specific classifier training method will be explained later and will not be elaborated here.

[0096] S206: Determine whether the classifier training is complete.

[0097] In this embodiment, in response to the classifier training being completed, step S207 is executed; in response to the generator training being not completed, step S205 is executed.

[0098] For example, the classifier can complete a preset number of iterative training or a preset number of training cycles; and / or, the convergence value of the reconstruction loss function can be preset. When the reconstruction loss function of the classifier currently training converges, it can be considered that the classifier has good classification performance of the source restored image and the derived restored image, and can reliably distinguish the source restored image from the derived restored image, then it can be determined that the classifier has completed training.

[0099] S207: Fix the model parameters of the generator and the classifier.

[0100] In this embodiment, in response to the completion of the classifier training, the feature extractor can be allowed to be trained to update the feature extractor. The model parameters of both the generator and the classifier can be fixed, and the feature extractor can be adjusted to a state where the gradient backpropagation can be performed to update the parameters.

[0101] S208: Train the feature extractor and update the model parameters of the feature extractor.

[0102] In this embodiment, in response to the model parameters of both the generator and the classifier being fixed, the feature extractor can be trained to update the model parameters of the feature extractor and improve the adversarial fault tolerance performance of the feature extractor until the feature extraction training is completed.

[0103] Optionally, whether the feature extractor has completed adversarial fault-tolerant training can be determined by at least one method such as the number of iterations, the number of training cycles, and whether the fault loss function converges, which will not be described in detail here.

[0104] It can be seen that in this embodiment, by reasonably designing the training order of the generator, the classifier and the feature extractor, the rationality of the training mechanism is improved, which is conducive to improving the training reliability of the feature extractor. Specifically, when training to update the model parameters of the classifier, the generator can reliably reconstruct the source restored image and the derived restored image, which is conducive to good training of the resolution performance of the classifier. When training to update the model parameters of the feature extractor, the generator can reliably reconstruct the source restored image and the derived restored image, and the classifier can reliably distinguish the source restored image and the derived restored image, which can significantly improve the model's anti-interference ability and enhance the model's ability to resist model failures.

[0105] See also Figure 3 , Figure 3 It is a flowchart of an embodiment of a training method of the generator of the present application.

[0106] In one embodiment, when training the generator, the model parameters of the feature extractor may be fixed as in the embodiment described above. In other words, the model parameters of the feature extractor may be frozen during the gradient back propagation process, and when the reconstruction loss function is obtained and the model parameters of the generator are updated by gradient back propagation, the model parameters of the feature extractor will not change accordingly.

[0107] Before using sample images for training, the sample images in the sample set may be preprocessed to obtain sample images with target size and definition requirements. The sample set in this embodiment refers to a collection of sample images used for training the generator, classifier, and feature extractor.

[0108] Specifically, the sample images in the sample set can be cropped to the target size. Initializing the number of sample images input for one iteration of training is equivalent to setting batch_size (the number of sample images passed to the program for training at one time).

[0109] The sample image can be input into a feature extractor, and the feature extractor is used to extract features of the sample image to obtain source image features of the sample image.

[0110] The source image features are input into the generator, and the generator can reconstruct the image based on the source image features to obtain the source restored image generated by the generator.

[0111] Based on the error between the source restored image and the sample image with the source image features extracted, a reconstruction loss function is constructed.

[0112] The reconstruction loss function is used to update the model parameters of the generator in the hope of reducing the difference between the source restored image and the sample image, and improving the restoration degree of the source restored image generated by the generator based on the source image features to the sample image, that is, the image reconstructed based on the image features generated by the generator is close to the original input image. At the same time, the reconstruction loss function is used to constrain the image reconstruction process of the generator, which is conducive to improving the restoration of the image generated by the generator.

[0113] At the same time, it is possible to judge whether the reconstruction loss function converges and / or whether the training cycle reaches a second preset number, so as to judge whether the generator training is completed. Until the reconstruction loss function of the generator training converges and / or the second preset number of training cycles are completed, the generator training can be considered completed. Among them, one training cycle includes multiple iterative trainings and traverses the sample images in the sample set.

[0114] For example, a convergence value may be preset to determine whether the reconstruction loss function converges. For example, the convergence value during the generator training process may be 0.003, 0.005, etc. When the reconstruction loss function converges to less than or equal to 0.003, it is considered that the source image features generated by the generator have a good degree of restoration, and the reconstruction loss function is determined to converge.

[0115] Optionally, the reconstruction loss function may be a mean square error loss function. The specific formula of the reconstruction loss function in this embodiment may be expressed as:

[0116] L R (x,x′)=‖xx′‖ 2 Formula 1-1

[0117] Among them, L R (x, x') represents the reconstruction loss function; x represents the sample image from which the source image features are extracted; x' represents the source restored image; ||x-x'|| 2 Represents the mean square error loss between the source restored image and the sample image.

[0118] In an alternative embodiment, the reconstruction loss function may also be a cross entropy loss function, an exponential loss, etc., which is not limited here.

[0119] See also Figure 4 , Figure 4 It is a flowchart of an embodiment of a training method for a classifier of the present application.

[0120] In one embodiment, when training the classifier, the model parameters of the generator may be fixed as in the embodiment described above. The model parameters of the generator may be frozen during the gradient back propagation process, and when the classification loss function is obtained and the model parameters of the classifier are updated by gradient back propagation, the model parameters of the generator will not change accordingly.

[0121] A training derivative can be constructed to simulate a feature extractor in a faulty state. For example, a training derivative of the current model parameters, parameter structure, model structure, etc. of the feature extractor can be copied in advance, and a fault element can be generated through a fault simulation module, and the fault element can be superimposed on the training derivative to form a simulated feature extractor in a faulty state. Alternatively, there can be a reusable simulation module that can simulate the normal state of the feature extractor and transform it to a faulty state as a training derivative, which is not limited here.

[0122] Among them, due to process variations, thermal issues, leakage, etc., the underlying semiconductor devices and hardware are inherently not completely reliable and may affect the neural network calculations on the circuit in an erroneous form. For example, during the execution of a neural network, the main calculation is the multiplication and accumulation (MAC) operation between the weights of the layer and the input activations of the previous layer. Since the weights or intermediate calculations are reused for subsequent calculations during the forward process, the neural network accelerator includes additional temporary storage in each computing circuit. Due to hardware failure, the memory unit may not be accessible, resulting in the reading of the "0" value of the corresponding node activation and parameter (in layman's terms, the parameter is lost and is treated as 0). There is a separation parameter failure in the synaptic or edge connection between nodes in the convolutional layer filter and the fully connected layer of the neural network. In addition, the fault state can also include overfitting, underfitting, gradient disappearance, gradient explosion, etc., which will not be repeated here.

[0123] The feature extractor and the training derivator can be used to extract features from the sample image to obtain source image features and derived image features. In other words, the sample image is input into the feature extractor to obtain source image features, and the sample image is input into the training derivator to obtain derived image features. The source image features can be used for image classification and / or object recognition.

[0124] In response to obtaining source image features and derived image features belonging to a sample image, image reconstruction can be performed based on the source image features and the derived image features to generate a source restored image and a derived restored image. For example, the source image features can be input into a generator, and the generator can be used to map the source image features back to the original input space to obtain a source restored image; the derived image features can be input into a generator, and the generator can be used to map the derived image features back to the original input space to obtain a derived restored image.

[0125] The source restored image and the derived restored image can be input into a classifier, and the classifier is used to determine the source restored image and the derived restored image obtained based on a sample image, and the image is reconstructed in the same way, so that in the process of obtaining the source restored image and the derived restored image, the error between the two caused by the difference in the path can be reduced, which is conducive to reducing the error in the training process and improving the reliability of the training method of this embodiment. For example, the classifier can perform a binary classification task and output whether the current input image is a source restored image or a derived restored image; or, the classifier can analyze the probability that the input image belongs to the source restored image and / or the derived restored image, and output the probability of belonging to the source restored image and / or the probability of the derived restored image.

[0126] Furthermore, a classification loss function can be constructed based on the classification result of the classifier and the real category of the input image. The classification loss function can be used to update the model parameters of the classifier to improve the classifier's ability to distinguish and discriminate between the source restored image and the derived restored image. When the classifier is applied to the model parameter update of the feature extractor, it can further promote the improvement of the similarity between the source restored image and the derived restored image, which is conducive to improving the adversarial fault tolerance performance of the feature extractor. The real category of the input image refers to whether it is a source restored image or a derived restored image, and the classification result refers to the classifier's determination of whether the input image is a source restored image or a derived restored image. Among them, at least in the training process, the classifier, the generator, and the feature extractor are used as an overall model. In view of this, the real category information of the image input to the classifier in the overall model can be used to supervise the classification results of the classifier, distinguish between the false data points generated by the feature extractor in the fault simulation and the true data points sampled from the prior distribution, which is conducive to improving the accuracy of the classifier.

[0127] Furthermore, a classification loss function can be constructed based on the classification result of the classifier, and the model parameters of the classifier can be updated using the classification loss function until the classifier training is completed and it is considered that the classifier can reliably distinguish the source restored image from the derived restored image. Optionally, the completion of the training of the classifier can be the convergence of the classification loss function and / or the completion of a first preset number of training cycles.

[0128] Optionally, the classification loss function can be constructed by measuring the sum of losses between multiple sample images in one iteration training based on the derived classification probability and the source classification probability, wherein the source classification probability refers to the probability that the classifier determines that the source restored image is the source restored image; the derived classification probability refers to the probability that the classifier determines that the derived restored image is the derived restored image.

[0129] For example, the classification loss function can be:

[0130]

[0131] Among them, G D (S img , S' img ) represents the classification loss function; m represents the number of sample images in one iteration training; D k (S' img ) represents the derived classification probability based on the kth sample image; D k (S img ) represents the source classification probability based on the kth sample image.

[0132] See also Figure 5 , Figure 5 It is a flowchart of another embodiment of the training method of the feature extractor of the present application.

[0133] In one embodiment, the feature extractor trained in this embodiment can be applied to an image classification model. Specifically, the image classification model can include a feature extractor and a recognizer.

[0134] Before training and optimizing the adversarial fault tolerance of the feature extractor, the feature extractor and the recognizer can be trained until the image classification model training is completed, and it is considered that the image classification model can reliably perform image classification and / or target recognition tasks. The feature extractor can be further optimized by training the feature extractor with the training method in the following text embodiment to improve the adversarial fault tolerance performance of the feature extractor and reduce the error of the features extracted when the feature extractor is in a fault state, thereby improving the reliability of the image features extracted by the feature extractor, which is conducive to improving the reliability of the image classification model. Among them, the recognizer is used for image classification and / or target recognition based on the features extracted by the feature extractor.

[0135] In this embodiment, the fault loss function may include a classification loss function and / or a reconstruction loss function. For example, the fault loss function may include a classification loss function; or, the fault loss function may include a reconstruction loss function; or, the fault loss function may include a classification loss function and a reconstruction loss function, and the two may update the model parameters of the feature extractor respectively; or, the fault loss function may include a classification loss function and a reconstruction loss function, and the fused classification loss function and reconstruction loss function are used to update the model parameters of the feature extractor. Other possible implementation methods of the fault loss function in this embodiment will not be described here.

[0136] Optionally, when the fault loss function includes a classification loss function and a reconstruction loss function, the two can be fused to form a fault loss function for updating the feature extraction model. Fusion can refer to weighted fusion of the classification loss function and the reconstruction loss function; or, as exemplified later in this embodiment, the classification loss function and the reconstruction loss function can be fused through a preset operation rule.

[0137] The following is a detailed description of the training method for fusing the classification loss function and the reconstruction loss function to form the fault loss function.

[0138] In response to the generator and the classifier being trained, the model parameters of the generator and the classifier can be fixed so that when the model parameters of the feature extractor are updated, the model parameters of the generator and the classifier are maintained unchanged. The training method of the generator and the classifier is described above and will not be repeated here.

[0139] The feature extractor can be used to extract features from the sample image to obtain the source image features. The source image features are input into the generator to obtain the source restored image generated by the generator. Based on the error between the source restored image and the sample image from which the source image features are extracted, a reconstruction loss function is constructed. Furthermore, in the stage of training and updating the model parameters of the feature extractor, the reconstruction loss function can also include the loss of the derived restored image obtained by image reconstruction based on the derived image features, which will not be described in detail here.

[0140] Taking the feature extractor as a neural network model as an example, the feature extractor usually includes a convolution layer, an activation function, a fully connected layer, etc. When simulating that the feature extractor is in a fault state, the situation where the parameters are set to zero in each functional layer can be simulated in layers.

[0141] Specifically, the failure rates of several functional layers of the feature extractor can be obtained. Among them, the functional layers include convolutional layers, fully connected layers, etc., and the failure rate is the ratio of the number of quasi-fault weight parameters in the functional layer to the number of all weight parameters. For example, the failure rates of several functional layers may not be exactly the same, and the failure rates may be pre-set, or input by the user in real time, or randomly generated, which is not limited here.

[0142] Optionally, the failure rates of several functional layers that meet the simulated fault conditions can be obtained. Among them, the simulated fault conditions include the first two network layers of the functional layer that are not the feature extractor and the last four network layers of the non-feature extractor. In layman's terms, the first two network layers and the last four network layers of the feature extractor can be avoided when performing fault simulation. In this way, although the adversarial fault tolerance capability of the feature extractor may be relatively weakened, the network layers that have a greater impact on the feature extraction results of the feature extractor can be avoided during the training process, which is beneficial for the feature extractor to reliably complete the adversarial fault tolerance training. In other words, the design of the present application can balance the adversarial fault tolerance performance of the feature extractor and the reliability of the training process.

[0143] And / or, the failure rate can be 5% to 30%. For example, the failure rate can be 5%, 11.25%, 17.5%, 28.75%, 30%, etc., which will not be repeated here. It is easy to understand that the higher the failure rate is set during the training process, the better the adversarial fault tolerance performance of the trained feature extractor. At the same time, the higher the difficulty of successfully training the feature extractor. Therefore, setting the failure rate to 5% to 30% can improve the reliability of the training process, which is conducive to the successful training of the feature extractor, and at the same time, it is conducive to ensuring the adversarial fault tolerance performance of the feature extractor.

[0144] Furthermore, a random fault mask matching the parameter structure and fault rate of the functional layer can be constructed. For example, a random fault mask can be constructed by means of a random mask. In other words, the weight parameters of the simulated fault are randomly selected through the random fault mask, which is conducive to jumping out of the local optimum and the saddle point, so as to reduce the risk of overfitting of the mask generation method during the training process.

[0145] Alternatively, if Figure 6 As shown in the example, Figure 6 It is a flowchart of an embodiment of the present application for constructing a training derivative. In one embodiment, the random fault mask can be a binary weight mask, and the ratio of the number of mask parameters that are 0 in the random fault mask to the total number of mask parameters matches the fault rate. Each random fault mask is multiplied by the corresponding weight parameter in the network model of the feature extractor to achieve the fault simulation of the feature extractor parameter being set to zero, which can also simplify the fault simulation process and improve the training efficiency of the feature extractor. In an alternative embodiment, the mask parameter of the random fault mask can also be any real number between 0 and 1 to simulate other fault states, which is not limited here.

[0146] Furthermore, the random fault mask corresponding to each functional layer can be fused with the weight parameter of the functional layer to construct a training derivative that simulates the feature extractor in a faulty state. For example, the mask parameter is multiplied by the corresponding model parameter. In the case of a node failure, during the forward propagation of the feature extractor, the random fault mask is multiplied by the parameter tensor to obtain the weight parameter with error, and the fault simulation is performed on the intermediate layers of the neural network in the feature extractor to obtain the feature extractor in the simulated faulty state, i.e., the training derivative.

[0147] Next, the trained derivative can be used to extract features from the sample image to obtain derived image features.

[0148] Image reconstruction is performed based on the source image features and the derived image features to generate a source restored image and a derived restored image. In this embodiment, the source image features and the derived image features can be input into the generator, and the generator is used to perform image reconstruction to obtain the source restored image and the derived restored image.

[0149] The derived restored image and the source restored image can be input into a classifier, and the classifier is obtained to output a derived classification probability of the derived restored image and a source classification probability of the source restored image.

[0150] Based on the derived classification probability and the source classification probability, the sum of the losses between multiple sample images in one iterative training is measured to construct a classification loss function. In this way, the error between the derived restored image and the source restored image can be calculated, and the classification loss function can be constructed based on the error between the derived restored image and the source restored image.

[0151] As such, in this embodiment, a reconstruction loss function can be constructed based on the source restored image and the sample image; at the same time, a classification loss function can also be constructed based on the source restored image and the derived restored image. Furthermore, the classification loss function and the reconstruction loss function can be fused to obtain a fault loss function. The feature extractor is updated using the fault loss function. When updating the model parameters of the feature extractor, the losses in the image reconstruction process and the source restored image and the derived restored image discrimination process can be comprehensively considered, thereby improving the reliability and relative comprehensiveness of the feature extractor training.

[0152] For example, the failure loss function can be:

[0153]

[0154] Where LOSS represents the failure loss function; q φ represents the feature extractor; L R (x, x') represents the reconstruction loss function; G D (S img , S' img) represents the classification loss function; D can represent the classifier; min represents the minimum value; max represents the maximum value.

[0155] It is easy to understand that the number of sample images used in a training cycle and the number of sample images passed to the program for training at a single time are both multiple.

[0156] In this way, by using the fault loss function in Formula 3-1, we can try to minimize the error between the feature extractor and the training derivative while maximizing the classification loss function and the reconstruction loss function as much as possible. The image classification model such as the feature extractor / face recognition system obtained based on this can have a certain degree of adversarial fault tolerance.

[0157] For example, the generator can be fixed to L as described above. R (x, x') is used as the reconstruction loss function to train the feature extractor.

[0158] Until the difference between the derived restored image and the source restored image is less than or equal to the difference threshold, it can be considered that there is basically no difference between the derived restored image and the source restored image, and the feature extractor training can be determined to be completed. It is easy to understand that there is basically no difference between the derived restored image and the source restored image. It can be considered that even if the feature extractor is in a faulty state, the image features extracted in the faulty state can basically represent the important information of the image, that is, the difference is small compared with the image features extracted when the feature extractor is in a normal state. It is considered that the difference is within an acceptable range and has little impact on the task results of the target recognition and / or image classification tasks.

[0159] In one embodiment, an Adam (Adaptive Moment Estimation) optimizer, an SGD (Stochastic Gradient Descent) optimizer, etc. may be used for classifier training. The initial learning rate may be set to 0.001, and exponential decay may be used, i.e., in each iteration step, the learning rate is multiplied by a decay factor of 0.3 (not greater than 1). For example, the decay may be performed once per training cycle.

[0160] Next, the generator and discriminator can be fixed, and the feature extractor can be trained using LOSS as the fault loss function in Formula 3-1.

[0161] In one embodiment, the feature extractor can be combined with the recognizer of the image classification model for adversarial fault-tolerant training. In other words, after the image classification model completes the training of image classification / target recognition, the image classification model is subjected to adversarial fault-tolerant training. Optionally, when the image classification model is subjected to adversarial fault-tolerant training, the model parameters of the recognizer can be fixed. When the model parameters of the feature extractor are updated using the fault loss function, the model parameters of the recognizer can be maintained unchanged to reduce the impact of the adversarial fault-tolerant training of the feature extractor on the classification / recognition performance and to ensure the classification / recognition performance of the recognizer. In an alternative embodiment, when the model parameters of the feature extractor are updated using the fault loss function, the model parameters of the recognizer may also change accordingly, which is not limited here.

[0162] Taking the image classification model as a face recognition system as an example, that is, combining the application scenario of the feature extractor training method of the present application applied to the face recognition system, an embodiment of the present application is explained in a popular way.

[0163] It can be considered that the training method of the feature extractor has three stages. The three-stage training method can improve the adversarial fault tolerance performance of the feature extractor and image classification models such as face recognition systems and target recognition models.

[0164] Specifically, in the first stage, a pre-trained model of a face recognition system can be obtained, and a generator can be trained in an unsupervised manner so that the generator can restore a face image. The pre-trained model of a face recognition system refers to a model that has been trained for face recognition performance and can be considered to have a reliable, expected, and expected face recognition function when the face recognition system is in a normal state.

[0165] In the second stage, the model parameters of the generator and the model parameters of the face recognition system can be fixed to train the classifier. In order to train the classifier, in addition to the restored face image (i.e., the source restored image) of the first stage, it is also necessary to simulate the restored face image with errors generated under hardware failure, i.e., the derived restored image. At this time, the error simulation module can be used to modify the model parameters of the face recognition system to obtain a face recognition system with errors, i.e., the training derivative. The derived restored image can be obtained by training the derivative and the generator. The goal of training the classifier can be that the classifier can reliably determine whether the image input to it is a source restored image or a derived restored image. At this stage, the classifier can be modified according to the gradient backpropagation until the set number of training times or the model converges. It can be considered that the judge can reliably determine whether the input image is generated by the training derivative.

[0166] In the third stage, the model parameters of the generator and the model parameters of the classifier can be fixed. The fault simulation module is used to simulate the error of the face recognition system to obtain a face recognition system with fault simulation, that is, a training derivative. The face image is respectively transmitted to the face recognition system and the training derivative to obtain the source face features and the derived face features respectively. The generator is used to obtain the output restoration image, the source face restoration image and the derived face restoration image. The trained classifier module is used to determine whether the input image is generated under the fault condition. In this stage, the face recognition system can be modified according to the gradient back propagation until the difference between the derived face restoration image and the source face restoration image is less than or equal to the difference threshold. It can be considered that there is basically no difference between the derived face restoration image and the source face restoration image, and it can be determined that the training of the face recognition system is completed. It is easy to understand that there is basically no difference between the derived face restoration image and the source face restoration image. It can be considered that even if the face recognition system is in a fault state, the image features extracted in the fault state can basically represent the important information of the image, that is, the difference with the image features extracted when the face recognition system is in a normal state is small, and it is considered that the difference is within an acceptable range.

[0167] See also Figure 7 , Figure 7 It is a flow chart of an embodiment of a training device for a feature extractor of the present application.

[0168] In one embodiment, the training device of the feature extractor may include a fault simulation module 11 and a control module 12 .

[0169] The fault simulation module 11 is used to construct a training derivative that simulates the feature extractor being in a fault state.

[0170] The control module 12 is used to use a feature extractor and a training derivative to extract features from the sample image respectively, and obtain source image features and derived image features; wherein the source image features are used for image classification and / or target recognition; a fault loss function is obtained based on the error between the derived image features and the source image features, and the feature extractor is updated using the fault loss function.

[0171] For example, the control module 12 may include a generator and / or a classifier as in the above embodiments, and the working principles of the two are not described in detail here.

[0172] For the specific definition of the training device of the feature extractor, please refer to the definition of the training method of the feature extractor above, which will not be repeated here. The various modules in the above-mentioned training device of the feature extractor can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0173] Please refer to Figure 8 and Fig. 9 , Figure 8 is a flow chart of an embodiment of the face recognition method of the present application, Fig. 9 It is a schematic diagram of an application scenario of an embodiment of the face recognition method of the present application.

[0174] S301: Obtain an image of a face to be recognized.

[0175] In one embodiment, the image to be identified is an image that needs to be identified whether a human face exists and / or the identity of the human face. For example, the image to be identified may be a photo taken by a camera device such as a mobile phone or a camera; or, the image to be identified may be a screenshot obtained by taking a screenshot of a video; or, the image to be identified may be a video or video frame taken by a camera, a surveillance camera or other device, which is not limited here.

[0176] The image to be recognized can be sent to the face recognition system from external devices such as mobile phones, cameras, surveillance cameras, computers, etc.; or, the face recognition system can periodically pull streaming media data, which is not limited here.

[0177] S302: Extracting facial features of the image to be recognized using a feature extractor; wherein the feature extractor is trained using a feature extractor training method.

[0178] In one embodiment, the feature extractor can be obtained by using the adversarial fault tolerance training in the embodiment described above, and the feature extractor has good adversarial fault tolerance performance. The image to be recognized can be input into the feature extractor, and the feature extractor extracts the facial features in the image to be recognized to reduce the risk of facial feature loss due to faults.

[0179] S303: Inputting facial features into a face recognition device, and using the face recognition device for recognition.

[0180] In one embodiment, the facial features extracted by the feature extractor are input into the face recognizer, and the face recognizer performs face recognition based on the facial features. In view of the fact that the feature extractor can reduce the risk of facial feature loss due to failure, performing face recognition based on the facial features is conducive to improving the reliability of the recognition result.

[0181] The recognition result of the face recognizer can be used as the output result of the face recognition system, and the recognition result can be fed back to the target client so that the user can know the face recognition result in time; or, the recognition result can be fed back to the target client in response to the user's acquisition instruction after waiting for the acquisition instruction; or, the recognition result can be fed back at a regular interval, which will not be elaborated here.

[0182] For example, the target client can communicate with the face recognition system through the network, or can communicate through a data line, which is not limited here. Among them, the target client can be but not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices. The target client can also be implemented by an independent server or a server cluster composed of multiple servers, which will not be repeated here.

[0183] See also Fig.10 , Fig.10 It is a structural diagram of the face recognition system of this application.

[0184] In one embodiment, the face recognition system includes a feature extractor 21 and a face recognizer 22 .

[0185] The feature extractor 21 can be trained using the feature extractor training method in the above embodiment. The feature extractor 21 can extract the facial features of the image to be recognized.

[0186] The face recognizer 22 is connected to the feature extractor 21. The face recognizer 22 can receive the face features from the feature extractor, perform recognition based on the face features, and execute the face recognition task.

[0187] For the specific definition of the face recognition system, please refer to the definition of the face recognition method above, which will not be repeated here. Each module in the above face recognition system can be implemented in whole or in part by software, hardware and their combination. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0188] It should be understood that although Figure 1-Figure 6 as well as Figure 8 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-Figure 6 as well as Figure 8At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0189] See also Fig.11 , Fig.11 It is a structural diagram of an embodiment of a computer device of the present application.

[0190] In one embodiment, the computer device may be a terminal or a server, etc. The internal structure diagram of the computer device may be as follows: Fig.11 As shown in the example.

[0191] The computer device may include a processor, a memory, a network interface and an input device connected through a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a training method for a feature extractor is implemented; or, when the computer program is executed by the processor, a face recognition method is implemented.

[0192] Furthermore, the computer device may also include a display screen. The display screen may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a key, trackball or touchpad provided on the computer device housing, or an external keyboard, touchpad or mouse.

[0193] Those skilled in the art will understand that Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0194] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:

[0195] S101: extract features from a sample image using a pre-trained feature extractor to obtain source image features; wherein the source image features are used for image classification and / or target recognition; input the source image features into a generator to obtain a source restored image; and use the error between the source restored image and the sample image to train the image reconstruction performance of the generator.

[0196] S102: Construct a training derivative; wherein the training derivative is used to simulate a feature extractor in a fault state; the fault state includes at least part of the weight parameters used by the feature extractor for feature extraction being set to zero.

[0197] S103: Use a feature extractor to extract features from a sample image to obtain features of a source image; input the features of the source image into a generator to obtain a source restored image; use a training derivative to extract features from a sample image to obtain features of a derived image; input the features of the derived image into a generator to obtain a derived restored image; use the error between the source restored image and the derived restored image to train the classification performance of the classifier.

[0198] S104: Input the sample image into the feature extractor to obtain the source image features; input the source image features into the generator for image reconstruction to obtain the source restored image; input the sample image into the training derivative to obtain the derived image features; input the derived image features into the generator for image reconstruction to obtain the derived restored image; input the source restored image and the derived restored image into the classifier for classification to obtain the error between the source restored image and the derived restored image.

[0199] S105: Construct a fault loss function for training the fault-tolerant performance of the feature extractor, and use the fault loss function to update the feature extractor; wherein the fault loss function is obtained based on the error between the source restored image and the derived restored image, and the loss of the generator during the image reconstruction process.

[0200] In one embodiment, when the processor executes the computer program, the following steps are further implemented: S201: fixing the model parameters of the feature extractor.

[0201] S202: Train the generator and update the model parameters of the generator.

[0202] S203: Determine whether the generator training is complete.

[0203] In this embodiment, in response to the generator training being completed, step S204 is executed; in response to the generator training not being completed, step S202 is executed.

[0204] S204: Fix the model parameters of the generator.

[0205] S205: Train the classifier and update the model parameters of the classifier.

[0206] S206: Determine whether the classifier training is complete.

[0207] In this embodiment, in response to the classifier training being completed, step S207 is executed; in response to the generator training being not completed, step S205 is executed.

[0208] S207: Fix the model parameters of the generator and the classifier.

[0209] S208: Train the feature extractor and update the model parameters of the feature extractor.

[0210] In one embodiment, when the processor executes the computer program, the following steps are further implemented: when training the generator, the model parameters of the feature extractor are fixed.

[0211] Crop the sample images in the sample set to the target size and initialize the number of sample images input for one iteration of training.

[0212] The feature extractor is used to extract features from the sample image to obtain the source image features.

[0213] The source image features are input into the generator to obtain the source restored image generated by the generator.

[0214] Based on the error between the source restored image and the sample image with the source image features extracted, a reconstruction loss function is constructed.

[0215] The model parameters of the generator are updated using the reconstruction loss function until the reconstruction loss function converges and / or a second preset number of training cycles are completed; wherein one training cycle includes multiple iterative trainings and traverses the sample images in the sample set.

[0216] Optionally, the reconstruction loss function can be:

[0217] L R (x,x′)=‖xx′‖ 2 Formula 1-1

[0218] Among them, L R (x, x') represents the reconstruction loss function; x represents the sample image from which the source image features are extracted; x' represents the source restored image; ||x-x'|| 2 Represents the mean square error loss between the source restored image and the sample image.

[0219] In one embodiment, when the processor executes the computer program, the following steps are further implemented: when training the classifier, the model parameters of the generator can be fixed.

[0220] Construct a trained derivative that simulates a failed feature extractor.

[0221] The feature extractor and the training derivation device are used to extract features from the sample image to obtain source image features and derived image features, wherein the source image features can be used for image classification and / or target recognition.

[0222] Image reconstruction is performed based on the source image features and the derived image features to generate a source restored image and a derived restored image. For example, the source image features can be input into the generator, and the source image features can be mapped back to the original input space by the generator to obtain the source restored image; the derived image features can be input into the generator, and the derived image features can be mapped back to the original input space by the generator to obtain the derived restored image.

[0223] The source restored image and the derived restored image can be input into the classifier, a classification loss function can be constructed based on the classification result of the classifier, and the model parameters of the classifier can be updated using the classification loss function until the classification loss function converges and / or the first preset number of training cycles are completed.

[0224] Optionally, the classification loss function can be constructed by measuring the sum of losses between multiple sample images in one iterative training based on the derived classification probability and the source classification probability.

[0225] For example, the classification loss function can be:

[0226]

[0227] Among them, G D (S img , S' img ) represents the classification loss function; m represents the number of sample images in one iteration training; D k (S' img ) represents the derived classification probability based on the kth sample image; D k (S img ) represents the source classification probability based on the kth sample image.

[0228] In one embodiment, when the processor executes the computer program, the following steps are further implemented: the feature extractor trained in this embodiment can be applied to an image classification model. Specifically, the image classification model can include a feature extractor and a recognizer.

[0229] Before training and optimizing the adversarial fault tolerance of the feature extractor, the feature extractor and the recognizer can be trained until the image classification model training is completed and the image classification and / or target recognition tasks can be performed. The recognizer is used to perform image classification and / or target recognition based on the features extracted by the feature extractor.

[0230] In this embodiment, the fault loss function may include a classification loss function and / or a reconstruction loss function. Optionally, when the fault loss function includes a classification loss function and a reconstruction loss function, the two may be fused to form a fault loss function for updating the feature extraction model. The following is a detailed description of the training method for fusing the classification loss function and the reconstruction loss function to form a fault loss function.

[0231] In response to the generator and the classifier being trained, the model parameters of the generator and the classifier may be fixed.

[0232] The feature extractor is used to extract features from the sample image to obtain the source image features.

[0233] The source image features are input into the generator to obtain the source restored image generated by the generator.

[0234] Based on the error between the source restored image and the sample image with the source image features extracted, a reconstruction loss function is constructed.

[0235] Obtain the failure rates of several functional layers of the feature extractor, where the functional layers include convolutional layers and fully connected layers, and the failure rate is the ratio of the number of quasi-failure weight parameters in the functional layer to the number of all weight parameters.

[0236] Optionally, the failure rates of several functional layers meeting the pseudo-failure conditions may be obtained. The pseudo-failure conditions include the first two network layers of the functional layer that are not feature extractors and the last four network layers that are not feature extractors. And / or, the failure rate is 5% to 30%.

[0237] A random fault mask is constructed that matches the parameter structure and fault rate of the functional layer.

[0238] The random fault masks corresponding to each functional layer are fused with the weight parameters of the functional layer to construct a training derivative that simulates the feature extractor being in a faulty state.

[0239] Furthermore, the random fault mask can be a binary weight mask, and the ratio of the number of mask parameters that are 0 in the random fault mask to the total number of mask parameters matches the fault rate. Each random fault mask is multiplied by the corresponding weight parameter in the network model of the feature extractor to achieve fault simulation of the feature extractor parameter being set to zero.

[0240] Next, the trained derivative can be used to extract features from the sample image to obtain derived image features.

[0241] Image reconstruction is performed based on the source image features and the derived image features to generate the source restored image and the derived restored image. In this embodiment, the source image features and the derived image features can be input into the generator, and the generator is used to restore the source restored image and the derived restored image.

[0242] The derived restored image as well as the source restored image are input into the classifier.

[0243] Obtain the classifier outputs its derived classification probability for the derived restored image and the source classification probability for the source restored image.

[0244] Based on the derived classification probability and the source classification probability, the sum of the losses between multiple sample images in one iterative training is measured to construct a classification loss function. In this way, the error between the derived restored image and the source restored image can be calculated, and the classification loss function can be constructed based on the error between the derived restored image and the source restored image.

[0245] Thus, in this embodiment, a reconstruction loss function is constructed based on the source restored image and the sample image; at the same time, a classification loss function is constructed based on the source restored image and the derived restored image.

[0246] The classification loss function and the reconstruction loss function can be fused to obtain the fault loss function, and the feature extractor is updated using the fault loss function.

[0247] For example, the failure loss function can be:

[0248]

[0249] Where LOSS represents the failure loss function; q φ represents the feature extractor; L R (x, x') represents the reconstruction loss function; G D (S img , S' img ) represents the classification loss function; D represents the classifier.

[0250] In one embodiment, when the processor executes the computer program, the following steps are further implemented: S301: Acquire an image to be recognized of a face to be recognized.

[0251] S302: Extracting facial features of the image to be recognized using a feature extractor; wherein the feature extractor is trained using a feature extractor training method.

[0252] S303: Inputting facial features into a face recognition device, and using the face recognition device for recognition.

[0253] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0254] S101: extract features from a sample image using a pre-trained feature extractor to obtain source image features; wherein the source image features are used for image classification and / or target recognition; input the source image features into a generator to obtain a source restored image; and use the error between the source restored image and the sample image to train the image reconstruction performance of the generator.

[0255] S102: Construct a training derivative; wherein the training derivative is used to simulate a feature extractor in a fault state; the fault state includes at least part of the weight parameters used by the feature extractor for feature extraction being set to zero.

[0256] S103: Use a feature extractor to extract features from a sample image to obtain features of a source image; input the features of the source image into a generator to obtain a source restored image; use a training derivative to extract features from a sample image to obtain features of a derived image; input the features of the derived image into a generator to obtain a derived restored image; use the error between the source restored image and the derived restored image to train the classification performance of the classifier.

[0257] S104: Input the sample image into the feature extractor to obtain the source image features; input the source image features into the generator for image reconstruction to obtain the source restored image; input the sample image into the training derivative to obtain the derived image features; input the derived image features into the generator for image reconstruction to obtain the derived restored image; input the source restored image and the derived restored image into the classifier for classification to obtain the error between the source restored image and the derived restored image.

[0258] S105: Construct a fault loss function for training the fault-tolerant performance of the feature extractor, and use the fault loss function to update the feature extractor; wherein the fault loss function is obtained based on the error between the source restored image and the derived restored image, and the loss of the generator during the image reconstruction process.

[0259] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: S201: fixing the model parameters of the feature extractor.

[0260] S202: Train the generator and update the model parameters of the generator.

[0261] S203: Determine whether the generator training is complete.

[0262] In this embodiment, in response to the generator training being completed, step S204 is executed; in response to the generator training not being completed, step S202 is executed.

[0263] S204: Fix the model parameters of the generator.

[0264] S205: Train the classifier and update the model parameters of the classifier.

[0265] S206: Determine whether the classifier training is complete.

[0266] In this embodiment, in response to the classifier training being completed, step S207 is executed; in response to the generator training being not completed, step S205 is executed.

[0267] S207: Fix the model parameters of the generator and the classifier.

[0268] S208: Train the feature extractor and update the model parameters of the feature extractor.

[0269] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0270] When training the generator, the model parameters of the feature extractor are fixed.

[0271] Crop the sample images in the sample set to the target size and initialize the number of sample images input for one iteration of training.

[0272] The feature extractor is used to extract features from the sample image to obtain the source image features.

[0273] The source image features are input into the generator to obtain the source restored image generated by the generator.

[0274] Based on the error between the source restored image and the sample image with the source image features extracted, a reconstruction loss function is constructed.

[0275] The model parameters of the generator are updated using the reconstruction loss function until the reconstruction loss function converges and / or a second preset number of training cycles are completed; wherein one training cycle includes multiple iterative trainings and traverses the sample images in the sample set.

[0276] Optionally, the reconstruction loss function can be:

[0277] L R (x,x′)=‖xx′‖ 2 Formula 1-1

[0278] Among them, L R (x, x') represents the reconstruction loss function; x represents the sample image from which the source image features are extracted; x' represents the source restored image; ||x-x'|| 2 Represents the mean square error loss between the source restored image and the sample image.

[0279] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: when training the classifier, the model parameters of the generator can be fixed.

[0280] Construct a trained derivative that simulates a failed feature extractor.

[0281] The feature extractor and the training derivation device are used to extract features from the sample image to obtain source image features and derived image features, wherein the source image features can be used for image classification and / or target recognition.

[0282] Image reconstruction is performed based on the source image features and the derived image features to generate a source restored image and a derived restored image. For example, the source image features can be input into the generator, and the source image features can be mapped back to the original input space by the generator to obtain the source restored image; the derived image features can be input into the generator, and the derived image features can be mapped back to the original input space by the generator to obtain the derived restored image.

[0283] The source restored image and the derived restored image can be input into the classifier, a classification loss function can be constructed based on the classification result of the classifier, and the model parameters of the classifier can be updated using the classification loss function until the classification loss function converges and / or the first preset number of training cycles are completed.

[0284] Optionally, the classification loss function can be constructed by measuring the sum of losses between multiple sample images in one iterative training based on the derived classification probability and the source classification probability.

[0285] For example, the classification loss function can be:

[0286]

[0287] Among them, G D (S img , S' img ) represents the classification loss function; m represents the number of sample images in one iteration training; D k (S' img ) represents the derived classification probability based on the kth sample image; D k (S img ) represents the source classification probability based on the kth sample image.

[0288] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: the feature extractor trained in this embodiment can be applied to an image classification model. Specifically, the image classification model can include a feature extractor and a recognizer.

[0289] Before training and optimizing the adversarial fault tolerance of the feature extractor, the feature extractor and the recognizer can be trained until the image classification model training is completed and the image classification and / or target recognition tasks can be performed. The recognizer is used to perform image classification and / or target recognition based on the features extracted by the feature extractor.

[0290] In this embodiment, the fault loss function may include a classification loss function and / or a reconstruction loss function. Optionally, when the fault loss function includes a classification loss function and a reconstruction loss function, the two may be fused to form a fault loss function for updating the feature extraction model. The following is a detailed description of the training method for fusing the classification loss function and the reconstruction loss function to form a fault loss function.

[0291] In response to the generator and the classifier being trained, the model parameters of the generator and the classifier may be fixed.

[0292] The feature extractor is used to extract features from the sample image to obtain the source image features.

[0293] The source image features are input into the generator to obtain the source restored image generated by the generator.

[0294] Based on the error between the source restored image and the sample image with the source image features extracted, a reconstruction loss function is constructed.

[0295] Obtain the failure rates of several functional layers of the feature extractor, where the functional layers include convolutional layers and fully connected layers, and the failure rate is the ratio of the number of quasi-failure weight parameters in the functional layer to the number of all weight parameters.

[0296] Optionally, the failure rates of several functional layers meeting the pseudo-failure conditions may be obtained. The pseudo-failure conditions include the first two network layers of the functional layer that are not feature extractors and the last four network layers that are not feature extractors. And / or, the failure rate is 5% to 30%.

[0297] A random fault mask is constructed that matches the parameter structure and fault rate of the functional layer.

[0298] The random fault masks corresponding to each functional layer are fused with the weight parameters of the functional layer to construct a training derivative that simulates the feature extractor being in a faulty state.

[0299] Furthermore, the random fault mask can be a binary weight mask, and the ratio of the number of mask parameters that are 0 in the random fault mask to the total number of mask parameters matches the fault rate. Each random fault mask is multiplied by the corresponding weight parameter in the network model of the feature extractor to achieve fault simulation of the feature extractor parameter being set to zero.

[0300] Next, the trained derivative can be used to extract features from the sample image to obtain derived image features.

[0301] Image reconstruction is performed based on the source image features and the derived image features to generate the source restored image and the derived restored image. In this embodiment, the source image features and the derived image features can be input into the generator, and the generator is used to restore the source restored image and the derived restored image.

[0302] The derived restored image as well as the source restored image are input into the classifier.

[0303] Obtain the classifier outputs its derived classification probability for the derived restored image and the source classification probability for the source restored image.

[0304] Based on the derived classification probability and the source classification probability, the sum of the losses between multiple sample images in one iterative training is measured to construct a classification loss function. In this way, the error between the derived restored image and the source restored image can be calculated, and the classification loss function can be constructed based on the error between the derived restored image and the source restored image.

[0305] Thus, in this embodiment, a reconstruction loss function is constructed based on the source restored image and the sample image; at the same time, a classification loss function is constructed based on the source restored image and the derived restored image.

[0306] The classification loss function and the reconstruction loss function can be fused to obtain the fault loss function, and the feature extractor is updated using the fault loss function.

[0307] For example, the failure loss function can be:

[0308]

[0309] Where LOSS represents the failure loss function; q φ represents the feature extractor; L R (x, x') represents the reconstruction loss function; G D (S img , S' img ) represents the classification loss function; D represents the classifier.

[0310] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented.

[0311] S301: Obtain an image of a face to be recognized.

[0312] S302: Extracting facial features of the image to be recognized using a feature extractor; wherein the feature extractor is trained using a feature extractor training method.

[0313] S303: Inputting facial features into a face recognition device, and using the face recognition device for recognition.

[0314] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0315] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0316] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application.

Claims

1. A method for training a feature extractor, characterized in that: The training method comprises: Using a pre-trained feature extractor to extract features from a sample image, and obtaining source image features; wherein the source image features are used for image classification and / or target recognition; inputting the source image features into a generator to obtain a source restored image; using the error between the source restored image and the sample image to train the image reconstruction performance of the generator; constructing a training derivative; wherein the training derivative is used to simulate the feature extractor in a fault state; the fault state includes at least part of the weight parameters used by the feature extractor for feature extraction being set to zero; Using the feature extractor to extract features from the sample image to obtain the source image features; inputting the source image features into the generator to obtain a source restored image; using the training derivative to extract features from the sample image to obtain derived image features; inputting the derived image features into the generator to obtain a derived restored image; using the error between the source restored image and the derived restored image to train the classification performance of the classifier; Input the sample image into the feature extractor to obtain the source image features; input the source image features into the generator for image reconstruction to obtain the source restored image; input the sample image into the training derivative to obtain the derived image features; input the derived image features into the generator for image reconstruction to obtain the derived restored image; input the source restored image and the derived restored image into the classifier for classification to obtain the error between the source restored image and the derived restored image; Constructing a fault loss function for training the fault tolerance performance of the feature extractor, and updating the feature extractor using the fault loss function; wherein the fault loss function is obtained based on the error between the source restored image and the derived restored image, and the loss in the image reconstruction process of the generator; The fault loss function is obtained based on the error between the source restored image and the derived restored image and the loss during the image reconstruction process of the generator, and includes: Obtaining a source restored image and a derived restored image obtained by performing image reconstruction on the source image features and the derived image features; Obtaining a reconstruction loss function constructed based on the source restored image and the sample image; obtaining a classification loss function constructed based on the source restored image and the derived restored image; The classification loss function and the reconstruction loss function are integrated to obtain a fault loss function.

2. The training method according to claim 1, characterized in that: The error between the source restored image and the derived restored image comprises a classification loss function; the inputting the source restored image and the derived restored image into the classifier for classification to obtain the error between the source restored image and the derived restored image comprises: Inputting the source restored image and the derived restored image into the classifier, and the classifier classifies whether the input image belongs to the source restored image or the derived restored image; The error between the derived restored image and the source restored image is calculated, and the classification loss function is constructed based on the error between the derived restored image and the source restored image.

3. The training method according to claim 2, characterized in that: The calculating the error between the derived restored image and the source restored image, and constructing the classification loss function based on the error between the derived restored image and the source restored image comprises: Inputting the derived restored image and the source restored image into a classifier; Obtaining the derived classification probability of the derived restored image and the source classification probability of the source restored image output by the classifier; Based on the derived classification probability and the source classification probability, the sum of losses between the plurality of sample images in one iterative training is measured to construct the classification loss function.

4. The training method according to claim 3, characterized in that: The classification loss function is: Among them, G D (S img , S' img ) represents the classification loss function; m represents the number of sample images in one iteration training; D k (S' img ) represents the derived classification probability obtained based on the k-th sample image; D k (S img ) represents the source classification probability obtained based on the kth sample image.

5. The training method according to claim 3, characterized in that: The inputting the source image features into the generator for image reconstruction to obtain the source restored image comprises: Inputting the source image features into a generator, and using the generator to map the source image features back to the original input space to obtain the source restored image; Inputting the derived image features into the generator for image reconstruction to obtain a derived restored image comprises: The derived image features are input into the generator, and the derived image features are mapped back to the original input space by the generator to obtain the derived restored image.

6. The training method according to claim 5, characterized in that: The training method of the classifier comprises: Fix the model parameters of the generator; The source restored image and the derived restored image are input into the classifier, the classification loss function is constructed based on the classification result of the classifier, and the model parameters of the classifier are updated using the classification loss function until the classification loss function converges and / or a first preset number of training cycles are completed.

7. The training method according to claim 1, characterized in that: The loss in the image reconstruction process of the generator includes a reconstruction loss function; and the image reconstruction performance of the generator trained by using the error between the source restored image and the sample image includes: Inputting the source image feature into a generator to obtain a source restored image generated by the generator; Based on the error between the source restored image and the sample image from which the features of the source image are extracted, the reconstruction loss function is constructed, and the model parameters of the generator are updated using the reconstruction loss function.

8. The training method according to claim 7, characterized in that: The reconstruction loss function is: L R (x,x ′ )=‖xx′‖ 2 , where L R (x, x') represents the reconstruction loss function; x represents the sample image from which the source image features are extracted; x' represents the source restored image; / / x-x' / / 2 represents the mean square error loss between the source restored image and the sample image.

9. The training method according to claim 7, characterized in that: The training method of the generator includes: fixing model parameters of the feature extractor; Crop the sample images in the sample set to a target size, and initialize the number of the sample images input for one iteration of training; The source image features are input into the generator to obtain the source restored image, the reconstruction loss function is constructed based on the error between the source restored image and the sample image, and the model parameters of the generator are updated using the reconstruction loss function until the reconstruction loss function converges and / or a second preset number of training cycles are completed; wherein one training cycle includes multiple iterative trainings and traverses the sample images in the sample set.

10. The training method according to claim 1, characterized in that: The fault loss function is: Wherein, LOSS represents the failure loss function; q φ represents the feature extractor; D represents the classifier; L R (x, x') represents the reconstruction loss function; G D (S img , S' img ) represents the classification loss function.

11. The training method according to claim 1, characterized in that: The training method comprises: Fixing the model parameters of the feature extractor, training the generator, and updating the model parameters of the generator; In response to the completion of the training of the generator, fixing the model parameters of the generator, training the classifier, and updating the model parameters of the classifier; In response to the completion of the classifier training, the model parameters of the generator and the classifier are fixed, the feature extractor is trained, and the model parameters of the feature extractor are updated.

12. The training method according to claim 1, characterized in that: The construction of the training derivative includes: Obtaining the failure rate of several functional layers of the feature extractor; wherein the functional layer includes a convolutional layer and a fully connected layer, and the failure rate is the ratio of the number of quasi-fault weight parameters to the number of all weight parameters in the functional layer; Constructing a random fault mask that matches the parameter structure and fault rate of the functional layer; The random fault mask corresponding to each of the functional layers is merged with the weight parameter of the functional layer.

13. The training method according to claim 12, characterized in that: The obtaining of the failure rates of several functional layers of the feature extractor comprises: Obtaining the failure rates of several functional layers that meet the pseudo-fault conditions; the pseudo-fault conditions include that the functional layers are not the first two network layers of the feature extractor and are not the last four network layers of the feature extractor; And / or, the failure rate is 5% to 30%.

14. The training method according to claim 12, characterized in that: The random fault mask is a binary weighted mask, and the ratio of the number of mask parameters being 0 to the total number of mask parameters in the random fault mask matches the fault rate; The fusing of the random fault mask corresponding to each of the functional layers with the weight parameter of the functional layer comprises: Each of the random fault masks is multiplied by a corresponding weight parameter in the network model of the feature extractor.

15. The training method according to claim 1, characterized in that: The image classification model includes the feature extractor and the recognizer; The method of extracting features from the sample image using a pre-trained feature extractor includes: The feature extractor and the recognizer are trained until the image classification model is trained and image classification and / or target recognition tasks can be performed; The identifier is used to perform image classification and / or target recognition based on the features extracted by the feature extractor.

16. A face recognition method, characterized in that: The face recognition method comprises: Obtain an image of a face to be recognized; Extracting facial features of the image to be recognized by using a feature extractor; wherein the feature extractor is trained by using the training method of the feature extractor according to any one of claims 1 to 15; The facial features are input into a face recognition device, and the face recognition device is used for recognition.

17. A training device for a feature extractor, characterized in that: The training device comprises: A fault simulation module, used for constructing a training derivative; wherein the training derivative is used for simulating the feature extractor in a fault state; the fault state includes at least part of the weight parameters used by the feature extractor for feature extraction being set to zero; A control module is used to use a pre-trained feature extractor to extract features from a sample image to obtain source image features; wherein the source image features are used for image classification and / or target recognition; the source image features are input into a generator to obtain a source restored image; the image reconstruction performance of the generator is trained using the error between the source restored image and the sample image; the sample image is extracted from the sample image using the feature extractor to obtain the source image features; the source image features are input into the generator to obtain the source restored image; the sample image is extracted from the sample image using the training derivative to obtain the derived image features; the derived image features are input into the generator to obtain the derived restored image; the classification performance of the classifier is trained using the error between the source restored image and the derived restored image; the sample image is input into the feature extractor to obtain the source image features; the source image features are input into the generator for image reconstruction to obtain the source restored image; the sample image is input into the training derivative to obtain the derived image features; the derived image features are input into the generator to obtain the derived restored image The method comprises the steps of: inputting the source restored image and the derived restored image into the generator for image reconstruction to obtain a derived restored image; inputting the source restored image and the derived restored image into the classifier for classification to obtain the error between the source restored image and the derived restored image; constructing a fault loss function for training the fault-tolerant performance of the feature extractor, and updating the feature extractor using the fault loss function; wherein the fault loss function is obtained based on the error between the source restored image and the derived restored image and the loss in the image reconstruction process of the generator; the fault loss function is obtained based on the error between the source restored image and the derived restored image and the loss in the image reconstruction process of the generator, including: obtaining a source restored image and a derived restored image obtained by image reconstruction of the source image features and the derived image features; obtaining a reconstruction loss function constructed based on the source restored image and the sample image; obtaining a classification loss function constructed based on the source restored image and the derived restored image; fusing the classification loss function and the reconstruction loss function to obtain a fault loss function.

18. A face recognition system, characterized in that: The face recognition system comprises: A feature extractor trained by the feature extractor training method according to any one of claims 1 to 15, used to extract facial features of an image to be recognized; A face recognizer is connected to the feature extractor and is used to receive the face features for recognition.

19. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, it implements the steps of the feature extractor training method described in any one of claims 1 to 15, or implements the steps of the face recognition method described in claim 16.

20. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the feature extractor training method described in any one of claims 1 to 15 are implemented, or the steps of the face recognition method described in claim 16 are implemented.