A target detection model dynamic distillation training method and device

By using a dynamic distillation training method, the high-quality output of a large model is used to filter and dynamically adjust the distillation loss weights to train student models. This solves the problem of improving detection performance without reducing inference speed, achieving a balance between detection accuracy and inference speed, and reducing training and manpower costs.

CN117636038BActive Publication Date: 2026-01-23FUJIAN YIRONG INFORMATION TECH +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311649881.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-01
Publication Date
2026-01-23
Estimated Expiration
2043-12-01

AI Technical Summary

Technical Problem

How can we improve the detection performance of object detection models without reducing model inference speed, and reduce training and manpower costs for deployment in industrial scenarios?

Method used

A dynamic distillation training method is adopted, which utilizes the high-quality output of the large model to dynamically distill the small model. By selecting high-quality prediction output data and dynamically adjusting the distillation loss weight, the student model is trained to achieve a balance between detection accuracy and inference speed.

Benefits of technology

This model improves detection performance and reduces training costs without increasing model deployment and inference time, making it suitable for deploying target detection models in industrial scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117636038B_ABST
    Figure CN117636038B_ABST
Patent Text Reader

Abstract

The application relates to a target detection model dynamic distillation training method and device, and relates to the technical field of deep learning model optimization. The method comprises the following steps: using a student model and a teacher model to infer training pictures to obtain respective prediction output data; obtaining a conventional loss function of the student model based on the prediction output data of the student model and picture labels of the training pictures; screening high-quality prediction output data of the teacher model; calculating a distillation loss function between the high-quality prediction output data of the teacher model and the prediction output data of the student model; obtaining a total loss function of the student model based on the distillation loss function and the conventional loss function, and training the student model based on the total loss function. The application is based on the technical principle of dynamically distilling a small model from a large model with high-quality output, and model training is performed, so that a good balance between detection precision and inference speed is achieved, and the manpower and training cost required for deploying a target detection model in an industrial scene are effectively reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of deep learning model optimization technology, specifically to a dynamic distillation training method and apparatus for object detection models. Background Technology

[0002] Object detection is a fundamental task in computer vision, which involves using computer algorithms to automatically identify the category and precise location of objects in digital images. Object detection models play a crucial role in various industrial scenarios, such as pedestrian detection, intelligent surveillance, and autonomous driving. Therefore, improving the detection performance of these models contributes to increased economic efficiency. For deep learning models, generally, more parameters and a larger model result in higher detection accuracy, but this also slows down inference speed and places higher demands on the performance of deployment equipment. Therefore, in practical deployments, considering the application scenario and the cost of deployment equipment, a trade-off between the model's detection performance and inference speed is often necessary.

[0003] Improving model detection performance without reducing inference speed has attracted considerable attention from researchers. Currently, most optimization methods for object detection models primarily involve engineers manually adjusting model parameters extensively for different deployment scenarios and devices, which increases experimentation and time costs. A better training method is needed to quickly deploy existing models to target tasks across diverse deployment scenarios.

[0004] Therefore, to meet practical needs, a dynamic distillation training technique for target detection models is provided. Summary of the Invention

[0005] This application provides a dynamic distillation training method and apparatus for target detection models. Based on the technical principle of dynamic distillation of small models with high-quality output from large models, the model is trained to achieve a good balance between detection accuracy and inference speed, effectively reducing the manpower and training costs required to deploy target detection models in industrial scenarios.

[0006] To achieve the above objectives, this application provides the following solution.

[0007] In a first aspect, this application provides a dynamic distillation training method for an object detection model, the method comprising the following steps:

[0008] Using the selected student model and the trained teacher model, reasoning is performed on the selected training images to obtain their respective prediction output data;

[0009] Based on the predicted output data of the student model and the image labels of the training images, the conventional loss function of the student model is obtained.

[0010] Based on multiple predicted output data from the teacher model, high-quality predicted output data are obtained through filtering.

[0011] Calculate the distillation loss function between the high-quality predicted output data of the teacher model and the predicted output data of the student model;

