Target recognition model training, target recognition method, system, equipment and medium

By dividing states and assigning weights based on the difference in feature information between original samples and mirror samples, the impact of noise samples on the target recognition model is solved and the robustness and accuracy of the model are improved.

CN118411568BActive Publication Date: 2024-10-01INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410846360.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-27
Publication Date
2024-10-01
Estimated Expiration
2044-06-27

AI Technical Summary

Technical Problem

In the training of target recognition models, the negative impact of noise samples on model performance is difficult to reduce, especially in large-scale data sets, where manual annotation consumes a lot of resources.

Method used

The sample states are divided by the difference in feature information between the original sample and its mirror sample, and different weights are assigned to samples in different states. The model is trained using a preset loss function to reduce the interference of noisy samples.

Benefits of technology

It improves the robustness and accuracy of the model, reduces the interference of noise samples on the model, and improves the training efficiency and the generalization ability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118411568B_ABST
    Figure CN118411568B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a training of a target recognition model, a target recognition method, a system, a device and a medium, and relate to the field of image processing. The training method includes: determining the state to which the original sample belongs according to the difference between the first feature information of the original sample and the second feature information of the mirror sample; the mirror sample is a sample obtained by horizontally flipping the original sample; assigning different weights to the original samples of different states in the current training cycle; determining the loss value according to the weight of the original sample in the current training cycle and a preset loss function; training the target recognition model according to the loss value to obtain the trained target recognition model. The method assigns different weights to the original samples of different states in the current training cycle, and subdivides the influence of the original samples of each state in the current training cycle on the model training through the weight, which can improve the robustness and accuracy of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a target recognition model training, target recognition method, system, device and medium. Background Art

[0002] The target recognition model is a model that uses computer vision and machine learning technology to analyze and compare target features for recognition. It can be applied to security fields (such as face access control systems, face payment verification), transportation fields (vehicle recognition, traffic sign recognition), medical fields, etc. The problem of noisy data in machine learning is a common and critical challenge. Noise samples in the training data set will change the sample distribution of the training data, have a negative impact on the training and prediction of the model, and thus lead to reduced performance of the model. In order to reduce or eliminate the impact of noise samples on the model, manual annotation is usually used to create low-noise or noise-free data sets.

[0003] However, the size of training datasets is increasing, usually including hundreds of thousands or even more images. For such large-scale datasets, manual annotation consumes a lot of manpower and material resources. Summary of the invention

