Neural network training method and device, face recognition method and device

By acquiring multiple images of the same label, using neural network models to extract feature information and calculate the loss coefficient, the problem of high consumption of data storage and computing resources in face recognition training is solved, and the recognition accuracy and robustness are improved.

CN114842302BActive Publication Date: 2025-01-07BEIJING SENSETIME TECH DEV CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210539985.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-18
Publication Date
2025-01-07
Estimated Expiration
2042-05-18

AI Technical Summary

Technical Problem

During the training process, existing facial recognition neural networks need to store a large number of anchor features, resulting in high data storage pressure and computing resources consumption, and are affected by noise data, so the recognition accuracy and robustness are low.

Method used

By obtaining multiple images of the same label, the target neural network model extracts feature information, and calculates the loss coefficient based on the similarity between feature information and the feature information in the historical feature group, and iterative training is carried out to reduce data storage and computing resources. Consumption, improve the robustness of the model.

Benefits of technology

It effectively reduces the data storage pressure and computing resource consumption of the training process, improves the recognition accuracy of the face recognition model and its robustness to noise.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114842302B_ABST
    Figure CN114842302B_ABST
Patent Text Reader

Abstract

The present disclosure provides a neural network training method and device, and a face recognition method and device, wherein the training method includes: acquiring a first image and at least a preset number of second images, wherein the second image and the first image have the same image label; using a target neural network model to perform feature extraction on the first image to obtain first feature information, and using a sliding average model of the target neural network model to perform feature extraction on each second image to obtain at least a preset number of second feature information; determining a first loss coefficient based on a first similarity between the first feature information and each second feature information, and determining a second loss coefficient based on a second similarity between the first feature information and third feature information in at least part of a historical feature group; determining a target loss based on the first loss coefficient and the second loss coefficient, and iteratively training the target neural network model using the target loss to obtain a trained target neural network model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image recognition technology, and in particular to a neural network training method and device, and a face recognition method and device. Background Art

[0002] With the rapid development of computer vision technology, face recognition technology plays an increasingly important role in people's daily lives. Most face recognition technologies rely on face recognition neural networks, and the recognition accuracy of face recognition neural networks is closely related to the scale of face training data.

[0003] In the process of using face training data for network training, it is necessary to store an anchor feature for each category of face label to determine the network loss. In this way, using a large number of different categories of face training data for network training requires storing a large number of anchor features. This greatly increases the pressure on data storage and the consumption of computing resources. In addition, due to the difficulty of collecting face training data, most of the collected face training data are noisy data. Using noisy face training data for network training reduces the robustness of the face recognition neural network to noise. Summary of the invention

[0004] The embodiments of the present disclosure at least provide a neural network training method and device, and a face recognition method and device.

[0005] In a first aspect, an embodiment of the present disclosure provides a neural network training method, comprising:

[0006] Acquire a first image and at least a preset number of second images, where the second images have the same image label as the first image;

[0007] Using a target neural network model to perform feature extraction on the first image to obtain first feature information, and using a sliding average model of the target neural network model to perform feature extraction on each of the second images to obtain at least a preset number of second feature information;

[0008] Determining a first loss coefficient based on a first similarity between the first feature information and each of the second feature information, and determining a second loss coefficient based on a second similarity between the first feature information and at least part of the third feature information in the historical feature group; the third feature information included in each of the historical feature groups is determined using other second images in other rounds of training before the current round of training;

[0009] Based on the first loss coefficient and the second loss coefficient, a target loss is determined, and the target neural network model is iteratively trained using the target loss until a training cutoff condition is met, thereby obtaining a trained target neural network model.

[0010] In this implementation, the first loss coefficient is determined based on the first similarity between the first feature information extracted from the first image and the second feature information extracted from each second image. The loss of the model when predicting images with the same label can be determined without storing and using the anchor point features corresponding to the image labels, thereby reducing the data storage pressure and computing resource consumption of the training process. Since the third feature information is determined using other second images in other rounds of training, the third feature information is equivalent to the noise data of the first feature information, and the second loss coefficient is determined based on the second similarity between the first feature information and the third feature information in at least part of the historical feature group, and the target loss is determined based on the second loss coefficient and the model is trained using the target loss, which can eliminate the noise data, reduce the impact of the noise data on the model recognition accuracy, and improve the recognition accuracy and robustness to noise of the trained target neural network model.

[0011] In a possible implementation, the first image and the second image are face images, and the target neural network model is a face recognition model.

[0012] In this implementation, according to the training method provided in the embodiment of the present disclosure, the face recognition model is trained using face images, which can not only reduce the data storage pressure and computing resource consumption of the training process, but also improve the face recognition accuracy and robustness to face noise of the trained face recognition model.

[0013] In a possible implementation manner, determining a first loss coefficient based on a first similarity between the first feature information and each of the second feature information includes:

[0014] A maximum similarity is screened out from the at least preset number of the first similarities, and the first loss coefficient is determined based on a first difference between the maximum similarity and a preset separation value.

[0015] In this embodiment, since the first image and the second image have the same image label, the higher the similarity between the first feature information and the second feature information, the closer the second feature information is to the anchor feature corresponding to the image label. By selecting the maximum similarity among at least a preset number of first similarities, that is, obtaining the similarity between the second feature information closest to the anchor feature corresponding to the image label and the first feature information, and using the similarity to determine the first loss coefficient, the accuracy of the determined first loss coefficient can be improved. In addition, by processing the maximum similarity with a preset separation value, the discrimination between images with different categories of image labels can be improved, and by determining the first loss coefficient using the first difference obtained after processing, and by training the target neural network model using the target loss determined based on the first loss coefficient, the discrimination of the feature information output by the target neural network model when identifying images with different categories of image labels can be improved.

[0016] In a possible implementation manner, determining the second loss coefficient based on the second similarity between the first feature information and at least part of the third feature information in the historical feature group includes:

[0017] For each historical feature group, based on the second similarity between each of the third feature information in the historical feature group and the first feature information, determine the minimum similarity corresponding to the historical feature group;

[0018] Based on the group label of each of the historical feature groups, a target historical feature group whose group label is inconsistent with the image label of the first image is screened out from the historical feature groups; the group label is an image label of another second image used to extract any of the third feature information in the historical feature group;

[0019] The second loss coefficient is determined based on the minimum similarity corresponding to each of the target historical feature groups.

[0020] In this implementation, the historical feature groups are screened using the group labels of each historical feature group and the image label of the first image, and the historical feature groups whose group labels are consistent with the image label of the first image can be eliminated, thereby reducing the impact of the historical feature groups on the robustness of the model. At the same time, the target historical feature groups whose group labels are inconsistent with the image label of the first image can be screened out. The second loss coefficient is determined using the minimum similarity corresponding to each target historical feature group, and the target neural network model is trained using the target loss determined based on the second loss coefficient, thereby improving the robustness of the target neural network model to image noise.

[0021] In a possible implementation manner, before determining the second loss coefficient based on the second similarity between the first feature information and at least part of the third feature information in the historical feature group, the method further includes:

[0022] According to the quantity of the second characteristic information and a preset grouping value, dividing the at least preset quantity of the second characteristic information into a plurality of current characteristic groups;

[0023] In the case where the sum of the number of the historical feature groups and the current feature group is greater than the preset number of groups, determining a second difference between the sum of the numbers and the preset number of groups;

[0024] Sorting each of the historical feature groups according to the order of generation time of each of the historical feature groups to obtain a ranking value of each of the historical feature groups;

[0025] Delete each of the historical feature groups whose ranking value is not greater than the second difference.

[0026] In this implementation, by dividing at least a preset number of second feature information into multiple current feature groups, the first feature information and second feature information corresponding to the image label of the first image and the third feature information corresponding to other image labels can be decoupled. By deleting each historical feature group whose ranking value is not greater than the second difference value, the historical feature groups with a long storage time are deleted, thereby ensuring the timeliness of the feature information in each retained feature group.

[0027] In a possible implementation manner, after deleting each of the historical feature groups whose ranking value is not greater than the second difference, the method further includes:

[0028] Each of the current feature groups is retained, wherein each of the current feature groups retained is used as a historical feature group for the next round of training.

[0029] This implementation method can retain the most timely feature group by retaining the current feature group, and provide the latest usable historical feature group for the next round of iterative training.

[0030] In a possible implementation manner, determining the second loss coefficient based on the second similarity between the first feature information and at least part of the third feature information in the historical feature group includes:

[0031] Based on the group label of each historical feature group, screening out a target historical feature group whose group label is inconsistent with the image label of the first image from the historical feature groups;

[0032] For each target historical feature group, based on the second similarity between each of the third feature information in the target historical feature group and the first feature information, determine the minimum similarity corresponding to the target historical feature group;

[0033] The second loss coefficient is determined based on the minimum similarity corresponding to each of the target historical feature groups.

[0034] In this implementation, the target historical feature group is first screened out from multiple historical feature groups using the group label of the historical feature group and the image label of the first image, and then the second similarity between each third feature information in the target historical feature group and the first feature information is calculated, which can reduce the amount of calculation and improve the calculation speed.

[0035] In a possible implementation manner, determining the second loss coefficient based on the minimum similarity corresponding to each of the target historical feature groups includes:

[0036] Each of the minimum similarities is numerically expanded using the target expansion parameter, and the second loss coefficient is determined based on each minimum similarity after numerical expansion.

[0037] In this implementation, each minimum similarity is numerically expanded using the target expansion parameter, which can increase the numerical range corresponding to the similarity. The second loss coefficient is determined based on each minimum similarity after numerical expansion, which can improve the rationality and accuracy of the determined second loss coefficient, and further improve the rationality and accuracy of the determined target loss.

[0038] In a possible implementation manner, determining the target loss based on the first loss coefficient and the second loss coefficient includes:

[0039] A coefficient sum of the first loss coefficient and the second loss coefficient is determined, and the target loss is determined based on a ratio of the first loss coefficient to the coefficient sum.

[0040] In this way, based on this implementation, an accurate target loss can be obtained.

[0041] In a possible implementation, when the current round of training is the first round of training, the second loss coefficient is set to a preset coefficient.

[0042] This implementation can provide a second loss coefficient that can be directly used for calculating the target loss when there is no usable historical feature set.

[0043] In a second aspect, the present disclosure also provides a face recognition method, including:

[0044] Obtain a face image to be recognized;

[0045] The facial image is input into a target neural network model trained based on the first aspect or the training method described in any possible implementation manner of the first aspect, to obtain target facial information included in the facial image.

[0046] This implementation uses a target neural network model trained by the training method based on the first aspect or any possible implementation method of the first aspect, and has reliable recognition accuracy. The trained target neural network model is used to recognize the acquired facial image, and the target facial information included in the facial image can be accurately determined.

[0047] In a third aspect, the present disclosure also provides a neural network training device, including:

[0048] A first acquisition module, used to acquire a first image and at least a preset number of second images, where the second images have the same image label as the first image;

[0049] An extraction module, configured to perform feature extraction on the first image using a target neural network model to obtain first feature information, and to perform feature extraction on each of the second images using a sliding average model of the target neural network model to obtain at least a preset number of second feature information;

[0050] a determination module, configured to determine a first loss coefficient based on a first similarity between the first feature information and each of the second feature information, and to determine a second loss coefficient based on a second similarity between the first feature information and at least part of the third feature information in the historical feature group; the third feature information included in each of the historical feature groups is determined by using other second images in other rounds of training before the current round of training;

[0051] A training module is used to determine a target loss based on the first loss coefficient and the second loss coefficient, and to iteratively train the target neural network model using the target loss until a training cutoff condition is met, thereby obtaining a trained target neural network model.

[0052] In a possible implementation, the first image and the second image are face images, and the target neural network model is a face recognition model.

[0053] In a possible implementation, the determination module, when determining the first loss coefficient based on the first similarity between the first feature information and each of the second feature information, is used to screen out the maximum similarity from the at least preset number of the first similarities, and determine the first loss coefficient based on a first difference between the maximum similarity and a preset separation value.

[0054] In a possible implementation manner, the determination module, when determining the second loss coefficient based on the second similarity between the first feature information and the third feature information in at least part of the historical feature group, is used to determine, for each historical feature group, a minimum similarity corresponding to the historical feature group based on the second similarity between each of the third feature information in the historical feature group and the first feature information;

[0055] Based on the group label of each of the historical feature groups, a target historical feature group whose group label is inconsistent with the image label of the first image is screened out from the historical feature groups; the group label is an image label of another second image used to extract any of the third feature information in the historical feature group;

[0056] The second loss coefficient is determined based on the minimum similarity corresponding to each of the target historical feature groups.

[0057] In a possible implementation manner, the determination module, before determining the second loss coefficient based on the second similarity between the first feature information and at least part of the third feature information in the historical feature group, is further used to divide the at least preset number of second feature information into multiple current feature groups according to the number of the second feature information and a preset grouping value;

[0058] In the case where the sum of the number of the historical feature groups and the current feature group is greater than the preset number of groups, determining a second difference between the sum of the numbers and the preset number of groups;

[0059] Sorting each of the historical feature groups according to the order of generation time of each of the historical feature groups to obtain a ranking value of each of the historical feature groups;

[0060] Delete each of the historical feature groups whose ranking value is not greater than the second difference.

[0061] In a possible implementation, the device further includes a retaining module, configured to retain each of the current feature groups after deleting each of the historical feature groups whose ranking value is not greater than the second difference, wherein each of the current feature groups retained serves as a historical feature group for the next round of training.

[0062] In a possible implementation, the determination module, when determining the second loss coefficient based on the second similarity between the first feature information and the third feature information in at least part of the historical feature groups, is used to filter out, from the historical feature groups, a target historical feature group whose group label is inconsistent with an image label of the first image, based on a group label of each historical feature group;

