Training method, device, electronic device and storage medium for face recognition model

By adjusting the scaling ratio of the face recognition loss function, an adjustable scaling vector is generated, which solves the problem of unreasonable length constraints caused by fixed scaling ratios, increases the distance of the class center vector, and improves the recognition accuracy of the face recognition model.

CN111860364BActive Publication Date: 2024-12-27CTRIP COMP TECH SHANGHAI
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202010722196.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-24
Publication Date
2024-12-27
Estimated Expiration
2040-07-24

AI Technical Summary

Technical Problem

In the existing face recognition model, the length constraints of the eigenvector and class center vector caused by fixed scaling ratios are unreasonable, which affects the recognition accuracy of the model.

Method used

By adjusting the fixed scaling ratio of the face recognition loss function, an adjustable scalable vector is generated and the distance between the class center vectors is increased, thereby optimizing the separability of features and recognition accuracy.

Benefits of technology

By adjusting the scaling ratio of the loss function, an adjustable scalable vector is generated, the Euclidean distance between the eigenvectors is increased, and the recognition accuracy of the face recognition model is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111860364B_ABST
    Figure CN111860364B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of face recognition technology, and provides a training method, device, electronic device and storage medium for a face recognition model. The training method of the face recognition model includes: obtaining the batch data volume of the face recognition model and the number of categories of the training set; constructing a 0-1 distribution based on random numbers, and generating a parameter vector with the number of columns being the number of categories; adjusting the fixed scaling ratio of the face recognition loss function according to the parameter vector to obtain an adjustable scaling vector, and obtaining a scaling matrix with the number of rows being the batch data volume and the number of columns being the number of categories according to the adjustable scaling vector; rescaling the output of the face recognition model using the scaling matrix; and supervising the training of the face recognition model based on the rescaled output. The present invention adjusts the fixed scaling ratio of the face recognition loss function to generate an adjustable scaling vector that can increase the distance between class center vectors, thereby improving the recognition accuracy of the face recognition model.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] ArcFace (Additive Angular Margin Loss for Deep Face Recognition) is the latest technology in the field of face recognition. Its loss function is ArcFace loss (additive angular margin loss function). The recognition accuracy of the face recognition model mainly depends on the design of the loss function.

[0003] ArcFace loss improves inter-class separability and strengthens intra-class compactness by adding angular margin based on traditional face recognition technology. However, there is no reasonable setting for the radius of feature scaling, and only a fixed scaling ratio is taken, so that all feature vectors and class center vectors become the same vector length, even if all feature vectors and class center vectors are scaled to a hypersphere with a radius of the fixed scaling ratio.

[0004] If we keep the added angular margin and keep the length of the feature vector and the class center vector unchanged, then the scaling ratio should be equal to the product of the length of the feature vector and the class center vector. The feature vector is determined by the input data and the parameters of the convolution layer, and its length is constantly changing; the class center vector is a learnable parameter, and its length is also constantly changing. It can be seen that requiring the product of the length of the feature vector and the class center vector to be fixed and equal to a fixed scaling ratio is not a good constraint.

[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0006] In view of this, the present invention provides a training method, device, electronic device and storage medium for a face recognition model, which can generate an adjustable scaling vector that can increase the distance between class center vectors by adjusting the fixed scaling ratio of the face recognition loss function, thereby improving the recognition accuracy of the face recognition model.

[0007] One aspect of the present invention provides a training method for a face recognition model, comprising the steps of: obtaining a batch data volume of the face recognition model and the number of categories of a training set; constructing a 0-1 distribution based on random numbers to generate a parameter vector whose number of columns is the number of categories; adjusting a fixed scaling ratio of a face recognition loss function according to the parameter vector to obtain an adjustable scaling vector, and obtaining a scaling matrix whose number of rows is the batch data volume and whose number of columns is the number of categories according to the adjustable scaling vector; rescaling the output of the face recognition model using the scaling matrix; and supervised training of the face recognition model based on the rescaled output.

