Image recognition network model training method, image recognition method and device
Through a training method based on image features, identity and posture classifiers are used for posture conversion, and the generator generates an image recognition network model, which solves the problem of large calculation amount in side face image straightening processing and improves the accuracy and efficiency of face recognition. .
Patent Information
- Application Number
- CN201910262855.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-04-02
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2039-04-02
AI Technical Summary
In the existing technology, in face recognition, the processing of side face image forwarding requires a large neural network, which results in a large amount of calculation, high model complexity, consumes a large amount of computing resources, and increases the difficulty of training.
Using a training method based on image features, image features are obtained through identity and posture classifiers, and posture conversion is performed. The generator is used to generate an image recognition network model, which reduces model complexity and computing resource consumption.
It improves the accuracy of side face recognition, reduces the consumption of computing resources, reduces the complexity of the model, and achieves more efficient face recognition performance.
Smart Images

Figure CN110163082B
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and in particular to an image recognition network model training method, an image recognition method and a device. Background Art
[0002] With the rapid development of face recognition technology, face recognition has been applied to many aspects including life and security monitoring. Side face recognition is of great significance in face recognition. In many cases, it is difficult to obtain a person's front face image. For example, the probability of capturing a person's front face in a monitoring scene is relatively small. Therefore, improving the accuracy of side face recognition is a very critical technical problem that needs to be solved in face recognition.
[0003] At present, the way to detect side face images is to first train a Generative Adversarial Network (GAN) model, then input the side face image into the GAN model, and use the GAN model to perform face normalization processing on the side face image without changing the spatial identity to obtain the normalized face image. Finally, the face image is input into the neural network for recognition.
[0004] However, the current method is to perform face rotation based on the original side face image, that is, to perform face rotation on the original image space. Since the original image space is not organized, for example, the length of the original image is 128 and the width is 128, that is, the space size is 3×128×128, a large neural network is required to train the original image space. This process is very computationally intensive, which increases the difficulty of training and the complexity of the model, requiring a large amount of computing resources. Summary of the invention
[0005] The embodiments of the present application provide an image recognition network model training method, an image recognition method and an apparatus, which perform training based only on image features, and the image features are organized and therefore have a smaller spatial dimension than the original image, thereby reducing the difficulty of training and the complexity of the model, and can reduce the consumption of computing resources.
[0006] In view of this, the first aspect of the present application provides an image recognition network model training method, comprising:
[0007] Acquire a first image feature corresponding to a set of images to be trained, wherein the set of images to be trained includes at least one image to be trained, and the image to be trained has an identity tag and a posture tag, the identity tag is used to represent the identity information of a target object in the image to be trained, and the posture tag is used to represent the posture information of the target object in the image to be trained;
[0008] Obtaining a first identity prediction result corresponding to the first image feature through an identity classifier to be trained, and obtaining a first posture prediction result corresponding to the first image feature through a posture classifier to be trained;
[0009] The identity classifier to be trained is trained according to the first identity prediction result and the identity label to obtain an identity classifier, and the posture classifier to be trained is trained according to the first posture prediction result and the posture label to obtain a posture classifier;
[0010] Performing posture conversion on the first image feature through the generator to be trained to obtain a second image feature corresponding to the set of images to be trained, wherein the second image feature corresponds to a target posture;
[0011] Acquire a second identity prediction result corresponding to the second image feature through the identity classifier, and acquire a second posture prediction result corresponding to the second image feature through the posture classifier;
[0012] The generator to be trained is trained according to the second identity prediction result, the identity label, the second posture prediction result, the target posture label, the second image feature and the third image feature to obtain a generator, wherein the third image feature is an image feature corresponding to the image to be trained belonging to the target posture in the image set to be trained, the target posture label represents the information of the target posture, and the generator is used to generate an image recognition network model.
[0013] A second aspect of the present application provides an image recognition method, comprising:
[0014] Acquire a first image to be identified, wherein the first image to be detected includes a first target object, the first target object corresponds to first posture information, and the first target object corresponds to target identity information;
[0015] Obtaining, by means of a generator in an image recognition network model, a second image to be recognized corresponding to the first image to be recognized, wherein the second image to be recognized includes a second target object, the second target object corresponds to second posture information, the second target object corresponds to the target identity information, and the generator is used to perform posture conversion on the object in the image;
[0016] The recognition result of the second image to be recognized is determined by the recognition module in the image recognition network model.
[0017] The third aspect of the present application provides a method for converting facial posture, comprising:
[0018] Acquire a facial image to be normalized, wherein the facial image to be normalized corresponds to first posture information, the facial image to be normalized corresponds to target identity information, and the first posture information represents posture information of the image before normalization;
[0019] The facial image to be normalized is converted by a generator to obtain a normalized facial image corresponding to the facial image to be normalized, wherein the normalized facial image corresponds to second posture information, the normalized facial image corresponds to the target identity information, the second posture information represents the posture information of the image after normalization, and the generator is used to perform posture conversion on the object in the image.
[0020] A fourth aspect of the present application provides a model training device, comprising:
[0021] An acquisition module, configured to acquire a first image feature corresponding to a set of images to be trained, wherein the set of images to be trained includes at least one image to be trained, and the image to be trained has an identity tag and a posture tag, wherein the identity tag is used to represent the identity information of a target object in the image to be trained, and the posture tag is used to represent the posture information of the target object in the image to be trained;
[0022] The acquisition module is further used to acquire a first identity prediction result corresponding to the first image feature through the identity classifier to be trained, and to acquire a first posture prediction result corresponding to the first image feature through the posture classifier to be trained;
[0023] A training module, used for training the identity classifier to be trained according to the first identity prediction result and the identity label obtained by the acquisition module to obtain an identity classifier, and training the posture classifier to be trained according to the first posture prediction result and the posture label obtained by the acquisition module to obtain a posture classifier;
[0024] A conversion module, configured to perform posture conversion on the first image feature acquired by the acquisition module through a generator to be trained, so as to obtain a second image feature corresponding to the set of images to be trained, wherein the second image feature corresponds to a target posture;
[0025] The acquisition module is further used to acquire a second identity prediction result corresponding to the second image feature through the identity classifier trained by the training module, and to acquire a second posture prediction result corresponding to the second image feature through the posture classifier trained by the training module;
[0026] The training module is also used to train the generator to be trained according to the second identity prediction result, the identity label, the second posture prediction result, the target posture label, the second image feature and the third image feature obtained by the acquisition module to obtain a generator, wherein the third image feature is the image feature corresponding to the image to be trained belonging to the target posture in the image set to be trained, the target posture label represents the information of the target posture, and the generator is used to generate an image recognition network model.
[0027] In a possible design, in a first implementation of the fourth aspect of the embodiments of the present application,
[0028] The acquisition module is specifically used to calculate the identity output probability of each category according to the network weight value of the identity classifier to be trained, the first image feature and the identity category;
[0029] Determine the first identity prediction result corresponding to the first image feature according to the identity output probability of each category;
[0030] The training module is specifically used to determine the model parameters of the identity classifier to be trained by using a first loss function according to the first identity prediction result and the identity label;
[0031] The identity classifier is generated using the model parameters of the identity classifier to be trained.
[0032] In a possible design, in a second implementation of the fourth aspect of the embodiments of the present application,
[0033] The acquisition module is specifically used to calculate the identity output probability of each category in the following manner:
[0034]
[0035] Among them, the represents the identity output probability of the jth identity category, i represents the total number of the identity categories, E(x) represents the first image feature, represents the network weight value of the identity classifier to be trained corresponding to the j-th identity category, represents the network weight value of the identity classifier to be trained corresponding to the i-th identity category;
[0036] The first loss function is expressed as:
[0037] L I = -E[logP(y I |Y I )];
[0038] Among them, the L I represents the first loss function, the E represents the expected value calculation, the P(y I |Y I ) represents the Y I Belong to the y I The probability that y I represents the identity tag, the Y I Represents the first identity prediction result.
[0039] In a possible design, in a third implementation of the fourth aspect of the embodiments of the present application,
[0040] The acquisition module is specifically used to calculate the posture output probability of each category according to the network weight value of the posture classifier to be trained, the first image feature and the posture category;
[0041] Determining the first posture prediction result corresponding to the first image feature according to the posture output probability of each category;
[0042] The training module is specifically used to determine the model parameters of the posture classifier to be trained by using a second loss function according to the first posture prediction result and the posture label;
[0043] The posture classifier is generated using the model parameters of the posture classifier to be trained.
[0044] In a possible design, in a fourth implementation of the fourth aspect of the embodiments of the present application,
[0045] The acquisition module is specifically used to calculate the posture output probability of each category in the following manner:
[0046]
[0047] Among them, the represents the identity output probability of the j-th posture category, i represents the total number of the posture categories, E(x) represents the first image feature, represents the network weight value of the posture classifier to be trained corresponding to the j-th posture category, represents the network weight value of the posture classifier to be trained corresponding to the i-th posture category;
[0048] The second loss function is expressed as:
[0049] L P = -E[logP(y P |Y P )];
[0050] Among them, the L P represents the second loss function, the E represents the expected value calculation, the P(y P |Y P ) represents the Y P Belong to the y P The probability that y P represents the posture label, the Y P Represents the second identity prediction result.
[0051] In a possible design, in a fifth implementation of the fourth aspect of the embodiments of the present application,
[0052] The acquisition module is specifically used to acquire the second posture prediction result corresponding to the second image feature through the posture classifier and the target posture label corresponding to the second image feature;
[0053] The second identity prediction result corresponding to the second image feature is obtained through the identity classifier and the identity label corresponding to the first image feature.
[0054] In a possible design, in a sixth implementation of the fourth aspect of the embodiments of the present application,
[0055] The training module is specifically configured to determine a first minimum loss result using a third loss function according to the second identity prediction result and the identity label;
[0056] Determine a second minimum loss result using a fourth loss function according to the second posture prediction result and the target posture label;
[0057] Determine a third minimum loss result using a fifth loss function according to the second image feature and the third image feature, wherein the second image feature is a false input of a discriminator, the third image feature is a true input of the discriminator, and the discriminator is used to perform authenticity discrimination on the second image feature and the third image feature;
[0058] Determine a fourth minimum loss result using a sixth loss function according to the third image feature;
[0059] According to the first minimum loss result, the second minimum loss result, the third minimum loss result and the fourth minimum loss result, the generator to be trained is trained to obtain the generator.
[0060] In a possible design, in a seventh implementation of the fourth aspect of the embodiments of the present application,
[0061] The third loss function is expressed as:
[0062] L IG = -E[logP(y I |Y IG )];
[0063] Among them, the L IG represents the third loss function, E represents the expected value calculation, and P(y I |Y IG ) represents the Y IG Belong to the y I The probability that y I represents the identity tag, the Y IG represents the second identity prediction result;
[0064] The fourth loss function is expressed as:
[0065] L PG = -E[logP(y F |Y PG )];
[0066] Among them, the L PG represents the fourth loss function, the (y F |Y PG ) represents the Y PG Belong to the y F The probability that y F represents the target pose label, the Y PG Represents the second posture prediction result.
[0067] In a possible design, in an eighth implementation of the fourth aspect of the embodiments of the present application,
[0068] The fifth loss function is expressed as:
[0069]
[0070] Among them, the L advD represents the fifth loss function, the D in_fake represents the second image feature, the D in_real represents the third image feature, the E represents expected value calculation, the D() represents the input of the discriminator, and the f represents the input feature;
[0071] The sixth loss function is expressed as:
[0072]
[0073] Among them, the L advG Denotes the sixth loss function.
[0074] A fifth aspect of the present application provides an image recognition device, comprising:
[0075] An acquisition module, configured to acquire a first image to be identified, wherein the first image to be detected includes a first target object, the first target object corresponds to first posture information, and the first target object corresponds to target identity information;
[0076] The acquisition module is further used to acquire a second image to be recognized corresponding to the first image to be recognized through a generator in the image recognition network model, wherein the second image to be recognized includes a second target object, the second target object corresponds to second posture information, the second target object corresponds to the target identity information, and the generator is used to perform posture conversion on the object in the image;
[0077] A determination module is used to determine the recognition result of the second image to be recognized obtained by the acquisition module through the recognition module in the image recognition network model.
[0078] A sixth aspect of the present application provides a face posture conversion device, comprising:
[0079] An acquisition module, used for acquiring a facial image to be normalized, wherein the facial image to be normalized corresponds to first posture information, the facial image to be normalized corresponds to target identity information, and the first posture information represents posture information of the image before normalization;
[0080] A processing module is used to convert the facial image to be normalized obtained by the acquisition module through a generator to obtain a normalized facial image corresponding to the facial image to be normalized, wherein the normalized facial image corresponds to second posture information, the normalized facial image corresponds to the target identity information, the second posture information represents the posture information of the image after normalization, and the generator is used to perform posture conversion on the object in the image.
[0081] A seventh aspect of the present application provides a server, including: a memory, a transceiver, a processor, and a bus system;
[0082] Wherein, the memory is used to store programs;
[0083] The processor is used to execute the program in the memory, comprising the following steps:
[0084] Acquire a first image feature corresponding to a set of images to be trained, wherein the set of images to be trained includes at least one image to be trained, and the image to be trained has an identity tag and a posture tag, the identity tag is used to represent the identity information of a target object in the image to be trained, and the posture tag is used to represent the posture information of the target object in the image to be trained;
[0085] Obtaining a first identity prediction result corresponding to the first image feature through an identity classifier to be trained, and obtaining a first posture prediction result corresponding to the first image feature through a posture classifier to be trained;
[0086] The identity classifier to be trained is trained according to the first identity prediction result and the identity label to obtain an identity classifier, and the posture classifier to be trained is trained according to the first posture prediction result and the posture label to obtain a posture classifier;
[0087] Performing posture conversion on the first image feature through the generator to be trained to obtain a second image feature corresponding to the set of images to be trained, wherein the second image feature corresponds to a target posture;
[0088] Acquire a second identity prediction result corresponding to the second image feature through the identity classifier, and acquire a second posture prediction result corresponding to the second image feature through the posture classifier;
[0089] According to the second identity prediction result, the identity label, the second posture prediction result, the target posture label, the second image feature and the third image feature, the generator to be trained is trained to obtain a generator, wherein the third image feature is an image feature corresponding to the image to be trained belonging to the target posture in the image set to be trained, the target posture label represents information of the target posture, and the generator is used to generate an image recognition network model;
[0090] The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.
[0091] An eighth aspect of the present application provides a terminal device, including: a memory, a transceiver, a processor, and a bus system;
[0092] Wherein, the memory is used to store programs;
[0093] The processor is used to execute the program in the memory, comprising the following steps:
[0094] Acquire a first image to be identified, wherein the first image to be detected includes a first target object, the first target object corresponds to first posture information, and the first target object corresponds to target identity information;
[0095] Obtaining, by means of a generator in an image recognition network model, a second image to be recognized corresponding to the first image to be recognized, wherein the second image to be recognized includes a second target object, the second target object corresponds to second posture information, the second target object corresponds to the target identity information, and the generator is used to perform posture conversion on the object in the image;
[0096] Determining a recognition result of the second image to be recognized by using a recognition module in the image recognition network model;
[0097] The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.
[0098] A ninth aspect of the present application provides a terminal device, including: a memory, a transceiver, a processor, and a bus system;
[0099] Wherein, the memory is used to store programs;
[0100] The processor is used to execute the program in the memory, comprising the following steps:
[0101] Acquire a facial image to be normalized, wherein the facial image to be normalized corresponds to first posture information, the facial image to be normalized corresponds to target identity information, and the first posture information represents posture information of the image before normalization;
[0102] The generator converts the facial image to be normalized to obtain a normalized facial image corresponding to the facial image to be normalized, wherein the normalized facial image corresponds to the second posture information, the normalized facial image corresponds to the target identity information, the second posture information represents the posture information of the normalized image, and the generator is used to perform posture conversion on the object in the image;
[0103] The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.
[0104] The tenth aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the methods described in the above aspects.
[0105] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0106] In an embodiment of the present application, a method for training an image recognition network model is provided, wherein the first image feature corresponding to the image set to be trained is first obtained, and then the first identity prediction result corresponding to the first image feature is obtained through the identity classifier to be trained, and the first posture prediction result corresponding to the first image feature is obtained through the posture classifier to be trained, and then the identity classifier to be trained is trained according to the first identity prediction result and the identity label to obtain the identity classifier, and the posture classifier to be trained is trained according to the first posture prediction result and the posture label to obtain the posture classifier, and the posture classifier to be trained is trained according to the first posture prediction result and the posture label to obtain the posture classifier, and the first image feature is posture-converted by the generator to be trained to obtain the second image feature corresponding to the image set to be trained, and the second identity prediction result corresponding to the second image feature is obtained through the identity classifier, and the second posture prediction result corresponding to the second image feature is obtained through the posture classifier, and finally the generator to be trained is trained according to the second identity prediction result, the identity label, the second posture prediction result, the target posture label, the second image feature and the third image feature to obtain the generator. In the above manner, training is performed only based on image features, and the image features are organized, so they have a smaller spatial dimension than the original image, thereby reducing the difficulty of training, reducing the complexity of the model, and reducing the consumption of computing resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0107] Figure 1 A schematic diagram of the architecture of an image recognition system in an embodiment of the present application;
[0108] Figure 2 A schematic diagram of a framework for converting a non-frontal image into a normal image in an embodiment of the present application;
[0109] Figure 3 This is a schematic diagram of an example of recognition use based on a celebrity multi-pose face dataset in an embodiment of the present application;
[0110] Figure 4 This is a schematic diagram of a verification usage example based on a celebrity multi-pose face dataset in an embodiment of the present application;
[0111] Figure 5 This is a schematic diagram of the statistical distribution of personal photos based on a celebrity multi-pose face dataset in an embodiment of the present application;
[0112] Figure 6 This is a statistical diagram of nationality translation based on a celebrity multi-pose face dataset in an embodiment of the present application;
[0113] Figure 7 A schematic diagram of the structure of the automatic data set acquisition system in the embodiment of the present application;
[0114] Figure 8This is a schematic diagram of annotation information based on a celebrity multi-pose face dataset in an embodiment of the present application;
[0115] Fig. 9 This is a schematic diagram of an embodiment of the image recognition network model training method in the embodiment of the present application;
[0116] Fig.10 A schematic diagram of the structure of the image recognition network model in the embodiment of the present application;
[0117] Fig.11 This is a schematic diagram of an embodiment of the image recognition method in the embodiment of the present application;
[0118] Fig.12 This is a schematic diagram of an embodiment of the method for converting facial posture in the embodiment of the present application;
[0119] Fig.13 A schematic diagram of a process of side face recognition in an embodiment of the present application;
[0120] Fig.14 A schematic diagram of the visualization based on the Multi-PIE dataset in the experimental scenario of this application;
[0121] Fig.15 A schematic diagram is provided for visualizing the celebrity profile dataset in the experimental scenario of this application;
[0122] Fig.16 A schematic diagram of the recognition capability of the image recognition network model at 15 degrees in the experimental scenario of this application;
[0123] Fig.17 A schematic diagram of the recognition capability of the image recognition network model at 90 degrees in the experimental scenario of this application;
[0124] Fig.18 This is a schematic diagram of an embodiment of a model training device in an embodiment of the present application;
[0125] Fig.19 A schematic diagram of an embodiment of an image recognition device in an embodiment of the present application;
[0126] Fig. 20 This is a schematic diagram of an embodiment of a face posture conversion device in an embodiment of the present application;
[0127] Fig.21 A schematic diagram of the structure of the server in the embodiment of the present application;
[0128] Fig. 22 A schematic diagram of the structure of a terminal device in an embodiment of the present application. DETAILED DESCRIPTION
[0129] The embodiments of the present application provide an image recognition network model training method, an image recognition method and an apparatus, which perform training based only on image features, and the image features are organized and therefore have a smaller spatial dimension than the original image, thereby reducing the difficulty of training and the complexity of the model, and can reduce the consumption of computing resources.
[0130] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "corresponding to" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0131] It should be understood that the present application is applied to the field of artificial intelligence, and can be applied to image recognition scenarios in the field of artificial intelligence, and more specifically, can also be applied to face recognition scenarios and detection and tracking scenarios and other face-related technical fields. In practical applications, many interference factors such as posture, glasses, expressions and shadows are prevalent, which will affect the recognition effect to varying degrees. Among them, the problem of side face recognition caused by changes in posture is particularly significant. The frontal processing of the face in the image is not only the basis for subsequent processing, but also has a wide range of application value in the fields of security (for example, when the image of the suspect is collected, the image can be processed frontally to identify the identity of the suspect), finance (for example, when paying, the face image can be processed frontally to identify the identity of the payer), attendance (for example, when the photo of the employee punching in is collected, the photo can be processed frontally to identify the employee's identity), and customs (for example, when the head portrait of the tourist is collected, the head portrait can be processed frontally to identify the identity of the tourist). The method provided in this application can be deployed in a camera or cloud server to provide side face recognition technology, relax the position restrictions of the face recognition camera during the placement process, and make face recognition possible under some extreme human posture conditions. In addition, it can be deployed in mobile phones for unlocking or paying, thereby improving convenience and ease of use.
[0132] For ease of understanding, this application proposes an image recognition method, which is applied to Figure 1 The image recognition system shown in Figure 1 , Figure 1This is a schematic diagram of the architecture of the image recognition system in the embodiment of the present application. As shown in the figure, the model training method provided in the present application can be applied to the server, and an image recognition network model is obtained by the server training, and the image recognition network model can be deployed in the client or in the cloud server. If deployed in the client, the client can perform positive processing on the image in an offline state, and then recognize the positive image. If deployed in a cloud server, the client can send the image to be recognized to the cloud server in an online state, and the cloud server will perform positive processing on the image, and then recognize the positive image, and finally the recognition result can be fed back to the client.
[0133] It should be noted that the client is deployed on the terminal device, where the terminal device includes but is not limited to tablet computers, laptop computers, PDAs, mobile phones, voice interaction devices, personal computers (PCs), gate machines, time clock machines, and cameras, which are not limited here. Among them, the voice interaction device includes but is not limited to smart speakers and smart home appliances.
[0134] In the model training process, a conventional face recognition network is first trained using a convolutional neural network, and then the trained face feature layer in the face recognition network is used as the input of the GAN to generate a corrected feature with the same dimension as the original feature. This corrected feature is the feature expression of the face at any angle after correction. In the stage of training the GAN, the final classification layer of the face recognition network needs to be used to provide identity invariant loss for the new feature. In addition, the final classification layer of a pre-trained face posture evaluation network needs to be used to provide posture constraint information for the new feature. Finally, in order to alleviate the problem of overfitting of the corrected features to the posture constraints and identity constraints, adversarial losses can also be added to the generated features. The true input of the discriminator is the feature output of the positive face sample through the face recognition network, and the false input is the corrected feature of any sample after passing through the generator. By adjusting the weights of the three losses of identity constraint, posture constraint and adversarial constraint, the converted facial features can achieve better side face recognition effect than the original side face features, thereby significantly improving the accuracy of side face recognition and greatly improving the camera performance in application scenarios such as face attendance and face gates. At the same time, it weakens the restrictions on the posture of the person being recognized and improves the comfort in scenarios such as face clocking in, gates, payment and search.
[0135] Based on the above introduction, the dataset used in the model training of this application can be a Multi-PIE dataset or a celebrity frontal-probile (CFP) dataset. However, in the benchmarks disclosed by pose invariant face recognition (PIFR), these datasets may be limited in laboratory environments or may contain only a small number of test images. Therefore, these images are not enough to evaluate the capabilities of different algorithms. In view of the above problems, this application uses a celebrity poseface dataset (CPFD), which is a million-level face dataset captured from a network engine with large pose variations, which can be used for pose-invariant face verification and recognition. This application introduces a face frontalization module to learn the frontal representation in the feature space of all faces (frontal and non-frontal), which is called adversarial feature frontalization (AFF).
[0136] For ease of introduction, see Figure 2 , Figure 2 This is a framework diagram for converting a non-frontal image to a positive image in an embodiment of the present application. As shown in the figure, two images corresponding to the postures of the target object are obtained, which are image A and image B. First, image A and image B are input into the feature extractor of the Convolutional Neural Network (CNN), and the initial features of image A and image B are output using a conventional face recognition network. The initial features of image A and the initial features of image B are compared, and the Euclidean distance of the features is 1.36. Assuming that the threshold is 0.95, 1.36 is greater than 0.95, which means that the identities of image A and image B are inconsistent. The initial features of image A and the initial features of image B are input into the AFF generator trained by the present application to obtain the frontal features of image A and the frontal features of image B, that is, after passing through the AFF generator, the non-frontal features are transformed into frontal features. The frontal features of image A and the frontal features of image B are compared, and the Euclidean distance of the features is 0.52. 0.52 is less than 0.95, which means that the identities of image A and image B are consistent.
[0137] For further information, see Figure 3 , Figure 3This is a schematic diagram of an example of recognition use based on a celebrity multi-pose face dataset in an embodiment of the present application. As shown in the figure, for each face registered in the system in advance, faces belonging to the same identity are found in a query library containing millions of faces. Taking the venue check-in scenario as an example, the query library is used to query the face data collected when checking in at the venue, and the collected faces are matched with the faces registered in the system in advance to find the face with the smallest Euclidean distance that is less than a threshold (for example, 0.95) as the recognition result. Figure 3 The easy difficulty level indicates that the face is offset at a small angle, the medium difficulty level indicates that the face is offset at a slightly larger angle, and the hard difficulty level indicates that the face is offset at the largest angle. Figure 4 , Figure 4 This is a schematic diagram of a verification use example based on a celebrity multi-pose face dataset in an embodiment of the present application. As shown in the figure, in the process of matching face images, it is necessary to first turn the face image with an offset angle to obtain a frontal face image, and then compare the frontal face image with face images of different difficulty levels to determine the possibility of belonging to the same person, which can be applied to scenes such as unlocking. Therefore, CPFD can provide good feedback on the performance of face recognition algorithms in various scenarios.
[0138] Based on the existing PIFR test set scale and CPFD scale, this application provides a comparative diagram, see Table 1.
[0139] Table 1
[0140] Benchmarks Number of images Verification pair (1:1) Images in gallery (1:N) Multi-PIE Dataset 149,400 - 99 CFP Dataset 7,000 7,000 - CPFD 886,577 137,196 1,000,000
[0141] As can be seen from Table 1, the CPFD used in this application has a better evaluation benchmark than the PIFR test set, and includes more image data, which enhances the generalization ability of CPFD. The number of images in CPFD is 886,577, which is much larger than the existing benchmarks. The number of verification pairs and the number of images in the gallery are also large, which is conducive to open training.
[0142] See also Figure 5 , Figure 5 This is a schematic diagram of the statistical distribution of personal photos based on the celebrity multi-pose face dataset in the embodiment of the present application. As shown in the figure, taking CPFD as an example, which contains 9071 identity tags in total, assuming that it includes 2,596,325 images, each identity tag has an average of 286 images. Given that the datasets contained in CPFD are all celebrities, for example, Zhang San has 400 images and Li Si has 200 images, Figure 5As can be seen, there is 1 identity label with 0 to 10 images, 178 identities with 0 to 30 images, 1816 identities with 30 to 100 images, 5499 identities with 100 to 500 images, and 1577 identities with more than 500 images. Since most of the identities in CPFD are Asian, please refer to Figure 6 , Figure 6 This is a statistical diagram of nationality translation based on a celebrity multi-pose face dataset in an embodiment of the present application. As shown in the figure, 76% of the face images in CPFD come from China, 10% of the face images come from South Korea, 11% of the face images come from Japan, and 3% of the face images come from other Asian countries.
[0143] In order to facilitate data collection, this application provides an automatic data set collection system, please refer to Figure 7 , Figure 7 This is a structural diagram of the automatic data set acquisition system in the embodiment of the present application. As shown in the figure, the automatic data set acquisition system includes a name list, collects and cleans images by a hierarchical clustering method, the input of the system is a sublist Lseed, the pre-trained model M is used as a feature extractor, and the system outputs a high-quality face recognition data set and a trained face recognition network. The acquisition process is specifically as follows: first, a sublist Lseed is collected. Assuming that Lseed can include 600 people, the identities of these 600 people are used to search for related images on the website, thereby expanding Lseed to a list of more than 10,000 people. It can be understood that 10,000 is only a schematic, and an extended list of other people can also be set in actual applications. Then, images belonging to the extended list (which can be photos or synthetic images, etc.) are downloaded from the website to obtain an image pool. The face images in the image pool are detected by multi-task convolutional neural networks (MTCNN), and the detected face images are used to train a preliminary face recognition network. After training the face recognition network, extract the features of each person, and then filter out the images that do not belong to this person through the clustering algorithm based on the features of each person. For example, searching for Zhang San's images may return Zhao Wu's images, and then Zhao Wu's images need to be filtered out. The filtered images are then used to train a new face recognition network, which has better recognition results. Based on the new face recognition network, continue to filter the data set. After multiple iterations, the noise in the data set can be cleaned up, thus obtaining an ideal data set (such as CPFD). Please refer to Figure 8 , Figure 8This is a schematic diagram of annotation information based on a celebrity multi-pose face dataset in an embodiment of the present application. As shown in the figure, each identity label in the CPFD corresponds to annotation information, and the annotation information includes gender and the offset angle of the face.
[0144] Combined with the above introduction, the following will introduce the image recognition network model training method in this application, please refer to Fig. 9 In the embodiment of the present application, an embodiment of the image recognition network model training method includes:
[0145] 101. Obtain a first image feature corresponding to a set of images to be trained, wherein the set of images to be trained includes at least one image to be trained, and the image to be trained has an identity tag and a posture tag, the identity tag is used to represent identity information of a target object in the image to be trained, and the posture tag is used to represent posture information of the target object in the image to be trained;
[0146] In this embodiment, the model training device first obtains a set of images to be trained, wherein the set of images to be trained may include at least one image to be trained, but in order to ensure the training efficiency, the set of images to be trained may include 265 images to be trained. It should be noted that the set of images to be trained may come from CPFD or other types of data sets, which is not limited here. The model training device may be deployed on a server or on a terminal device, which is not limited here. The images to be trained may be facial images, animal images, landscape images or other types of images. In this application, the image to be trained is illustrated as a facial image, but this should not be understood as a limitation on this application.
[0147] For easier understanding, see Fig.10 , Fig.10 This is a structural diagram of the image recognition network model in the embodiment of the present application. As shown in the figure, the training of the image recognition network model mainly includes the training of these two parts of the network, namely the backbone network of multi-task learning (multi-task main branch) and the feature normalization network based on adversarial learning. The backbone network of multi-task learning can perform image recognition (specifically face recognition) and posture prediction at the same time. Each image to be trained in the set of images to be trained is input into the feature extractor (E), and the feature extractor (E) outputs the first image feature E(x) corresponding to each image to be trained. Among them, the first image feature represents the initial face representation of each image to be trained in the set of images to be trained, and the length of the first image feature is m, and m can be a 64 floating point number or a 128 floating point number.
[0148] It is understandable that the feature extractor (E) can be any deep convolutional neural network, such as a residual neural network (Residual Neural Network, ResNet) or a visual geometry group (Visual Geometry Group, VGG) network, etc., which is not limited here.
[0149] It is understandable that each image to be trained has a corresponding identity tag and a posture tag, wherein the identity tag is used to indicate the identity information of the target object in the image to be trained. The target object may specifically refer to a person in the image, and the identity information may be represented as an identifier, such as 001, and the identity information of the identifier 001 is "Zhang San". The posture tag is used to indicate the posture information of the target object in the image to be trained. The posture information may be represented as an identifier, such as identifier 100, and the posture information of identifier 100 indicates that the offset angle range is within 5 degrees to 15 degrees.
[0150] In the present application, the posture tag is designed for the offset angle (yaw), and each posture tag corresponds to an offset angle within a range. It can be understood that in practical applications, the pitch angle (pitch) and the rotation angle (roll) can also be designed.
[0151] 102. Obtain a first identity prediction result corresponding to the first image feature by using the identity classifier to be trained, and obtain a first posture prediction result corresponding to the first image feature by using the posture classifier to be trained;
[0152] In this embodiment, based on the first image feature obtained in step 101, the model training device inputs the first image feature into the identity classifier to be trained, and the identity classifier to be trained outputs the first identity prediction result. For example, the identity label of the image A to be trained in the image set to be trained is 001 (Zhang San), and the first identity prediction result of the image A to be trained is 026 (Li Si). Similarly, based on the first image feature obtained in step 101, the first image feature is input into the posture classifier to be trained, and the posture classifier to be trained outputs the first posture prediction result. For example, the posture label of the image A to be trained in the image set to be trained is 101 (the offset angle range is between -5 degrees and 0 degrees), and the first posture prediction result of the image A to be trained is 103 (the offset angle range is between 0 degrees and 5 degrees).
[0153] 103. Train the identity classifier to be trained according to the first identity prediction result and the identity label to obtain an identity classifier, and train the posture classifier to be trained according to the first posture prediction result and the posture label to obtain a posture classifier;
[0154] In this embodiment, the model training device can use the cross entropy classification loss function to train Fig.10The backbone network of the multi-task learning shown in FIG. 1 is to train the identity classifier to be trained based on the first identity prediction result and the identity label using the cross entropy classification loss function to obtain the identity classifier. Similarly, based on the first posture prediction result and the posture label, the posture classifier to be trained is trained using the cross entropy classification loss function to obtain the posture classifier.
[0155] 104. Performing posture conversion on the first image feature through the generator to be trained to obtain a second image feature corresponding to the set of images to be trained, wherein the second image feature corresponds to the target posture;
[0156] In this embodiment, after completing steps 101 to 103, the training is performed to obtain Fig.10 The identity classifier C shown I And the pose classifier C P Please continue reading Fig.10 The feature conversion network based on adversarial learning includes a generator (G) and a discriminator (D) composed of a multi-layer perceptron (MLP). The generator (G) is mainly used to generate a positive facial feature expression that maintains the original identity information, and the discriminator (D) is mainly used to determine whether the input is an original feature or a generated feature.
[0157] The model training device inputs the first image feature E(x) corresponding to each image to be trained in the image set to be trained into the generator to be trained, and the generator to be trained outputs the second image feature G(E(x)) corresponding to each image to be trained, that is, after passing through the generator to be trained, the original posture feature of the image to be trained will be changed, so that the image to be trained corresponds to the target posture, and the target posture can specifically be the posture corresponding to the front face, and the offset angle under this posture is 90 degrees.
[0158] 105. Obtain a second identity prediction result corresponding to the second image feature through an identity classifier, and obtain a second posture prediction result corresponding to the second image feature through a posture classifier;
[0159] In this embodiment, the model training device inputs the second image feature into the identity classifier, and the identity classifier outputs the second identity prediction result, wherein in principle, the second identity prediction result needs to be consistent with the identity label of the image to be trained. For example, if the identity label of the image A to be trained in the image set to be trained is 001 (Zhang San), then the output second identity prediction result is 001 (Zhang San). Similarly, the second image feature is input into the posture classifier, and the posture classifier outputs the second posture prediction result, wherein in principle, the second posture prediction result should be the posture of the face after being straightened.
[0160] It is understandable that the identity classifier CI And the pose classifier C P The network weight values in are fixed.
[0161] 106. Train the generator to be trained according to the second identity prediction result, the identity label, the second posture prediction result, the target posture label, the second image feature and the third image feature to obtain a generator, wherein the third image feature is an image feature corresponding to the image to be trained that belongs to the target posture in the image set to be trained, the target posture label represents the information of the target posture, and the generator is used to generate an image recognition network model.
[0162] In this embodiment, the model training device uses the second image feature G(E(x)) corresponding to each image to be trained as the false input of the discriminator (D), and uses the third image feature corresponding to the target posture in the image set to be trained as the true input of the discriminator (D), wherein the target posture can specifically be the posture corresponding to the front face, and the offset angle under this posture is 90 degrees, and the third image feature is the result obtained after the feature expression of the part of the image to be trained that belongs to the front face in the image set to be trained. Among them, the real front face feature (third image feature) is used as the true input of the discriminator (D) in order to prevent the discriminator (D) from using the posture as the main basis for discrimination due to the different postures before and after the straightening, and failing to reasonably capture the feature distribution of normal facial features.
[0163] The model training device adopts a loss function to train the discriminator according to the second image features and the third image features to obtain a trained discriminator. Based on the trained discriminator, the model training device continues to adopt a loss function to train the generator to be trained according to the second identity prediction result, the identity label, the second posture prediction result and the target posture label to obtain a generator. The generator is used as a part of the image recognition network model to convert the side face image into a front face image. Another part of the image recognition network model is a recognition module, which is used to recognize the face image after the conversion, and then determine the identity of the face image.
[0164] In an embodiment of the present application, a method for training an image recognition network model is provided, wherein the first image feature corresponding to the image set to be trained is first obtained, and then the first identity prediction result corresponding to the first image feature is obtained through the identity classifier to be trained, and the first posture prediction result corresponding to the first image feature is obtained through the posture classifier to be trained, and then the identity classifier to be trained is trained according to the first identity prediction result and the identity label to obtain the identity classifier, and the posture classifier to be trained is trained according to the first posture prediction result and the posture label to obtain the posture classifier, and the posture classifier to be trained is trained according to the first posture prediction result and the posture label to obtain the posture classifier, and the first image feature is posture-converted by the generator to be trained to obtain the second image feature corresponding to the image set to be trained, and the second identity prediction result corresponding to the second image feature is obtained through the identity classifier, and the second posture prediction result corresponding to the second image feature is obtained through the posture classifier, and finally the generator to be trained is trained according to the second identity prediction result, the identity label, the second posture prediction result, the target posture label, the second image feature and the third image feature to obtain the generator. In the above manner, training is performed only based on image features, and the image features are organized, so they have a smaller spatial dimension than the original image, thereby reducing the difficulty of training, reducing the complexity of the model, and reducing the consumption of computing resources.
[0165] Optionally, in the above Fig. 9 On the basis of the corresponding embodiments, in a first optional embodiment of the image recognition network model training method provided in the embodiments of the present application, obtaining a first identity prediction result corresponding to a first image feature through an identity classifier to be trained may include:
[0166] Calculate the identity output probability of each category according to the network weight value of the identity classifier to be trained, the first image feature and the identity category;
[0167] Determine a first identity prediction result corresponding to the first image feature according to the identity output probability of each category;
[0168] The identity classifier to be trained is trained according to the first identity prediction result and the identity label to obtain the identity classifier, including:
[0169] Determine the model parameters of the identity classifier to be trained using a first loss function according to the first identity prediction result and the identity label;
[0170] The identity classifier is generated using the model parameters of the identity classifier to be trained.
[0171] In this embodiment, a method for training an identity classifier is introduced. Specifically, first, the model training device inputs each image to be trained in the image set to be trained into the feature extractor. Among them, the network parameters of the feature extractor, the identity classifier to be trained, and the posture classifier to be trained all need to be trained. The output of the neural network can be constrained by the posture label and the identity label. This constraint process enables the feature extractor to extract features in the image. The identity classifier to be trained constrains the neural network through the identity label so that a gradient is back-propagated, and the gradient updates the feature extractor and the identity classifier to be trained at the same time. Next, the model training device calculates the identity output probability of each category according to the network weight value of the identity classifier to be trained, the predicted first image feature, and the identity category, wherein the identity category can have 1000, and the first image feature can be the initial image feature of all the images to be trained in the image set to be trained. Based on the identity output probability of each category, the first identity prediction result of each image to be trained in the image set to be trained is determined, that is, the first identity prediction result corresponding to each first image feature is obtained.
[0172] Finally, the model training device uses the first loss function to calculate the first identity prediction result of each image to be trained and the identity label of each image to be trained. When the result of the first loss function is minimized, the model parameters corresponding to the minimum value are obtained, and the model parameters of the identity classifier to be trained are used to generate an identity classifier.
[0173] It is understandable that the backbone network of the entire multi-task learning is trained together, because the feature extractor needs to learn useful information from the identity label and the posture label to obtain an effective feature extractor. In the initial stage, the network parameters of the feature extractor and the network parameters of the posture classifier to be trained are meaningless, but after joint training, the feature extractor and the posture classifier to be trained will be trained synchronously, thus obtaining a better feature extractor and posture classifier.
[0174] Secondly, in an embodiment of the present application, a method for training an identity classifier is provided, firstly, according to the network weight value of the identity classifier to be trained, the first image feature and the identity category, the identity output probability of each category is calculated, then the first identity prediction result corresponding to the first image feature is determined according to the identity output probability of each category, and then the model parameters of the identity classifier to be trained are determined by using the first loss function based on the first identity prediction result and the identity label, and finally the identity classifier is generated by using the model parameters of the identity classifier to be trained. In the above manner, the true value and the predicted value are calculated using the cross entropy classification loss function, and the model parameters can be obtained when the result of the cross entropy classification loss function is minimized, wherein the advantage of using the cross entropy as the loss function is that the problem of reduced learning rate of the mean square error loss function can be avoided when the gradient is descended using the sigmoid function, because the learning rate can be controlled by the output error.
[0175] Optionally, in the above Fig. 9 On the basis of the corresponding first embodiment, in a second optional embodiment of the image recognition network model training method provided in the embodiment of the present application, according to the network weight value of the identity classifier to be trained, the first image feature and the identity category, calculating the identity output probability of each category may include:
[0176] The identity output probability of each category is calculated as follows:
[0177]
[0178] in, represents the identity output probability of the jth identity category, i represents the total number of identity categories, E(x) represents the first image feature, represents the network weight value of the identity classifier to be trained corresponding to the j-th identity category, represents the network weight value of the identity classifier to be trained corresponding to the i-th identity category;
[0179] The first loss function can be expressed as:
[0180] L I = -E[logP(y I |Y I )];
[0181] Among them, L I represents the first loss function, E represents the expected value calculation, P(y I |Y I ) indicates Y I Belong to y I The probability of y I Indicates the identity tag, Y I Represents the first identity prediction result.
[0182] In this embodiment, a method for calculating the identity output probability of each category is introduced. Fig.10 In the backbone network of multi-task learning shown in the figure, in order to encode more identity information into the first image feature E(x), an identity classifier C can be added to the first image feature E(x) I , thus, the main branch becomes multi-task learning. Let w I Denotes the identity classifier C I The network weight values in , the output Y from the identity classification branch I It can be formulated as:
[0183] Y I =C I (E(x));
[0184]
[0185] in, represents the identity output probability of the jth identity category, i represents the total number of identity categories, E(x) represents the first image feature, represents the network weight value of the identity classifier to be trained corresponding to the j-th identity category, Represents the network weight value of the identity classifier to be trained corresponding to the i-th identity category.
[0186] Next, jointly train the feature extractor, the identity classifier to be trained, and the posture classifier to be trained, respectively, by the identity classification loss (i.e., the first loss function) L I And posture classification loss (i.e., the second loss function) L P Supervision, where the first loss function can be expressed as:
[0187] L I = -E[logP(y I |Y I )];
[0188] Among them, L I represents the first loss function, E represents the expected value calculation, P(y I |Y I ) indicates Y I Belong to y I The probability of yI represents the identity label, Y I Represents the first identity prediction result.
[0189] Again, in the embodiment of the present application, a specific form of the first loss function is provided. Through the above method, a feasible basis can be provided for the implementation of the solution, thereby improving the feasibility and operability of model training.
[0190] Optionally, in the above Fig. 9 On the basis of the corresponding first embodiment, in a third optional embodiment of the image recognition network model training method provided in the embodiment of the present application, obtaining a first posture prediction result corresponding to a first image feature through a posture classifier to be trained may include:
[0191] Calculate the posture output probability of each category according to the network weight value of the posture classifier to be trained, the first image feature and the posture category;
[0192] Determine a first posture prediction result corresponding to the first image feature according to the posture output probability of each category;
[0193] The posture classifier to be trained is trained according to the first posture prediction result and the posture label to obtain a posture classifier, including:
[0194] Determine the model parameters of the posture classifier to be trained using a second loss function according to the first posture prediction result and the posture label;
[0195] The posture classifier is generated using the model parameters of the posture classifier to be trained.
[0196] In this embodiment, a method for training a posture classifier is introduced. Specifically, first, the model training device inputs each image to be trained in the image set to be trained into the feature extractor. Among them, the feature extractor, the posture classifier to be trained and the network parameters of the posture classifier to be trained all need to be trained. The output of the neural network can be constrained by the posture label and the identity label. This constraint process is to enable the feature extractor to extract features in the image. The posture classifier to be trained constrains the neural network through the posture label so that a gradient is back-propagated, and the gradient simultaneously updates the feature extractor and the posture classifier to be trained. Next, the model training device calculates the posture output probability of each category according to the network weight value of the posture classifier to be trained, the predicted first image feature and the posture category, wherein the posture category can have 1000, and the first image feature can be the initial image feature of all the images to be trained in the image set to be trained. Based on the posture output probability of each category, the first posture prediction result of each image to be trained in the image set to be trained is determined, that is, the first posture prediction result corresponding to each first image feature is obtained.
[0197] Finally, the model training device uses the first loss function to calculate the first posture prediction result of each image to be trained and the posture label of each image to be trained. When the result of the first loss function is minimized, the model parameters corresponding to the minimum value are obtained, and the posture classifier is generated using the model parameters of the posture classifier to be trained.
[0198] It is understandable that the backbone network of the entire multi-task learning is trained together, because the feature extractor needs to learn useful information from the pose label and the pose classifier to obtain an effective feature extractor. In the initial stage, the network parameters of the feature extractor and the network parameters of the pose classifier to be trained are meaningless, but after joint training, the feature extractor and the pose classifier to be trained will be trained synchronously, thus obtaining a better feature extractor and pose classifier.
[0199] Secondly, in an embodiment of the present application, a method for training a posture classifier is provided. First, according to the network weight value of the posture classifier to be trained, the first image feature and the posture category, the posture output probability of each category is calculated, and then the first posture prediction result corresponding to the first image feature is determined according to the posture output probability of each category. Then, the model parameters of the posture classifier to be trained are determined using the first loss function based on the first posture prediction result and the posture label, and finally the posture classifier is generated using the model parameters of the posture classifier to be trained. In the above manner, the true value and the predicted value are calculated using the cross entropy classification loss function, and the model parameters can be obtained when the result of the cross entropy classification loss function is minimized. Among them, the advantage of using cross entropy as the loss function is that the problem of reduced learning rate of the mean square error loss function can be avoided when the gradient is descended using the sigmoid function, because the learning rate can be controlled by the output error.
[0200] Optionally, in the above Fig. 9 On the basis of the corresponding third embodiment, in a fourth optional embodiment of the image recognition network model training method provided in the embodiment of the present application, according to the network weight value of the posture classifier to be trained, the first image feature and the posture category, the posture output probability of each category is calculated, which may include:
[0201] The posture output probability of each category is calculated as follows:
[0202]
[0203] in, represents the identity output probability of the jth posture category, i represents the total number of posture categories, E(x) represents the first image feature, represents the network weight value of the posture classifier to be trained corresponding to the j-th posture category, represents the network weight value of the posture classifier to be trained corresponding to the i-th posture category;
[0204] The second loss function can be expressed as:
[0205] L P = -E[logP(y P |YP )];
[0206] Among them, L P represents the second loss function, E represents the expected value calculation, P(y P |Y P ) indicates Y P Belong to y P The probability of y P represents the pose label, Y P Represents the second identity prediction result.
[0207] In this embodiment, a method for calculating the output probability of each category of posture is introduced. Fig.10 In order to encode more posture information into the first image feature E(x), a posture classifier C can be added to the first image feature E(x). P , thus, the main branch is transformed into multi-task learning. The supervision information in the multi-task learning process comes from the posture values predicted by the DeepPose algorithm. Then, all the posture values are segmented and classified at fixed intervals to obtain the true value of the posture for training. Let w P Represents the pose classifier C P The network weight values in , the output Y from the pose classification branch P It can be formulated as:
[0208] Y P =C P (E(x));
[0209]
[0210] in, represents the identity output probability of the jth posture category, i represents the total number of posture categories, E(x) represents the first image feature, represents the network weight value of the posture classifier to be trained corresponding to the j-th posture category, Represents the network weight value of the posture classifier to be trained corresponding to the i-th posture category.
[0211] Next, the feature extractor, the identity classifier to be trained, and the posture classifier to be trained are jointly trained, supervised by the identity classification loss (i.e., the first loss function) and the posture classification loss (i.e., the second loss function), respectively. The second loss function can be expressed as:
[0212] L P = -E[logP(y P |Y P )];
[0213] Among them, LP represents the second loss function, E represents the expected value calculation, P(y P |Y P ) indicates Y P Belong to y P The probability of y P represents the pose label, Y P Represents the second identity prediction result.
[0214] Again, in the embodiment of the present application, a specific form of the second loss function is provided. Through the above method, a feasible basis can be provided for the implementation of the solution, thereby improving the feasibility and operability of model training.
[0215] Optionally, in the above Fig. 9 as well as Fig. 9 On the basis of any one of the corresponding first to fourth embodiments, in a fifth optional embodiment of the image recognition network model training method provided in the embodiment of the present application, obtaining a second identity prediction result corresponding to the second image feature through an identity classifier, and obtaining a second posture prediction result corresponding to the second image feature through a posture classifier may include:
[0216] Obtaining a second posture prediction result corresponding to the second image feature through a posture classifier and a target posture label corresponding to the second image feature;
[0217] A second identity prediction result corresponding to the second image feature is obtained through the identity classifier and the identity label corresponding to the first image feature.
[0218] In this embodiment, after training the posture classifier and identity classifier, based on Fig.10 The feature normalization network based on adversarial learning shown in the figure uses the first image feature E(x) output by the backbone network as the input of the generator to be trained, obtains the second image feature G(E(x)) after the posture is changed by the generator to be trained, and then inputs the second image feature G(E(x)) into the trained posture classifier and identity classifier, and fixes the network weights of the posture classifier and identity classifier. At this time, when training the generator to be trained, the target posture label corresponding to the second image feature and the identity label corresponding to the first image feature are added, with the true value as a constraint.
[0219] Specifically, when predicting the second posture prediction result corresponding to the second image feature, the target posture label corresponding to the second image feature needs to be used as supervision. The target posture label refers to the true value of the posture after correction, so as to ensure that the second image feature G(E(x)) after correction has a positive face posture. When predicting the second identity prediction result corresponding to the second image feature, the identity label corresponding to the first image feature needs to be used as supervision. The identity label is also the true value of the identity, so as to ensure that the second image feature G(E(x)) after correction has the same identity as the first image feature E(x) before correction.
[0220] Furthermore, in an embodiment of the present application, a method is provided for a posture classifier to obtain a second posture prediction result and a second identity prediction result corresponding to a second image feature, that is, the second posture prediction result corresponding to the second image feature is obtained through the posture classifier and the target posture label corresponding to the second image feature, and the second identity prediction result corresponding to the second image feature is obtained through the identity classifier and the identity label corresponding to the first image feature. Through the above method, when the network parameters of the identity classifier and the network parameters of the posture classifier are fixed, the true value of the posture after correction and the true value of the identity before correction are used as supervision, which can force the constraint that the corrected feature can maintain the same identity as before correction, and at the same time, the constraint that the corrected feature can have a positive face posture.
[0221] Optionally, in the above Fig. 9 On the basis of the corresponding embodiments, in a sixth optional embodiment of the image recognition network model training method provided in the embodiments of the present application, according to the second identity prediction result, the identity label, the second posture prediction result, the target posture label, the second image feature and the third image feature, the generator to be trained is trained to obtain the generator, which may include:
[0222] Determine a first minimum loss result using a third loss function according to the second identity prediction result and the identity label;
[0223] Determine a second minimum loss result using a fourth loss function according to the second posture prediction result and the target posture label;
[0224] Determine a third minimum loss result using a fifth loss function according to the second image feature and the third image feature, wherein the second image feature is a false input of the discriminator, the third image feature is a true input of the discriminator, and the discriminator is used to perform authenticity discrimination on the second image feature and the third image feature;
[0225] Determine a fourth minimum loss result using a sixth loss function according to the third image feature;
[0226] According to the first minimum loss result, the second minimum loss result, the third minimum loss result and the fourth minimum loss result, the generator to be trained is trained to obtain a generator.
[0227] In this embodiment, how to train the generator is introduced. Specifically, four parts need to be trained, that is, the loss function results are minimized alternately in sequence. Assume that the image set to be trained includes 265 face images to be trained, of which 60 face images are frontal images, so the features of these 60 frontal images are extracted to obtain the third image features. After obtaining the feature trainer, identity classifier and posture classifier, the generator and discriminator can be trained iteratively. The update of the generator needs to ensure that the identity remains unchanged and the posture becomes frontal. Therefore, it is necessary to train through the third loss function (for maintaining identity invariance) and the fourth loss function (for ensuring the frontal posture), and use the fifth loss function (for adversarial training of the discriminator) and the sixth loss function for supervision (for adversarial training of the generator).
[0228] Secondly, in an embodiment of the present application, a specific method for training a generator is provided. According to the second identity prediction result and the identity label, a third loss function is used to determine the first minimum loss result. According to the second posture prediction result and the target posture label, a fourth loss function is used to determine the second minimum loss result. According to the second image feature and the third image feature, a fifth loss function is used to determine the third minimum loss result. According to the third image feature, a sixth loss function is used to determine the fourth minimum loss result. Finally, the four minimum loss results are used to train the generator to be trained to obtain the generator. In the above manner, the generator is trained by alternately minimizing the third loss function, the fourth loss function, the fifth loss function and the sixth loss function, so that it can obtain the frontal features of the normal facial feature classification while ensuring that the identity remains unchanged, thereby improving the feasibility and reliability of face conversion.
[0229] Optionally, in the above Fig. 9 On the basis of the corresponding sixth embodiment, in a seventh optional embodiment of the image recognition network model training method provided by the embodiment of the present application, the third loss function can be expressed as:
[0230] L IG = -E[logP(y I |Y IG )];
[0231] Among them, L IG represents the third loss function, E represents the expected value calculation, P(y I |Y IG ) indicates Y IG Belong to y IThe probability of y I Indicates the identity tag, Y IG represents the second identity prediction result;
[0232] The fourth loss function can be expressed as:
[0233] L PG = -E[logP(y F |Y PG )];
[0234] Among them, L PG represents the fourth loss function, (y F |Y PG ) indicates Y PG Belong to y F The probability of y F represents the target pose label, Y PG Represents the second posture prediction result.
[0235] In this embodiment, the third loss function is used to calculate the second identity prediction result and the identity label. The third loss function L IG Specifically, it can be a cross entropy loss function, where the transformed second image feature is input into the identity classifier C I In the above example, we can get the following third loss function:
[0236] Y IG =C I (G(E(x)));
[0237] L IG = -E[logP(y I |Y IG )];
[0238] Among them, L IG represents the third loss function, E represents the expected value calculation, P(y I |Y IG ) indicates Y IG Belong to y I The probability of y I Indicates the identity tag, Y IG Represents the second identity prediction result.
[0239] Similarly, the fourth loss function is used to calculate the second posture prediction result and the target posture label. The fourth loss function L PG Specifically, it can be a cross entropy loss function, and the transformed second image features are input into the posture classifier C P In the fourth loss function, we can get the following:
[0240] Y PG =C P(G(E(x)));
[0241] L PG = -E[logP(y F |Y PG )];
[0242] Among them, L PG represents the fourth loss function, (y F |Y PG ) indicates Y PG Belong to y F The probability of y F represents the target pose label, Y PG Represents the second posture prediction result.
[0243] Again, in the embodiments of the present application, specific forms of the third loss function and the fourth loss function are provided. Through the above method, a feasible basis can be provided for the implementation of the solution, thereby improving the feasibility and operability of model training.
[0244] Optionally, in the above Fig. 9 On the basis of the corresponding sixth embodiment, in an eighth optional embodiment of the image recognition network model training method provided by the embodiment of the present application, the fifth loss function may be expressed as:
[0245]
[0246] Among them, L advD Denotes the fifth loss function, D in_fake represents the second image feature, D in_real represents the third image feature, E represents the expected value calculation, D() represents the input of the discriminator, and f represents the input feature;
[0247] The sixth loss function can be expressed as:
[0248]
[0249] Among them, L advG Represents the sixth loss function.
[0250] In this embodiment, the fifth loss function is used to calculate the second image feature and the third image feature. The third image feature is the image feature corresponding to the frontal face image in the image set to be trained. Assuming that the image set to be trained has a total of 265 face images, of which 60 face images are frontal face images, then the third image feature is the feature extracted from these 60 frontal face images. The second image feature is the false input of the discriminator, and the third image feature is the true input of the discriminator, that is, the true frontal face image feature (i.e., the third image feature) is:
[0251] D in_real=E(x) frontal ;
[0252] The features of the profile face after being transformed (i.e., the second image features) are:
[0253] D in_fake = G(E(x));
[0254] Based on the second image feature and the third image feature, a fifth loss function can be obtained, wherein the fifth loss function is mainly used to train the discriminator, and the fifth loss function is expressed as:
[0255]
[0256] Among them, L advD Denotes the fifth loss function, D in_fake represents the second image feature, D in_real represents the third image feature, E represents the expected value calculation, D() represents the input of the discriminator, and f represents the input feature.
[0257] Based on the third image feature, a sixth loss function can be obtained, wherein the sixth loss function is mainly used to train the generator, and the sixth loss function is expressed as:
[0258]
[0259] Again, in the embodiments of the present application, specific forms of the fifth loss function and the sixth loss function are provided. Through the above method, a feasible basis can be provided for the implementation of the solution, thereby improving the feasibility and operability of model training.
[0260] In combination with the above introduction, the image recognition method in this application will be introduced below. Fig.11 In the embodiment of the present application, an image recognition method includes:
[0261] 201. Acquire a first image to be identified, wherein the first image to be detected includes a first target object, the first target object corresponds to first posture information, and the first target object corresponds to target identity information;
[0262] In this embodiment, a first image to be identified is first obtained, wherein the first image to be identified usually has an offset angle, such as an offset angle of 15 degrees, and the corresponding first posture information is 15 degrees. In practical applications, the first image to be identified may itself be a frontal face image, and the corresponding first posture information is 0 degrees. The first image to be identified includes a first target object, wherein the first target object is usually a person, or an animal. Assuming that there are two people in the first image to be identified, namely Zhang San and Li Si, then a first target object can be selected from it, such as Zhang San, and the target identity information corresponding to Zhang San is obtained.
[0263] 202. Obtaining, by means of a generator in an image recognition network model, a second image to be recognized corresponding to the first image to be recognized, wherein the second image to be recognized includes a second target object, the second target object corresponds to second posture information, the second target object corresponds to target identity information, and the generator is used to perform posture conversion on the object in the image;
[0264] In this embodiment, the first image to be recognized is input into the generator of the image recognition network model. It can be understood that the generation method of the generator can be referred to in Fig. 9 The corresponding embodiments are not described in detail here. The generator performs conversion processing on the first image to be identified, and specifically, the face can be processed to be normalized, so as to obtain a second image to be identified corresponding to the first image to be identified. The second image to be identified includes a second target object, and the second target object and the first target object belong to the same object, that is, correspond to the same target identity information, but the second target object and the second target object have different postures, and the second target object corresponds to second posture information, and the second posture information can specifically refer to a frontal face posture.
[0265] 203. Determine a recognition result of a second image to be recognized through a recognition module in the image recognition network model.
[0266] In this embodiment, the normalized second image to be identified is finally input into a recognition module in the image recognition network model, and the recognition module identifies the object in the second image to be identified, thereby obtaining a recognition result.
[0267] In an embodiment of the present application, a method for image recognition is provided, firstly obtaining a first image to be recognized, then obtaining a second image to be recognized corresponding to the first image to be recognized through a generator in an image recognition network model, and finally determining the recognition result of the second image to be recognized through a recognition module in the image recognition network model. In the above manner, the side face image is processed by a generator to be turned to the right position, which can significantly improve the accuracy of side face recognition, greatly improve the camera performance in application scenarios such as face attendance and face gates, and at the same time weaken the restrictions on the posture of the person being recognized, and improve the comfort level in scenarios such as face clocking in, gates, payment, and search.
[0268] In combination with the above introduction, the face posture conversion method in this application will be introduced below. Fig.12 In the embodiment of the present application, an embodiment of the face posture conversion method includes:
[0269] 301. Acquire a facial image to be normalized, wherein the facial image to be normalized corresponds to first posture information, the facial image to be normalized corresponds to target identity information, and the first posture information indicates posture information of the image before normalization;
[0270] In this embodiment, a facial image to be corrected is first obtained, wherein the facial image to be corrected usually has an offset angle, such as an offset angle of 15 degrees, and the corresponding first posture information is 15 degrees. In practical applications, the facial image to be corrected may itself be a frontal face image, and the corresponding first posture information is 0 degrees. The facial image to be corrected corresponds to the target identity information, which represents the identity of the facial image to be corrected, for example, "Zhang San" or "Li Si".
[0271] 302. The facial image to be corrected is converted by a generator to obtain a corrected facial image corresponding to the facial image to be corrected, wherein the corrected facial image corresponds to the second posture information, the corrected facial image corresponds to the target identity information, the second posture information represents the posture information of the image after correction, and the generator is used to perform posture conversion on the object in the image.
[0272] In this embodiment, for the convenience of explanation, please refer to Fig.13 , Fig.13 This is a flow chart of side face recognition in an embodiment of the present application. As shown in the figure, in step S1, an image is obtained, which is the face image to be normalized. In step S2, the face image to be normalized is input into the trained generator. It can be understood that the generation method of the generator can be referred to in Fig. 9The corresponding embodiments are not described in detail here. The generator performs conversion processing on the facial image to be straightened, and specifically, the face can be straightened to obtain a straightened facial image corresponding to the facial image to be straightened. Among them, the straightened facial image corresponds to the second posture information, and the second posture information can be a frontal face posture, or a posture set according to actual conditions. The present application uses the frontal face posture as an example for explanation, but this should not be understood as a limitation of the present application. The straightened facial image has the same target identity information as the facial image to be straightened. In step S3, a classifier can be further used to identify the target identity information.
[0273] It can be understood that in addition to straightening the face, the present application can also use the adversarial network to fine-tune the facial features.
[0274] In an embodiment of the present application, a method for converting facial posture is provided, wherein a facial image to be corrected is first obtained, and then the facial image to be corrected is input into a generator, and the facial image to be corrected is converted by the generator to obtain a corrected facial image corresponding to the facial image to be corrected. In the above manner, the trained generator can be used to correct the facial image, thereby generating a frontal face image, and the generator can ensure that the facial image after correction belongs to the same identity as the facial image before correction, and has a different posture, so that the facial features after correction can achieve a better side face recognition effect than the original side face features.
[0275] For ease of introduction, see Fig.14 , Fig.14 This is a schematic diagram based on the visualization of the Multi-PIE dataset in the experimental scenario of this application. As shown in the figure, the first row is the input image, the second row is the constructed image space based on the original Margin-MT1 feature map, where Margin-MT represents a multi-task face recognition network with classification gaps, and the third row is the image obtained by frontalization of the AFF module. Fig.15 , Fig.15 A schematic diagram is provided for visualizing the celebrity front and side face dataset in the experimental scenario of this application. As shown in the figure, the first row is the input image, the second row is the constructed image space based on the original Margin-MT1 feature map, where Margin-MT represents a multi-task face recognition network with classification gaps, and the third row is the image obtained by frontalization of the AFF module.
[0276] Further, for ease of introduction, please refer to Fig.16 , Fig.16 This is a schematic diagram of the recognition ability of the image recognition network model at 15 degrees in the experimental scenario of this application. As shown in the figure, when the offset angle is 15 degrees, the image recognition network model provided by this application has better discrimination ability. Fig.17 , Fig.17 This is a schematic diagram of the recognition capability of the image recognition network model at 90 degrees in the experimental scenario of this application. As shown in the figure, the image recognition network model has the best recognition capability at 90 degrees.
[0277] Based on the above introduction, the application of this application will be described below by taking several different types of data sets as examples. For ease of understanding, please refer to Table 2, which is a schematic table of recognition accuracy in the Multi-PIE data set.
[0278] Table 2
[0279] method ±90° ±75° ±60° ±45° ±30° ±15° CPF - - - 71.65 81.05 89.45 TP-GAN 64.03 84.10 92.93 98.58 99.85 99.78 PIM2 75.00 91.20 97.70 98.30 99.40 99.80 Margin-MT1 81.17 93.51 99.12 99.82 99.97 99.92 AFF1 84.85 95.06 99.34 99.95 100 99.96 Margin-MT2 81.96 93.08 98.27 99.67 99.92 99.99 AFF2 87.49 95.08 99.41 100 100 100
[0280] Among them, Margin-MT1 and Margin-MT2 represent multi-task face recognition networks with classification gaps, the backbone structure of Margin-MT1 and AFF1 is Resnet18, the backbone structure of Margin-MT2 and AFF2 is Resnet50, TP-GAN represents a dual-channel generation model, and PIM2 represents a posture invariant module. As can be seen from Table 2, AFF2 has the highest recognition accuracy, especially at ±45°, ±30°, and ±15°.
[0281] Please refer to Table 3, which is a schematic diagram of the recognition accuracy of the Multi-PIE dataset for ablation research.
[0282] Table 3
[0283] set up ±90° ±75° ±60° ±45° <![CDATA[There is no L adv > 83.35 93.14 99.38 99.96 <![CDATA[There is no L PG > 83.81 94.49 99.36 99.96 <![CDATA[No L adv &L PG > 82.75 94.48 99.33 99.97 AFF1 84.19 94.58 99.54 99.97
[0284] As can be seen from Table 3, AFF1 has the highest recognition accuracy for ablation studies on the Multi-PIE dataset.
[0285] Please refer to Table 4, which is a schematic table of recognition accuracy based on CPFD. Among them, Top1 represents the probability of identifying the person closest to a certain person from the pre-stored image base, and the returned person is the correct answer. Top5 represents the probability of identifying the 5 people closest to a certain person from the pre-stored image base, and the returned 5 people are the correct answer. 100K and 1M represent the size of the image base, respectively. The larger the base, the greater the recognition difficulty.
[0286] Table 4
[0287]
[0288] Please refer to Table 5, Figure 5The following table shows the evaluation results of the CPFD verification task. The following three indicators are used to evaluate the verification task, namely accuracy (Acc), equal error rate (EER) and true positive rate (TPR).
[0289] Table 5
[0290]
[0291] Please refer to Table 6, which is a schematic diagram of the evaluation results of the CFP dataset.
[0292] Table 6
[0293] method Acc EER TPR@FPR=0.1% DR-GAN 93.41 - - PIM2 93.10 7.69 - Uvmap 94.05 - - DREAM - 6.02 - GNAP-LRes18 95.19 4.97 78.31 Human 94.57 5.02 - Margin-MT1 96.10 3.83 75.91 AFF1 96.51 3.31 79.54 Margin-MT2 97.21 2.66 76.80 AFF2 97.37 2.29 79.89
[0294] Among them, TPR@false positive rate (FPR) = 0.1% means the recognition rate under the error rate of one thousandth, DR-GAN means decoupled generative network, GNAP-LRes18 means global normalized average pooling residual network 18, Human means human performance, and DREAM means equal transformation residual module. As can be seen from Table 2, AFF2 has the best evaluation result.
[0295] Please refer to Table 7, which is a schematic diagram of the evaluation results in MegaFace Challenge 1.
[0296] Table 7
[0297] Dataset Batch size Number of training iterations Top 1 (%) CASIA 128 / 2 60k 73.09 VggFace 128 / 2 60k 76.29 CASIA+CPFD 128 / 2 60k 78.82 VggFace2+CASIA 128 / 2 60k 78.62 VggFace+CPFD 256 / 4 100k 84.46
[0298] Among them, CASIA stands for the Institute of Automation of the Chinese Academy of Sciences, and VGGFace stands for the Oxford Visual Geometry Group Face Dataset.
[0299] The model training device in this application is described in detail below. Fig.18 , Fig.18 This is a schematic diagram of an embodiment of a model training device in an embodiment of the present application. The model training device 40 includes:
[0300] An acquisition module 401 is used to acquire a first image feature corresponding to a set of images to be trained, wherein the set of images to be trained includes at least one image to be trained, and the image to be trained has an identity tag and a posture tag, wherein the identity tag is used to represent the identity information of a target object in the image to be trained, and the posture tag is used to represent the posture information of the target object in the image to be trained;
[0301] The acquisition module 401 is further used to acquire the first identity prediction result corresponding to the first image feature through the identity classifier to be trained, and acquire the first posture prediction result corresponding to the first image feature through the posture classifier to be trained;
[0302] A training module 402 is used to train the identity classifier to be trained according to the first identity prediction result and the identity label obtained by the acquisition module 401 to obtain an identity classifier, and to train the posture classifier to be trained according to the first posture prediction result and the posture label obtained by the acquisition module to obtain a posture classifier;
[0303] A conversion module 403 is used to perform posture conversion on the first image feature obtained by the acquisition module 401 through a generator to be trained, so as to obtain a second image feature corresponding to the image set to be trained, wherein the second image feature corresponds to a target posture;
[0304] The acquisition module 401 is further used to acquire the second identity prediction result corresponding to the second image feature converted by the conversion module 403 through the identity classifier trained by the training module 402, and to acquire the second posture prediction result corresponding to the second image feature through the posture classifier trained by the training module 402;
[0305] The training module 402 is also used to train the generator to be trained according to the second identity prediction result, the identity label, the second posture prediction result, the target posture label, the second image feature and the third image feature obtained by the acquisition module 401 to obtain a generator, wherein the third image feature is the image feature corresponding to the image to be trained belonging to the target posture in the image set to be trained, the target posture label represents the information of the target posture, and the generator is used to generate an image recognition network model.
[0306] In this embodiment, the acquisition module 401 acquires a first image feature corresponding to a set of images to be trained, wherein the set of images to be trained includes at least one image to be trained, and the image to be trained has an identity tag and a posture tag, the identity tag is used to represent the identity information of the target object in the image to be trained, and the posture tag is used to represent the posture information of the target object in the image to be trained, the acquisition module 401 acquires a first identity prediction result corresponding to the first image feature through an identity classifier to be trained, and acquires a first posture prediction result corresponding to the first image feature through the posture classifier to be trained, the training module 402 trains the identity classifier to be trained according to the first identity prediction result and the identity tag acquired by the acquisition module 401 to obtain an identity classifier, and trains the posture classifier to be trained according to the first posture prediction result and the posture tag acquired by the acquisition module to obtain a posture classifier, and the conversion module 403 converts the first posture prediction result and the posture classifier acquired by the acquisition module 401 into a posture classifier through a generator to be trained. The first image feature is taken for posture conversion to obtain the second image feature corresponding to the set of images to be trained, wherein the second image feature corresponds to the target posture, the acquisition module 401 obtains the second identity prediction result corresponding to the second image feature converted by the conversion module 403 through the identity classifier trained by the training module 402, and obtains the second posture prediction result corresponding to the second image feature through the posture classifier trained by the training module 402. The training module 402 trains the generator to be trained according to the second identity prediction result, the identity label, the second posture prediction result, the target posture label, the second image feature and the third image feature obtained by the acquisition module 401 to obtain a generator, wherein the third image feature is the image feature corresponding to the image to be trained that belongs to the target posture in the set of images to be trained, and the target posture label represents the information of the target posture, and the generator is used to generate an image recognition network model.
[0307] In an embodiment of the present application, a model training device is provided. First, the model training device obtains a first image feature corresponding to a set of images to be trained, then obtains a first identity prediction result corresponding to the first image feature through an identity classifier to be trained, and obtains a first posture prediction result corresponding to the first image feature through a posture classifier to be trained, and then trains the identity classifier to be trained according to the first identity prediction result and the identity label to obtain an identity classifier, and trains the posture classifier to be trained according to the first posture prediction result and the posture label to obtain a posture classifier, and performs posture conversion on the first image feature through a generator to be trained to obtain a second image feature corresponding to the set of images to be trained, obtains a second identity prediction result corresponding to the second image feature through the identity classifier, obtains a second posture prediction result corresponding to the second image feature through the posture classifier, and finally trains the generator to be trained according to the second identity prediction result, the identity label, the second posture prediction result, the target posture label, the second image feature and the third image feature to obtain a generator. In the above manner, training is performed only based on image features, and the image features are organized, so they have a smaller spatial dimension than the original image, thereby reducing the difficulty of training, reducing the complexity of the model, and reducing the consumption of computing resources.
[0308] Optionally, in the above Fig.18 On the basis of the corresponding embodiment, in another embodiment of the model training device 40 provided in the embodiment of the present application,
[0309] The acquisition module 401 is specifically used to calculate the identity output probability of each category according to the network weight value of the identity classifier to be trained, the first image feature and the identity category;
[0310] Determine the first identity prediction result corresponding to the first image feature according to the identity output probability of each category;
[0311] The training module 402 is specifically configured to determine the model parameters of the identity classifier to be trained by using a first loss function according to the first identity prediction result and the identity label;
[0312] The identity classifier is generated using the model parameters of the identity classifier to be trained.
[0313] Secondly, in an embodiment of the present application, a method for training an identity classifier is provided, firstly, according to the network weight value of the identity classifier to be trained, the first image feature and the identity category, the identity output probability of each category is calculated, then the first identity prediction result corresponding to the first image feature is determined according to the identity output probability of each category, and then the model parameters of the identity classifier to be trained are determined by using the first loss function based on the first identity prediction result and the identity label, and finally the identity classifier is generated by using the model parameters of the identity classifier to be trained. In the above manner, the true value and the predicted value are calculated using the cross entropy classification loss function, and the model parameters can be obtained when the result of the cross entropy classification loss function is minimized, wherein the advantage of using the cross entropy as the loss function is that the problem of reduced learning rate of the mean square error loss function can be avoided when the gradient is descended using the sigmoid function, because the learning rate can be controlled by the output error.
[0314] Optionally, in the above Fig.18 On the basis of the corresponding embodiment, in another embodiment of the model training device 40 provided in the embodiment of the present application,
[0315] The acquisition module 401 is specifically used to calculate the identity output probability of each category in the following manner:
[0316]
[0317] Among them, the represents the identity output probability of the jth identity category, i represents the total number of the identity categories, E(x) represents the first image feature, represents the network weight value of the identity classifier to be trained corresponding to the j-th identity category, represents the network weight value of the identity classifier to be trained corresponding to the i-th identity category;
[0318] The first loss function is expressed as:
[0319] L I = -E[logP(y I |Y I )];
[0320] Among them, the L I represents the first loss function, the E represents the expected value calculation, the P(y I |Y I ) represents the Y I Belong to the y I The probability that y I represents the identity tag, the Y I Represents the first identity prediction result.
[0321] Again, in the embodiment of the present application, a specific form of the first loss function is provided. Through the above method, a feasible basis can be provided for the implementation of the solution, thereby improving the feasibility and operability of model training.
[0322] Optionally, in the above Fig.18 On the basis of the corresponding embodiment, in another embodiment of the model training device 40 provided in the embodiment of the present application,
[0323] The acquisition module 401 is specifically used to calculate the posture output probability of each category according to the network weight value of the posture classifier to be trained, the first image feature and the posture category;
[0324] Determining the first posture prediction result corresponding to the first image feature according to the posture output probability of each category;
[0325] The training module 402 is specifically used to determine the model parameters of the posture classifier to be trained by using a second loss function according to the first posture prediction result and the posture label;
[0326] The posture classifier is generated using the model parameters of the posture classifier to be trained.
[0327] Secondly, in an embodiment of the present application, a method for training a posture classifier is provided. First, according to the network weight value of the posture classifier to be trained, the first image feature and the posture category, the posture output probability of each category is calculated, and then the first posture prediction result corresponding to the first image feature is determined according to the posture output probability of each category. Then, the model parameters of the posture classifier to be trained are determined using the first loss function based on the first posture prediction result and the posture label, and finally the posture classifier is generated using the model parameters of the posture classifier to be trained. In the above manner, the true value and the predicted value are calculated using the cross entropy classification loss function, and the model parameters can be obtained when the result of the cross entropy classification loss function is minimized. Among them, the advantage of using cross entropy as the loss function is that the problem of reduced learning rate of the mean square error loss function can be avoided when the gradient is descended using the sigmoid function, because the learning rate can be controlled by the output error.
[0328] Optionally, in the above Fig.18 On the basis of the corresponding embodiment, in another embodiment of the model training device 40 provided in the embodiment of the present application,
[0329] The acquisition module 401 is specifically used to calculate the posture output probability of each category in the following manner:
[0330]
[0331] Among them, the represents the identity output probability of the j-th posture category, i represents the total number of the posture categories, E(x) represents the first image feature, represents the network weight value of the posture classifier to be trained corresponding to the j-th posture category, represents the network weight value of the posture classifier to be trained corresponding to the i-th posture category;
[0332] The second loss function is expressed as:
[0333] L P = -E[logP(y P |Y P )];
[0334] Among them, the L P represents the second loss function, the E represents the expected value calculation, the P(y P |Y P ) represents the Y P Belong to the y P The probability that y P represents the posture label, the Y P Represents the second identity prediction result.
[0335] Again, in the embodiment of the present application, a specific form of the second loss function is provided. Through the above method, a feasible basis can be provided for the implementation of the solution, thereby improving the feasibility and operability of model training.
[0336] Optionally, in the above Fig.18 On the basis of the corresponding embodiment, in another embodiment of the model training device 40 provided in the embodiment of the present application,
[0337] The acquisition module 401 is specifically used to acquire the second posture prediction result corresponding to the second image feature through the posture classifier and the target posture label corresponding to the second image feature;
[0338] The second identity prediction result corresponding to the second image feature is obtained through the identity classifier and the identity label corresponding to the first image feature.
[0339] Furthermore, in an embodiment of the present application, a method is provided for a posture classifier to obtain a second posture prediction result and a second identity prediction result corresponding to a second image feature, that is, the second posture prediction result corresponding to the second image feature is obtained through the posture classifier and the target posture label corresponding to the second image feature, and the second identity prediction result corresponding to the second image feature is obtained through the identity classifier and the identity label corresponding to the first image feature. Through the above method, when the network parameters of the identity classifier and the network parameters of the posture classifier are fixed, the true value of the posture after correction and the true value of the identity before correction are used as supervision, which can force the constraint that the corrected feature can maintain the same identity as before correction, and at the same time, the constraint that the corrected feature can have a positive face posture.
[0340] Optionally, in the above Fig.18 On the basis of the corresponding embodiment, in another embodiment of the model training device 40 provided in the embodiment of the present application,
[0341] The training module 402 is specifically configured to determine a first minimum loss result using a third loss function according to the second identity prediction result and the identity label;
[0342] Determine a second minimum loss result using a fourth loss function according to the second posture prediction result and the target posture label;
[0343] Determine a third minimum loss result using a fifth loss function according to the second image feature and the third image feature, wherein the second image feature is a false input of a discriminator, the third image feature is a true input of the discriminator, and the discriminator is used to perform authenticity discrimination on the second image feature and the third image feature;
[0344] Determine a fourth minimum loss result using a sixth loss function according to the third image feature;
[0345] According to the first minimum loss result, the second minimum loss result, the third minimum loss result and the fourth minimum loss result, the generator to be trained is trained to obtain the generator.
[0346] Secondly, in an embodiment of the present application, a specific method for training a generator is provided. According to the second identity prediction result and the identity label, a third loss function is used to determine the first minimum loss result. According to the second posture prediction result and the target posture label, a fourth loss function is used to determine the second minimum loss result. According to the second image feature and the third image feature, a fifth loss function is used to determine the third minimum loss result. According to the third image feature, a sixth loss function is used to determine the fourth minimum loss result. Finally, the four minimum loss results are used to train the generator to be trained to obtain the generator. In the above manner, the generator is trained by alternately minimizing the third loss function, the fourth loss function, the fifth loss function and the sixth loss function, so that it can obtain the frontal features of the normal facial feature classification while ensuring that the identity remains unchanged, thereby improving the feasibility and reliability of face conversion.
[0347] Optionally, in the above Fig.18 On the basis of the corresponding embodiment, in another embodiment of the model training device 40 provided in the embodiment of the present application,
[0348] The third loss function is expressed as:
[0349] L IG = -E[logP(y I |Y IG )];
[0350] Among them, the L IG represents the third loss function, E represents the expected value calculation, and P(y I |Y IG ) represents the Y IG Belong to the y I The probability that y I represents the identity tag, the Y IG represents the second identity prediction result;
[0351] The fourth loss function is expressed as:
[0352] L PG = -E[logP(y F |Y PG )];
[0353] Among them, the L PG represents the fourth loss function, the (y F |Y PG ) represents the Y PG Belong to the y F The probability that y F represents the target pose label, the Y PGRepresents the second posture prediction result.
[0354] Again, in the embodiments of the present application, specific forms of the third loss function and the fourth loss function are provided. Through the above method, a feasible basis can be provided for the implementation of the solution, thereby improving the feasibility and operability of model training.
[0355] Optionally, in the above Fig.18 On the basis of the corresponding embodiment, in another embodiment of the model training device 40 provided in the embodiment of the present application,
[0356] The fifth loss function is expressed as:
[0357]
[0358] Among them, the L advD represents the fifth loss function, the D in_fake represents the second image feature, the D in_real represents the third image feature, the E represents expected value calculation, the D() represents the input of the discriminator, and the f represents the input feature;
[0359] The sixth loss function is expressed as:
[0360]
[0361] Among them, the L advG Denotes the sixth loss function.
[0362] Again, in the embodiments of the present application, specific forms of the fifth loss function and the sixth loss function are provided. Through the above method, a feasible basis can be provided for the implementation of the solution, thereby improving the feasibility and operability of model training.
[0363] The image recognition device in this application is described in detail below. Fig.19 , Fig.19 This is a schematic diagram of an embodiment of an image recognition device in an embodiment of the present application. The image recognition device 50 includes:
[0364] An acquisition module 501 is used to acquire a first image to be recognized, wherein the first image to be detected includes a first target object, the first target object corresponds to first posture information, and the first target object corresponds to target identity information;
[0365] The acquisition module 501 is further used to acquire a second image to be recognized corresponding to the first image to be recognized through a generator in the image recognition network model, wherein the second image to be recognized includes a second target object, the second target object corresponds to second posture information, the second target object corresponds to the target identity information, and the generator is used to perform posture conversion on the object in the image;
[0366] The determination module 502 is used to determine the recognition result of the second image to be recognized obtained by the acquisition module 502 through the recognition module in the image recognition network model.
[0367] In this embodiment, the acquisition module 501 acquires a first image to be identified, wherein the first image to be detected includes a first target object, the first target object corresponds to first posture information, and the first target object corresponds to target identity information. The acquisition module 501 acquires a second image to be identified corresponding to the first image to be identified through a generator in an image recognition network model, wherein the second image to be identified includes a second target object, the second target object corresponds to second posture information, and the second target object corresponds to the target identity information. The generator is used to perform posture conversion on objects in the image. The determination module 502 determines the recognition result of the second image to be identified acquired by the acquisition module 502 through the recognition module in the image recognition network model.
[0368] In an embodiment of the present application, a method for image recognition is provided, firstly obtaining a first image to be recognized, then obtaining a second image to be recognized corresponding to the first image to be recognized through a generator in an image recognition network model, and finally determining the recognition result of the second image to be recognized through a recognition module in the image recognition network model. In the above manner, the side face image is processed by a generator to be turned to the right position, which can significantly improve the accuracy of side face recognition, greatly improve the camera performance in application scenarios such as face attendance and face gates, and at the same time weaken the restrictions on the posture of the person being recognized, and improve the comfort level in scenarios such as face clocking in, gates, payment, and search.
[0369] The following is a detailed description of the face posture conversion device in this application. Fig. 20 , Fig. 20 This is a schematic diagram of an embodiment of a face posture conversion device in an embodiment of the present application. The face posture conversion device 60 includes:
[0370] An acquisition module 601 is used to acquire a facial image to be normalized, wherein the facial image to be normalized corresponds to first posture information, the facial image to be normalized corresponds to target identity information, and the first posture information represents posture information of the image before normalization;
[0371] The processing module 602 is used to convert the facial image to be straightened obtained by the acquisition module 601 through a generator to obtain a straightened facial image corresponding to the facial image to be straightened, wherein the straightened facial image corresponds to the second posture information, the straightened facial image corresponds to the target identity information, the second posture information represents the posture information of the image after straightening, and the generator is used to perform posture conversion on the object in the image.
[0372] In this embodiment, the acquisition module 601 acquires a facial image to be straightened, wherein the facial image to be straightened corresponds to first posture information, the facial image to be straightened corresponds to target identity information, and the first posture information represents the posture information of the image before straightening. The processing module 602 converts the facial image to be straightened acquired by the acquisition module 601 through a generator to obtain a straightened facial image corresponding to the facial image to be straightened, wherein the straightened facial image corresponds to second posture information, the straightened facial image corresponds to the target identity information, and the second posture information represents the posture information of the image after straightening. The generator is used to perform posture conversion on objects in the image.
[0373] In an embodiment of the present application, a face posture conversion device is provided, which first obtains a face image to be corrected, and then inputs the face image to be corrected into a generator, and the face image to be corrected is converted by the generator to obtain a corrected face image corresponding to the face image to be corrected. In the above manner, the trained generator can be used to correct the face image, thereby generating a frontal face image. The generator can ensure that the face image after correction belongs to the same identity as the face image before correction, and has a different posture, so that the face features after correction can achieve a better side face recognition effect than the original side face features.
[0374] Fig.21 7 is a schematic diagram of a server structure provided in an embodiment of the present application. The server 700 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 722 (for example, one or more processors) and a memory 732, and one or more storage media 730 (for example, one or more mass storage devices) storing application programs 742 or data 744. Among them, the memory 732 and the storage medium 730 may be temporary storage or permanent storage. The program stored in the storage medium 730 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 722 may be configured to communicate with the storage medium 730 to execute a series of instruction operations in the storage medium 730 on the server 700.
[0375] The server 700 may also include one or more power supplies 726, one or more wired or wireless network interfaces 750, one or more input and output interfaces 758, and / or one or more operating systems 741, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0376] The steps performed by the server in the above embodiment can be based on the Fig.21 The server structure shown.
[0377] In the embodiment of the present application, the CPU 722 included in the terminal also has the following functions:
[0378] Acquire a first image feature corresponding to a set of images to be trained, wherein the set of images to be trained includes at least one image to be trained, and the image to be trained has an identity tag and a posture tag, the identity tag is used to represent the identity information of a target object in the image to be trained, and the posture tag is used to represent the posture information of the target object in the image to be trained;
[0379] Obtaining a first identity prediction result corresponding to the first image feature through an identity classifier to be trained, and obtaining a first posture prediction result corresponding to the first image feature through a posture classifier to be trained;
[0380] The identity classifier to be trained is trained according to the first identity prediction result and the identity label to obtain an identity classifier, and the posture classifier to be trained is trained according to the first posture prediction result and the posture label to obtain a posture classifier;
[0381] Performing posture conversion on the first image feature through the generator to be trained to obtain a second image feature corresponding to the set of images to be trained, wherein the second image feature corresponds to a target posture;
[0382] Acquire a second identity prediction result corresponding to the second image feature through the identity classifier, and acquire a second posture prediction result corresponding to the second image feature through the posture classifier;
[0383] The generator to be trained is trained according to the second identity prediction result, the identity label, the second posture prediction result, the target posture label, the second image feature and the third image feature to obtain a generator, wherein the third image feature is an image feature corresponding to the image to be trained belonging to the target posture in the image set to be trained, the target posture label represents the information of the target posture, and the generator is used to generate an image recognition network model.
[0384] The present application also provides another image recognition device and a face posture conversion device, such as Fig. 22 For the sake of convenience, only the parts related to the embodiments of the present application are shown. For specific technical details not disclosed, please refer to the method part of the embodiments of the present application. The terminal device can be any terminal device including a mobile phone, a tablet computer, a personal digital assistant (PDA), a point of sales (POS), a car computer, etc., taking the mobile phone as an example:
[0385] Fig. 22 FIG. 1 is a block diagram showing a partial structure of a mobile phone related to a terminal device provided in an embodiment of the present application. Fig. 22 The mobile phone includes: a radio frequency (RF) circuit 810, a memory 820, an input unit 830, a display unit 840, a sensor 850, an audio circuit 860, a wireless fidelity (WiFi) module 870, a processor 880, and a power supply 890. Those skilled in the art will understand that Fig. 22 The mobile phone structure shown in the figure does not constitute a limitation on the mobile phone, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0386] Combine the following Fig. 22 A detailed introduction to the various components of the mobile phone:
[0387] The RF circuit 810 can be used for receiving and sending signals during the process of sending and receiving information or making calls. In particular, after receiving the downlink information of the base station, it is sent to the processor 880 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit 810 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (Low Noise Amplifier, LNA), a duplexer, etc. In addition, the RF circuit 810 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to the Global System of Mobile communication (Global System of Mobile communication, GSM), General Packet Radio Service (General Packet Radio Service, GPRS), Code Division Multiple Access (Code Division Multiple Access, CDMA), Wideband Code Division Multiple Access (Wideband Code Division Multiple Access, WCDMA), Long Term Evolution (Long Term Evolution, LTE), email, Short Messaging Service (SMS), etc.
[0388] The memory 820 can be used to store software programs and modules. The processor 880 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 820. The memory 820 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 820 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0389] The input unit 830 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the mobile phone. Specifically, the input unit 830 may include a touch panel 831 and other input devices 832. The touch panel 831, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 831 or near the touch panel 831 using any suitable object or accessory such as a finger, stylus, etc.), and drive the corresponding connection device according to a pre-set program. Optionally, the touch panel 831 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 880, and can receive and execute commands sent by the processor 880. In addition, the touch panel 831 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 831, the input unit 830 may also include other input devices 832. Specifically, the other input devices 832 may include but are not limited to one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, etc.
[0390] The display unit 840 can be used to display information input by the user or information provided to the user and various menus of the mobile phone. The display unit 840 may include a display panel 841. Optionally, the display panel 841 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch panel 831 may cover the display panel 841. When the touch panel 831 detects a touch operation on or near it, it is transmitted to the processor 880 to determine the type of touch event. Subsequently, the processor 880 provides a corresponding visual output on the display panel 841 according to the type of touch event. Although in Fig. 22 In the embodiment, the touch panel 831 and the display panel 841 are used as two independent components to realize the input and output functions of the mobile phone, but in some embodiments, the touch panel 831 and the display panel 841 can be integrated to realize the input and output functions of the mobile phone.
[0391] The mobile phone may also include at least one sensor 850, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 841 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 841 and / or the backlight when the mobile phone is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can be configured in the mobile phone, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be repeated here.
[0392] The audio circuit 860, the speaker 861, and the microphone 862 can provide an audio interface between the user and the mobile phone. The audio circuit 860 can transmit the received audio data to the speaker 861 after converting the received audio data into an electrical signal, which is converted into a sound signal for output; on the other hand, the microphone 862 converts the collected sound signal into an electrical signal, which is received by the audio circuit 860 and converted into audio data, and then the audio data is output to the processor 880 for processing, and then sent to another mobile phone through the RF circuit 810, or the audio data is output to the memory 820 for further processing.
[0393] WiFi is a short-range wireless transmission technology. The mobile phone can help users send and receive emails, browse web pages and access streaming media through the WiFi module 870. It provides users with wireless broadband Internet access. Fig. 22 A WiFi module 870 is shown, but it is understandable that it is not an essential component of the mobile phone and can be omitted as needed without changing the essence of the invention.
[0394] The processor 880 is the control center of the mobile phone. It uses various interfaces and lines to connect various parts of the entire mobile phone. It executes various functions of the mobile phone and processes data by running or executing software programs and / or modules stored in the memory 820, and calling data stored in the memory 820, so as to monitor the mobile phone as a whole. Optionally, the processor 880 may include one or more processing units; optionally, the processor 880 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 880.
[0395] The mobile phone also includes a power supply 890 (such as a battery) for supplying power to various components. Optionally, the power supply can be logically connected to the processor 880 through a power management system, thereby managing functions such as charging, discharging, and power consumption management through the power management system.
[0396] Although not shown, the mobile phone may also include a camera, a Bluetooth module, etc., which will not be described in detail here.
[0397] In the embodiment of the present application, the processor 880 included in the terminal device also has the following functions:
[0398] Acquire a first image to be identified, wherein the first image to be detected includes a first target object, the first target object corresponds to first posture information, and the first target object corresponds to target identity information;
[0399] Obtaining, by means of a generator in an image recognition network model, a second image to be recognized corresponding to the first image to be recognized, wherein the second image to be recognized includes a second target object, the second target object corresponds to second posture information, the second target object corresponds to the target identity information, and the generator is used to perform posture conversion on the object in the image;
[0400] The recognition result of the second image to be recognized is determined by the recognition module in the image recognition network model.
[0401] In the embodiment of the present application, the processor 880 included in the terminal device also has the following functions:
[0402] Acquire a facial image to be normalized, wherein the facial image to be normalized corresponds to first posture information, the facial image to be normalized corresponds to target identity information, and the first posture information represents posture information of the image before normalization;
[0403] The facial image to be normalized is converted by a generator to obtain a normalized facial image corresponding to the facial image to be normalized, wherein the normalized facial image corresponds to second posture information, the normalized facial image corresponds to the target identity information, the second posture information represents the posture information of the image after normalization, and the generator is used to perform posture conversion on the object in the image.
[0404] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0405] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0406] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0407] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0408] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0409] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for training an image recognition network model, characterized in that: include: Acquire a first image feature corresponding to a set of images to be trained, wherein the set of images to be trained includes at least one image to be trained, and the image to be trained has an identity tag and a posture tag, the identity tag is used to represent the identity information of a target object in the image to be trained, and the posture tag is used to represent the posture information of the target object in the image to be trained; Obtaining a first identity prediction result corresponding to the first image feature through an identity classifier to be trained, and obtaining a first posture prediction result corresponding to the first image feature through a posture classifier to be trained; The identity classifier to be trained is trained according to the first identity prediction result and the identity label to obtain an identity classifier, and the posture classifier to be trained is trained according to the first posture prediction result and the posture label to obtain a posture classifier; Performing posture conversion on the first image feature through the generator to be trained to obtain a second image feature corresponding to the set of images to be trained, wherein the second image feature corresponds to a target posture; Acquire a second identity prediction result corresponding to the second image feature through the identity classifier, and acquire a second posture prediction result corresponding to the second image feature through the posture classifier; According to the second identity prediction result, the identity label, the second posture prediction result, the target posture label, the second image feature and the third image feature, the generator to be trained is trained to obtain a generator, wherein the third image feature is an image feature corresponding to the image to be trained belonging to the target posture in the image set to be trained, the target posture label represents information of the target posture, and the generator is used to generate an image recognition network model; The method of training the generator to be trained according to the second identity prediction result, the identity label, the second posture prediction result, the target posture label, the second image feature and the third image feature to obtain the generator includes: Determine a first minimum loss result using a third loss function according to the second identity prediction result and the identity label; Determine a second minimum loss result using a fourth loss function according to the second posture prediction result and the target posture label; Determine a third minimum loss result using a fifth loss function according to the second image feature and the third image feature, wherein the second image feature is a false input of a discriminator, the third image feature is a true input of the discriminator, and the discriminator is used to perform authenticity discrimination on the second image feature and the third image feature; Determine a fourth minimum loss result using a sixth loss function according to the third image feature; According to the first minimum loss result, the second minimum loss result, the third minimum loss result and the fourth minimum loss result, the generator to be trained is trained to obtain the generator.
2. The method according to claim 1, characterized in that The obtaining, by using the identity classifier to be trained, a first identity prediction result corresponding to the first image feature includes: Calculating the identity output probability of each category according to the network weight value of the identity classifier to be trained, the first image feature and the identity category; Determine the first identity prediction result corresponding to the first image feature according to the identity output probability of each category; The step of training the identity classifier to be trained according to the first identity prediction result and the identity label to obtain the identity classifier includes: Determining model parameters of the identity classifier to be trained using a first loss function according to the first identity prediction result and the identity label; The identity classifier is generated using the model parameters of the identity classifier to be trained.
3. The method according to claim 2, characterized in that The calculating the identity output probability of each category according to the network weight value of the identity classifier to be trained, the first image feature and the identity category includes: The identity output probability of each category is calculated as follows: Among them, the represents the identity output probability of the jth identity category, i represents the total number of the identity categories, E(x) represents the first image feature, represents the network weight value of the identity classifier to be trained corresponding to the j-th identity category, represents the network weight value of the identity classifier to be trained corresponding to the i-th identity category; The first loss function is expressed as: L I =-Ε[logP(y I |Y I )]; Among them, the L I represents the first loss function, the E represents the expected value calculation, the P(y I |Y I ) represents the Y I Belong to the y I The probability that y I represents the identity tag, the Y I Represents the first identity prediction result.
4. The method according to claim 1, characterized in that: The step of obtaining the first posture prediction result corresponding to the first image feature by using the posture classifier to be trained includes: Calculating the posture output probability of each category according to the network weight value of the posture classifier to be trained, the first image feature and the posture category; Determining the first posture prediction result corresponding to the first image feature according to the posture output probability of each category; The step of training the posture classifier to be trained according to the first posture prediction result and the posture label to obtain the posture classifier comprises: Determine the model parameters of the posture classifier to be trained using a second loss function according to the first posture prediction result and the posture label; The posture classifier is generated using the model parameters of the posture classifier to be trained.
5. The method according to claim 4, characterized in that The step of calculating the posture output probability of each category according to the network weight value of the posture classifier to be trained, the first image feature, and the posture category includes: The posture output probability of each category is calculated as follows: Among them, the represents the identity output probability of the j-th posture category, i represents the total number of the posture categories, E(x) represents the first image feature, represents the network weight value of the posture classifier to be trained corresponding to the j-th posture category, represents the network weight value of the posture classifier to be trained corresponding to the i-th posture category; The second loss function is expressed as: L P =-Ε[logP(y P |Y P )]; Among them, the L P represents the second loss function, the E represents the expected value calculation, the P(y P |Y P ) represents the Y P Belong to the y P The probability that y P represents the posture label, the Y P Represents the second identity prediction result.
6. The method according to any one of claims 1 to 5, characterized in that The step of obtaining a second identity prediction result corresponding to the second image feature by using the identity classifier, and obtaining a second posture prediction result corresponding to the second image feature by using the posture classifier includes: Obtaining the second posture prediction result corresponding to the second image feature through the posture classifier and the target posture label corresponding to the second image feature; The second identity prediction result corresponding to the second image feature is obtained through the identity classifier and the identity label corresponding to the first image feature.
7. The method according to claim 1, characterized in that The third loss function is expressed as: L IG =-Ε[logP(y I |Y IG )]; Among them, the L IG represents the third loss function, the E represents the expected value calculation, the P(y I |Y IG ) represents the Y IG Belong to the y I The probability that y I represents the identity tag, the Y IG represents the second identity prediction result; The fourth loss function is expressed as: L PG =-Ε[logP(y F |Y PG )]; Among them, the L PG represents the fourth loss function, the (y F |Y PG ) represents the Y PG Belong to the y F The probability that y F represents the target pose label, the Y PG Represents the second posture prediction result.
8. The method according to claim 1, characterized in that The fifth loss function is expressed as: Among them, the L advD represents the fifth loss function, the D in_fake represents the second image feature, the D in_real represents the third image feature, the E represents expected value calculation, the D() represents the input of the discriminator, and the f represents the input feature; The sixth loss function is expressed as: Among them, the L advG Denotes the sixth loss function.
9. An image recognition method, characterized in that: include: Acquire a first image to be identified, wherein the first image to be identified includes a first target object, the first target object corresponds to first posture information, and the first target object corresponds to target identity information; Obtaining, by means of a generator in an image recognition network model, a second image to be identified corresponding to the first image to be identified, wherein the second image to be identified includes a second target object, the second target object corresponds to second posture information, and the second target object corresponds to the target identity information, the generator is used to perform posture conversion on the object in the image, and the generator is trained by the method according to any one of claims 1 to 8; The recognition result of the second image to be recognized is determined by the recognition module in the image recognition network model.
10. A method for converting facial posture, characterized in that: include: Acquire a facial image to be normalized, wherein the facial image to be normalized corresponds to first posture information, the facial image to be normalized corresponds to target identity information, and the first posture information represents posture information of the image before normalization; The facial image to be normalized is converted by a generator to obtain a normalized facial image corresponding to the facial image to be normalized, wherein the normalized facial image corresponds to second posture information, the normalized facial image corresponds to the target identity information, the second posture information represents the posture information of the image after normalization, the generator is used to perform posture conversion on the object in the image, and the generator is trained by the method as described in any one of claims 1 to 8.
11. A model training device, characterized in that: include: An acquisition module, configured to acquire a first image feature corresponding to a set of images to be trained, wherein the set of images to be trained includes at least one image to be trained, and the image to be trained has an identity tag and a posture tag, wherein the identity tag is used to represent the identity information of a target object in the image to be trained, and the posture tag is used to represent the posture information of the target object in the image to be trained; The acquisition module is further used to acquire a first identity prediction result corresponding to the first image feature through the identity classifier to be trained, and to acquire a first posture prediction result corresponding to the first image feature through the posture classifier to be trained; A training module, used for training the identity classifier to be trained according to the first identity prediction result and the identity label obtained by the acquisition module to obtain an identity classifier, and training the posture classifier to be trained according to the first posture prediction result and the posture label obtained by the acquisition module to obtain a posture classifier; A conversion module, configured to perform posture conversion on the first image feature acquired by the acquisition module through a generator to be trained, so as to obtain a second image feature corresponding to the set of images to be trained, wherein the second image feature corresponds to a target posture; The acquisition module is further used to acquire a second identity prediction result corresponding to the second image feature through the identity classifier trained by the training module, and to acquire a second posture prediction result corresponding to the second image feature through the posture classifier trained by the training module; The training module is further used to train the generator to be trained according to the second identity prediction result, the identity label, the second posture prediction result, the target posture label, the second image feature and the third image feature obtained by the acquisition module to obtain a generator, wherein the third image feature is an image feature corresponding to the image to be trained belonging to the target posture in the image set to be trained, the target posture label represents the information of the target posture, and the generator is used to generate an image recognition network model; Wherein, the training module is specifically used for: Determine a first minimum loss result using a third loss function according to the second identity prediction result and the identity label; Determine a second minimum loss result using a fourth loss function according to the second posture prediction result and the target posture label; Determine a third minimum loss result using a fifth loss function according to the second image feature and the third image feature, wherein the second image feature is a false input of a discriminator, the third image feature is a true input of the discriminator, and the discriminator is used to perform authenticity discrimination on the second image feature and the third image feature; Determine a fourth minimum loss result using a sixth loss function according to the third image feature; According to the first minimum loss result, the second minimum loss result, the third minimum loss result and the fourth minimum loss result, the generator to be trained is trained to obtain the generator.
12. The device according to claim 11, characterized in that The acquisition module is specifically used for: Calculating the identity output probability of each category according to the network weight value of the identity classifier to be trained, the first image feature and the identity category; Determine the first identity prediction result corresponding to the first image feature according to the identity output probability of each category; The training module is specifically used for: Determining model parameters of the identity classifier to be trained using a first loss function according to the first identity prediction result and the identity label; The identity classifier is generated using the model parameters of the identity classifier to be trained.
13. The device according to claim 12, characterized in that The acquisition module is specifically used for: The identity output probability of each category is calculated as follows: Among them, the represents the identity output probability of the jth identity category, i represents the total number of the identity categories, E(x) represents the first image feature, represents the network weight value of the identity classifier to be trained corresponding to the j-th identity category, represents the network weight value of the identity classifier to be trained corresponding to the i-th identity category; The first loss function is expressed as: L I =-Ε[logP(y I |Y I )]; Among them, the L I represents the first loss function, the E represents the expected value calculation, the P(y I |Y I ) represents the Y I Belong to the y I The probability that y I represents the identity tag, the Y I Represents the first identity prediction result.
14. The device according to claim 11, characterized in that The acquisition module is specifically used for: Calculating the posture output probability of each category according to the network weight value of the posture classifier to be trained, the first image feature and the posture category; Determining the first posture prediction result corresponding to the first image feature according to the posture output probability of each category; The training module is specifically used for: Determine the model parameters of the posture classifier to be trained using a second loss function according to the first posture prediction result and the posture label; The posture classifier is generated using the model parameters of the posture classifier to be trained.
15. The device according to claim 14, characterized in that The acquisition module is specifically used for: The posture output probability of each category is calculated as follows: Among them, the represents the identity output probability of the j-th posture category, i represents the total number of the posture categories, E(x) represents the first image feature, represents the network weight value of the posture classifier to be trained corresponding to the j-th posture category, represents the network weight value of the posture classifier to be trained corresponding to the i-th posture category; The second loss function is expressed as: L P =-Ε[logP(y P |Y P )]; Among them, the L P represents the second loss function, the E represents the expected value calculation, the P(y P |Y P ) represents the Y P Belong to the y P The probability that y P represents the posture label, the Y P Represents the second identity prediction result.
16. The device according to any one of claims 11 to 15, characterized in that The acquisition module is specifically used for: Obtaining the second posture prediction result corresponding to the second image feature through the posture classifier and the target posture label corresponding to the second image feature; The second identity prediction result corresponding to the second image feature is obtained through the identity classifier and the identity label corresponding to the first image feature.
17. The device according to claim 11, characterized in that The third loss function is expressed as: L IG =-Ε[logP(y I |Y IG )]; Among them, the L IG represents the third loss function, the E represents the expected value calculation, the P(y I |Y IG ) represents the Y IG Belong to the y I The probability that y I represents the identity tag, the Y IG represents the second identity prediction result; The fourth loss function is expressed as: L PG =-Ε[logP(y F |Y PG )]; Among them, the L PG represents the fourth loss function, the (y F |Y PG ) represents the Y PG Belong to the y F The probability that y F represents the target pose label, the Y PG Represents the second posture prediction result.
18. The device according to claim 11, characterized in that The fifth loss function is expressed as: Among them, the L advD represents the fifth loss function, the D in_fake represents the second image feature, the D in_real represents the third image feature, the E represents expected value calculation, the D() represents the input of the discriminator, and the f represents the input feature; The sixth loss function is expressed as: Among them, the L advG Denotes the sixth loss function.
19. An image recognition device, characterized in that: include: An acquisition module, configured to acquire a first image to be recognized, wherein the first image to be recognized includes a first target object, the first target object corresponds to first posture information, and the first target object corresponds to target identity information; The acquisition module is further used to acquire a second image to be recognized corresponding to the first image to be recognized through a generator in an image recognition network model, wherein the second image to be recognized includes a second target object, the second target object corresponds to second posture information, and the second target object corresponds to the target identity information, and the generator is used to perform posture conversion on the object in the image, and the generator is trained by the method according to any one of claims 1 to 8; A determination module is used to determine the recognition result of the second image to be recognized obtained by the acquisition module through the recognition module in the image recognition network model.
20. A server, characterized in that: include: memories, transceivers, processors, and bus systems; Wherein, the memory is used to store programs; The processor is used to execute the program in the memory, comprising the following steps: Acquire a first image feature corresponding to a set of images to be trained, wherein the set of images to be trained includes at least one image to be trained, and the image to be trained has an identity tag and a posture tag, the identity tag is used to represent the identity information of a target object in the image to be trained, and the posture tag is used to represent the posture information of the target object in the image to be trained; Obtaining a first identity prediction result corresponding to the first image feature through an identity classifier to be trained, and obtaining a first posture prediction result corresponding to the first image feature through a posture classifier to be trained; The identity classifier to be trained is trained according to the first identity prediction result and the identity label to obtain an identity classifier, and the posture classifier to be trained is trained according to the first posture prediction result and the posture label to obtain a posture classifier; Performing posture conversion on the first image feature through the generator to be trained to obtain a second image feature corresponding to the set of images to be trained, wherein the second image feature corresponds to a target posture; Acquire a second identity prediction result corresponding to the second image feature through the identity classifier, and acquire a second posture prediction result corresponding to the second image feature through the posture classifier; According to the second identity prediction result, the identity label, the second posture prediction result, the target posture label, the second image feature and the third image feature, the generator to be trained is trained to obtain a generator, wherein the third image feature is an image feature corresponding to the image to be trained belonging to the target posture in the image set to be trained, the target posture label represents information of the target posture, and the generator is used to generate an image recognition network model; The method of training the generator to be trained according to the second identity prediction result, the identity label, the second posture prediction result, the target posture label, the second image feature and the third image feature to obtain the generator includes: Determine a first minimum loss result using a third loss function according to the second identity prediction result and the identity label; Determine a second minimum loss result using a fourth loss function according to the second posture prediction result and the target posture label; Determine a third minimum loss result using a fifth loss function according to the second image feature and the third image feature, wherein the second image feature is a false input of a discriminator, the third image feature is a true input of the discriminator, and the discriminator is used to perform authenticity discrimination on the second image feature and the third image feature; Determine a fourth minimum loss result using a sixth loss function according to the third image feature; According to the first minimum loss result, the second minimum loss result, the third minimum loss result, and the fourth minimum loss result, the generator to be trained is trained to obtain the generator; The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.
21. A terminal device, characterized in that: include: memories, transceivers, processors, and bus systems; Wherein, the memory is used to store programs; The processor is used to execute the program in the memory, comprising the following steps: Acquire a first image to be identified, wherein the first image to be identified includes a first target object, the first target object corresponds to first posture information, and the first target object corresponds to target identity information; Obtaining, by means of a generator in an image recognition network model, a second image to be identified corresponding to the first image to be identified, wherein the second image to be identified includes a second target object, the second target object corresponds to second posture information, and the second target object corresponds to the target identity information, the generator is used to perform posture conversion on the object in the image, and the generator is trained by the method according to any one of claims 1 to 8; Determining a recognition result of the second image to be recognized by using a recognition module in the image recognition network model; The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.
22. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the method according to any one of claims 1 to 10.