[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the embodiments of the present application provide a training method for a target recognition model, a target recognition method, a system, an electronic device and a computer-readable storage medium.

[0005] In a first aspect, an embodiment of the present application provides a method for training a target recognition model, comprising:

[0006] Determine the state to which the original sample belongs according to the difference between the first feature information of the original sample and the second feature information of the mirror sample; the mirror sample is a sample obtained by horizontally flipping the original sample;

[0007] Assign different weights to original samples in different states in the current training cycle;

[0008] Determine a loss value according to the weight of the original sample in the current training cycle and a preset loss function;

[0009] The target recognition model is trained according to the loss value to obtain a trained target recognition model.

[0010] Optionally, the state to which the original sample belongs includes a first state, a second state and a third state;

[0011] The method of assigning different weights to original samples in different states in the current training cycle includes: in the current training cycle, the weight assigned to the original samples in the first state is greater than or equal to the weight assigned to the original samples in the second state, and the weight assigned to the original samples in the second state is greater than the weight assigned to the original samples in the third state.

[0012] Optionally, the method of assigning different weights to original samples in different states in the current training cycle also includes: assigning weights to original samples in a first state in the current training cycle according to a preset attenuation relationship; the preset attenuation relationship indicates that the weights of original samples in the first state gradually decrease in each cycle from the beginning of training to the end of training; and assigning weights to original samples in a second state in the current training cycle according to a preset growth relationship; the preset growth relationship indicates that the weights of original samples in the second state gradually increase in each cycle from the beginning of training to the end of training.

[0013] Optionally, the preset attenuation relationship indicates that the weight of the original sample in the first state from the beginning of training to the end of training decays from the preset first initial value to 1, and the preset growth relationship indicates that the weight of the original sample in the second state from the beginning of training to the end of training increases from the preset second initial value to 1.

[0014] Optionally, the allocating different weights to original samples in different states in the current training cycle further includes: determining that the weight of the original samples in the third state in the current training cycle is 0.

[0015] Optionally, the target recognition model includes a feature extraction network, and the feature extraction network includes a plurality of convolutional layers and a first fully connected layer coupled in sequence;

[0016] The method also includes: inputting the original sample as input data into the current target recognition model, obtaining a first vector output by a first fully connected layer of the current feature extraction network, and using the first vector as first feature information of the original sample in the current training cycle; inputting the mirror sample as input data into the current target recognition model, obtaining a second vector output by a first fully connected layer of the current feature extraction network, and using the second vector as second feature information of the mirror sample in the current training cycle.

[0017] Optionally, the method also includes: determining the class center corresponding to the category label to which the original sample belongs; determining a first distance between the first feature information and the class center corresponding to the category label; determining a second distance between the second feature information and the class center corresponding to the category label; and determining the difference between the first feature information of the original sample and the second feature information of the mirror sample in the current training cycle based on the first distance and the second distance.

[0018] Optionally, the target recognition model includes a second fully connected layer, and the second fully connected layer is used to classify the original sample according to the first feature information, and classify the mirror sample according to the second feature information;

[0019] Determining the class center corresponding to the class label to which the original sample belongs in the current training cycle includes: obtaining the class center corresponding to the class label to which the original sample belongs in the current training cycle from the weight parameters of the second fully connected layer of the current target recognition model.

[0020] Optionally, determining the difference between the first feature information of the original sample and the second feature information of the mirror sample in the current training cycle according to the first distance and the second distance includes:

[0021] Determine at least one associated cycle corresponding to the current training cycle according to the current training cycle and a preset maximum number of historical cycles;

[0022] Determine the first distance, the second distance, and the coefficient corresponding to the at least one association period, and determine the difference between the first feature information of the original sample and the second feature information of the mirror sample in the current training period according to the first distance, the second distance, and the coefficient corresponding to each of the association periods.

[0023] Optionally, determining the difference between the first feature information of the original sample and the second feature information of the mirror sample in the current training cycle according to the first distance, the second distance, and the coefficient corresponding to each of the association cycles includes:

[0024] For each association period, determining an absolute value of a difference between a first distance and a second distance corresponding to the association period;

[0025] According to the coefficients corresponding to the association periods, the weighted sum of the absolute values ​​corresponding to the association periods is calculated, and the weighted sum is used as the difference between the first feature information of the original sample and the second feature information of the mirror sample in the current training period.

[0026] Optionally, determining a coefficient corresponding to at least one associated cycle includes: determining that a coefficient corresponding to a current training cycle is the largest, and determining that a coefficient corresponding to an associated cycle farther from the current training cycle is smaller.

[0027] Optionally, determining the state to which the original sample belongs according to the difference between the first feature information of the original sample and the second feature information of the mirror sample includes:

[0028] comparing the difference, a first preset threshold and a second preset threshold, wherein the first preset threshold is less than the second preset threshold;

[0029] When the difference is less than the first preset threshold, determining that the state to which the original sample belongs is the first state;

[0030] When the difference is greater than or equal to the first preset threshold and less than or equal to the second preset threshold, determining that the state to which the original sample belongs is the second state;

[0031] When the difference is greater than the second preset threshold, it is determined that the state to which the original sample belongs is the third state.

[0032] Optionally, determining the loss value according to the weight of the original sample and a preset loss function includes:

[0033] Dividing the training data set to obtain multiple training subsets, wherein the training data set includes multiple original samples;

[0034] Determine the class center corresponding to each class label in the training data set in the current training cycle;

[0035] For the original samples in the training subset, the class center corresponding to the class label to which the original samples belong is taken as the first class center, and the class center corresponding to the class label other than the class label to which the original samples belong is taken as the second class center, and a first distance between the first feature information of the original samples and the first class center and a third distance between the first feature information of the original samples and the second class center are determined;

[0036] The loss value corresponding to the training subset is calculated according to a preset loss function, a weight of each original sample in the training subset, and the first distance and the third distance corresponding to each original sample in the training subset.

[0037] Optionally, different weights are assigned to original samples in different states in the current training cycle according to the following formula (1):

[0038] (1)

[0039] in, Represents the original sample The weight at the kth training cycle, E represents the total number of training cycles, is a preset coefficient less than 1, The default value is less than 0.5.

[0040] Optionally, a first distance between the first feature information and the class center corresponding to the class label is determined according to the following formula (2), and a second distance between the second feature information and the class center corresponding to the class label is determined according to the following formula (3):

[0041] (2)

[0042] (3)

[0043] in, represents the first distance in the kth training cycle, represents the second distance in the kth training cycle, represents the original sample, Represents the original sample The mirror image sample, Represents the original sample The first feature information in the kth training cycle, Represents a mirror sample The second feature information in the kth training cycle, Represents the original sample The category label it belongs to, Represents the category label at the kth training cycle The corresponding class center, T represents the vector transpose, express Norm.

[0044] Optionally, at least one associated cycle corresponding to the current training cycle is determined according to the following formula (4):

[0045] (4)

[0046] Among them, k represents the current training cycle, H represents the preset maximum number of historical cycles, and max It means taking the larger value between (k-H+1) and 0, z represents the association period corresponding to the current training period, and z is a positive integer.

[0047] Optionally, the difference between the first feature information of the original sample and the second feature information of the mirror image sample is determined according to the following formula (5):

[0048] (5)

[0049] in, represents the difference between the first feature information of the original sample and the second feature information of the mirror sample in the kth training cycle, Indicates the preset reference value.

[0050] Optionally, the loss value corresponding to the training subset is calculated according to the following formula (6):

[0051] (6)

[0052] Among them, L represents the loss value corresponding to the training subset, B represents the number of original samples in the training subset, represents the i-th original sample in the training subset, Represents the original sample The weight in the kth training cycle, e represents a natural constant, s represents a preset scaling factor, m is a preset hyperparameter, q represents the category label in the training data set except the category label to which the original sample belongs, Represents the original sample The third distance between the first feature information of and the class center corresponding to the class label q, and C represents the number of class labels in the training data set.

[0053] In a second aspect, an embodiment of the present application provides a target recognition method, including:

[0054] Inputting an image to be identified as input data into a target recognition model, wherein the image to be identified includes a target to be identified; the target recognition model is obtained according to the training method described in any embodiment of the present application, and the target recognition model includes a feature extraction network;

[0055] Acquire feature information of the image to be identified output by the feature extraction network;

[0056] Matching the feature information of the image to be identified with known features in a feature library to determine the similarity between the feature information of the image to be identified and the known features;

[0057] According to the similarity, the target to be identified on the image to be identified is identified.

[0058] In a third aspect, an embodiment of the present application provides a training system for a target recognition model, including:

[0059] A state determination module, which determines the state to which the original sample belongs according to the difference between the first characteristic information of the original sample and the second characteristic information of the mirror sample; the mirror sample is a sample obtained by horizontally flipping the original sample;

[0060] The weight determination module is used to assign different weights to original samples in different states in the current training cycle;

[0061] A loss determination module, used to determine a loss value according to the weight of the original sample in the current training cycle and a preset loss function;

[0062] The parameter updating module is used to train the target recognition model according to the loss value to obtain a trained target recognition model.

[0063] In a fourth aspect, an embodiment of the present application provides a target recognition system, including:

[0064] An input module, used to input at least one image to be recognized as input data into a target recognition model, wherein the at least one image to be recognized includes a target to be recognized; the target recognition model is obtained according to the training method described in any embodiment of the present application; the target recognition model includes a feature extraction network;

[0065] An acquisition module, used for acquiring feature information of the at least one image to be identified output by the feature extraction network;

[0066] A matching module, used to match the feature information of the at least one image to be identified with known features in a feature library, and determine the similarity between the feature information of the at least one image to be identified and the known features;

[0067] The identification module is used to identify the target to be identified according to the similarity.

[0068] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the training method or target recognition method of the target recognition model described in any embodiment of the present application.

[0069] In a sixth aspect, an embodiment of the present application provides an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; the memory is used to store computer programs; and the processor is used to implement the target recognition model training method or the target recognition method described in any embodiment of the present application when executing the program stored in the memory.

[0070] In a seventh aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the training method of the target recognition model or the target recognition method described in any embodiment of the present application is implemented.

[0071] The technical solution provided by the embodiments of the present application brings at least the following beneficial effects:

[0072] The training method of the target recognition model provided in the embodiment of the present application determines the state to which the original sample belongs by the difference between the first feature information of the original sample and the second feature information of the mirror sample, and then assigns different weights to the original samples of different states in the current training cycle, and calculates the loss value based on the weight of the original sample in the current training cycle and the preset loss function, and trains the target recognition model based on the loss value to update the parameters of the target recognition model and obtain the trained target recognition model. The method divides the original sample according to the difference between the first feature information of the original sample and the second feature information of the mirror sample, divides the original sample into different states, and then assigns different weights to the samples of different states, so as to control the influence of the original samples of different states on the target recognition model through weights, thereby reducing or eliminating the interference of noise samples on the model; further, the embodiment of the present application determines the weights of the original samples of each state in the current training cycle according to the training cycle of the target recognition model, so that the weights of the original samples of each state change with the change of the model training cycle, and further refines the influence of the original samples of each state on the target recognition model in different training cycles, so as to improve the robustness and accuracy of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0073] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

[0074] Figure 1 A flowchart of a method for training a target recognition model provided by an embodiment of the present application is schematically shown;

[0075] Figure 2 A block diagram of a target recognition model according to an embodiment of the present application is schematically shown;

[0076] Figure 3 A flowchart schematically shows a method for training a target recognition model provided by another embodiment of the present application;

[0077] Figure 4 A block diagram of a target recognition model according to another embodiment of the present application is schematically shown;

[0078] Figure 5 A flowchart of a method for training a target recognition model provided by another embodiment of the present application is schematically shown;

[0079] Figure 6 A flowchart schematically shows a method for training a target recognition model provided by another embodiment of the present application;

[0080] Figure 7 A flowchart of a target recognition method provided by an embodiment of the present application is schematically shown;

[0081] Figure 8 A block diagram of a training system for a target recognition model provided in an embodiment of the present application is schematically shown;

[0082] Fig. 9 A block diagram of a target recognition system provided by an embodiment of the present application is schematically shown;

[0083] Fig.10 A block diagram of an electronic device provided in an embodiment of the present application is schematically shown. DETAILED DESCRIPTION

[0084] Below in conjunction with the accompanying drawings, exemplary embodiments of the present invention are described, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be appreciated by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention.

[0085] Figure 1 The flowchart of the target recognition model training method of an embodiment of the present application is schematically shown. The target recognition model provided by the embodiment of the present application can be applied to various scenarios, such as access control systems, face recognition in payment verification systems, vehicle recognition in the field of intelligent driving, lane recognition, etc. For ease of understanding, face recognition is used as an example for explanation below.