[0008] In some embodiments, the face recognition model is constructed based on a deep convolutional neural network, and the face recognition loss function is an additive angular margin loss function.

[0009] In some embodiments, the step of adjusting the fixed scaling ratio of the face recognition loss function according to the parameter vector comprises: altered_s=S+selected_vector*S*2*(1-cosθ j ), where altered_s is the adjustable scaling vector, the number of columns of the adjustable scaling vector is the number of categories, S is the fixed scaling ratio, selected_vector is the parameter vector, θ j is the angle between the class center vectors of two adjacent classes, and the class center vector is obtained according to the output of the face recognition model.

[0010] In some embodiments, the step of adjusting the fixed scaling ratio of the face recognition loss function according to the parameter vector comprises:

[0011] altered_s=S+selected_vector*S*2*(1-cos(θ yi + m).mean(dim=0)), where altered_s is the adjustable scaling vector, the number of columns of the adjustable scaling vector is the number of categories, S is the fixed scaling ratio, selected_vector is the parameter vector, cos(θ yi +m) is the cosine value of the sum of the angle between the current feature vector and the target class center vector and an angle interval value, the cosine value is a matrix with the number of rows being the batch data amount and the number of columns being the number of categories, and the current feature vector is obtained based on the output of the face recognition model.

[0012] In some embodiments, the fixed scaling ratio is: S=64, and the angle between the class center vectors of two adjacent classes is: θ j =71.61÷360×2π radians.

[0013] In some embodiments, the step of constructing a 0-1 distribution based on random numbers and generating a parameter vector with the number of columns being the number of categories includes: taking a random seed to perform an average distribution selection of 0 and 1 to generate the parameter vector; and registering the parameter vector as a fixed vector.

[0014] In some embodiments, the step of rescaling the output of the face recognition model using the scaling matrix comprises: altered -s'*cos(θ yi +m), where altered_s' is the scaling matrix, which is formed by repeating the batch data amount by row of the adjustable scaling vector, cos(θ yi +m) is the cosine value of the sum of the angle between the current feature vector and the target class center vector and an angle interval value, the cosine value is a matrix with the number of rows being the batch data amount and the number of columns being the number of categories, and the current feature vector is obtained based on the output of the face recognition model.

[0015] In some embodiments, based on the rescaled output, the step of supervised training the face recognition model includes: obtaining the predicted probability of the face recognition model through logistic regression Softmax according to the rescaled output; and obtaining the difference between the predicted probability and the target probability based on the cross entropy loss function, and performing supervised training on the face recognition model until the face recognition model converges to the training set.

[0016] Another aspect of the present invention provides a training device for a face recognition model, comprising: an initial data acquisition module, configured to obtain the batch data volume of the face recognition model and the number of categories of the training set; a parameter vector generation module, configured to construct a 0-1 distribution based on random numbers, and generate a parameter vector with the number of columns being the number of categories; a scaling ratio adjustment module, configured to adjust the fixed scaling ratio of the face recognition loss function according to the parameter vector, obtain an adjustable scaling vector, and obtain a scaling matrix with the number of rows being the batch data volume and the number of columns being the number of categories according to the adjustable scaling vector; a feature rescaling module, configured to rescale the output of the face recognition model using the scaling matrix; and a supervised training module, configured to supervise the training of the face recognition model based on the rescaled output.

[0017] Yet another aspect of the present invention provides an electronic device, comprising: a processor; and a memory, wherein the memory stores executable instructions of the processor; wherein the processor is configured to execute the steps of the training method of the face recognition model described in any of the above embodiments by executing the executable instructions.

[0018] Another aspect of the present invention provides a computer-readable storage medium for storing a program, characterized in that when the program is executed, the steps of the training method of the face recognition model described in any of the above embodiments are implemented.

[0019] The beneficial effects of the present invention compared with the prior art include at least:

