Feature detection method, model merging method, device and medium

The parameters of the student model are adjusted through the distillation loss function to enable it to have the feature detection capabilities of multiple teacher models, which solves the problem of too many models in edge deployment and achieves model merging and occupancy reduction.

CN114663941BActive Publication Date: 2024-09-06SHENZHEN SHULIAN TIANXIA INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210264286.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-17
Publication Date
2024-09-06
Estimated Expiration
2042-03-17

AI Technical Summary

Technical Problem

The excessive number of existing models makes edge deployment unfavorable, and a method is needed to reduce model occupancy to facilitate edge deployment.

Method used

By obtaining multiple unlabeled face training images, input them into multiple teacher models to obtain feature information, and use these feature information as labels to input into the student model for training, and use the distillation loss function to adjust the student model parameters until The student model converges, thereby achieving model merging and reducing model occupancy.

Benefits of technology

It realizes that the student model has the feature detection capability of multiple teacher models, reduces the model occupancy, and simplifies the edge deployment process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114663941B
    Figure CN114663941B
Patent Text Reader

Abstract

The present invention discloses a model merging method, including: firstly obtaining a plurality of unlabeled face training images, respectively inputting the first face image into a plurality of teacher models, obtaining the first feature information output by each teacher model, and using the first feature information output by all teacher models as the label of the first face image; then inputting the first face image with the label into the student model, obtaining the second feature information corresponding to the plurality of features output by the student model; finally, calculating the distillation loss according to the first feature information and the second feature information through a preset distillation loss function, adjusting the parameters of the student model according to the distillation loss, and repeating the previous training steps until the student model converges. It can be seen that the present invention enables the student model to have the feature detection capabilities of all teacher models, so as to achieve the purpose of model merging and reducing the model occupancy, and facilitate further edge deployment. In addition, a feature detection method, device and medium are also proposed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer vision technology, and in particular to a feature detection method, a model merging method, a device and a medium. Background Art

[0002] Due to changes in actual business, more and more businesses prefer edge deployment. Edge deployment is mainly used for embedded devices. It is mainly achieved by packaging the model into a software development kit (SDK) and integrating it into the embedded device. Data processing and model reasoning are performed on the terminal device. However, there are too many existing models. If they are deployed one by one, edge deployment will be very disadvantageous. Summary of the invention

[0003] Based on this, it is necessary to provide feature detection methods, model merging methods, devices and media to address the above problems, so as to solve the problem that existing models are not conducive to edge deployment.

[0004] A model merging method is applied to a model set, wherein the model set includes multiple teacher models with the same network structure and one student model, the multiple teacher models have converged, different teacher models are used to detect different features, and the student model has not converged, the method comprising:

[0005] Acquire multiple unlabeled face training images, input the first face image into the multiple teacher models respectively, obtain the first feature information output by each teacher model, and use the first feature information output by all teacher models as the label of the first face image; wherein the first face image is any one of the multiple unlabeled face training images, and the first feature information output by different teacher models is different;

[0006] Inputting the first face image carrying the label into the student model, and obtaining second feature information corresponding to the plurality of features output by the student model;

[0007] The distillation loss is calculated according to the first feature information and the second feature information through a preset distillation loss function, the parameters of the student model are adjusted according to the distillation loss, and the step of inputting the first face image into the multiple teacher models respectively is returned to execute until the student model converges.

[0008] In one specific embodiment, the first feature information and the second feature information both include feature severity and confidence, the distillation loss function includes multiple feature distillation loss functions, one feature distillation loss function corresponds to one feature, and one feature distillation loss function includes a soft label loss function and a hard label loss function;

[0009] The calculating the distillation loss according to the first feature information and the second feature information by using a preset distillation loss function includes:

[0010] Calculating the soft label loss of the target feature according to the feature severity corresponding to the target feature in the first feature information and the feature severity corresponding to the target feature in the second feature information by using the soft label loss function; wherein the target feature is any one of the features detected by the multiple teacher models;

[0011] Calculating the hard label loss of the target feature according to the confidence corresponding to the target feature in the first feature information and the feature severity corresponding to the target feature in the second feature information by using the hard label loss function;

[0012] Calculating a first product of a first weight and the soft label loss, and a second product of a second weight and the hard label loss, and taking the sum of the first product and the second product as the feature distillation loss corresponding to the target feature; wherein the sum of the first weight and the second weight is 1;

[0013] The sum of the feature distillation losses corresponding to all features is calculated to obtain the distillation loss.