[0063] For each target historical feature group, based on the second similarity between each of the third feature information in the target historical feature group and the first feature information, determine the minimum similarity corresponding to the target historical feature group;

[0064] The second loss coefficient is determined based on the minimum similarity corresponding to each of the target historical feature groups.

[0065] In a possible implementation, the determination module, when determining the second loss coefficient based on the minimum similarity corresponding to each of the target historical feature groups, is used to use the target extension parameter to numerically expand each of the minimum similarities, and determine the second loss coefficient based on each minimum similarity after numerical expansion.

[0066] In one possible implementation, the training module, when determining the target loss based on the first loss coefficient and the second loss coefficient, is used to determine the sum of the coefficients of the first loss coefficient and the second loss coefficient, and to determine the target loss based on the ratio of the first loss coefficient to the sum of the coefficients.

[0067] In a possible implementation, the determination module is further configured to set the second loss coefficient to a preset coefficient when the current round of training is a first round of training.

[0068] In a fourth aspect, the present disclosure also provides a face recognition device, including:

[0069] The second acquisition module is used to acquire the face image to be recognized;

[0070] A recognition module is used to input the facial image into a target neural network model trained based on the training method described in the first aspect or any possible implementation method of the first aspect, to obtain target facial information included in the facial image.

[0071] In a fifth aspect, an optional implementation of the present disclosure further provides a computer device, a processor, and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory, and when the machine-readable instructions are executed by the processor, the machine-readable instructions execute the above-mentioned first aspect, or the steps in any possible implementation of the first aspect; or, when the machine-readable instructions are executed by the processor, the above-mentioned second aspect is executed.

[0072] In a sixth aspect, an optional implementation of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the steps of the above-mentioned first aspect, or any possible implementation of the first aspect are executed; or, when the computer program is executed, the above-mentioned second aspect is executed.

[0073] For a description of the effects of the above-mentioned neural network training method and device, face recognition method and device, computer equipment, and computer-readable storage medium, please refer to the description of the above-mentioned neural network training method and face recognition method, which will not be repeated here.

[0074] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0075] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.

[0076] Figure 1 A flowchart of a neural network training method provided by an embodiment of the present disclosure is shown;

[0077] Figure 2 A flow chart of a face recognition method provided by an embodiment of the present disclosure is shown;

[0078] Figure 3 A schematic diagram of a neural network training device provided by an embodiment of the present disclosure is shown;

[0079] Figure 4 A schematic diagram of a face recognition device provided by an embodiment of the present disclosure is shown;

[0080] Figure 5 A schematic diagram of the structure of a computer device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0081] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure is not intended to limit the scope of the present disclosure claimed for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.

[0082] In addition, the terms "first", "second", etc. in the description and claims of the embodiments of the present disclosure 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 terms used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein.

[0083] The "multiple or several" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.

[0084] According to research, in the process of using face training data for network training, the difficulty in obtaining training data with accurate face data labels leads to a small amount of such training data, which affects the effect of network training. However, it is very easy to collect face training data with noise labels, which can achieve large-scale data acquisition. However, in the process of using large-scale training data with noise labels to train the network, the influence of training data with noise labels on the face recognition neural network reduces the robustness of the face recognition neural network to noise. In addition, the need to store a large number of anchor features also increases the pressure of data storage and computing resource consumption. For example, the anchor feature corresponding to an image label can be a 512-dimensional feature vector. When using face training data corresponding to a large number of labels for network training, a large number of 512-dimensional feature vectors need to be stored. For the storage capacity of the device, the storage of a large number of feature vectors will greatly increase the pressure of data storage, and it is usually necessary to use feature vectors to calculate network loss, which greatly causes computing resource consumption.

[0085] Based on the above research, the present disclosure provides a training scheme for a neural network, which determines a first loss coefficient based on a first similarity between first feature information extracted from a first image and second feature information extracted from each second image, and can determine the loss of the model when predicting images with the same label without storing and using anchor features corresponding to image labels, thereby reducing the data storage pressure and computing resource consumption of the training process. Since the third feature information is determined using other second images in other rounds of training, the third feature information is equivalent to the noise data of the first feature information, and the second loss coefficient is determined based on the second similarity between the first feature information and the third feature information in at least part of the historical feature group, and the target loss is determined based on the second loss coefficient and the model is trained using the target loss, which can eliminate noise data, reduce the impact of noise data on model recognition accuracy, and improve the recognition accuracy and robustness to noise of the trained target neural network model.

[0086] The defects existing in the above solutions are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed by the present disclosure for the above problems below should be the contributions made by the inventor to the present disclosure during the disclosure process.

[0087] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0088] To facilitate understanding of the present embodiment, a neural network training method and a face recognition method disclosed in the embodiment of the present disclosure are first introduced in detail. The execution subject of the neural network training method and the face recognition method provided in the embodiment of the present disclosure is generally a terminal device or other processing device with a certain computing capability, wherein the terminal device may be a user equipment (User Equipment, UE), a mobile device, a user terminal, a terminal, a personal digital assistant (Personal Digital Assistant, PDA), a handheld device, a computer device, etc.; in some possible implementations, the neural network training method and the face recognition method may be implemented by a processor calling computer-readable instructions stored in a memory.

[0089] The following describes the neural network training method provided by the embodiment of the present disclosure by taking a computer device as an example of the execution subject.

[0090] like Figure 1 As shown, it is a flowchart of a neural network training method provided by an embodiment of the present disclosure, which may include the following steps:

[0091] S101: Acquire a first image and at least a preset number of second images, where the second images have the same image label as the first images.

[0092] Here, the first image and the second image may be images taken by a camera device, and specifically, the first image and the second image may be images acquired from an existing data set. The preset number may be, for example, 4, 8, 12, etc., which is not specifically limited here.

[0093] The first image and the second image have the same image label, and the same image label may include multiple images. The image label is used to characterize the category of the object included in the image. For example, when the first image and the second image are both face images, the image label of the first image and the image labels of each second image are person A. Different image labels correspond to different anchor feature information, for example, person A corresponds to anchor feature information 1, and person B corresponds to anchor feature information 2.

[0094] Both the first image and the second image can be processed using the target neural network model. After acquiring the image, the target neural network model can extract features from the image and output feature information of the image.

[0095] In one embodiment, the first image and the second image are face images, and the target neural network model can be a face recognition model. Here, since the face image is the user's personal data, the user's authorization is required when collecting the face image, which increases the difficulty of data collection. It is very difficult to collect large-scale face images as training data. Therefore, the data sets used in the embodiments of the present disclosure are all publicly available large-scale face data sets. In specific implementation, the first image with the same image label and at least a preset number of second images can be obtained from the public face data set.

[0096] In addition, since there is noise data in the large-scale face dataset for public use, for example, for multiple images with the label of person A, the multiple images may include not only the image corresponding to person A, but also the images corresponding to person B, person C, etc. In this way, the images corresponding to person B and person C are all noise data in the multiple images with the label of person A. Alternatively, the images corresponding to person B and person C can also be called the intra-class noise of the image corresponding to person A.