[0012] Based on the distillation loss function and the conventional loss function, the total loss function of the student model is obtained;

[0013] The student model is trained based on the total loss function.

[0014] Furthermore, before using the selected student model and the trained teacher model to perform inference on the selected training images and obtain their respective corresponding prediction output data, the method also includes the following steps:

[0015] Among a variety of preset target detection models, the teacher model and the student model are selected;

[0016] Modify the model localization branches of the teacher model and the student model into a probability distribution form;

[0017] The teacher model is trained based on a pre-set dataset.

[0018] Furthermore, the recognition accuracy of the target detection model corresponding to the teacher model is higher than that of the target detection model corresponding to the student model.

[0019] Furthermore, the number of model parameters in the target detection model corresponding to the student model is less than the number of model parameters in the target detection model corresponding to the teacher model.

[0020] Furthermore, based on the multiple predicted output data from the teacher model, high-quality predicted output data is obtained by filtering, including the following steps:

[0021] Identify the classification output accuracy score, localization output accuracy score, and distance between the center of the predicted box and the ground truth box for each of the multiple predicted output data of the teacher model;

[0022] Based on the classification output accuracy score, the localization output accuracy score, and the center distance between the predicted box and the ground box, a prediction output quality score is obtained for each of the multiple prediction output data.

[0023] The prediction output data corresponding to the maximum value of each prediction output quality score is taken as the high-quality prediction output data.

[0024] Furthermore, the conventional loss function includes the original model classification loss, the original model localization loss, and the DFL loss.

[0025] Furthermore, the distillation loss function includes distillation classification loss and distillation localization loss.

[0026] Secondly, this application provides a dynamic distillation training device for an object detection model, the device comprising:

[0027] The prediction output acquisition module is used to perform inference on the selected training images using the selected student model and the trained teacher model to obtain the corresponding prediction output data.

[0028] A conventional loss calculation module is used to obtain the conventional loss function of the student model based on the predicted output data of the student model and the image labels of the training images.

[0029] The prediction output filtering module is used to filter and obtain high-quality prediction output data based on multiple prediction output data of the teacher model.

[0030] A distillation loss calculation module is used to calculate the distillation loss function between the high-quality prediction output data of the teacher model and the prediction output data of the student model.

[0031] The total loss prediction output module is used to obtain the total loss function of the student model based on the distillation loss function and the conventional loss function.

[0032] A student model training module is used to train the student model based on the total loss function.

[0033] Furthermore, the device also includes:

[0034] The model selection module is used to select the teacher model and the student model from a variety of preset target detection models;

[0035] The model modification module is used to modify the model localization branches of the teacher model and the student model into a probability distribution form;

[0036] The teacher model training module is used to train the teacher model based on a preset dataset.

[0037] Furthermore, the prediction output filtering module is also used to identify the classification output accuracy score, localization output accuracy score, and distance between the center of the prediction box and the ground truth box for each of the multiple prediction output data of the teacher model.

[0038] The prediction output filtering module is also used to obtain prediction output quality scores corresponding to each of the multiple prediction output data based on the classification output accuracy score, the positioning output accuracy score, and the center distance between the prediction box and the ground box.

[0039] The prediction output filtering module is also used to select the prediction output data corresponding to the maximum value of each prediction output quality score as the high-quality prediction output data.

[0040] Furthermore, the recognition accuracy of the target detection model corresponding to the teacher model is higher than that of the target detection model corresponding to the student model.

[0041] Furthermore, the number of model parameters in the target detection model corresponding to the student model is less than the number of model parameters in the target detection model corresponding to the teacher model.

[0042] Furthermore, the conventional loss function includes the original model classification loss, the original model localization loss, and the DFL loss.

[0043] Furthermore, the distillation loss function includes distillation classification loss and distillation localization loss.

[0044] The beneficial effects of the technical solution provided in this application include:

[0045] This application is based on the technical principle of dynamic distillation of small models to output high quality from large models, and performs model training to achieve a good balance between detection accuracy and inference speed, effectively reducing the manpower and training costs required to deploy target detection models in industrial scenarios. Attached Figure Description

[0046] Terminology Explanation:

[0047] DFL: Distribution Focal Loss.

[0048] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0049] Figure 1 This is a flowchart illustrating the steps of the dynamic distillation training method for the target detection model provided in this application embodiment;

[0050] Figure 2 This is a flowchart illustrating the principle of the dynamic distillation training method for the target detection model provided in this application embodiment;

[0051] Figure 3 This is a schematic diagram showing the comparison between the modified dynamic distillation training method for the target detection model provided in this application embodiment and the modification before and after.

[0052] Figure 4 This is a graph of the student model distillation training loss function for the dynamic distillation training method for the target detection model provided in this embodiment.

[0053] Figure 5 This is a structural block diagram of the dynamic distillation training device for the target detection model provided in the embodiments of this application. Detailed Implementation

[0054] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0055] The embodiments of this application will be further described in detail below with reference to the accompanying drawings.

[0056] This application provides a dynamic distillation training method and apparatus for a target detection model. Based on the technical principle of dynamic distillation of small models from high-quality output of large models, the model is trained to achieve a good balance between detection accuracy and inference speed, effectively reducing the manpower and training costs required to deploy target detection models in industrial scenarios.

[0057] To achieve the aforementioned technical effects, the overall concept of this application is as follows:

[0058] A dynamic distillation training method for an object detection model, comprising the following steps:

[0059] S1. Using the selected student model and the trained teacher model, reason about the selected training images to obtain their respective prediction output data.

[0060] S2. Based on the predicted output data of the student model and the image labels of the training images, obtain the regular loss function of the student model.

[0061] S3. Based on multiple predicted output data from the teacher model, filter to obtain high-quality predicted output data;

[0062] S4. Calculate the distillation loss function between the high-quality predicted output data of the teacher model and the predicted output data of the student model.

[0063] S5. Based on the distillation loss function and the conventional loss function, obtain the total loss function of the student model;

[0064] S6. Train the student model based on the total loss function.

[0065] The embodiments of this application will be further described in detail below with reference to the accompanying drawings.

[0066] Firstly, see [the following] Figures 1-4 As shown in the figure, this application provides a dynamic distillation training method for a target detection model, which includes the following steps:

[0067] S1. Using the selected student model and the trained teacher model, reason about the selected training images to obtain their respective prediction output data.

[0068] S2. Based on the predicted output data of the student model and the image labels of the training images, obtain the regular loss function of the student model.

[0069] S3. Based on multiple predicted output data from the teacher model, filter to obtain high-quality predicted output data;

[0070] S4. Calculate the distillation loss function between the high-quality predicted output data of the teacher model and the predicted output data of the student model.

[0071] S5. Based on the distillation loss function and the conventional loss function, obtain the total loss function of the student model;

[0072] S6. Train the student model based on the total loss function.

[0073] It should be noted that knowledge distillation is a commonly used model compression method in image classification tasks. Its core idea is to use a well-trained high-precision model as the teacher and a small-parameter model to be trained as the student.

[0074] During the training of the student model, the inference results of the teacher model on the training samples are added as soft labels to help the student model improve its generalization ability, thereby achieving higher performance than when trained alone.

[0075] This application proposes a method for training student models based on knowledge distillation technology, using the high-quality output of a teacher model to dynamically distill and train student models for object detection models. It uses a large-parameter model with high accuracy but slow inference speed as the teacher, and a small model with fewer parameters but faster inference speed as the student. The prediction output of the teacher model is used to assist the student model in training, thereby improving the detection performance of the student model. Ultimately, this results in a student model that achieves both high inference speed and high detection accuracy, meeting the requirements for model deployment in industrial scenarios.

[0076] Furthermore, unlike conventional knowledge distillation techniques, the embodiments of this application innovatively introduce a screening strategy and dynamic factors;