[0014] In one specific embodiment, the formula of the soft label loss function is:

[0015]

[0016] Among them, N is the total degree of feature severity corresponding to the target feature; is the feature severity corresponding to the target feature in the first feature information, indicating the value of the feature severity corresponding to the target feature in the first feature information at level j when temperature = T;

[0017] is the feature severity corresponding to the target feature in the second feature information, indicating the value of the feature severity corresponding to the target feature in the second feature information at level j when temperature = T.

[0018] In one specific embodiment,

[0019]

[0020] Among them, v j Indicates the output of the target feature at level j on the fully connected layer in the teacher model; Indicates the sum of all outputs of the fully connected layers in the teacher model;

[0021]

[0022] Among them, z j Indicates the output of the fully connected layer at level j in the student model corresponding to the target feature; Indicates the sum of all outputs of the fully connected layers in the student model.

[0023] In one specific embodiment, the formula of the hard label loss function is:

[0024]

[0025] Among them, M j is the confidence level corresponding to the target feature in the first feature information.

[0026] In one specific embodiment, before calculating the sum of the feature distillation losses corresponding to all features, the method further includes:

[0027] A corresponding feature weight is assigned to the feature distillation loss corresponding to each feature; wherein the feature weight is determined based on the reduction rate of the distillation losses of different features.

[0028] In one specific embodiment, the feature weight of feature a is expressed as:

[0029]

[0030] Among them, L a (t-1) indicates the feature distillation loss of feature a at the t-1th step of adjusting parameters; L a (t-2) indicates the feature distillation loss of feature a at the t-2th step of adjusting parameters.

[0031] In one of the specific embodiments, the first feature information and the second feature information both include: feature position information of a plurality of features;

[0032] The method further comprises:

[0033] Calculating the position loss of the target feature according to the feature position information corresponding to the target feature in the first feature information and the feature position information corresponding to the target feature in the second feature information by using a preset position loss function; wherein the target feature is any one of the features detected by the multiple teacher models;

[0034] The parameters of the student model are adjusted according to the position loss of all features.

[0035] In one specific embodiment, the position loss function is:

[0036]

[0037] Among them, i∈Pos indicates the box with the object, m∈{cx,cy,w,h} indicates the center position (cx,cy), width w, and height h of the box; Indicates whether the feature position information in the first feature information matches the feature position information corresponding to the target feature in the second feature information with respect to degree k, where 1 is matched and 0 is not matched; Indicates feature position information in the first feature information, Indicates feature position information in the second feature information.

[0038] A feature detection method, the method comprising:

[0039] Obtain a face image to be detected, and input the face image to be detected into a student model to obtain second feature information corresponding to multiple features of the face image to be detected; wherein the student model is trained by the above-mentioned model merging method.

[0040] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the steps of the above-mentioned model merging method and feature detection method.

[0041] A terminal device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above-mentioned model merging method and feature detection method.

[0042] The present invention provides a feature detection method, a model merging method, a device and a medium. First, a plurality of unlabeled face training images are obtained, and the first face image is input into a plurality of teacher models respectively, and the first feature information output by each teacher model is obtained, and the first feature information output by all teacher models is used as the label of the first face image; then the first face image with the label is input into the student model, and the second feature information corresponding to the plurality of features output by the student model is obtained; finally, the distillation loss is calculated according to the first feature information and the second feature information through a preset distillation loss function, and the parameters of the student model are adjusted according to the distillation loss, and the step of inputting the first face image into the plurality of teacher models is returned to execute respectively until the student model converges. It can be seen that the present invention guides a student model through a plurality of converged teacher models until the student model converges, so that the student model has the feature detection capability of all teacher models, achieves the purpose of model merging, reduces the model occupancy, and facilitates the further realization of edge deployment. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] 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 will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0044] in:

[0045] Figure 1 A schematic diagram of a flow chart of a model merging method in one embodiment;

[0046] Figure 2 is a schematic diagram of a facial image carrying feature information in one embodiment;

[0047] Figure 3 FIG. 4 is a structural block diagram of a terminal device in an embodiment. DETAILED DESCRIPTION

[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0049] Specifically, the "features" in the present invention refer to various details that need to be detected in a face image, including but not limited to details such as "blackheads", "wrinkles" and "dark circles". For the convenience of explaining the scheme, the following mainly uses the two features of "blackheads" and "wrinkles" as examples. Of course, it can be understood that the "blackheads" and "wrinkles" in the following scheme can also be replaced by any other feature, or the number of features can be increased.