[0020] By adjusting the fixed scaling ratio of the face recognition loss function, an adjustable scaling vector is generated that can increase the distance between class center vectors and make the Euclidean distance between feature vectors larger, that is, the distance between feature vectors is farther, thereby improving the recognition accuracy of the face recognition model.

[0021] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present invention, and together with the specification are used to explain the principles of the present invention. Obviously, the accompanying drawings described below are only some embodiments of the present invention, and for those of ordinary skill in the art, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0023] Figure 1 A schematic diagram showing the steps of a method for training a face recognition model in an embodiment of the present invention;

[0024] Figure 2 A processing flow chart of a face recognition model supervised training based on improved ArcFace loss in an embodiment of the present invention is shown;

[0025] Figure 3 A schematic diagram showing the principle of obtaining an adjustable scaling vector in an embodiment of the present invention;

[0026] Figure 4 A comparison of feature distribution between the face recognition model of the embodiment of the present invention and the existing ArcFace is shown;

[0027] Figure 5 A module schematic diagram showing a training device for a face recognition model in an embodiment of the present invention;

[0028] Figure 6 A schematic diagram showing the structure of an electronic device in an embodiment of the present invention; and

[0029] Figure 7 A schematic diagram showing the structure of a computer-readable storage medium in an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0030] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to make the present invention comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar structures, and thus their repeated description will be omitted.

[0031] In addition, the accompanying drawings are only schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0032] The step numbers in the following method embodiments are only used to indicate different execution contents, and do not limit the logical relationship and execution order between the steps.

[0033] The problem to be solved by the present invention is to change the radius length of all class center vectors in an unreasonable fixed hypersphere to improve the unreasonable constraint problem caused by the fixed scaling ratio, and to enhance the face recognition model's ability to distinguish faces by optimizing the radius length design, thereby improving the separability of features and the recognition accuracy of face recognition models. The technical concept of the present invention is to optimize the fixed scaling ratio in ArcFace loss into an adjustable scaling vector, so that in the hypersphere space of class center vectors of different categories, the hypersphere of fixed radius distance is changed to a hypersphere of different radius distance, so that the radius distances of different categories are different, thereby improving the separability of features.

[0034] Figure 1 The main steps of the training method of the face recognition model in the embodiment are shown, referring to Figure 1 As shown, the training method of the face recognition model in this embodiment mainly includes: in step S110, the batch data volume of the face recognition model and the number of categories of the training set are obtained; in step S120, a 0-1 distribution is constructed based on random numbers to generate a parameter vector whose number of columns is the number of categories; in step S130, a fixed scaling ratio of the face recognition loss function is adjusted according to the parameter vector to obtain an adjustable scaling vector, and a scaling matrix whose number of rows is the batch data volume and the number of columns is the number of categories is obtained according to the adjustable scaling vector; in step S140, the output of the face recognition model is rescaled using the scaling matrix; and in step S150, based on the rescaled output, supervised training of the face recognition model is performed.

[0035] In the above embodiment, the face recognition model is constructed based on deep convolutional neural networks (DCNN), and the face recognition loss function is the additive angular margin loss function (ArcFaceloss). Figure 2 The processing flow of the face recognition model trained based on the improved ArcFace loss supervision is shown in Figure 2. Figure 2 As shown, in the process of supervised training of face recognition model by using the improved ArcFace loss of the present invention, the feature vector x is firstly transformed into i and the class center vector w j Normalize so that subsequent predictions depend only on the angle between the feature and the weight. Then, process P220 performs an additive angle margin penalty by adding the angle margin value m to the angle θ between the feature and the weight. Specifically, the feature vector x i With the class center vector w j The angle is θ j , calculate cosθ j , find the inverse cosine arccos(cosθ yi ) to obtain the eigenvector x i and the target class center vector W yi The angle θ between yi , add the angle interval value m, so that the eigenvector x i and the target class center vector W yi The angle between them increases to θ yi +m. Then, calculate cosine cos(θ yj +m) and dot-multiply with the scaling matrix altered_s', so as to rescale all logs based on the scaling matrix altered_s'. Finally, through process P240, the log is input into the logistic regression Softmax function to obtain the probability of each category, and then the cross entropy loss function is used to calculate the cross entropy loss, based on which the face recognition model is supervised and trained.