[0097] For another example, a publicly available large-scale face dataset may also include multiple images with a person label B and multiple images with a person label C. However, the multiple images with the person label B and the multiple images with the person label C may actually correspond to the same person label, for example, both correspond to the person label B. In this case, when the face recognition model is trained using the first image and the second image selected from the multiple images with the person label B, the multiple images with the person label C will become noise data of the first image and the second image selected from the multiple images with the person label B, also known as inter-class noise.

[0098] The existing training methods, when using face images in a publicly available large-scale face dataset to train a face recognition model, not only need to store and use anchor features, but are also limited by the influence of the above-mentioned intra-class noise and inter-class noise, resulting in poor robustness of the trained face recognition model to noise and low recognition accuracy. The method provided by the embodiment of the present disclosure not only does not need to use each anchor feature, but can also effectively avoid the influence of intra-class noise and inter-class noise, thereby improving the robustness of the trained face recognition model to noise and the model recognition accuracy. The specific training method provided by the embodiment of the present disclosure will be further described below.

[0099] In the specific implementation of S101, any first image can be selected from a publicly available data set with noisy data, and at least a preset number of second images with the image label can be sampled from the data set according to the image label of the first image. For example, for a first image X, four second images U with the same image label as the first image X can be sampled.

[0100] In each iterative training process of the target neural network model, multiple first images can be used. At the same time, for each first image, at least a preset number of second images having the same image label as the first image can be sampled.

[0101] S102: Using the target neural network model to perform feature extraction on the first image to obtain first feature information, and using the sliding average model of the target neural network model to perform feature extraction on each second image to obtain at least a preset number of second feature information.

[0102] Here, each round of iterative training process for the target neural network model may include multiple training steps, each step needs to use the acquired first image and at least a preset number of second images for training, and each step includes one forward propagation + one back propagation + model parameter update for the target neural network model. Since the model parameters of the target neural network model will be updated after each step, the feature information extracted from the second image will change significantly after each step. Therefore, in order to ensure that the feature information in each feature group can be approximately extracted by the same target neural network model, a sliding average calculation can be performed on the model parameters of the target neural network model before and after each step, and based on the model parameters obtained after the sliding average, the sliding average model corresponding to the target neural network model in this step is determined, and the sliding average model is used to extract features from the second image to obtain the second feature information. Among them, the sliding average model, that is, the moving average model, is referred to as MA.

[0103] The target neural network model may include but is not limited to a face recognition model. For example, in an object recognition scenario, the target neural network model may be an object recognition model. Then, the training method provided in the embodiment of the present disclosure may be used to train the object recognition model to obtain a trained object recognition model. The embodiment of the present disclosure is described by taking the target neural network model as a face recognition model.

[0104] In specific implementation, during each round of iterative training, for each first image, the first image can be input into the face recognition model corresponding to the current round of training, and the face recognition model is used to extract features from the first image to obtain first feature information of the first image. At the same time, for each second image corresponding to the first image, each second image can be input into the MA model of the face recognition model, and the MA model is used to extract features from each second image to obtain second feature information corresponding to each second image, that is, at least a preset number of second feature information can be obtained.

[0105] S103: Determine a first loss coefficient based on a first similarity between the first feature information and each second feature information, and determine a second loss coefficient based on a second similarity between the first feature information and at least part of the third feature information in the historical feature group; the third feature information included in each historical feature group is determined using other second images in other rounds of training before the current round of training.

[0106] Here, the first similarity is the similarity between the first feature information and the second feature information. In the case where the second feature information includes at least a preset number of , the first similarity will also include at least a preset number of . The second similarity is the similarity between the first feature information and the third feature information.

[0107] The above-mentioned historical feature group is determined based on the third feature information obtained in other rounds of training before the current round of training, and is determined based on the second feature information of the second image extracted in each other step before the current step of the current round of training. The above-mentioned third feature information is the feature information obtained after feature extraction of the second image used in this round of training using the sliding average model obtained in other rounds of training. The second feature information extracted from the second image for the current round of training can be used as the third feature information in the next round of training. Each second feature information extracted in the current step of the current round of training can be used as the third feature information corresponding to a step, and / or the third feature information in the next round of training.

[0108] The first loss coefficient is a loss value determined based on the first similarity, and the second loss coefficient is a loss value determined based on the second similarity.

[0109] For the first image currently being processed and at least a preset number of second images, a first similarity between the first feature information extracted from the first image and the first similarity between the first feature information extracted from at least a preset number of second feature information may be calculated. Specifically, the first similarity may be determined according to the following formula 1:

[0110]

[0111] Where m∈(1, 2, ..., k), k is equal to the number of the second image, x i represents the first image, represents the mth second image, f(x i ) represents the first feature information, f represents the target neural network model, f' represents the sliding average model of the target neural model, Represents the second feature information of the mth second image, cosθ i represents the first similarity, ||f(x i )|| represents the value of the determinant corresponding to the first feature information, represents the value of the determinant corresponding to the second feature information of the mth second image, T represents the transposed matrix, f(x i ) T The transposed matrix representing the feature matrix corresponding to the first feature information.

[0112] Specifically, the first feature information and each second feature information may be substituted into the above formula 1 to obtain the first similarity between the first feature information and each second feature information. Then, the first loss coefficient may be determined based on the first similarity. For example, the first loss coefficient may be determined based on the average of each first similarity.

[0113] In one embodiment, for the first round of training, there may not be a usable historical feature set for determining the second loss coefficient. In this case, the second loss coefficient required for the first round of training can be directly set to a preset coefficient, such as 0. In this way, when there is no usable historical feature set, a second loss coefficient that can be directly used can be provided for calculating the target loss.

[0114] In one embodiment, the first loss coefficient may be determined according to the following steps:

[0115] A maximum similarity is screened out from at least a preset number of first similarities, and a first loss coefficient is determined based on a first difference between the maximum similarity and a preset separation value.

[0116] Here, the preset separation value is used to reduce the maximum similarity to increase the discrimination between the maximum similarities determined in different rounds of training, thereby improving the discrimination between images with different category image labels.

[0117] Specifically, the largest first similarity, i.e., the maximum similarity, can be screened out from at least a preset number of first similarities, and the second feature information corresponding to the maximum similarity is used as the approximated intra-class anchor feature of the first feature information. In this way, there is no need to store the anchor feature information corresponding to the first feature information in advance, and the approximated intra-class anchor feature is used to calculate the subsequent loss coefficient, which not only reduces the data storage pressure and computing resource consumption, but also can accurately determine the loss information.

[0118] Then, a first difference between the maximum similarity and the preset separation value may be determined, and a first loss coefficient may be determined based on the first difference. For example, a power operation may be performed on the first difference with e as the base and the first difference as the power exponent to obtain a first target value, and a first loss coefficient may be determined based on the first target value.

[0119] In one embodiment, before determining the second loss coefficient based on the second similarity between the first feature information and the third feature information in at least part of the historical feature group, the second feature information extracted in the current step may be grouped to obtain the current feature group. Specifically, the following steps may be followed:

[0120] Step 1: According to the quantity of the second characteristic information and the preset grouping value, at least a preset number of second characteristic information are divided into a plurality of current characteristic groups.

[0121] Here, the current feature group is a feature group determined based on each second feature information in the current step in the current round of training. The preset grouping value may be the number of second feature information to be included in each feature group, and the preset grouping value is less than the number of second images. The preset grouping value may be set based on experience. For example, when the second image includes 4 images, the preset grouping value may be 2; when the second image includes 6 images, the preset grouping value may be 2, 4, etc.

[0122] In specific implementation, the extracted second feature information may be divided into a plurality of current feature groups using a preset grouping value, and the group label of each current feature group may be an image label of the second image.

[0123] Step 2: When the sum of the number of historical feature groups and the number of current feature groups is greater than the number of preset groups, determine a second difference between the sum and the number of preset groups.

[0124] The preset number of groups may be the maximum number of feature groups to be stored. The preset number of groups may be set based on experience and is not limited here.

[0125] In a specific implementation, after obtaining each current feature group, each current feature group can be stored in a feature group queue, wherein the capacity of the feature group queue is a preset number of groups. Before storing each current feature group in the feature group queue, it can also be determined whether the feature group queue has sufficient capacity to store each current feature group.

[0126] Specifically, it can be determined whether the sum of the number of stored historical feature groups and the number of current feature groups is greater than the preset number of groups. If not, it means that the feature group queue can store all current feature groups, and each current feature group is directly stored in the feature group queue. Afterwards, each current feature group newly stored in the feature group queue can be used as a historical feature group, and each second feature information in each current feature group newly stored in the feature group queue can be used as the third feature information.

[0127] If yes, it means that the feature group queue cannot store all current feature groups, and it is necessary to further determine the second difference between the sum of the quantities and the preset group quantity.

[0128] Step 3: Sort each historical feature group according to the order of generation time of each historical feature group to obtain a ranking value of each historical feature group.

[0129] Here, when each historical feature group is generated, its generation time can be recorded. Then, each historical feature group can be sorted according to the generation time of each historical feature group included in the feature group queue to obtain a ranking value of each historical feature group. Among them, the earlier the historical feature group is generated, the smaller its ranking value.

[0130] Step 4: Delete each historical feature group whose ranking value is not greater than the second difference value.

[0131] Exemplarily, among the historical feature groups included in the feature group queue, the historical feature groups whose ranking values ​​are not greater than the second difference value may be deleted to ensure that there is enough space in the feature group queue for retaining the current feature groups.

[0132] In a specific implementation, after successfully deleting each historical feature group whose ranking value is not greater than the second difference, each current feature group can be retained. Each retained current feature group is used as a historical feature group for the next round of training. Specifically, each current feature group can be stored in a feature group queue as a historical feature group for the next round of iterative training, or for the training of the next step.

[0133] It is understandable that the timing for retaining each current feature group may be after deleting each historical feature group whose ranking value is not greater than the second difference, and at any time point before determining the second loss coefficient, or after determining the second loss coefficient, which is not specifically limited here.

[0134] Further, with respect to the above S103, after obtaining the first feature information and the second feature information, a second similarity between the first feature information and each third feature information in at least part of the historical feature group may be determined, and a second loss coefficient may be determined based on the second similarity.

[0135] In a specific implementation, after each current feature group is added to the feature group queue, for each historical feature group in the feature group queue, the second similarity between the first feature information and each third feature information in the historical feature group can be determined respectively. Alternatively, after each current feature group is added to the feature group queue, each current feature group newly added to the feature group queue can be ignored, and for each historical feature group other than each current feature group newly added to the feature group queue, the second similarity between the first feature information and each third feature information in the historical feature group can be determined respectively.

[0136] Specifically, the second similarity may be determined according to the following formula 2:

[0137]

[0138] Among them, cosθi,j represents the second similarity,

[0139] Where m∈(1, 2, ..., n), n is equal to the number of historical feature groups, x i represents the first image, represents the jth second image in the nth historical feature group, f(x i ) represents the first feature information, f represents the target neural network model, f' represents the sliding average model of the target neural model, represents the third feature information corresponding to the jth second image in the nth historical feature group, that is, the jth third feature information in the nth historical feature group, cosθ i,j represents the second similarity, Represents the value of the determinant corresponding to the j-th third feature information in the n-th historical feature group.

[0140] Specifically, the first feature information and the third feature information in each historical feature group can be substituted into the above formula 2 to obtain the similarity between the first feature information and each third feature information. Afterwards, the second loss coefficient can be determined using each second similarity. For example, the second loss coefficient can be determined based on the average of each second similarity.

[0141] In one embodiment, the step of determining the second loss coefficient in S103 may be implemented according to the following steps:

[0142] S103 - 1 : For each historical feature group, based on the second similarity between each third feature information in the historical feature group and the first feature information, determine the minimum similarity corresponding to the historical feature group.

[0143] Here, the minimum similarity is the minimum similarity among the similarities between the first feature information and each third feature information in the historical feature group. Here, the third feature information corresponding to each minimum similarity can be used as the inter-class anchor feature of the approximated first feature information.

[0144] In a specific implementation, for each historical feature group, after determining the second similarity between each third feature information in the historical feature group and the first feature information, the minimum similarity corresponding to the historical feature group can be screened out from the multiple second similarities. Based on this, the minimum similarity corresponding to each historical feature group can be determined, that is, the inter-class anchor feature of the approximate first feature information can be screened out from each historical feature group.

[0145] S103-2 Based on the group label of each historical feature group, a target historical feature group whose group label is inconsistent with the image label of the first image is screened out from the historical feature group; the group label is the image label of other second images used to extract any third feature information in the historical feature group.

[0146] Here, the group label is the image label of the other second images used to extract each third feature information in the historical feature group. Since the image labels of the other second images corresponding to each third feature information are consistent, each historical feature group corresponds to a group label.

[0147] In a specific implementation, the target historical feature group whose group label is inconsistent with the image label of the first image can be screened out from multiple historical feature groups according to the group label of each historical feature group. In this way, the historical feature group whose group label is consistent with the image label of the first image can be eliminated, thereby reducing the impact of the historical feature group on the robustness of the model.

[0148] Here, even if the similarity between the second feature information and the first feature information in each current feature group is calculated during the calculation of the second similarity, since the group label of each current feature group is consistent with the image label of the first image, each current feature group will be eliminated and will not be used as an approximate inter-class anchor feature.

[0149] S103-3: Determine a second loss coefficient based on the minimum similarity corresponding to each target historical feature group.

[0150] Here, the third feature information corresponding to each of the selected minimum similarities can be used as the inter-class anchor feature corresponding to the first feature information. Furthermore, the second loss coefficient can be determined using the minimum similarity corresponding to each inter-class anchor feature. Exemplarily, a power operation can be performed on the minimum similarity with e as the base and the minimum similarity as the power exponent to obtain a second target value, and the second loss coefficient can be determined based on the second target values ​​obtained after performing the power operation on each minimum similarity.