[0050] like Figure 1 As shown, Figure 1 The figure is a flow chart of a model merging method in an embodiment. The model merging method is applied to a model set, which includes multiple teacher models and one student model with the same network structure. The multiple teacher models have converged, different teacher models are used to detect different features, and the student model has not converged. It is intended to train the unconverged student model through multiple converged teacher models so that the student model has the feature detection capabilities of all teacher models and completes the model merging.

[0051] The steps provided by the model merging method in this embodiment include:

[0052] Step 102, obtain multiple unlabeled face training images, input the first face image into multiple teacher models respectively, obtain the first feature information output by each teacher model, and use the first feature information output by all teacher models as the label of the first face image.

[0053] First, a plurality of unlabeled face training images are captured by a camera, or some unlabeled face training images are retrieved from a database. Of course, a plurality of unlabeled face training images can also be acquired by other methods, which are not specifically limited here.

[0054] It is understandable that the acquired face training images are different, and the reasons for the differences include differences in face angles and / or image sizes. Therefore, it is necessary to perform certain preprocessing operations on these acquired face training images, which include: according to the face key point algorithm, for example, using the face 68-point landmark model algorithm of the Dlib library, to obtain the center position of the two eyeballs and the center position of the nose, and then connect these two center positions and combine the vertical line to calculate the angle θ of the left and right rotation of the face, and finally use the rotation change matrix to adjust the face image with the nose coordinate information as the center. The specific calculation formula is as follows:

[0055]

[0056] Where x and y are the two-dimensional coordinates of the pixels in the original face training image. ′ and ′ The two-dimensional coordinates of the adjusted pixels in the face training image. This allows the angle of the crooked face training image to be corrected.

[0057] For the corrected image, the effective face area can be intercepted based on the coordinates of the key points of the face, with the coordinates of the center of the nose as the center and the maximum distance between the key points of the face as the length, so that only the effective face image part is predicted later to appropriately improve the processing efficiency. Then the scale normalization operation is performed to obtain face training images of the same size, and the normalized size is unified to 1024*1024. In this way, the initially obtained face training images can all meet certain processing standards.

[0058] Further, any one of the multiple unlabeled face training images is selected as the first face image, and is respectively input into the multiple converged teacher models. In this embodiment, since it is applied to an embedded device, these multiple teacher models can all use lightweight convolutional neural networks to identify feature information, such as ssd-mobilenetV2. Of course, lightweight models such as YOLO and Resnet can also be used as teacher models, but the premise is that they all need to be pre-trained to converge. Among them, the parameters of different features are different, so that the first feature information output by different teacher models is different.

[0059] In this embodiment, the first feature information output by each teacher model includes feature position information, feature severity and confidence, taking blackheads and wrinkles as examples. Among them, the feature position information is displayed in the form of a box to indicate the location of the feature. For example, the feature position information output by the blackhead teacher model is used to indicate the location of the blackhead, and the feature position information output by the wrinkle teacher model is used to indicate the location of the wrinkle. The feature severity is used to indicate the significance and quantity of the feature; for example, the higher the feature severity output by the blackhead teacher model, the more and more obvious the blackheads are. The higher the feature severity output by the wrinkle teacher model, the longer and more obvious the wrinkles are. The confidence is used to indicate the credibility of the feature severity. The higher the confidence, the more credible the obtained feature severity.

[0060] The first feature information output by all teacher models is used as the label of the first face image, replacing the manual annotation of the first face image, thereby reducing the workload of manual annotation. In addition, this method is also different from the previous detection output one-hot annotation form, introducing confidence as an annotation, softening the possibility of student model learning.

[0061] Step 104: input the first face image carrying the label into the student model to obtain second feature information corresponding to the multiple features output by the student model.

[0062] In this embodiment, since the network structure of the constructed student model is consistent with the network structure of the teacher model, after the first face image with a label is input into the student model, the second feature information obtained also includes feature position information, feature severity and confidence. However, since the student model has not converged, at the beginning of training, there is a significant difference between the actual first feature information and the second feature information, and the parameters of the student model need to be adjusted through step 106 to reduce the difference between the first feature information and the second feature information.

[0063] Step 106, calculating the distillation loss according to the first feature information and the second feature information through a preset distillation loss function, and adjusting the parameters of the student model according to the distillation loss.