[0036] Among them, the processes P210, P220 and P240 all use existing technologies, so they are not described in detail. The following describes the process P230, that is, the process of obtaining an adjustable scaling vector and rescaling the output of the face recognition model based on the scaling matrix.

[0037] First, the batch data volume batch_size and the number of classes of the training set class_num of the face recognition model are obtained, which can be obtained according to the output of the face recognition model. In this embodiment, the face recognition model is built based on the residual neural network ResNet50, and the feature vector x of the i-th batch is iThe size of is (batch_size, embedding_size); W is equivalent to the weight of the fully connected layer, which is learnable, and the size of W is (embedding_size, class_num), the class center vector w j The size of is (embedding, 1).

[0038] In a specific example, the training set uses casia-webface, the optimizer uses SGD, lr is 1e-1, weight_decay is 5e-4, momentum is 0.9, training uses P100, batch_size is 128, and epoch is 100.

[0039] Next, a 0-1 distribution is constructed based on random numbers to generate a parameter vector selected_vector, and the parameter vector selected_vector is registered as a fixed vector. Specifically, a random seed is taken, and an average distribution selection of 0 and 1 is made to generate a parameter vector selected_vector with a length of the number of classes class_num. For example, Pytorch (an open source Python machine learning library) can be used to implement it, and the parameter vector selected_vector is registered as a buffer, because the parameter vector selected_vector is a parameter that does not need to be learned and only needs to be fixed during the entire training process.

[0040] Since it is impossible to determine whether the center vectors of two classes are adjacent, a random method is used. Moreover, when the number of classes is relatively large, usually more than 10,000 classes, the random method can also achieve good results.

[0041] Then, the fixed scaling ratio of ArcFace loss is adjusted according to the parameter vector. In one implementation, the formula “altered_s=S+selected_vector*S*2*(1-cosθ j )” to obtain the adjustable scaling vector altered_s. The number of columns of the adjustable scaling vector altered_s is the number of categories class_num, and its size is (1, class_num). The fixed scaling ratio S refers to the experience of ArcFace and is set to 64. θ j is the angle between the class center vectors of two adjacent classes, for example, the class center vector w i With the class center vector w j Referring to the experience in ArcFace, θ jThe value can be 71.61÷360×2π radians. In another implementation, the formula "altered_s=S+selected_vector*S*2*(1-cos(θ yi + m).mean(dim=0))” adjusts the fixed scaling of the face recognition loss function, where cos(θ yi +m) is the result after adding the angular margin, whose size is (batch_size, class_num). That is, cos(θ yi +m) is the cosine value of the sum of the angle between the current feature vector and the target class center vector and an angle interval value. The cosine value is a matrix with the number of rows equal to the batch data size and the number of columns equal to the number of categories. The current feature vector is obtained based on the output of the face recognition model, that is, the current output feature vector x i . mean(dim=0) means finding the mean of the 0th dimension.

[0042] Figure 3 The principle of obtaining an adjustable scaling vector in the embodiment is shown, referring to Figure 3 As shown, two adjacent class center vectors w i and w j For example, the class center vector w i Equivalent to ob, class center vector w j Equivalent to oc, the result of face recognition model training is to make the feature vector x i Close to one class and far from another, for example, close to the class center vector w i Away from the cluster center vector w j , after training, the feature vector x i It is close to the class center vector wi, so the final distance between different classes is the class center vector w i With the class center vector w j The distance between these two different class center vectors is equivalent to the distance between ob and oc. Assume that there is another class center vector w k , equivalent to oa.