[0086] like Figure 1 As shown, the target recognition model training method provided in the embodiment of the present application includes:

[0087] Step S101: determining the state to which the original sample belongs according to the difference between the first feature information of the original sample and the second feature information of the mirror sample corresponding to the original sample; the mirror sample is a sample obtained by horizontally flipping the original sample.

[0088] The original samples are samples in the training data set. The training data set can be, for example, a collection of face images collected by engineering and technical personnel, which contains a large number of face images. Optionally, the training data set also includes a category label (such as ID) of each original sample, which is used to identify the identity to which the face image belongs. The mirror sample is a sample obtained by horizontally flipping the original sample. Horizontal flipping refers to mirroring the left and right parts of the image with the vertical center axis of the image as the center, so that the content originally on the left side of the image is displayed on the right side, and the content originally on the right side is displayed on the left side.

[0089] The first feature information of the original sample can be used to describe the specific structure of the original sample, such as the specific structure of the face in the original sample. Similarly, the second feature information of the mirror sample can be used to describe the specific structure of the mirror sample, such as the specific structure of the face in the mirror sample. As an example, the first feature information can describe one or more of the following features: color features, texture features, shape features, spatial relationship features, HOG (Histogram of Oriented Gradient) features, LBP (Local Binary Patterns) features, Haar-like features, etc. of the original sample. The second feature information can also describe one or more of the following features: color features, texture features, shape features, spatial relationship features, HOG (Histogram of Oriented Gradient) features, LBP (Local Binary Patterns) features, Haar-like features, etc. of the original sample.

[0090] In an optional embodiment, the first feature information of the original sample and the second feature information of the mirrored sample can be obtained by a feature extraction algorithm (HOG algorithm, LBP algorithm, Haar algorithm) and a feature extraction model (such as a Markov random field model). In other optional embodiments, the first feature information of the original sample and the second feature information of the mirrored sample can be obtained by the target recognition model of this embodiment. For example, the target recognition model includes a feature extraction network, which is used to obtain feature information of an input sample (original sample or mirrored sample). As an example, Figure 2 As shown, the feature extraction network may include a plurality of convolutional layers coupled in sequence (such as Figure 2 The first fully connected layer comprises convolutional layer 1, convolutional layer 2, convolutional layer N) and a first fully connected layer. As an example, each convolutional layer adopts a 3x3 convolution kernel, and the convolution step size is 1. The vector output by the first fully connected layer can be, for example, a 512-dimensional vector, or a 128-, 256-, and 1024-dimensional vector, which is not limited in the present application. In this embodiment, the original sample is input into the target recognition model as input data, and the first vector output by the first fully connected layer of the feature extraction network is obtained, and the first vector is used as the first feature information of the original sample. The mirror sample is input into the target recognition model as input data, and the second vector output by the first fully connected layer of the feature extraction network is obtained, and the second vector is used as the second feature information of the mirror sample.

[0091] The difference between the first feature information of the original sample and the second feature information of the mirror sample can describe the difference between the features of the original sample and the features of the mirror sample. The greater the difference, the greater the difference between the features of the original sample and the features of the mirror sample. Optionally, the difference between the first feature information and the second feature information can be determined based on the distance between the two. For example, the Euclidean distance, Manhattan distance, cosine distance, Hamming distance or Chebyshev distance between the first feature information and the second feature information can be used as the difference between the two.

[0092] After obtaining the difference between the first feature information and the second feature information, the original sample is divided to determine the state to which the original sample belongs. In an optional embodiment, the states to which the original sample belongs include three, namely, the first state, the second state and the third state. The original sample of the third state belongs to a noise sample, and the original sample of the first state and the original sample of the second state belong to a non-noise sample, that is, a clean sample. The noise sample is a sample that is misclassified or mislabeled in the training data set. For example, in a face image set, the face images can be grouped according to identity (ID) by manual labeling or computer program. In the grouping process, face images of different identities may be labeled or clustered to the same identity. In the embodiment of the present application, the face images of other IDs mixed in the face image set of one ID are called noise samples. The difference between the feature information of the noise sample and the feature information of the corresponding mirror sample is large, and the difference between the feature information of the clean sample and the feature information of the corresponding mirror sample is small. The original sample of the first state belongs to an easy sample in the clean sample, and the original sample of the second state belongs to a difficult sample in the clean sample. The difference degree corresponding to the easy sample (the difference degree between the feature information of the easy sample and the feature information of its corresponding mirror sample) is smaller than the difference degree corresponding to the difficult sample (the difference degree between the feature information of the difficult sample and the feature information of its corresponding mirror sample), and the difficulty of the easy sample being correctly identified or correctly classified by the target recognition model is lower than that of the difficult sample. The difference degree corresponding to the original sample in the first state is smaller than the difference degree corresponding to the original sample in the second state, and the difference degree corresponding to the original sample in the second state is smaller than the difference degree corresponding to the original sample in the third state.

[0093] Therefore, when the difference between the first feature information and the second feature information is less than the first preset threshold, the original sample belongs to the first state; when the difference between the first feature information and the second feature information is greater than or equal to the first preset threshold and less than or equal to the second preset threshold, the original sample belongs to the second state; when the difference between the first feature information and the second feature information is greater than the second preset threshold, the original sample belongs to the third state.

[0094] Step S102: assigning different weights to original samples in different states in the current training cycle.

[0095] In the embodiment of the present application, different weights are assigned to original samples in different states, which can control the influence of original samples in different states on the target recognition model. For example, in the current training cycle, the weight assigned to the original sample (easy sample) in the first state is greater than or equal to the weight assigned to the original sample (difficult sample) in the second state, and the weight assigned to the original sample (difficult sample) in the second state is greater than the weight assigned to the original sample (noise sample) in the third state. Among them, the current training cycle can be any cycle or a specified cycle in the process of training the target recognition model, that is, in any cycle or a specified cycle of the training target recognition model, the weight assigned to the original sample in the first state is greater than or equal to the weight assigned to the original sample in the second state, and the weight assigned to the original sample in the second state is greater than the weight assigned to the original sample in the third state. In this step, the weight assigned to the easy sample is greater than or equal to the weight assigned to the difficult sample, and the weight assigned to the difficult sample is greater than the weight assigned to the noise sample, so that the influence of the easy sample on the target recognition model is greater than or equal to the influence of the difficult sample on the target recognition model, and the influence of the easy sample and the difficult sample on the target recognition model is greater than the influence of the noise sample on the target recognition model, thereby reducing the negative interference of the noise sample on the target recognition model and improving the robustness and accuracy of the target recognition model.

[0096] Optionally, assigning weights to the original samples in the first state includes: assigning weights to the original samples (easy samples) in the first state in the current training cycle according to a preset decay relationship, and the preset decay relationship indicates that the weights of the original samples in the first state gradually decrease in each cycle from the beginning of training to the end of training. The preset decay relationship causes the weights of easy samples to gradually decay during the training process of the target recognition model, and the target recognition model's attention to easy samples gradually decreases. Optionally, assigning weights to the original samples in the second state includes: assigning weights to the original samples in the second state in the current training cycle according to a preset growth relationship, and the preset growth relationship indicates that the weights of the original samples in the second state gradually increase in each cycle from the beginning of training to the end of training. The preset growth relationship causes the weights of difficult samples to gradually increase during the training process of the target recognition model, and the target recognition model's attention to difficult samples gradually increases. Weights are assigned to the original samples of the first state and the original samples of the second state respectively through a preset attenuation relationship and a preset growth relationship, so that in the initial stage of training the target recognition model, the target recognition model pays more attention to easy samples. As the training process proceeds, the target recognition model gradually pays attention to difficult samples, thereby reducing the impact of difficult samples (including noise samples that are misjudged as difficult samples) on the model in the early stage of training, and avoiding training instability caused by difficult samples (including noise samples that are misjudged as difficult samples).