[0064] In this embodiment, the distillation loss function includes multiple feature distillation loss functions, and the distillation loss function KD_loss is composed of multiple feature distillation losses. For example, to detect blackheads and wrinkles, the preset feature distillation loss function includes a blackhead distillation loss function and a wrinkle distillation loss function, and the distillation loss is correspondingly composed of a blackhead distillation loss and a wrinkle distillation loss. Furthermore, a feature distillation loss function corresponds to one feature, and a feature distillation loss function includes a soft label loss function and a hard label loss function. The following is an example of calculating the blackhead distillation loss KD_loss1 using the blackhead distillation loss function.

[0065] The soft label loss of the target feature is calculated according to the feature severity corresponding to the target feature (blackhead) in the first feature information and the feature severity corresponding to the target feature (blackhead) in the second feature information through the soft label loss function.

[0066] Specifically, the formula of the soft label loss function is:

[0067]

[0068] Wherein, N is the total degree of feature severity corresponding to the target feature (blackhead). For example, if the severity of the blackhead is set to 5, then N=5.

[0069] is the feature severity level corresponding to the target feature (blackhead) in the first feature information, indicating the value of the feature severity level corresponding to the target feature in the first feature information at level j when temperature = T.

[0070]

[0071] Among them, v j Indicates the output of the target feature (black head) at level j on the fully connected layer in the teacher model. Indicates the sum of all outputs of the fully connected layers in the teacher model.

[0072] is the feature severity corresponding to the target feature in the second feature information, indicating the value of the feature severity corresponding to the target feature in the second feature information at level j when temperature = T.

[0073]

[0074] Among them, z j Indicates the output of the fully connected layer at level j in the student model corresponding to the target feature (blackhead). Indicates the sum of all outputs of the fully connected layers in the student model.

[0075] At the same time, the hard label loss function is used to calculate the hard label loss L of the target feature according to the confidence corresponding to the target feature (blackhead) in the first feature information and the feature severity corresponding to the target feature (blackhead) in the second feature information. out_label .

[0076] Specifically, the formula for the hard label loss function is:

[0077]

[0078] Among them, M j is the confidence corresponding to the target feature in the first feature information.

[0079] Finally, the blackhead distillation loss KD_loss1 is obtained based on the following formula:

[0080] KD_loss1 = L soft *α+L out_label *(1-α)

[0081] Among them, α is the first weight and (1-α) is the second weight.

[0082] According to the empirical parameter setting, let T = 20 and α = 0.8 in the above formula. Of course, the calculation of other feature distillation loss functions is similar, so I will not go into details.

[0083] Furthermore, considering that different features have different distributions and characteristics on the face, such as wrinkles and blackheads, the difficulty of learning different features will also vary. Therefore, when constructing KD_loss, the losses of different features are constructed separately, and by assigning different weights, the distillation loss function can balance the learning of different features, and there will be no obvious difference in the training progress between feature distillation loss functions.

[0084] Specifically, a corresponding feature weight is assigned to the feature distillation loss corresponding to each feature; wherein the feature weight is determined based on the reduction rate of the distillation losses of different features.

[0085] Exemplarily, the feature weight of feature a is expressed as:

[0086]

[0087] Among them, L a (t-1) indicates the feature distillation loss of feature a at the t-1th step of adjusting parameters; L a (t-2) indicates the feature distillation loss of feature a at the t-2th step of adjusting the parameters. From the formula, we can see that the faster the feature distillation loss of feature a decreases, the easier the learning difficulty is, so setting this β aOn the contrary, when the feature distillation loss of feature a decreases more slowly, it indicates that the learning difficulty is more difficult, so setting this β a The larger the distillation loss function is, the more difficult it will be in the learning process, and the training progress of each feature distillation loss function will be basically consistent.

[0088] Correspondingly, the distillation loss function is expressed as:

[0089] KD_loss=β1KD-loss1+β2KD_loss2…+β M KD_loss M

[0090] Here, M indicates the number of features. For example, if the detected features include “blackheads”, “wrinkles” and “dark circles”, then M=3.

[0091] In addition, for the feature position information, the position loss of the target feature (e.g., blackhead) is calculated according to the feature position information corresponding to the target feature (e.g., blackhead) in the first feature information and the feature position information corresponding to the target feature (e.g., blackhead) in the second feature information through a preset position loss function. Of course, the target feature can also be any other feature detected by the multiple teacher models, such as wrinkles.

[0092] Specifically, the position loss function is:

[0093]

[0094] Among them, i∈Pos indicates the box with the object, m∈{cx,cy,w,h} indicates the center position (cx,cy), width w, and height h of the box; Indicates whether the feature position information in the first feature information matches the feature position information corresponding to the target feature in the second feature information with respect to degree k, where 1 is matched and 0 is not matched; Indicates feature position information in the first feature information, Indicates feature position information in the second feature information.