[0043] The distance between class center vectors in the original ArcFace is ab or bc. Assuming ab = bc, since a and c are not adjacent, only the distance between adjacent class center vectors is considered, and the distance between class center vectors is ab or bc. Now delay the ob vector to oe, then the distance between adjacent class center vectors is ae or ce. Note that a and c also become adjacent at this time, so the distance between adjacent class center vectors is ae, ce or ac. If all three sides are to be equal, and it has been assumed that ab = bc, then be = ab or be = bc is required, thereby increasing the distance between all adjacent class center vectors, that is, increasing the class center vector w. i With w j The distance between.

[0044] It should also be noted that when the model is trained, the extracted facial features are represented as feature vectors x i , instead of the class center vector w i . But the average eigenvector x i (i.e., the embedding feature center) and the class center vector w i The angle is small, and the cross entropy loss function will also make the feature vector x i With the class center vector w i The lengths of the eigenvectors x i The length of the eigenvector x i The distance between them, that is, the distance between the extracted embedded features, is larger, which is beneficial to enhance the model's discriminability and improve the effect of face recognition.

[0045] In order to achieve the purpose of setting different lengths of class center vectors of different categories, this embodiment changes the fixed scaling ratio S into an adjustable scaling vector composed of two different values. Each element in the adjustable scaling vector represents a category, and the smaller value can be set by training experience, such as 64, and the other larger value can be set by adding "2*(1-cosθ j )" or "2*(1-cos(θ yi + m).mean(dim=0))”, thus adding additional benefits on the basis of ArcFace, namely the distance between the class center vectors, and finally the feature vector x i The distance between.

[0046] It should be further explained that due to the scaling factor S j =|x i |*|w j |, although the purpose is to set the class center vector w of different lengths j , but actually sets |x i |*|w j|, this difference does not affect the effect of the solution. Specifically, because ArcFace loss makes the feature vector x i With the class center vector w j The direction of tends to be consistent, that is, the eigenvector x i With the class center vector w j The angle between them is relatively small, and the cross entropy loss function will automatically make the value of the Softmax output point of the neural network corresponding to the true label larger, so that the cross entropy loss function is smaller. In addition to increasing the feature vector x i With the class center vector w j In addition to the angle of , another training direction is to make the feature vector x i With the class center vector w j The same length as j Can achieve simultaneous setting |x i | and |w j | effect, and in this process |x i |Size settings.

[0047] On the other hand, assuming that the lengths of different column vectors have been specifically set when the weight W is initialized, it has no effect on Arcface. However, for the present invention, since setting the lengths of different column vectors is equivalent to multiplication, and multiplication is commutative, feature rescaling is equivalent to restoring the lengths of different column vectors of the weight W, that is, logically, vector rescaling can be regarded as only for the column vectors in the weight W rather than the feature x.

[0048] After obtaining the adjustable scaling vector altered_s, the adjustable scaling vector altered_s is repeated by batch processing data amount batch_size, that is, the scaling matrix altered of size (batch_size, class_num) is obtained by repeating the batch processing data amount batch_size row by row. _ s'.

[0049] After that, the scaled matrix altered_s' is combined with the cosine value cos(θ yi +m) dot multiplication to complete the rescaling. Specifically, through the formula "altered-s'*cos(θ yi +m)” rescales the output of the face recognition model, where cos(θ yi +m) as mentioned above, is the cosine value of the sum of the angle between the current feature vector and the target class center vector and an angle interval value. The cosine value is a matrix with the number of rows being the batch data amount and the number of columns being the number of categories. The current feature vector is obtained based on the output of the face recognition model.

[0050] Finally, the rescaled output is imported into the logistic regression Softmax and cross entropy loss function to complete the forward propagation. Specifically, based on the rescaled output, the predicted probability of the face recognition model is obtained through logistic regression Softmax, and then the cross entropy loss is calculated together with the Ground Truth (real data, that is, the target probability) and One Hot Vector (unique hot encoding), that is, the difference between the predicted probability and the target probability is obtained, so as to supervise the training of the face recognition model until the face recognition model converges to the training set.