[0077] The screening strategy can filter the output of the teacher model, retaining only the high-quality output, so as to ensure that the student model can better perform distillation learning.

[0078] The dynamic factor dynamically weights the distillation loss, causing its influence to decrease continuously as training progresses. This ensures that the student model focuses on learning the knowledge in the image labels during the later stages of training, further improving the detection performance of the student model.

[0079] In this embodiment, the model training is based on the technical principle of dynamic distillation of small models with high-quality output from large models, achieving a good balance between detection accuracy and inference speed, and effectively reducing the manpower and training costs required to deploy target detection models in industrial scenarios.

[0080] Furthermore, before using the selected student model and the trained teacher model to perform inference on the selected training images and obtain their respective corresponding prediction output data, the method also includes the following steps:

[0081] Among a variety of preset target detection models, the teacher model and the student model are selected;

[0082] Modify the model localization branches of the teacher model and the student model into a probability distribution form;

[0083] The teacher model is trained based on a pre-set dataset.

[0084] Furthermore, the recognition accuracy of the target detection model corresponding to the teacher model is higher than that of the target detection model corresponding to the student model.

[0085] Furthermore, the number of model parameters in the target detection model corresponding to the student model is less than the number of model parameters in the target detection model corresponding to the teacher model.

[0086] Furthermore, based on the multiple predicted output data from the teacher model, high-quality predicted output data is obtained by filtering, including the following steps:

[0087] Identify the classification output accuracy score, localization output accuracy score, and distance between the center of the predicted box and the ground truth box for each of the multiple predicted output data of the teacher model;

[0088] Based on the classification output accuracy score, the localization output accuracy score, and the center distance between the predicted box and the ground box, a prediction output quality score is obtained for each of the multiple prediction output data.

[0089] The prediction output data corresponding to the maximum value of each prediction output quality score is taken as the high-quality prediction output data.

[0090] Furthermore, the conventional loss function includes the original model classification loss, the original model localization loss, and the DFL loss.

[0091] Furthermore, the distillation loss function includes distillation classification loss and distillation localization loss.

[0092] In actual implementation, based on the technical solutions of the embodiments of this application, the specific situation is as follows:

[0093] Step 1, Select the teacher and student model:

[0094] Currently, many open-source object detection models, such as YOLOv6 and YOLOv8, are categorized based on their depth and width, ranging from tiny, nano, small, medium, to large. Taking the YOLOv6 model as an example, we select the largest model (YOLOv6-l) as the teacher model (YOLOv6-l) and the smallest and fastest model (YOLOv6-n) as the student model (YOLOv6-n).

[0095] Based on knowledge distillation technology, the specific structures of the teacher and student models need to be determined first during the distillation training process. Generally, after determining the object detection model framework, the model parameters can be adjusted by modifying the model's depth and width. In deep learning convolutional networks, model depth refers to the number of convolutional layers in the network, and model width refers to the number of channels in the intermediate feature maps of the model. Since a larger model depth and width allow for more learnable parameters and a stronger learning ability, generally resulting in better detection performance, this embodiment selects a large-parameter model with greater depth and width as the teacher model. On the other hand, a larger depth and width also lead to slower inference speed. To ensure the practicality of the detection model in actual deployment, this embodiment selects a model with smaller depth and width as the student model.

[0096] It should be clarified that the teacher and student models only differ in the number of parameters; the overall model architecture remains the same, thus allowing for training using knowledge distillation techniques.

[0097] Step 2, modify the model localization branch:

[0098] Knowledge distillation is a technique commonly used in image classification tasks. In these tasks, the classification model only outputs a classification value, representing the probability of an image belonging to each category. The sum of the probabilities for each category is 1, forming a discrete probability distribution. KL divergence is a function specifically designed to calculate the difference between different probability distributions, and therefore it is often used to calculate the distillation loss between the predicted probability distributions of the teacher model and the student model for the same image.