[0095] Then, the parameters of the student model are adjusted according to the position loss of all features, so that the position information of each feature output by the student model continuously approaches the position information of the same feature and the same degree k annotated by the sample, which means that the student model can learn the detection ability of the teacher model about the position information of all features.

[0096] If the student model has converged after the training of steps 102-106, the training is stopped. If the student model has not converged after the training of steps 102-106, the process returns to step 102 until the student model converges.

[0097] The above-mentioned model merging method first obtains multiple unlabeled face training images, inputs the first face image into multiple teacher models respectively, obtains the first feature information output by each teacher model, and uses the first feature information output by all teacher models as the label of the first face image; then inputs the labeled first face image into the student model, obtains the second feature information corresponding to the multiple features output by the student model; finally, the distillation loss is calculated according to the first feature information and the second feature information through a preset distillation loss function, the parameters of the student model are adjusted according to the distillation loss, and the step of inputting the first face image into multiple teacher models is returned to execute respectively until the student model converges. It can be seen that the present invention guides a student model through multiple converged teacher models until the student model converges, so that the student model has the feature detection capabilities of all teacher models, achieves the purpose of model merging, reduces the model occupancy, and facilitates the further realization of edge deployment.

[0098] Furthermore, it is only necessary to deploy this trained student model on an embedded device. When feature detection is required for a face image to be detected, the face image to be detected can be obtained based on the embedded device, and the face image to be detected can be input into the converged student model. Feature detection is performed through the converged student model, and finally a similar image is obtained in the embedded device. Figure 2 The effect diagram of the second feature information containing multiple features is shown. In this way, the model merging can be achieved, the model occupancy can be reduced, and the edge deployment is convenient.

[0099] Figure 3 FIG. 2 shows an internal structure diagram of a terminal device in an embodiment. Figure 3 As shown, the terminal device includes a processor, a memory and a network interface connected via a system bus. Among them, the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the terminal device stores an operating system and may also store a computer program. When the computer program is executed by the processor, the processor can implement the model merging method and the feature detection method. The internal memory may also store a computer program. When the computer program is executed by the processor, the processor can execute the model merging method and the feature detection method. Those skilled in the art can understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the scheme of the present invention, and does not constitute a limitation on the terminal device to which the scheme of the present invention is applied. The specific terminal device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0100] A terminal device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program: obtaining multiple unlabeled face training images, inputting the first face image into multiple teacher models respectively, obtaining the first feature information output by each teacher model, and using the first feature information output by all teacher models as the label of the first face image; wherein the first face image is any one of the multiple unlabeled face training images, and the first feature information output by different teacher models is different; inputting the labeled first face image into a student model, and obtaining second feature information corresponding to multiple features output by the student model; calculating the distillation loss according to the first feature information and the second feature information through a preset distillation loss function, adjusting the parameters of the student model according to the distillation loss, and returning to execute the step of inputting the first face image into multiple teacher models respectively until the student model converges.

[0101] And perform the following steps: obtain a face image to be detected, input the face image to be detected into a student model to obtain second feature information corresponding to multiple features of the face image to be detected.

[0102] A computer-readable storage medium stores a computer program, which implements the following steps when executed by a processor: obtaining multiple unlabeled face training images, inputting the first face image into multiple teacher models respectively, obtaining the first feature information output by each teacher model, and using the first feature information output by all teacher models as the label of the first face image; wherein the first face image is any one of the multiple unlabeled face training images, and the first feature information output by different teacher models is different; inputting the labeled first face image into a student model, and obtaining second feature information corresponding to multiple features output by the student model; calculating the distillation loss according to the first feature information and the second feature information through a preset distillation loss function, adjusting the parameters of the student model according to the distillation loss, and returning to execute the step of inputting the first face image into multiple teacher models respectively until the student model converges.

[0103] And perform the following steps: obtain a face image to be detected, input the face image to be detected into a student model to obtain second feature information corresponding to multiple features of the face image to be detected.

[0104] It should be noted that the above-mentioned feature detection method, model merging method, device and computer-readable storage medium belong to a general inventive concept, and the contents in the embodiments of the feature detection method, model merging method, device and computer-readable storage medium are applicable to each other.

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

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

[0107] The above embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present invention. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention patent shall be subject to the attached claims.

Claims