[0051] Figure 4 The spatial comparison of the feature distribution of the face recognition model trained by the above embodiment and the existing ArcFace is shown. Figure 4 As shown, the features of the traditional ArcFace are distributed on a hypersphere 410 of the same radius, and the features of the face recognition model of the present invention are distributed on a hypersphere 420 of different radii, so that the Euclidean distance between the feature vector and the class center vector is larger.

[0052] In summary, the present invention adjusts the fixed scaling ratio of the face recognition loss function to generate an adjustable scaling vector that can increase the distance between the class center vectors, thereby overcoming the drawbacks of fixed feature rescaling and changing to feature rescaling of two different lengths for different classification categories to increase the class center vector w i With w j The distance between them, and the characteristic vector x i With x j The Euclidean distance between them becomes larger, that is, the distance between the feature vectors is farther, thereby improving the recognition accuracy of the face recognition model.

[0053] The present invention also provides a training device based on the training method described in the above embodiment. Figure 5 The main modules of the training device of the face recognition model in the embodiment are shown. Figure 5 As shown, the training device 500 for the face recognition model in this embodiment mainly includes: an initial data acquisition module 510, configured to obtain the batch data volume of the face recognition model and the number of categories of the training set; a parameter vector generation module 520, configured to construct a 0-1 distribution based on random numbers, and generate a parameter vector with the number of columns being the number of categories; a scaling ratio adjustment module 530, configured to adjust the fixed scaling ratio of the face recognition loss function according to the parameter vector, obtain an adjustable scaling vector, and obtain a scaling matrix with the number of rows being the batch data volume and the number of columns being the number of categories according to the adjustable scaling vector; a feature rescaling module 540, configured to rescale the output of the face recognition model using the scaling matrix; and a supervised training module 550, configured to supervise the training of the face recognition model based on the rescaled output.

[0054] The training device of this embodiment can adjust the fixed scaling ratio of the face recognition loss function to generate an adjustable scaling vector that can increase the distance between class center vectors and increase the Euclidean distance between feature vectors, that is, the distance between feature vectors is farther, thereby improving the recognition accuracy of the face recognition model.

[0055] An embodiment of the present invention also provides an electronic device, including a processor and a memory, wherein executable instructions are stored in the memory, and the processor is configured to execute the steps of the training method of the face recognition model in the above embodiment by executing the executable instructions.

[0056] As described above, the electronic device of the present invention can adjust the fixed scaling ratio of the face recognition loss function to generate an adjustable scaling vector that can increase the distance between class center vectors and increase the Euclidean distance between feature vectors, that is, the distance between feature vectors is farther, thereby improving the recognition accuracy of the face recognition model.

[0057] Figure 6 is a schematic diagram of the structure of an electronic device in an embodiment of the present invention. It should be understood that: Figure 6 The modules are only schematically shown, and these modules may be virtual software modules or actual hardware modules. The combination and splitting of these modules and the addition of other modules are all within the protection scope of the present invention.

[0058] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as systems, methods or program products. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, which may be collectively referred to herein as "circuits", "modules" or "platforms".

[0059] Refer to the following Figure 6 The electronic device 600 of the present invention is described. Figure 6 The electronic device 600 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0060] like Figure 6 As shown, the electronic device 600 is in the form of a general computing device. The components of the electronic device 600 may include, but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different platform components (including the storage unit 620 and the processing unit 610), a display unit 640, etc.

[0061] The storage unit stores program codes, which can be executed by the processing unit 610, so that the processing unit 610 executes the steps of the training method of the face recognition model described in the above embodiment. For example, the processing unit 610 can execute the following steps: Figure 1 Steps shown.

[0062] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 6201 and / or a cache memory unit 6202 , and may further include a read-only memory unit (ROM) 6203 .