[0099] In the field of object detection, the classification output of a detection model is similar to that of a classification model and can be directly distilled. However, in addition to classification output, a detection model also includes localization output, which typically consists of four regression values ​​representing the relative coordinates of the predicted bounding boxes. Since the localization output of a conventional detection model is not in probability distribution form, KL divergence cannot be used to calculate the distillation loss. Therefore, to successfully utilize knowledge distillation techniques, this application's embodiments require modifying the regression branch structure of the conventional detection model using the DFL technique mentioned in the literature GFL (Generalized Focal Loss: Learning Qualified and Distributed BoundingBoxes for Dense Object Detection). A comparison before and after the modification is shown in the attached figures of the specification. Figure 3 As shown.

[0100] As shown in the attached diagram of the instruction manual. Figure 3 As shown, the localization branch output of the detection model before modification is the predicted bounding box coordinate regression value, and the localization branch output after modification is the probability distribution of the possible positions of each edge of the predicted bounding box. Based on this, KL divergence can be used to calculate the difference between the localization branch outputs of the teacher and student models.

[0101] It should be noted that after modifying the model localization branch to a probability distribution form, in addition to keeping the original loss function unchanged, a new DFL loss function will be added to assist in the training of the localization branch. The form of the DFL loss function is shown in formula (1).