1. A model merging method, characterized in that: Applied to a model set, the model set includes multiple teacher models with the same network structure and one student model, the multiple teacher models have converged, different teacher models are used to detect different features, and the student model has not converged, the method includes: Acquire multiple unlabeled face training images, input the first face image into the multiple teacher models respectively, obtain the first feature information output by each teacher model, and use the first feature information output by all teacher models as the label of the first face image; wherein the first face image is any one of the multiple unlabeled face training images, and the first feature information output by different teacher models is different; Inputting the first face image carrying the label into the student model, and obtaining second feature information corresponding to the plurality of features output by the student model; Calculating a distillation loss according to the first feature information and the second feature information by using a preset distillation loss function, adjusting parameters of the student model according to the distillation loss, and returning to execute the step of inputting the first face image into the multiple teacher models respectively until the student model converges; The first feature information and the second feature information both include feature severity and confidence, the distillation loss function includes multiple feature distillation loss functions, one feature distillation loss function corresponds to one feature, and one feature distillation loss function includes a soft label loss function and a hard label loss function; The calculating the distillation loss according to the first feature information and the second feature information by using a preset distillation loss function includes: Calculating the soft label loss of the target feature according to the feature severity corresponding to the target feature in the first feature information and the feature severity corresponding to the target feature in the second feature information by using the soft label loss function; wherein the target feature is any one of the features detected by the multiple teacher models; Calculating the hard label loss of the target feature according to the confidence corresponding to the target feature in the first feature information and the feature severity corresponding to the target feature in the second feature information by using the hard label loss function; Calculating a first product of a first weight and the soft label loss, and a second product of a second weight and the hard label loss, and taking the sum of the first product and the second product as the feature distillation loss corresponding to the target feature; wherein the sum of the first weight and the second weight is 1; The sum of the feature distillation losses corresponding to all features is calculated to obtain the distillation loss.

2. The method according to claim 1, characterized in that The formula of the soft label loss function is: Among them, N is the total degree of feature severity corresponding to the target feature; is the feature severity corresponding to the target feature in the first feature information, indicating the value of the feature severity corresponding to the target feature in the first feature information at level j when temperature = T; is the feature severity corresponding to the target feature in the second feature information, indicating the value of the feature severity corresponding to the target feature in the second feature information at level j when temperature = T.

3. The method according to claim 2, characterized in that Among them, v j Indicates the output of the target feature at level j on the fully connected layer in the teacher model; Indicates the sum of all outputs of the fully connected layers in the teacher model; Among them, z j Indicates the output of the fully connected layer at level j in the student model corresponding to the target feature; Indicates the sum of all outputs of the fully connected layers in the student model.

4. The method according to claim 2, characterized in that: The formula of the hard label loss function is: Among them, M j is the confidence level corresponding to the target feature in the first feature information.

5. The method according to claim 1, characterized in that Before calculating the sum of the feature distillation losses corresponding to all features, it also includes: A corresponding feature weight is assigned to the feature distillation loss corresponding to each feature; wherein the feature weight is determined based on the reduction rate of the distillation losses of different features.

6. The method according to claim 5, characterized in that The feature weight of feature a is expressed as: Among them, L a (t-1) indicates the feature distillation loss of feature a at the t-1th step of adjusting parameters; L a (t-2) indicates the feature distillation loss of feature a at the t-2th step of adjusting parameters.

7. The method according to claim 1, characterized in that The first feature information and the second feature information both include: feature position information of a plurality of features; The method further comprises: Calculating the position loss of the target feature according to the feature position information corresponding to the target feature in the first feature information and the feature position information corresponding to the target feature in the second feature information by using a preset position loss function; wherein the target feature is any one of the features detected by the multiple teacher models; The parameters of the student model are adjusted according to the position loss of all features.

8. The method according to claim 7, characterized in that The position loss function is: Among them, i∈Pos indicates the box with the object, m∈{cx,cy,w,h} indicates the center position (cx,cy), width w, and height h of the box; Indicates whether the feature position information in the first feature information matches the feature position information corresponding to the target feature in the second feature information with respect to degree k, where 1 is matched and 0 is not matched; Indicates the feature position information in the first feature information, Indicates feature position information in the second feature information.

9. A feature detection method, characterized in that: The method comprises: Obtain a face image to be detected, and input the face image to be detected into a student model to obtain second feature information corresponding to multiple features of the face image to be detected; wherein the student model is trained by the method described in any one of claims 1-8.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 9.

11. A terminal device, comprising a memory and a processor, characterized in that: The memory stores a computer program, and when the computer program is executed by the processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 9.