[0097] Optionally, the preset decay relationship indicates that the weight of the original sample in the first state from the beginning of training to the end of training decays from the preset first initial value to 1, and the preset growth relationship indicates that the weight of the original sample in the second state from the beginning of training to the end of training increases from the preset second initial value to 1. In the initial stage of training the target recognition model, the target recognition model pays more attention to easy samples. As the training process proceeds, the target recognition model gradually pays attention to difficult samples, and finally pays equal attention to easy samples and difficult samples at the end of the target recognition model training, thereby improving the generalization and robustness of the target recognition model. At the same time, at the end of the target recognition model training, the target recognition model has stabilized, the probability of noise samples being misjudged as difficult samples is very low, and the noise samples misjudged as difficult samples are very few or non-existent. Even if the weight of the difficult sample is increased to 1, since the number of noise samples misjudged as difficult samples is very small, the noise samples misjudged as difficult samples have little negative impact on the model, and little damage to the robustness and accuracy of the model.

[0098] As an optional example, weights may be assigned to samples in the first state and samples in the second state in the current training cycle according to the following formula (1):

[0099] (1)

[0100] in, Represents the original sample The weight at the kth training cycle, E represents the total number of training cycles, is a preset coefficient less than 1, is a preset value less than 0.5. As an example, is 0.2, is 0.2.

[0101] Step S103: determining a loss value according to the weight of the original sample in the current training cycle and a preset loss function.

[0102] In this step, the weight of the original sample in the current training cycle is used as a parameter for calculating the loss value, which can quantitatively process the impact of the original samples in different states on the target recognition model. As an optional example, the preset loss function can be a cross-entropy loss function, a mean squared error (MSE) loss function, etc.

[0103] Step S104: training the target recognition model according to the loss value to obtain a trained target recognition model.

[0104] In this step, for example, the parameters in the target recognition model can be updated based on the stochastic gradient descent algorithm and the loss value to obtain an updated target recognition model. Among them, the total number of cycles of model training and the parameters related to the stochastic gradient descent algorithm, such as the initial learning rate, momentum coefficient, decay coefficient, etc., can be pre-set. As an optional example, the total number of cycles of model training can be set to 20, the initial learning rate to 0.1, the momentum coefficient to 0.9, the decay coefficient to 0.0005, the learning rate drops to 0.01 in the 10th training cycle, the learning rate drops to 0.001 in the 15th training cycle, and the learning rate drops to 0.0001 in the 18th training cycle.

[0105] The training method of the target recognition model of the embodiment of the present application divides the original sample into different states according to the difference between the first feature information of the original sample and the second feature information of the mirror sample, and then assigns different weights to the samples in different states, so as to control the influence of the original samples in different states on the target recognition model through different weights, so as to reduce or eliminate the interference of noise samples on the model; further, the embodiment of the present application determines the weights of the original samples of each state in the current training cycle according to the training cycle of the target recognition model, so that the weights of the original samples of each state change with the change of the model training cycle, and further refines the influence of the original samples of each state on the target recognition model in different training cycles, thereby improving the robustness and accuracy of the model.

[0106] Figure 3 It is a flowchart of a method for training a target recognition model according to another embodiment of the present application. Figure 4 A block diagram of a target recognition network model in an embodiment of the present application is shown.

[0107] like Figure 3 As shown, the training method of the target recognition model includes:

[0108] Step S301: Input the original sample as input data into the current target recognition model, obtain the first vector output by the target recognition model, and use the first vector as the first feature information of the original sample; input the mirror sample as input data into the current target recognition model, obtain the second vector output by the target recognition model, and use the second vector as the second feature information of the mirror sample.

[0109] Among them, reference Figure 2 and Figure 4The target recognition model includes a feature extraction network, and the feature network model is used to obtain feature information of an input sample (original sample or mirror sample). During the training process of the target recognition model, the parameters of the model are different in different training cycles, the first feature information extracted by the target recognition model in different training cycles is partially different or completely different, and the second feature information extracted by the target recognition model in different training cycles is partially different or completely different.

[0110] Step S302: Determine the class center corresponding to the class label to which the original sample belongs in the current training cycle.

[0111] refer to Figure 4 , the target recognition model includes a second fully connected layer, and the second fully connected layer is coupled to the first fully connected layer of the feature extraction network. The second fully connected layer is used to classify the input sample according to the feature information output by the first fully connected layer. For example, the second fully connected layer classifies the original sample according to the first feature information of the original sample, maps the original sample to the category label included in the training data set, and divides the mirror sample according to the second feature information of the mirror sample, and maps the mirror sample to the category label included in the training data set. Therefore, the weight parameter of the second fully connected layer includes the class center corresponding to each category label, and the class center corresponding to the category label to which the original sample belongs is obtained from the weight parameter of the second fully connected layer. Among them, the category label in the training data set is used to identify the category of the original sample. Taking the original sample as a face image as an example, the training data set includes multiple face images and the category label (such as ID) of each face image, and the category label is used to identify the identity to which the face image belongs.

[0112] Step S303: Determine a first distance between the first feature information and the class center corresponding to the class label.

[0113] Step S304: Determine a second distance between the second feature information and the class center corresponding to the class label.

[0114] The first distance and the second distance are respectively the first distance and the second distance between the first feature information in the current training cycle and the class center in the current training cycle. In some optional embodiments, the first distance between the first feature information and the class center corresponding to the class label, and the second distance between the second feature information and the class center corresponding to the class label can be Euclidean distance, Manhattan distance, cosine distance, Hamming distance or Chebyshev distance, etc.

[0115] In some other optional embodiments, the first distance and the second distance may be angular distances. For example, the first distance is calculated according to the following formula (2), and the second distance is calculated according to the following formula (3):

[0116] (2)

[0117] (3)

[0118] in, represents the first distance in the kth training cycle, represents the second distance in the kth training cycle, represents the original sample, Represents the original sample The mirror image sample, Represents the original sample The first feature information in the kth training cycle, Represents a mirror sample The second feature information in the kth training cycle, Represents the original sample The category label it belongs to, Represents the category label at the kth training cycle The corresponding class center, T represents the vector transpose, express Norm.

[0119] Step S305: Determine the difference between the first feature information of the original sample and the second feature information of the mirrored sample in the current training cycle according to the first distance and the second distance.

[0120] In some optional embodiments, the difference between the absolute value of the first distance and the absolute value of the second distance can be used as the difference between the first feature information and the second feature information. In some other optional embodiments, the difference between the first feature information and the second feature information can be determined according to a preset custom difference function. The difference function is used to describe the relationship between the difference between the first feature information and the second feature information, the first distance, and the second distance.

[0121] Step S306: Determine the state of the original sample in the current training cycle according to the difference between the first feature information of the original sample and the second feature information of the mirror sample in the current training cycle; the mirror sample is a sample obtained by horizontally flipping the original sample.

[0122] Step S307: assigning different weights to original samples in different states in the current training cycle.

[0123] Step S308: Determine the loss value according to the weight of the original sample in the current training cycle and the preset loss function.

[0124] Step S309: Train the target recognition model according to the loss value to obtain a trained target recognition model.

[0125] Steps S306 to S309 can refer to Figure 1 To avoid repetition, the steps S101 to S104 shown are not described in detail herein.