[0102] DFL(S i ,S i+1 )=-((y i+1 -y)log(S i )+(yy i )log(S i+1 (1)

[0103] Where y i y i+1 S refers to the coordinate of the position closest to the true bounding box (y-coordinate). i and S i+1 The coordinates of the predicted bounding box edge are equal to y. i y i+1The probability of.

[0104] In practice, the regression branches of the teacher and student models are modified to produce a probability distribution output, the structure of which is shown in the attached diagram in the instruction manual. Figure 3 .

[0105] See the attached diagram in the instruction manual. Figure 3 In the upper part, the number of channels output by the regular localization branch is 4, representing the coordinates of the four sides of the prediction box;

[0106] See the attached diagram in the instruction manual. Figure 3 The lower half of the output, in probability distribution form, has 4 output channels multiplied by `reg_max`, where `reg_max` is the maximum possible position for each edge. The value for each channel represents the probability that the edge of the predicted bounding box falls within the corresponding distance of that channel. For example, if the value of the 5th channel is 0.2, it means that the probability that the current edge is 5 units away from the center of the predicted bounding box is 0.2. To determine the specific position of an edge, a weighted sum of probabilities is needed for each possible position, as shown in the formula: Where y i P(y) represents the possible positions where the edge may appear. i ) represents the probability of appearing at this position, and the sum of the probabilities at all positions is 1.

[0107] After modifying the model's localization branch to a probability distribution form, a new DFL loss function will be added to assist in optimizing this localization branch. The form of DFL is shown in the following formula:

[0108] DFL(S i ,S i+1 )=-((y i+1 -y)log(S i )+(yy i )log(S i+1 ),in,

[0109] y i y i+1 S refers to the coordinate of the position closest to the true bounding box (y-coordinate). i and S i+1 The coordinates of the predicted bounding box edge are equal to y. i y i+1 The probability of.

[0110] Step 3: Train the teacher model.

[0111] Before training the student model using distillation, the teacher model needs to be trained in advance using the dataset to learn and master the knowledge of the dataset, so as to provide auxiliary guidance to the student model in the future.

[0112] Step 4: Distillation training on the student model.

[0113] In the conventional detection model training process, the model to be trained first performs inference on the training images to obtain the prediction output;

[0114] Then, the loss function is calculated using the model output and image labels.

[0115] Next, the gradient is calculated by backpropagation based on the loss function, and the model parameters are updated using the gradient to complete one training cycle.

[0116] Repeat the above process until training is complete and the target model is obtained.

[0117] In the dynamic distillation training proposed in this application embodiment, the student model needs to go through the following process:

[0118] A1. Obtain training images, and use the teacher and student models respectively to perform inference on the training images to obtain their respective prediction outputs.

[0119] A2. Calculate the standard loss function using the student model's output and image labels, referring to the attached diagram in the instruction manual. Figure 4 The original model classification loss, the original model localization loss, and the newly added DFL loss are included.

[0120] A3. Use a screening strategy to sort the scores calculated from the teacher model outputs and select the high-quality outputs.

[0121] A4. Use KL divergence to calculate the distillation loss between the high-quality output of the teacher model and the corresponding student output;

[0122] KL divergence is given by the formula: As shown, p and q represent two probability distributions, which can be replaced with the probability distributions of the teacher and student models.

[0123] A5. Use a weighted distillation loss with weights that change dynamically as training progresses.

[0124] A6. Add the regular loss and the weighted distillation loss to obtain the total loss. Calculate the gradient based on the total loss and use the gradient to update the student model.

[0125] A7. Repeat steps 1-6 above, continuously updating the student model parameters until training is complete, and obtain the final trained student model.

[0126] It should be noted that the key technical points of the dynamic distillation training process proposed in the technical solution of this application embodiment are concentrated in the above-mentioned steps A3 and A5, which will be elaborated below.

[0127] First, the screening strategy:

[0128] While the teacher model boasts high detection accuracy, it is not 100% accurate, and its predictions inevitably contain false positives and false negatives. If all the teacher model's outputs are used to guide the student model's distillation training, erroneous knowledge will inevitably be introduced. Therefore, to improve the quality of distillation training, this application proposes a screening strategy to determine the quality of the teacher model's output, removing low-quality predictions and retaining only high-quality outputs.

[0129] This screening strategy evaluates the teacher model's output from three aspects: classification accuracy, localization accuracy, and the center distance between the predicted bounding box and the ground truth bounding box. It calculates three scores accordingly, and finally, the quality of the teacher model's output is judged based on the sum of these scores. The specific calculation formula is shown below:

[0130] score total =score cls +score reg +score prior (2)

[0131] The formula for calculating the classification score is: cls =CE(P,Y)*(YP) 2 ,

[0132] P represents the classification prediction output of the teacher model, Y represents the target that the classification output should learn, and the score is... cls A lower value indicates a more accurate classification prediction;

[0133] The formula for calculating regression cost is:

[0134] IoU (Intersection over Union) represents the intersection-over-union ratio between the predicted bounding box of the localization branch and the ground truth bounding box containing the target. reg The smaller the value, the more accurate the positioning prediction;

[0135] The formula for calculating the center distance is:

[0136] x pred and x gt These represent the center coordinates of the predicted bounding box and the ground truth bounding box, respectively. Similarly, the score... prior The smaller the value, the smaller the center distance between the predicted bounding box and the ground truth bounding box. Overall, the score... total The lower the total score, the higher the quality of the prediction.

[0137] The screening strategy proposed in this application calculates the above scores using the output of the teacher model and the ground truth boxes in the image labels during distillation training. Finally, the top 10 predictions with the lowest scores for each ground truth box are selected as high-quality predictions and retained.

[0138] Second, dynamic factors:

[0139] The teacher model's output is easier to learn than image labels, thus it helps accelerate student model training and improve generalization ability in the early stages of student model training. Therefore, in the early stages of training, the student model should focus more on learning from the teacher model, i.e., the weight of distillation loss should be relatively large. However, in the later stages of training, as the student model's prediction ability improves, the performance gap between the teacher model and the student model gradually narrows. At this point, the information in the teacher model's output has a lower accuracy compared to image labels. To reduce the influence of the teacher model, the weight of distillation loss should be reduced.

[0140] In summary, this application proposes the concept of a dynamic factor to automatically adjust the weights of the distillation loss during training. During distillation training, the total loss function of the student model is shown in the following formula:

[0141] L total =L det +αL KD (3)

[0142] The formula for how the dynamic factor α changes with training time is shown below:

[0143]

[0144] Where E i This indicates that the current training has reached the i-th epoch. One epoch represents a complete training cycle of the model on the dataset. max L represents the total number of training epochs; det L represents the loss function that the student model originally learned for learning image labels. KD This represents the distillation loss function by which the student model learns from the teacher model.

[0145] The technical solution provided in this application optimizes the performance of the deployed model based on knowledge distillation technology, and uses a screening and matching strategy to filter the output of the teacher model to retain high-quality predictions; in addition, the weight of the distillation loss is dynamically adjusted during the training process so that the student model can improve its performance through distillation training.

[0146] This approach can effectively alleviate the difficulty of deploying object detection models in industrial scenarios. It can be quickly applied to the latest object detection models to improve the detection performance of the deployed models. Furthermore, this technical solution only increases the training time of the model, without increasing the inference time after the model is deployed.

[0147] Secondly, see Figure 5 As shown, based on the same inventive concept as the method embodiment, this application provides a dynamic distillation training device for a target detection model, the device comprising:

[0148] The prediction output acquisition module is used to perform inference on the selected training images using the selected student model and the trained teacher model to obtain the corresponding prediction output data.

[0149] A conventional loss calculation module is used to obtain the conventional loss function of the student model based on the predicted output data of the student model and the image labels of the training images.

[0150] The prediction output filtering module is used to filter and obtain high-quality prediction output data based on multiple prediction output data of the teacher model.

[0151] A distillation loss calculation module is used to calculate the distillation loss function between the high-quality prediction output data of the teacher model and the prediction output data of the student model.

[0152] The total loss prediction output module is used to obtain the total loss function of the student model based on the distillation loss function and the conventional loss function.

[0153] A student model training module is used to train the student model based on the total loss function.

[0154] In this embodiment, the model training is based on the technical principle of dynamic distillation of small models with high-quality output from large models, achieving a good balance between detection accuracy and inference speed, and effectively reducing the manpower and training costs required to deploy target detection models in industrial scenarios.

[0155] Furthermore, the device also includes:

[0156] The model selection module is used to select the teacher model and the student model from a variety of preset target detection models;

[0157] The model modification module is used to modify the model localization branches of the teacher model and the student model into a probability distribution form;

[0158] The teacher model training module is used to train the teacher model based on a preset dataset.

[0159] Furthermore, the prediction output filtering module is also used to identify the classification output accuracy score, localization output accuracy score, and distance between the center of the prediction box and the ground truth box for each of the multiple prediction output data of the teacher model.

[0160] The prediction output filtering module is also used to obtain prediction output quality scores corresponding to each of the multiple prediction output data based on the classification output accuracy score, the positioning output accuracy score, and the center distance between the prediction box and the ground box.

[0161] The prediction output filtering module is also used to select the prediction output data corresponding to the maximum value of each prediction output quality score as the high-quality prediction output data.

[0162] Furthermore, the recognition accuracy of the target detection model corresponding to the teacher model is higher than that of the target detection model corresponding to the student model.

[0163] Furthermore, the number of model parameters in the target detection model corresponding to the student model is less than the number of model parameters in the target detection model corresponding to the teacher model.

[0164] Furthermore, the conventional loss function includes the original model classification loss, the original model localization loss, and the DFL loss.

[0165] Furthermore, the distillation loss function includes distillation classification loss and distillation localization loss.

[0166] It should be noted that the target detection model dynamic distillation training device provided in this application has similar technical problems, technical means and technical effects to the target detection model dynamic distillation training method in principle.

[0167] It should be noted that in this application, relational terms such as "comparison" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.

[0168] The above are merely specific embodiments of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A dynamic distillation training method for a target detection model, characterized in that, The method includes the following steps: Using the selected student model and the trained teacher model, reasoning is performed on the selected training images to obtain their respective prediction output data; Based on the predicted output data of the student model and the image labels of the training images, the conventional loss function of the student model is obtained. Based on multiple predicted output data from the teacher model, high-quality predicted output data are obtained through filtering. Calculate the distillation loss function between the high-quality predicted output data of the teacher model and the predicted output data of the student model; Based on the distillation loss function and the conventional loss function, the total loss function of the student model is obtained; The student model is trained based on the total loss function; Before using the selected student model and the trained teacher model to perform inference on the selected training images and obtain their respective corresponding prediction output data, the method further includes the following steps: Among a variety of preset target detection models, the teacher model and the student model are selected; Modify the model localization branches of the teacher model and the student model into a probability distribution form; The teacher model is trained based on a pre-set dataset; Based on multiple predicted output data from the teacher model, high-quality predicted output data is obtained by filtering, including the following steps: Identify the classification output accuracy score, localization output accuracy score, and distance between the center of the predicted box and the ground truth box for each of the multiple predicted output data of the teacher model; Based on the classification output accuracy score, the localization output accuracy score, and the center distance between the predicted box and the ground box, a prediction output quality score is obtained for each of the multiple prediction output data. The prediction output data corresponding to the maximum value of each prediction output quality score is taken as the high-quality prediction output data; During the distillation training process, the total loss function of the student model is: Dynamic factors The formula for how this changes with training time is: in, Indicates the current training up to the [number]th [number]. One epoch represents one complete training cycle of the model on the dataset. This represents the total number of training epochs; This represents the loss function used by the student model to learn image labels. This represents the distillation loss function used by the student model to learn from the teacher model. This represents the total loss of the student model.

2. The dynamic distillation training method for the target detection model as described in claim 1, characterized in that: The recognition accuracy of the target detection model corresponding to the teacher model is higher than that of the target detection model corresponding to the student model.

3. The dynamic distillation training method for the target detection model as described in claim 1, characterized in that: The number of model parameters in the target detection model corresponding to the student model is less than the number of model parameters in the target detection model corresponding to the teacher model.

4. The dynamic distillation training method for the target detection model as described in claim 1, characterized in that: The conventional loss functions include the original model classification loss, the original model localization loss, and the DFL loss.

5. The dynamic distillation training method for the target detection model as described in claim 1, characterized in that: The distillation loss function includes distillation classification loss and distillation localization loss.

6. A dynamic distillation training device for a target detection model, characterized in that, The device includes: The prediction output acquisition module is used to perform inference on the selected training images using the selected student model and the trained teacher model to obtain the corresponding prediction output data. A conventional loss calculation module is used to obtain the conventional loss function of the student model based on the predicted output data of the student model and the image labels of the training images. The prediction output filtering module is used to filter and obtain high-quality prediction output data based on multiple prediction output data of the teacher model. A distillation loss calculation module is used to calculate the distillation loss function between the high-quality prediction output data of the teacher model and the prediction output data of the student model. The total loss prediction output module is used to obtain the total loss function of the student model based on the distillation loss function and the conventional loss function. A student model training module, which is used to train the student model based on the total loss function; The model selection module is used to select the teacher model and the student model from a variety of preset target detection models; The model modification module is used to modify the model localization branches of the teacher model and the student model into a probability distribution form; A teacher model training module is used to train the teacher model based on a preset dataset; The prediction output filtering module is also used to identify the classification output accuracy score, localization output accuracy score, and distance between the center of the prediction box and the ground truth box for each of the multiple prediction output data of the teacher model. The prediction output filtering module is also used to obtain prediction output quality scores corresponding to each of the multiple prediction output data based on the classification output accuracy score, the positioning output accuracy score, and the center distance between the prediction box and the ground box. The prediction output filtering module is also used to select the prediction output data corresponding to the maximum value of each prediction output quality score as the high-quality prediction output data. During the distillation training process, the total loss function of the student model is: Dynamic factors The formula for how this changes with training time is: in, Indicates the current training up to the [number]th [number]. One epoch represents one complete training cycle of the model on the dataset. This represents the total number of training epochs; This represents the loss function used by the student model to learn image labels. This represents the distillation loss function used by the student model to learn from the teacher model. This represents the total loss of the student model.

Citation Information

Patent Citations

  • Detection model training method and device, equipment and storage medium

    CN114758199A

  • Target detection model training method and device and computer readable storage medium

    CN114882324A