[0151] In this way, based on the setting of feature groups, flexible switching between approximated intra-class anchor features and inter-class anchor features can be completed, and the decoupling between the approximated intra-class anchor features and inter-class anchor features can be achieved, effectively reducing the impact of intra-class noise and inter-class noise, and improving the performance of the trained target neural network model. In addition, by using the flexible switching between the approximated intra-class anchor features and inter-class anchor features to calculate the target loss and using the target loss for training, the data storage pressure and computing resource consumption of the training process can be reduced, and the robustness to noise can also be improved.

[0152] In addition, in a possible implementation, if the group labels of each historical feature group available for the current round of training are the same as the image label of the first image, the target historical feature group corresponding to the current round of training cannot be determined, and thus the following S103-3 cannot be performed, and the second loss coefficient cannot be obtained. In this case, in order to ensure that the target loss can be calculated in the current round of training, the second loss coefficient corresponding to the current round of training can be directly set to the above-mentioned preset coefficient.

[0153] In another embodiment, the step of determining the second loss coefficient in S103 may also be implemented according to the following steps:

[0154] S1: Based on the group label of each historical feature group, a target historical feature group whose group label is inconsistent with the image label of the first image is screened out from the historical feature groups.

[0155] Here, the second similarity may not be calculated first, but the target historical feature group may be screened first. Specifically, after obtaining each second feature information, or after adding each current feature group to the feature group queue, based on the group label of each historical feature group in the feature group queue and the image label of the first image, the target historical feature group whose group label is inconsistent with the image label of the first image may be screened out from multiple historical feature groups.

[0156] S2: For each target historical feature group, based on the second similarity between each third feature information in the target historical feature group and the first feature information, determine the minimum similarity corresponding to the target historical feature group.

[0157] In specific implementation, after determining each target historical feature group, for each target historical feature group, the above formula 2 can be used to determine the second similarity between each third feature information in each target historical feature group and the first feature information.

[0158] Then, based on the second similarity, the minimum similarity corresponding to each target historical feature group may be determined.

[0159] S3: Determine a second loss coefficient based on the minimum similarity corresponding to each target historical feature group.

[0160] Here, the specific implementation process of this step can refer to the above S103-3 and will not be repeated here.

[0161] Optionally, when executing S1, if the group labels of each historical feature group available for the current round of training are the same as the image labels of the first image and the target historical feature group cannot be screened out, the following S2 and S3 may not be executed, and the second loss coefficient corresponding to the current round of training may be directly set to the above-mentioned preset coefficient.

[0162] In one embodiment, the above S103-3 or the above S3 may be implemented according to the following steps:

[0163] Each minimum similarity is numerically expanded using the target expansion parameter, and a second loss coefficient is determined based on each minimum similarity after numerical expansion.

[0164] Here, the target extension parameter is a preset parameter used to expand the numerical range of the minimum similarity. Exemplarily, the target extension parameter can be 32, 64, a negative number, etc. The specific value of the target extension parameter is not limited here, but any target extension parameter used in a specific application process should fall within the protection scope of this application.

[0165] Exemplarily, each minimum similarity can be multiplied by the target expansion parameter to obtain the minimum similarity after each numerical expansion. Then, a power operation can be performed on the minimum similarity after numerical expansion with e as the base and the minimum similarity after numerical expansion as the power exponent to obtain a third target numerical value. Based on the third target numerical values ​​obtained after performing the power operation on the minimum similarities after each numerical expansion, the second loss coefficient can be determined.

[0166] In this way, by using the target extension parameters to numerically expand each minimum similarity respectively, the numerical range corresponding to the similarity can be improved. The second loss coefficient is determined based on each minimum similarity after numerical expansion, which can improve the rationality and accuracy of the determined second loss coefficient, and further improve the rationality and accuracy of the determined target loss.

[0167] S104: Based on the first loss coefficient and the second loss coefficient, determine the target loss, and use the target loss to iteratively train the target neural network model until the training cutoff condition is met to obtain a trained target neural network model.

[0168] Here, the training cutoff condition may be that the number of iterative training rounds reaches a target number of rounds, and / or the prediction accuracy of the target neural network model obtained through training reaches a target accuracy.

[0169] In specific implementation, the first loss coefficient and the second loss coefficient can be used to calculate the target loss of the target neural network model when predicting feature information, and the target neural network model can be iteratively trained using the target loss until the training cutoff condition is met to obtain a trained target neural network model.

[0170] In this way, based on the training method provided in the embodiment of the present disclosure, training can be performed on a large-scale data set with noisy labels, and a target neural network model with good performance can be obtained.

[0171] In one embodiment, S104 may be implemented according to the following steps:

[0172] A coefficient sum of the first loss coefficient and the second loss coefficient is determined, and a target loss is determined based on a ratio of the first loss coefficient to the coefficient sum.

[0173] Exemplarily, the target loss may be determined according to Formula 3 shown below:

[0174]

[0175] Among them, L represents the target loss, e a represents the first loss coefficient, e b represents the third target value, ∑e b represents the second loss coefficient, which is obtained by summing the third target values ​​corresponding to each minimum similarity. a +∑e b represents the coefficient sum of the first loss coefficient and the second loss coefficient, Represents the ratio of the first loss coefficient to the sum of the coefficients.

[0176] During specific implementation, the first loss coefficient and the second loss coefficient are substituted into the above formula 3 to obtain the target loss.

[0177] Through the above S101 to S104, based on the first similarity between the first feature information extracted from the first image and the second feature information extracted from each second image, the first loss coefficient is determined, and the loss of the model when predicting images with the same label can be determined without storing and using the anchor point features corresponding to the image labels, thereby reducing the data storage pressure and computing resource consumption of the training process. Since the third feature information is determined using other second images in other rounds of training, the third feature information is equivalent to the noise data of the first feature information, and based on the second similarity between the first feature information and the third feature information in at least part of the historical feature group, the second loss coefficient is determined, and then the target loss is determined based on the second loss coefficient and the model is trained using the target loss, which can eliminate the noise data, reduce the impact of the noise data on the model recognition accuracy, and improve the recognition accuracy and robustness to noise of the trained target neural network model.

[0178] In addition, the embodiment of the present disclosure also provides a face recognition method, which is obtained by iteratively training the face recognition model using the training method provided by the above embodiments. Figure 2 As shown, it is a flowchart of a face recognition method provided by an embodiment of the present disclosure, which may include the following steps:

[0179] S201: Obtain a face image to be recognized.

[0180] Here, the facial image to be recognized may be an image including facial information of a target person taken by any camera device.

[0181] S202: Inputting the face image into the target neural network model trained by the training method provided in the above embodiments to obtain the target face information included in the face image.

[0182] Here, the target neural network model may be a face recognition model, and the target face information may include, for example, a target face name. The target face name is the name of the target person included in the face image. For example, the target face information may be person A.