[0126] The training method of the target recognition model of the embodiment of the present application obtains the feature information of the original sample and the mirror sample in the current training cycle based on the current target recognition model, and determines the difference between the feature information of the original sample and the mirror sample in the current cycle. As the target recognition model is trained, the more stable the target recognition model is, the more stable the extracted feature information is, the more stable the difference between the feature information of each original sample and the mirror sample is, the more accurate the state of each original sample is determined, and the more accurate the weight assigned to the original sample in each state is, the more accurate the influence of the original sample in each state on the target recognition model described by the weight is, thereby improving the accuracy of the model.

[0127] Figure 5 FIG. 2 is a flow chart showing a method for training a target recognition model according to another embodiment of the present invention. Figure 5 As shown, the method includes:

[0128] Step S501: Input the original sample as input data into the current target recognition model, obtain the first vector output by the target recognition model, and use the first vector as the first feature information of the original sample; input the mirror sample as input data into the current target recognition model, obtain the second vector output by the target recognition model, and use the second vector as the second feature information of the mirror sample.

[0129] Step S502: Determine the class center corresponding to the class label to which the original sample belongs in the current training cycle.

[0130] Step S503: Determine a first distance between the first feature information and the class center corresponding to the class label.

[0131] Step S504: Determine a second distance between the second feature information and the class center corresponding to the class label.

[0132] Step S505: determining at least one associated cycle corresponding to the current training cycle according to the current training cycle and the preset longest historical cycle number;

[0133] Step S506: Determine the first distance, the second distance, and the coefficient corresponding to the at least one association period;

[0134] Step S507: determining the difference between the first feature information of the original sample and the second feature information of the mirror sample in the current training cycle according to the first distance, the second distance, and the coefficient corresponding to each of the association cycles;

[0135] Step S508: Determine the state to which the original sample belongs according to the difference between the first characteristic information of the original sample and the second characteristic information of the mirrored sample; the mirrored sample is a sample obtained by horizontally flipping the original sample;

[0136] Step S509: Determine the weight corresponding to the state in the current training cycle, and use the weight corresponding to the state in the current training cycle as the weight of the original sample;

[0137] Step S510: Determine the loss value according to the weight of the original sample in the current training cycle and the preset loss function.

[0138] Step S511: Train the target recognition model according to the loss value to obtain a trained target recognition model.

[0139] Among them, steps S501-step S504, steps S508-step S511 can refer to Figure 3 To avoid repetition, the present application will not describe the embodiments shown in detail.

[0140] For steps S505-S507, the difference between the first feature information of the original sample and the second feature information of the mirror sample in the current training cycle is not only related to the output information of the current target recognition model, but also to the output history information of the target recognition model. The output information of the current training cycle has the greatest impact on the difference, and the output information of the target recognition model in the training cycle farther from the current training cycle has a smaller impact on the difference. Therefore, the influence of the current training cycle and the training cycle before the current training cycle on the difference can be measured by the coefficient. The coefficient corresponding to the current training cycle is the largest, and the coefficient corresponding to the training cycle farther from the current training cycle is smaller.

[0141] In an optional embodiment, only the influence of the output information of the partial training cycle before the current training cycle on the difference can be considered, and the partial training cycle before the current training cycle that needs to be considered is used as the associated cycle corresponding to the current training cycle. The coefficient corresponding to the current training cycle is the largest, and the coefficient of the associated cycle farther from the current training cycle is smaller. As an optional example, at least one associated cycle corresponding to the current training cycle can be determined according to the following formula (4):

[0142] (4)

[0143] Among them, k represents the current training cycle, H represents the preset maximum number of historical cycles, and max It means taking the larger value between (k-H+1) and 0, z represents the association period corresponding to the current training period, and z is a positive integer.

[0144] Optionally, the difference between the first feature information of the original sample and the second feature information of the mirrored sample in the current training cycle is determined according to the following formula (6):

[0145] (5)

[0146] in, represents the difference between the first feature information of the original sample and the second feature information of the mirror sample in the kth training cycle, Indicates the preset reference value, Less than 1.

[0147] The target recognition model training method of the embodiment of the present application trains the target recognition model based on small batch training samples, and updates the parameters of the target recognition model based on the overall loss value of the small batch training samples, thereby saving model training time and improving model training efficiency.

[0148] Figure 6 A flow chart of an image recognition model training method of another embodiment of the present application is shown. In this embodiment, the image recognition model includes a feature extraction network, a second fully connected layer, and the feature extraction network includes 5 convolutional layers and a first fully connected layer. Each convolutional layer uses a 3x3 convolution kernel, and the convolution step size is 1. The vector output by the first fully connected layer can be, for example, a 512-dimensional vector, or a 128, 256, and 1024-dimensional vector, which is not limited in this application. The dimension of the vector output by the second fully connected layer is the same as the number of category labels in the training data set. The total number of cycles of model training and parameters related to the stochastic gradient descent algorithm, such as the initial learning rate, momentum coefficient, decay coefficient, etc., are pre-set. As an optional example, the total number of cycles of model training can be set to 20, the initial learning rate is 0.1, the momentum coefficient is 0.9, the decay coefficient is 0.0005, the learning rate drops to 0.01 in the 10th training cycle, the learning rate drops to 0.001 in the 15th training cycle, and the learning rate drops to 0.0001 in the 18th training cycle.

[0149] like Figure 6 As shown, the image recognition model training method includes:

[0150] Step S601: Obtain a training data set and obtain a mirror sample corresponding to each original sample in the training data set. The training data set is a face image sample set, which includes multiple face images.

[0151] Optionally, when obtaining a set of facial image samples, the facial images may be preprocessed so that the facial images meet preset specifications and facilitate the extraction of facial image features. The preprocessing of facial images may include, for example, facial alignment (obtaining an image with a correct facial position), image size normalization, grayscale adjustment, etc.

[0152] As an optional example, the preset specifications of the embodiment of the present application are: the image width is 112 pixels, the image height is 112 pixels, and the number of channels is 3 (three channels of R (red), G (green), and B (blue)). When the size of the face image is not the above size, it can be reduced or enlarged. When the face image is a single-channel grayscale image or an image in other formats (for example: YUV format), it can be grayscale adjusted or format converted to meet the above specification settings.

[0153] The face images in the training dataset are grouped by identity (ID) and a category label is assigned to each group. Optionally, for example, if the training dataset contains C people, the category label can be 0 to C-1.

[0154] Step S602: randomly sorting the original samples in the training data set, and dividing the sorted training data set to obtain multiple training subsets.

[0155] The training cycle of the model means that all the original samples are used once without repetition. In order to avoid the order of samples in the data set affecting the performance of the model, and to improve the generalization performance of the model, at the beginning of each training cycle, all the original samples in the training data set are rearranged randomly, that is, the order of the original samples is disrupted. In each training cycle, the disrupted training data set is divided into smaller training subsets, and the training subset is called a small batch of samples. Depending on the configuration of the training server, the number of samples in each small batch of samples can be set to 128, 256, 512, 1024, etc. The method of the embodiment of the present application reads a small batch of training samples each time, and uses these samples to calculate loss values, update model parameters, etc. When a training cycle (epoch) ends, enter the next training cycle (epoch).

[0156] Step S603: for each original sample in each training subset, determine the state of the original sample according to the difference between the original sample and the mirror sample corresponding to the original sample.

[0157] Step S604: assigning different weights to original samples of different states in each training subset in the current training cycle.

[0158] Step S605: Determine the class center corresponding to each class label in the training data set in the current training cycle. The class center corresponding to each class label in the training data set in the current training cycle can be obtained from the weight parameters of the second fully connected layer of the current target recognition model.