[0063] The storage unit 620 may also include a program / utility 6204 having one or more program modules 6205, such program modules 6205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0064] Bus 630 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0065] The electronic device 600 can also communicate with one or more external devices 700, which can be one or more of a keyboard, a pointing device, a Bluetooth device, etc. These external devices 700 enable the user to communicate interactively with the electronic device 600. The electronic device 600 can also communicate with one or more other computing devices, and the computer device shown includes a router and a modem. This communication can be performed through an input / output (I / O) interface 650. In addition, the electronic device 600 can also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN) and / or a public network, such as the Internet) through a network adapter 660. The network adapter 660 can communicate with other modules of the electronic device 600 through a bus 630. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms.

[0066] The embodiment of the present invention also provides a computer-readable storage medium for storing a program, which, when executed, implements the steps of the training method of the face recognition model described in the above embodiment. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of the training method of the face recognition model described in the above embodiment.

[0067] As described above, the computer-readable storage medium of the present invention can generate an adjustable scaling vector that can increase the distance between class center vectors by adjusting the fixed scaling ratio of the face recognition loss function, and increase the Euclidean distance between feature vectors, that is, the distance between feature vectors is farther, thereby improving the recognition accuracy of the face recognition model.

[0068] Figure 7 Schematic diagram of the structure of the computer-readable storage medium of the present invention. Figure 7 As shown, a program product 800 for implementing the above method according to an embodiment of the present invention is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.

[0069] The program product may adopt any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media include, but are not limited to: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0070] Computer-readable storage media may include data signals propagated in baseband or as part of a carrier wave, wherein readable program codes are carried. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program code contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination thereof.

[0071] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device, such as through the Internet using an Internet service provider.

[0072] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.

Claims

1. A training method for a face recognition model, characterized in that: Includes steps: Get the batch data size of the face recognition model and the number of categories in the training set; Construct a 0-1 distribution based on random numbers and generate a parameter vector with the number of columns being the number of categories; Adjusting a fixed scaling ratio of a face recognition loss function according to the parameter vector to obtain an adjustable scaling vector, and obtaining a scaling matrix having a row number equal to the batch data amount and a column number equal to the number of categories according to the adjustable scaling vector; Wherein, the face recognition model is constructed based on a deep convolutional neural network, and the face recognition loss function is an additive angle interval loss function; Adjusting the fixed scaling ratio of the face recognition loss function according to the parameter vector includes: altered_s=S+selected_vector*S*2*(1-cosθ j ), where altered_s is the adjustable scaling vector, the number of columns of the adjustable scaling vector is the number of categories, S is the fixed scaling ratio, selected _ vector is the parameter vector, θ j is the angle between the class center vectors of two adjacent classes, and the class center vector is obtained according to the output of the face recognition model; Alternatively, the fixed scaling ratio of the face recognition loss function is adjusted according to the parameter vector, including: altered_s=S+selected_vector*S*2*(1-cos(θ yi + m).mean(dim=0)), where altered _ s is the adjustable scaling vector, the number of columns of the adjustable scaling vector is the number of categories, S is the fixed scaling ratio, selected _ vector is the parameter vector, cos(θ yi +m) is the cosine value of the sum of the angle between the current feature vector and the target class center vector and an angle interval value, the cosine value is a matrix with the number of rows equal to the batch data amount and the number of columns equal to the number of categories, and the current feature vector is obtained according to the output of the face recognition model; rescaling the output of the face recognition model using the scaling matrix; and Based on the rescaled output, supervised training of the face recognition model is performed.

2. The training method according to claim 1, characterized in that: The fixed scaling ratio is: S=64; When using the formula altered_s = S + selected_vector * S * 2 * (1-cos θ j ) adjusts the fixed scaling ratio, and the value of the angle between the class center vectors of the two adjacent classes is: θ j =71.61÷360×2π radians.