[0183] In specific implementation, the acquired facial image can be input into the facial recognition model trained based on the training method provided in the above embodiments, and the facial recognition model can be used to perform facial recognition processing on the input facial image to output the target facial information included in the facial image.

[0184] In this way, the face recognition model trained based on the training methods provided in the above embodiments has reliable recognition accuracy. By using the trained face recognition model to perform face recognition on the acquired face image to be recognized, the target face information included in the face image can be accurately determined.

[0185] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.

[0186] Based on the same inventive concept, the embodiments of the present disclosure also provide a neural network training device corresponding to the neural network training method. Since the principle of solving the problem by the device in the embodiments of the present disclosure is similar to the above-mentioned neural network training method in the embodiments of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0187] like Figure 3 FIG. 1 is a schematic diagram of a neural network training device provided by an embodiment of the present disclosure, comprising:

[0188] A first acquisition module 301 is used to acquire a first image and at least a preset number of second images, where the second images have the same image label as the first image;

[0189] An extraction module 302 is used to perform feature extraction on the first image using a target neural network model to obtain first feature information, and to perform feature extraction on each of the second images using a sliding average model of the target neural network model to obtain at least a preset number of second feature information;

[0190] A determination module 303 is used to determine a first loss coefficient based on a first similarity between the first feature information and each of the second feature information, and to determine a second loss coefficient based on a second similarity between the first feature information and at least part of the third feature information in the historical feature group; the third feature information included in each of the historical feature groups is determined by using other second images in other rounds of training before the current round of training;

[0191] The training module 304 is used to determine the target loss based on the first loss coefficient and the second loss coefficient, and iteratively train the target neural network model using the target loss until the training cutoff condition is met to obtain a trained target neural network model.

[0192] In a possible implementation, the first image and the second image are face images, and the target neural network model is a face recognition model.

[0193] In one possible implementation, the determination module 303, when determining the first loss coefficient based on the first similarity between the first feature information and each of the second feature information, is used to screen out the maximum similarity from the at least preset number of the first similarities, and determine the first loss coefficient based on a first difference between the maximum similarity and a preset separation value.

[0194] In a possible implementation, the determination module 303, when determining the second loss coefficient based on the second similarity between the first feature information and the third feature information in at least part of the historical feature group, is used to determine, for each historical feature group, a minimum similarity corresponding to the historical feature group based on the second similarity between each of the third feature information in the historical feature group and the first feature information;

[0195] Based on the group label of each of the historical feature groups, a target historical feature group whose group label is inconsistent with the image label of the first image is screened out from the historical feature groups; the group label is an image label of another second image used to extract any of the third feature information in the historical feature group;

[0196] The second loss coefficient is determined based on the minimum similarity corresponding to each of the target historical feature groups.

[0197] In a possible implementation manner, the determination module 303, before determining the second loss coefficient based on the second similarity between the first feature information and the third feature information in at least part of the historical feature group, is further used to divide the at least preset number of the second feature information into multiple current feature groups according to the number of the second feature information and a preset grouping value;

[0198] In the case where the sum of the number of the historical feature groups and the current feature group is greater than the preset number of groups, determining a second difference between the sum of the numbers and the preset number of groups;

[0199] Sorting each of the historical feature groups according to the order of generation time of each of the historical feature groups to obtain a ranking value of each of the historical feature groups;

[0200] Delete each of the historical feature groups whose ranking value is not greater than the second difference.

[0201] In a possible implementation, the device further includes a retaining module 305, which is used to retain each of the current feature groups after deleting each of the historical feature groups whose ranking value is not greater than the second difference, wherein each of the current feature groups retained serves as a historical feature group for the next round of training.

[0202] In a possible implementation, the determination module 303, when determining the second loss coefficient based on the second similarity between the first feature information and the third feature information in at least part of the historical feature groups, is used to filter out, from the historical feature groups, a target historical feature group whose group label is inconsistent with an image label of the first image, based on a group label of each historical feature group;

[0203] For each target historical feature group, based on the second similarity between each of the third feature information in the target historical feature group and the first feature information, determine the minimum similarity corresponding to the target historical feature group;

[0204] The second loss coefficient is determined based on the minimum similarity corresponding to each of the target historical feature groups.

[0205] In a possible implementation, the determination module 303, when determining the second loss coefficient based on the minimum similarity corresponding to each of the target historical feature groups, is used to use the target extension parameter to numerically expand each of the minimum similarities, and determine the second loss coefficient based on each minimum similarity after numerical expansion.

[0206] In a possible implementation, the training module 304, when determining the target loss based on the first loss coefficient and the second loss coefficient, is used to determine the sum of the coefficients of the first loss coefficient and the second loss coefficient, and to determine the target loss based on the ratio of the first loss coefficient to the sum of the coefficients.

[0207] In a possible implementation manner, the determination module 303 is further configured to set the second loss coefficient to a preset coefficient when the current round of training is a first round of training.

[0208] Based on the same inventive concept, a face recognition device corresponding to the face recognition method is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned face recognition method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0209] like Figure 4 FIG. 1 is a schematic diagram of a face recognition device provided by an embodiment of the present disclosure, comprising:

[0210] The second acquisition module 401 is used to acquire a face image to be recognized;

[0211] The recognition module 402 is used to input the face image into the target neural network model trained based on the training method provided in the above embodiments to obtain the target face information included in the face image.

[0212] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.

[0213] Based on the same technical concept, the embodiment of the present application also provides a computer device. Figure 5 FIG. 1 is a schematic diagram of a computer device provided in an embodiment of the present application, including:

[0214] Processor 51, memory 52 and bus 53. Among them, memory 52 stores machine-readable instructions executable by processor 51, and processor 51 is used to execute machine-readable instructions stored in memory 52. ​​When the machine-readable instructions are executed by processor 51, processor 51 performs the following steps: S101: Acquire a first image and at least a preset number of second images, and the second image has the same image label as the first image; S102: Use the target neural network model to extract features of the first image to obtain first feature information, and use the sliding average model of the target neural network model to extract features of each second image to obtain at least a preset number of second feature information; S103: Based on the first similarity between the first feature information and each second feature information, determine the first loss coefficient, and based on the first feature information and at least The second similarity of the third feature information in some historical feature groups is used to determine the second loss coefficient; the third feature information included in each historical feature group is determined by using other second images in other rounds of training before the current round of training; and S104: based on the first loss coefficient and the second loss coefficient, the target loss is determined, and the target neural network model is iteratively trained using the target loss until the training cutoff condition is met to obtain a trained target neural network model; or, when the machine-readable instruction is executed by the processor 51, the processor 51 performs the following steps: S201: obtaining a face image to be recognized and S202: inputting the face image into the target neural network model trained by the training method provided in the above embodiments to obtain the target face information included in the face image.