[0159] Step S606: For the original samples in the training subset, the class center corresponding to the class label to which the original sample belongs is taken as the first class center, and the class center corresponding to the class label other than the class label to which the original sample belongs is taken as the second class center, and the first distance between the first feature information of the original sample and the first class center, and the third distance between the first feature information of the original sample and the second class center are determined.

[0160] Step S607: Calculate the loss value corresponding to the training subset according to a preset loss function, the weight of each original sample in the training subset, and the first distance and the third distance corresponding to each original sample in the training subset.

[0161] Optionally, the loss value corresponding to the training subset is calculated according to the following formula (6):

[0162] (6)

[0163] Among them, L represents the loss value corresponding to the training subset, B represents the number of original samples in the training subset, represents the i-th original sample in the training subset, Represents the original sample The weight in the kth training cycle, e represents a natural constant, s represents a preset scaling factor, m is a preset hyperparameter, q represents the category label in the training data set except the category label to which the original sample belongs, Represents the original sample The third distance between the first feature information of and the class center corresponding to the class label q, and C represents the number of class labels in the training data set.

[0164] Step S608: Update the parameters of the target recognition model according to the corresponding loss value in the training subset to train the target recognition model. Repeat steps S605-S608 until all original samples in the training data set are used. When all original samples in the training data set are used, the training of the target recognition model in this cycle is completed.

[0165] Step S609: Update the number of training cycles (the number of training cycles plus 1), and the updated training cycle is less than or equal to the total number of training cycles, and return to step S602.

[0166] Among them, steps S603-S606 can refer to Figure 5 To avoid repetition, the present application will not describe the embodiments shown here in detail.

[0167] The target recognition model training method provided in the embodiment of the present application effectively identifies noise samples through the feature information extracted from the original samples and the mirror samples through the target recognition network, which can not only maintain the stability of the original samples being classified into three categories of samples, but also improve the training stability. At the same time, the embodiment of the present application designs dynamic weight parameters, emphasizes the importance of easy samples at the beginning of training, and then gradually increases the importance of difficult samples, and at the end of training, makes the weights of the two reach equal importance, and the weights of the input samples classified as noise samples are forced to be set to zero, excluding noise samples from training, which can further improve the training stability and the accuracy of the target recognition model.

[0168] Figure 7 The flowchart of the target recognition method of the embodiment of the present application is shown. The target recognition method uses the target recognition model trained by the training method described in any embodiment of the present application to recognize the image to be recognized. Figure 7 As shown, the target recognition method includes:

[0169] Step S701: Input at least one image to be identified as input data into a target recognition model, wherein the at least one image to be identified includes a target to be identified; the target recognition model is trained by the training method described in any embodiment of the present application, and the target recognition model includes a feature extraction network.

[0170] Step S702: Acquire feature information of the at least one image to be identified output by the feature extraction network.

[0171] Step S703: Match the feature information of the at least one image to be identified with known features in the feature library to determine the similarity between the feature information of the at least one image to be identified and the known features.

[0172] As an example, the Euclidean distance, Manhattan distance, cosine distance, Hamming distance or Chebyshev distance can be used as the similarity between the feature information of the image to be recognized and the known feature. The known feature is extracted by the feature extraction network of the target recognition model.

[0173] Step S704: Identify the target to be identified according to the similarity.

[0174] Optionally, when there is only one image to be identified, the similarity between the feature information of the image to be identified and the known features is directly calculated, and the identity information corresponding to the known feature with the highest similarity is used as the identity information of the target to be identified.

[0175] Optionally, when more than one image to be identified is input, the average or weighted average value between multiple feature information corresponding to the multiple images to be identified can be calculated to obtain the average feature information, and the similarity between the average feature information and the known feature can be calculated. Alternatively, when more than one image to be identified is input, the similarity between the feature information of the image to be identified with the highest importance and the known feature can be calculated. Alternatively, the images to be identified are sorted in order from large to small in importance, and the top M images to be identified or the images to be identified with an importance greater than a specified value are taken as target images to be identified, and the average feature information corresponding to the target images to be identified is calculated, and then the similarity between the average feature information and the known feature information is calculated. Then, the identity information corresponding to the known feature with the highest similarity is taken as the identity information of the target to be identified. Among them, the importance of the image to be identified can be determined based on the image quality and / or the completeness of the target to be identified. Image quality includes, for example, image clarity (such as resolution), the proportion of the target to be identified in the image to be identified, and the like.

[0176] Optionally, when more than one image to be identified is input, the similarity between the feature information of each image to be identified and the known feature can be calculated. For a known feature, it corresponds to multiple similarities. According to the multiple similarities corresponding to the known feature, the score of the known feature is calculated (for example, the multiple similarities are summed up), and the identity information corresponding to the known feature with the highest score is used as the identity information of the target to be identified. If there are multiple known features with the highest scores, and the identity information corresponding to the multiple known features is different, the similarity between the average feature information corresponding to the image to be identified and the known feature with the highest score can be calculated to determine the identity of the target to be identified.

[0177] The target recognition method provided in the embodiment of the present application extracts feature information of the image to be recognized through a target recognition model, and can accurately determine the identity of the target to be recognized based on the similarity between the feature information and the known features.

[0178] Figure 8 FIG. 1 is a block diagram of a training system for a target recognition model according to an embodiment of the present application. Figure 8 As shown, the training system 800 of the target recognition model includes:

[0179] The state determination module 801 is used to determine the state to which the original sample belongs according to the difference between the first feature information of the original sample and the second feature information of the mirror sample; the mirror sample is a sample obtained by horizontally flipping the original sample;

[0180] A weight determination module 802 is used to assign different weights to original samples in different states in the current training cycle;

[0181] The loss determination module 803 is used to determine the loss value according to the weight of the original sample in the current training cycle and a preset loss function;

[0182] The parameter updating module 804 is used to train the target recognition model according to the loss value to obtain a trained target recognition model.

[0183] In an optional embodiment, the state to which the original sample belongs includes a first state, a second state and a third state;

[0184] The weight determination module is also used to: in the current training cycle, the weight assigned to the original sample of the first state is greater than or equal to the weight assigned to the original sample of the second state, and the weight assigned to the original sample of the second state is greater than the weight assigned to the original sample of the third state.

[0185] In an optional embodiment, the weight determination module is also used to: assign weights to original samples in the first state in the current training cycle according to a preset attenuation relationship; the preset attenuation relationship indicates that the weights of original samples in the first state gradually decrease in each cycle from the beginning of training to the end of training; and / or, assign weights to original samples in the second state in the current training cycle according to a preset growth relationship; the preset growth relationship indicates that the weights of original samples in the second state gradually increase in each cycle from the beginning of training to the end of training.

[0186] In an optional embodiment, the preset decay relationship indicates that the weight of the original sample in the first state from the beginning of training to the end of training decays from the preset first initial value to 1, and the preset growth relationship indicates that the weight of the original sample in the second state from the beginning of training to the end of training increases from the preset second initial value to 1.

[0187] In an optional embodiment, the weight determination module is further used to: determine that the weight corresponding to the third state in the current training cycle is 0.

[0188] In an optional embodiment, the target recognition model includes a feature extraction network, and the feature extraction network includes a plurality of convolutional layers and a first fully connected layer coupled in sequence;

[0189] The feature acquisition module is also used to: input the original sample as input data into the current target recognition model, obtain the first vector output by the first fully connected layer of the current feature extraction network, and use the first vector as the first feature information of the original sample in the current training cycle; input the mirror sample as input data into the current target recognition model, obtain the second vector output by the first fully connected layer of the current feature extraction network, and use the second vector as the second feature information of the mirror sample in the current training cycle.