3. The training method according to claim 1, characterized in that: The step of constructing a 0-1 distribution based on random numbers and generating a parameter vector whose number of columns is the number of categories comprises: Taking a random seed and performing an even distribution selection between 0 and 1 to generate the parameter vector; and The parameter vector is registered as a fixed vector.

4. The training method according to claim 1, characterized in that: The step of rescaling the output of the face recognition model using the scaling matrix comprises: altered_s’*cos(θ yi +m), Among them, altered _ s' is the scaling matrix, which is formed by repeating the batch data amount by row of the adjustable scaling vector, cos(θ yi +m) is the cosine value of the sum of the angle between the current feature vector and the target class center vector and an angle interval value, the cosine value is a matrix with the number of rows being the batch data amount and the number of columns being the number of categories, and the current feature vector is obtained based on the output of the face recognition model.

5. The training method according to claim 1, characterized in that: Based on the rescaled output, the steps of supervised training the face recognition model include: According to the rescaled output, the prediction probability of the face recognition model is obtained by logistic regression Softmax; and The difference between the predicted probability and the target probability is calculated based on the cross entropy loss function, and supervised training is performed on the face recognition model until the face recognition model converges to the training set.

6. A training device for a face recognition model, characterized in that: include: An initial data acquisition module, configured to obtain a batch data volume of a face recognition model and a number of categories of a training set; A parameter vector generation module is configured to construct a 0-1 distribution based on random numbers and generate a parameter vector having a column number equal to the number of categories; A scaling adjustment module, configured to adjust a fixed scaling ratio of the face recognition loss function according to the parameter vector to obtain an adjustable scaling vector, and obtain a scaling matrix having a row number equal to the batch data amount and a column number equal to the number of categories according to the adjustable scaling vector; Wherein, the face recognition model is constructed based on a deep convolutional neural network, and the face recognition loss function is an additive angle interval loss function; Adjusting the fixed scaling ratio of the face recognition loss function according to the parameter vector includes: altered_s=S+selected_vector*S*2*(1-cosθ j ), where altered_s is the adjustable scaling vector, the number of columns of the adjustable scaling vector is the number of categories, S is the fixed scaling ratio, selected _ vector is the parameter vector, θ j is the angle between the class center vectors of two adjacent classes, and the class center vector is obtained according to the output of the face recognition model; Alternatively, the fixed scaling ratio of the face recognition loss function is adjusted according to the parameter vector, including: altered_s=S+selected_vector*S*2*(1-cos(θ yi + m).mean(dim=0)), where altered _ s is the adjustable scaling vector, the number of columns of the adjustable scaling vector is the number of categories, S is the fixed scaling ratio, selected _ vector is the parameter vector, cos(θ yi +m) is the cosine value of the sum of the angle between the current feature vector and the target class center vector and an angle interval value, the cosine value is a matrix with the number of rows equal to the batch data amount and the number of columns equal to the number of categories, and the current feature vector is obtained according to the output of the face recognition model; a feature rescaling module configured to rescale the output of the face recognition model using the scaling matrix; and The supervised training module is configured to supervise the training of the face recognition model based on the rescaled output.

7. An electronic device, characterized in that: include: A processor; a memory storing executable instructions of the processor; Wherein, the processor is configured to perform the steps of the training method of the face recognition model as described in any one of claims 1 to 5 by executing the executable instructions.

8. A computer-readable storage medium for storing a program, characterized in that: When the program is executed, the steps of the training method of the face recognition model as described in any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Face key characteristic point positioning method based on multitask learning

    CN106897662A

  • A high-precision fast face detection method

    CN109359555A

  • Method and equipment for generating face recognition model

    CN110046551A

  • Face image feature extraction method and face recognition method based on modular constraint CentreFace

    CN111368683A

  • Methods and Software for Detecting Objects in an Image Using Contextual Multiscale Fast Region-Based Convolutional Neural Network

    US20180068198A1