[0215] The above-mentioned memory 52 includes a memory 521 and an external memory 522; the memory 521 here is also called an internal memory, which is used to temporarily store the calculation data in the processor 51, as well as the data exchanged with the external memory 522 such as a hard disk. The processor 51 exchanges data with the external memory 522 through the memory 521. When the computer device is running, the processor 51 and the memory 52 communicate through the bus 53, so that the processor 51 executes the execution instructions mentioned in the above-mentioned method embodiment.

[0216] The present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the neural network training method and the face recognition method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.

[0217] The computer program product of the neural network training method and the face recognition method provided in the embodiments of the present disclosure includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the steps of the neural network training method and the face recognition method described in the above method embodiments. For details, please refer to the above method embodiments, which will not be repeated here.

[0218] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK) and the like.

[0219] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined, 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 through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.

[0220] 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.

[0221] In addition, each functional unit in each embodiment of the present disclosure 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.

[0222] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for 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 disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0223] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.

[0224] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A neural network training method, characterized in that: include: Acquire a first image and at least a preset number of second images, where the second images have the same image label as the first image; Using a target neural network model to perform feature extraction on the first image to obtain first feature information, and using a sliding average model of the target neural network model to perform feature extraction on each of the second images to obtain at least a preset number of second feature information; The sliding average model of the target neural network model at each training step corresponding to each round of training is determined according to the parameters obtained by performing sliding average calculation on the model parameters of the target neural network model at the training step; Determine a first loss coefficient based on a first similarity between the first feature information and each of the second feature information, and determine a second loss coefficient based on a second similarity between the first feature information and at least part of the third feature information in the historical feature group; wherein the first similarity includes at least a preset number of pieces; and the third feature information included in each of the historical feature groups is determined using other second images in other rounds of training before the current round of training; Based on the first loss coefficient and the second loss coefficient, a target loss is determined, and the target neural network model is iteratively trained using the target loss until a training cutoff condition is met, thereby obtaining a trained target neural network model.

2. The method according to claim 1, characterized in that The first image and the second image are face images, and the target neural network model is a face recognition model.

3. The method according to claim 1, characterized in that The determining a first loss coefficient based on a first similarity between the first feature information and each of the second feature information includes: A maximum similarity is screened out from the at least preset number of the first similarities, and the first loss coefficient is determined based on a first difference between the maximum similarity and a preset separation value.

4. The method according to claim 1, characterized in that: The determining a second loss coefficient based on a second similarity between the first feature information and at least part of the third feature information in the historical feature group includes: For each historical feature group, based on the second similarity between each of the third feature information in the historical feature group and the first feature information, determine the minimum similarity corresponding to the historical feature group; Based on the group label of each of the historical feature groups, a target historical feature group whose group label is inconsistent with the image label of the first image is screened out from the historical feature groups; the group label is an image label of another second image used to extract any of the third feature information in the historical feature group; The second loss coefficient is determined based on the minimum similarity corresponding to each of the target historical feature groups.

5. The method according to claim 1, characterized in that Before determining the second loss coefficient based on the second similarity between the first feature information and at least part of the third feature information in the historical feature group, the method further includes: According to the quantity of the second characteristic information and a preset grouping value, dividing the at least preset quantity of the second characteristic information into a plurality of current characteristic groups; In the case where the sum of the number of the historical feature groups and the current feature group is greater than the preset number of groups, determining a second difference between the sum of the numbers and the preset number of groups; Sorting each of the historical feature groups according to the order of generation time of each of the historical feature groups to obtain a ranking value of each of the historical feature groups; Delete each of the historical feature groups whose ranking value is not greater than the second difference.

6. The method according to claim 5, characterized in that After deleting each of the historical feature groups whose ranking value is not greater than the second difference, the method further includes: Each of the current feature groups is retained, wherein each of the current feature groups retained is used as a historical feature group for the next round of training.

7. The method according to claim 1, characterized in that The determining a second loss coefficient based on a second similarity between the first feature information and at least part of the third feature information in the historical feature group includes: Based on the group label of each historical feature group, screening out a target historical feature group whose group label is inconsistent with the image label of the first image from the historical feature groups; For each target historical feature group, based on the second similarity between each of the third feature information in the target historical feature group and the first feature information, determine the minimum similarity corresponding to the target historical feature group; The second loss coefficient is determined based on the minimum similarity corresponding to each of the target historical feature groups.

8. The method according to claim 4, characterized in that The determining the second loss coefficient based on the minimum similarity corresponding to each of the target historical feature groups includes: Each of the minimum similarities is numerically expanded using a target expansion parameter, and the second loss coefficient is determined based on each minimum similarity after numerical expansion.

9. The method according to any one of claims 1 to 8, characterized in that: The determining the target loss based on the first loss coefficient and the second loss coefficient includes: A coefficient sum of the first loss coefficient and the second loss coefficient is determined, and the target loss is determined based on a ratio of the first loss coefficient to the coefficient sum.

10. The method according to any one of claims 1 to 8, characterized in that: The method further comprises: When the current round of training is the first round of training, the second loss coefficient is set to a preset coefficient.

11. A face recognition method, characterized in that: include: Obtain a face image to be recognized; The facial image is input into a target neural network model trained by the training method according to any one of claims 1 to 10 to obtain target facial information included in the facial image.

12. A neural network training device, characterized in that: include: A first acquisition module, used to acquire a first image and at least a preset number of second images, where the second images have the same image label as the first image; An extraction module, configured to perform feature extraction on the first image using a target neural network model to obtain first feature information, and to perform feature extraction on each of the second images using a sliding average model of the target neural network model to obtain at least a preset number of second feature information; The sliding average model of the target neural network model at each training step corresponding to each round of training is determined according to the parameters obtained by performing sliding average calculation on the model parameters of the target neural network model at the training step; A determination module, configured to determine a first loss coefficient based on a first similarity between the first feature information and each of the second feature information, and to determine a second loss coefficient based on a second similarity between the first feature information and at least part of the third feature information in the historical feature group; wherein the first similarity includes at least a preset number of pieces; and the third feature information included in each of the historical feature groups is determined using other second images in other rounds of training before the current round of training; A training module is used to determine a target loss based on the first loss coefficient and the second loss coefficient, and to iteratively train the target neural network model using the target loss until a training cutoff condition is met, thereby obtaining a trained target neural network model.

13. A face recognition device, characterized in that: include: The second acquisition module is used to acquire the face image to be recognized; A recognition module is used to input the face image into a target neural network model trained by the training method according to any one of claims 1 to 10 to obtain target face information included in the face image.

14. A computer device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory, and when the machine-readable instructions are executed by the processor, the processor executes the steps of the neural network training method as described in any one of claims 1 to 10; or, when the machine-readable instructions are executed by the processor, the processor executes the steps of the face recognition method as described in claim 11.

15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program. When the computer program is executed by a computer device, the computer device executes the steps of the neural network training method as described in any one of claims 1 to 10; or, when the computer program is executed by a computer device, the computer device executes the steps of the face recognition method as described in claim 11.

Citation Information

Patent Citations

  • Image processing method and device, electronic equipment and storage medium

    CN112396119A

  • Training method and device, computer equipment and storage medium

    CN113887458A