[0190] In an optional embodiment, the state determination module is also used to: determine the class center corresponding to the category label to which the original sample belongs in the current training cycle; determine a first distance between the first feature information and the class center corresponding to the category label; determine a second distance between the second feature information and the class center corresponding to the category label; and determine the difference between the first feature information of the original sample and the second feature information of the mirror sample in the current training cycle based on the first distance and the second distance.

[0191] In an optional embodiment, the target recognition model includes a second fully connected layer, and the second fully connected layer is used to classify the original sample according to the first feature information of the original sample, and classify the mirror sample according to the second feature information of the mirror sample;

[0192] The state determination module is also used to obtain, from the weight parameters of the second fully connected layer of the current target recognition model, the class center corresponding to the class label to which the original sample belongs in the current training cycle.

[0193] In an optional embodiment, the state determination module is also used to: determine at least one association cycle corresponding to the current training cycle based on the current training cycle and a preset maximum number of historical cycles; determine the first distance, the second distance, and the coefficient corresponding to the at least one association cycle, and determine the difference between the first feature information of the original sample and the second feature information of the mirror sample in the current training cycle based on the first distance, the second distance, and the coefficient corresponding to each of the association cycles.

[0194] In an optional embodiment, the state determination module is also used to: determine, for each association period, the absolute value of the difference between the first distance and the second distance corresponding to the association period; calculate the weighted sum of the absolute values ​​corresponding to each association period according to the coefficient corresponding to each association period, and use the weighted sum as the difference between the first feature information of the original sample and the second feature information of the mirror sample in the current training period.

[0195] In an optional embodiment, the state determination module is further used to: determine that the coefficient corresponding to the current training cycle is the largest, and determine that the coefficient corresponding to the associated cycle that is farther away from the current training cycle is smaller.

[0196] In an optional embodiment, the state determination module is also used to: compare the difference, a first preset threshold and a second preset threshold, the first preset threshold being less than the second preset threshold; when the difference is less than the first preset threshold, determine that the state to which the original sample belongs is the first state; when the difference is greater than or equal to the first preset threshold and less than or equal to the second preset threshold, determine that the state to which the original sample belongs is the second state; when the difference is greater than the second preset threshold, determine that the state to which the original sample belongs is the third state.

[0197] In an optional embodiment, the loss determination module is also used to: divide the training data set to obtain multiple training subsets, the training data set includes multiple original samples; determine the class center corresponding to each category label in the training data set in the current training cycle; for the original samples in the training subset, take the class center corresponding to the category label to which the original sample belongs as the first category center, and take the class center corresponding to the category label other than the category label to which the original sample belongs as the second category center, determine the first distance between the first feature information of the original sample and the first category center, and the third distance between the first feature information of the original sample and the second category center; calculate the loss value corresponding to the training subset according to a preset loss function, the weight of each original sample in the training subset, and the first distance and the third distance corresponding to each original sample in the training subset.

[0198] Fig. 9 FIG. 1 shows a schematic diagram of the structure of the target recognition system provided by the embodiment of the present application. Fig. 9 As shown, the target recognition system 900 includes:

[0199] An input module 901 is used to input at least one image to be identified as input data into a target recognition model, wherein the at least one image to be identified includes a target to be identified; the target recognition model includes a feature extraction network;

[0200] An acquisition module 902 is used to acquire feature information of the at least one image to be identified output by the feature extraction network;

[0201] A matching module 903 is used to match the feature information of the at least one image to be identified with the known features in the feature library to determine the similarity between the feature information of the at least one image to be identified and the known features;

[0202] The identification module 904 identifies the target to be identified according to the similarity.

[0203] The above device can execute the training method of the target recognition model provided by the embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. For technical details not described in detail in this embodiment, please refer to the method provided by the embodiment of the present invention.

[0204] Fig.10 FIG. 1 is a schematic diagram showing the structure of an electronic device according to an embodiment of the present invention. Fig.10 As shown, the electronic device includes:

[0205] Processor 1001, communication interface 1002, memory 1003 and communication bus 1004, wherein processor 1001, communication interface 1002, memory 1003 communicate with each other via communication bus 1004.

[0206] Memory 1003, used for storing computer programs;

[0207] The processor 1001 is used to execute the program stored in the memory 1003, and implements the following steps:

[0208] Determine the state to which the original sample belongs according to the difference between the first feature information of the original sample and the second feature information of the mirror sample; the mirror sample is a sample obtained by horizontally flipping the original sample;

[0209] Assign different weights to original samples in different states in the current training cycle;

[0210] Determine a loss value according to the weight of the original sample in the current training cycle and a preset loss function;

[0211] The target recognition model is trained according to the loss value to obtain a trained target recognition model.

[0212] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0213] The communication interface is used for communication between the above terminal and other devices.

[0214] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0215] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0216] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions. When the instructions are executed on a computer, the computer executes any of the methods described in the above embodiments.

[0217] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer is enabled to execute any of the methods described in the above embodiments.

[0218] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.

[0219] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0220] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A training method for a target recognition model, It is characterized in that include: Determining the state to which the original sample belongs according to the difference between the first feature information of the original sample and the second feature information of the mirror sample; The mirror sample is a sample obtained by horizontally flipping the original sample; the state to which the original sample belongs includes the first state, the second state or the third state; Assign different weights to original samples in different states in the current training cycle; Determine a loss value according to the weight of the original sample in the current training cycle and a preset loss function; Training the target recognition model according to the loss value to obtain a trained target recognition model; The step of determining the state of the original sample according to the difference between the first feature information of the original sample and the second feature information of the mirror sample includes: comparing the difference, a first preset threshold and a second preset threshold, wherein the first preset threshold is less than the second preset threshold; When the difference is less than the first preset threshold, determining that the state to which the original sample belongs is the first state; When the difference is greater than or equal to the first preset threshold and less than or equal to the second preset threshold, determining that the state to which the original sample belongs is the second state; When the difference is greater than the second preset threshold, determining that the state to which the original sample belongs is a third state; The method of assigning different weights to original samples in different states in the current training cycle includes: In the current training cycle, the weight assigned to the original sample of the first state is greater than or equal to the weight assigned to the original sample of the second state, and the weight assigned to the original sample of the second state is greater than the weight assigned to the original sample of the third state.

2. The method according to claim 1, It is characterized in that The assigning different weights to original samples in different states in the current training cycle also includes: According to a preset decay relationship, weights are assigned to the original samples of the first state in the current training cycle; the preset decay relationship indicates that the weights of the original samples of the first state gradually decrease in each cycle from the beginning of training to the end of training; and / or According to a preset growth relationship, weights are assigned to the original samples of the second state in the current training cycle; the preset growth relationship indicates that the weights of the original samples of the second state gradually increase in each cycle from the beginning of training to the end of training.

3. The method according to claim 2, It is characterized in that The preset decay relationship indicates that the weight of the original sample in the first state from the beginning of training to the end of training decays from the preset first initial value to 1, and the preset growth relationship indicates that the weight of the original sample in the second state from the beginning of training to the end of training increases from the preset second initial value to 1.

4. The method according to claim 3, It is characterized in that The allocating different weights to original samples in different states in the current training cycle also includes: determining that the weight of the original samples in the third state in the current training cycle is 0.

5. The method according to any one of claims 1 to 4, It is characterized in that The target recognition model includes a feature extraction network, and the feature extraction network includes a plurality of convolutional layers and a first fully connected layer coupled in sequence; the method further includes: Input the original sample as input data into the current target recognition model, obtain a first vector output by the first fully connected layer of the current feature extraction network, and use the first vector as the first feature information of the original sample in the current training cycle; The mirror sample is input as input data into the current target recognition model, a second vector output by the first fully connected layer of the current feature extraction network is obtained, and the second vector is used as the second feature information of the mirror sample in the current training cycle.

6. The method according to claim 5, It is characterized in that The method further comprises: Determine the class center corresponding to the class label of the original sample in the current training cycle; Determining a first distance between the first feature information and a class center corresponding to the class label; Determining a second distance between the second feature information and a class center corresponding to the class label; The difference between the first feature information of the original sample and the second feature information of the mirror sample in the current training cycle is determined according to the first distance and the second distance.

7. The method according to claim 6, It is characterized in that The target recognition model includes a second fully connected layer, and the second fully connected layer is used to classify the original sample according to the first feature information, and classify the mirror sample according to the second feature information; Determining the class center corresponding to the class label to which the original sample belongs in the current training cycle includes: From the weight parameters of the second fully connected layer of the current target recognition model, the class center corresponding to the class label to which the original sample belongs in the current training cycle is obtained.

8. The method according to claim 7, It is characterized in that The determining, according to the first distance and the second distance, the difference between the first feature information of the original sample and the second feature information of the mirror sample in the current training cycle includes: Determine at least one associated cycle corresponding to the current training cycle according to the current training cycle and a preset maximum number of historical cycles; Determine the first distance, the second distance, and the coefficient corresponding to the at least one association period, and determine the difference between the first feature information of the original sample and the second feature information of the mirror sample in the current training period according to the first distance, the second distance, and the coefficient corresponding to each of the association periods.

9. The method according to claim 8, It is characterized in that The determining, according to the first distance, the second distance, and the coefficient corresponding to each of the association periods, the difference between the first feature information of the original sample and the second feature information of the mirror sample in the current training period includes: For each association period, determining an absolute value of a difference between a first distance and a second distance corresponding to the association period; According to the coefficients corresponding to the association periods, the weighted sum of the absolute values ​​corresponding to the association periods is calculated, and the weighted sum is used as the difference between the first feature information of the original sample and the second feature information of the mirror sample in the current training period.

10. The method according to claim 8, It is characterized in that Determining a coefficient corresponding to at least one correlation period includes: It is determined that the coefficient corresponding to the current training cycle is the largest, and it is determined that the coefficient corresponding to the associated cycle farther away from the current training cycle is smaller.

11. The method according to claim 1 or 9, It is characterized in that The determining of the loss value according to the weight of the original sample and a preset loss function includes: Dividing the training data set to obtain multiple training subsets, wherein the training data set includes multiple original samples; Determine the class center corresponding to each class label in the training data set in the current training cycle; For the original samples in the training subset, the class center corresponding to the class label to which the original samples belong is taken as the first class center, and the class center corresponding to the class label other than the class label to which the original samples belong is taken as the second class center, and a first distance between the first feature information of the original samples and the first class center and a third distance between the first feature information of the original samples and the second class center are determined; The loss value corresponding to the training subset is calculated according to a preset loss function, a weight of each original sample in the training subset, and the first distance and the third distance corresponding to each original sample in the training subset.

12. The method according to claim 2, It is characterized in that Different weights are assigned to original samples of different states in the current training cycle according to the following formula (1): (1) in, Represents the original sample The weight at the kth training cycle, E represents the total number of training cycles, is a preset coefficient less than 1, The default value is less than 0.

5.

13. The method according to claim 10, It is characterized in that The first distance between the first feature information and the class center corresponding to the class label is determined according to the following formula (2), and the second distance between the second feature information and the class center corresponding to the class label is determined according to the following formula (3): (2) (3) in, represents the first distance in the kth training cycle, represents the second distance in the kth training cycle, represents the original sample, Represents the original sample The mirror image sample, Represents the original sample The first feature information in the kth training cycle, Represents a mirror sample The second feature information in the kth training cycle, Represents the original sample The category label it belongs to, Represents the category label at the kth training cycle The corresponding class center, T represents the vector transpose, express Norm.

14. The method according to claim 13, It is characterized in that At least one associated cycle corresponding to the current training cycle is determined according to the following formula (4): (4) Among them, H represents the preset maximum number of historical cycles, max It means taking the larger value between (k-H+1) and 0, z represents the association period corresponding to the kth training cycle, and z is a positive integer.

15. The method according to claim 14, It is characterized in that The difference between the first feature information of the original sample and the second feature information of the mirrored sample in the current training cycle is determined according to the following formula (5): (5) in, represents the difference between the first feature information of the original sample and the second feature information of the mirror sample in the kth training cycle, Indicates the preset reference value, Less than 1.

16. The method according to claim 15, It is characterized in that The loss value corresponding to the training subset is calculated according to the following formula (6): (6) Among them, L represents the loss value corresponding to the training subset, B represents the number of original samples in the training subset, represents the i-th original sample in the training subset, Represents the original sample The weight in the kth training cycle, e represents a natural constant, s represents a preset scaling factor, m is a preset hyperparameter, q represents the category label in the training data set except the category label to which the original sample belongs, Represents the original sample The third distance between the first feature information of and the class center corresponding to the class label q, and C represents the number of class labels in the training data set.

17. A target recognition method, It is characterized in that include: Inputting at least one image to be identified as input data into a target recognition model, wherein the at least one image to be identified includes a target to be identified; the target recognition model is obtained according to the method according to any one of claims 1 to 16; the target recognition model includes a feature extraction network; Acquire feature information of the at least one image to be identified output by the feature extraction network; Matching the feature information of the at least one image to be identified with known features in the feature library to determine the similarity between the feature information of the at least one image to be identified and the known features; The target to be identified is identified according to the similarity.

18. A training system for a target recognition model, It is characterized in that include: A state determination module, which determines the state to which the original sample belongs according to the difference between the first feature information of the original sample and the second feature information of the mirror sample; The mirror sample is a sample obtained by horizontally flipping the original sample; The weight determination module is used to assign different weights to original samples in different states in the current training cycle; A loss determination module, used to determine a loss value according to the weight of the original sample in the current training cycle and a preset loss function; A parameter updating module, used for training the target recognition model according to the loss value to obtain a trained target recognition model; The state determination module is further used to: compare the difference, a first preset threshold and a second preset threshold, wherein the first preset threshold is smaller than the second preset threshold; When the difference is less than the first preset threshold, determining that the state to which the original sample belongs is the first state; When the difference is greater than or equal to the first preset threshold and less than or equal to the second preset threshold, determining that the state to which the original sample belongs is the second state; when the difference is greater than the second preset threshold, determining that the state to which the original sample belongs is the third state; The weight determination module is also used to: in the current training cycle, the weight assigned to the original sample of the first state is greater than or equal to the weight assigned to the original sample of the second state, and the weight assigned to the original sample of the second state is greater than the weight assigned to the original sample of the third state.

19. A target recognition system, It is characterized in that include: An input module, used for inputting at least one image to be identified as input data into a target recognition model, wherein the at least one image to be identified includes a target to be identified; the target recognition model is obtained according to the method according to any one of claims 1 to 16; the target recognition model includes a feature extraction network; An acquisition module, used for acquiring feature information of the at least one image to be identified output by the feature extraction network; A matching module, used to match the feature information of the at least one image to be identified with known features in a feature library, and determine the similarity between the feature information of the at least one image to be identified and the known features; The identification module is used to identify the target to be identified according to the similarity.

20. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 17 are implemented.

21. An electronic device, It is characterized in that It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the steps of the method as claimed in any one of claims 1 to 17 when executing a program stored in a memory.

22. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 17 are implemented.