A target detection model training method, device and equipment and storage medium
By calculating the distillation loss values of the bottleneck layer and the detection layer in the distillation algorithm, and combining the differences between feature values and detection results, the training of the student model is optimized, which solves the problem of poor performance of the target detection model in the distillation algorithm and achieves better model performance and semantic information learning.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG PECKERAI TECH CO LTD
- Filing Date
- 2022-09-01
- Publication Date
- 2026-05-29
Smart Images

Figure CN115359322B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method, apparatus, device, and storage medium for training an object detection model. Background Technology
[0002] With the rapid development of neural networks in the field of object detection, object detection models are becoming increasingly powerful. These object detection models often employ deep neural network structures, which consume significant storage and computational resources, and the time required for object detection is also constantly increasing.
[0003] To overcome the aforementioned problems, the distillation algorithm was developed. Distillation is a model compression method. Its main idea is to use a pre-trained teacher network to assist the training of a resource-efficient student network, thereby reducing resource consumption during object detection while achieving the same object detection performance.
[0004] Currently, in the training process of student networks, the parameter adjustment of the bottleneck layer usually only considers the difference in feature values between the student model and the teacher model during the forward propagation process. The information learned by the student model is limited, which makes it impossible for the trained student model to achieve the expected results in object detection. Summary of the Invention
[0005] This invention provides a method, apparatus, device, and storage medium for training a target detection model, in order to solve the problem that target detection models trained based on distillation algorithms cannot achieve the expected results.
[0006] According to one aspect of the present invention, a method for training an object detection model is provided, comprising:
[0007] The sample image is input into the trained first model and the original second model to obtain the first feature value extracted by the bottleneck layer of the trained first model and the first detection result output by the detection layer, as well as the second feature value extracted by the bottleneck layer of the original second model and the second detection result output by the detection layer.
[0008] Based on the first feature value, the second feature value, the first detection result, and the second detection result, the bottleneck layer distillation loss value of the original second model is determined;
[0009] Based on the first and second detection results, the detection layer distillation loss value of the original second model is determined;
[0010] Based on the distillation loss values of the bottleneck layer and the detection layer, the original second model is trained, and the trained original second model is used as the target detection model.
[0011] According to another aspect of the present invention, a target detection model training apparatus is provided, comprising:
[0012] The feature value acquisition module is used to input sample images into the trained first model and the original second model, and to acquire the first feature value extracted by the bottleneck layer of the trained first model and the first detection result output by the detection layer, as well as the second feature value extracted by the bottleneck layer of the original second model and the second detection result output by the detection layer.
[0013] The bottleneck layer loss value determination module is used to determine the bottleneck layer distillation loss value of the original second model based on the first feature value, the second feature value, the first detection result, and the second detection result.
[0014] The detection layer loss value determination module is used to determine the detection layer distillation loss value of the original second model based on the first detection result and the second detection result.
[0015] The target detection model training module is used to train the original second model based on the bottleneck layer distillation loss value and the detection layer distillation loss value, and use the trained original second model as the target detection model.
[0016] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0017] At least one processor; and
[0018] A memory communicatively connected to the at least one processor; wherein,
[0019] The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the target detection model training method according to any embodiment of the present invention.
[0020] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the target detection model training method according to any embodiment of the present invention.
[0021] The technical solution of this invention first inputs a sample image into a trained first model and an original second model. It then obtains the first feature value extracted from the bottleneck layer of the trained first model and the first detection result output by the detection layer, as well as the second feature value extracted from the bottleneck layer of the original second model and the second detection result output by the detection layer. Based on the first feature value, the second feature value, the first detection result, and the second detection result, it determines the bottleneck layer distillation loss value of the original second model. Based on the first and second detection results, it determines the detection layer distillation loss value of the original second model. Finally, based on the bottleneck layer distillation loss value and the detection layer distillation loss value, it trains the original second model and uses the trained original second model as the target detection model. During training, the detection results are back-mapped to the bottleneck layer to determine the bottleneck layer distillation loss value. This allows for simultaneous consideration of the feature value differences of the bottleneck layer and the differences in prediction results at each position, thus optimizing the model training effect.
[0022] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention, 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 the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a flowchart of a target detection model training method provided by an embodiment of the present invention;
[0025] Figure 2 This is a flowchart of a target detection model training method provided by an embodiment of the present invention;
[0026] Figure 3 This is a flowchart of a target detection model training method provided by an embodiment of the present invention;
[0027] Figure 4 This is a schematic diagram of the structure of a target detection model training device according to an embodiment of the present invention;
[0028] Figure 5 This is a schematic diagram of the structure of an electronic device that implements the target detection model training method of the present invention. Detailed Implementation
[0029] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0031] Figure 1 This invention provides a flowchart of a method for training an object detection model, applicable to object detection model training based on a knowledge distillation algorithm. The method can be executed by an object detection model training device, which can be implemented in hardware and / or software and can be configured in various general-purpose computing devices. Figure 1 As shown, the method includes:
[0032] S110. Input the sample image into the trained first model and the original second model, and obtain the first feature value extracted by the bottleneck layer of the trained first model and the first detection result output by the detection layer, as well as the second feature value extracted by the bottleneck layer of the original second model and the second detection result output by the detection layer.
[0033] In knowledge distillation-based model training methods, a simpler, smaller network model is used to mimic a more complex, larger network model, enabling the smaller model to approximate the performance of the larger model. Specifically, firstly, the larger network model is trained using training data and pre-defined data labels. Next, the training data is simultaneously input into both the trained larger and smaller network models. The output of the larger network model is used as soft labels, and the pre-defined data labels are used as hard labels. Loss functions based on soft and hard labels are then constructed for the smaller network model. Finally, the total loss function, composed of both soft and hard label loss functions, is used to train the smaller network model, which is then used as the object detection model.
[0034] In this embodiment of the invention, the trained first model is the trained large network model, also known as the teacher model, and the original second model is the small network model to be trained, also known as the student model. Both the trained first model and the original second model include a backbone layer, a neck layer, and a head layer. The backbone layer is used for feature extraction from the input data (e.g., an image), the neck layer is located between the backbone layer and the head layer and is used for feature fusion, and the head layer is used to locate and classify targets in the input data.
[0035] In this embodiment of the invention, a sample image is input to a trained first model to obtain the first feature value of the sample image extracted by the trained first model at the bottleneck layer during forward propagation, and the first detection result of the sample image output at the detection layer. Simultaneously, the sample image is input to an original second model to obtain the second feature value of the sample image extracted by the original second model at the bottleneck layer during forward propagation, and the second detection result of the sample image output at the detection layer.
[0036] The sample image can be an image containing one or more objects. The first feature value and the second feature value are feature data obtained by the bottleneck layers of the trained first model and the original second model, respectively, from feature extraction of the sample image. The first detection result and the second detection result are the classification results output by the detection layers of the trained first model and the original second model, respectively. For example, both the first detection result and the second detection result can include the location of the predicted bounding box for the sample image, the predicted category of the predicted bounding box, and the corresponding confidence score. In addition, they can also include the probability that each predicted bounding box belongs to each category.
[0037] S120. Based on the first feature value, the second feature value, the first detection result, and the second detection result, determine the bottleneck layer distillation loss value of the original second model.
[0038] Existing techniques typically determine the bottleneck layer distillation loss by calculating the difference between the first and second feature values. This approach only considers the difference between each feature value of the bottleneck layer output of the first model trained during forward propagation and the original second model, without taking into account the differences in feature value detection results at each location, i.e., it does not extract semantic information at each location.
[0039] In this embodiment of the invention, to overcome the aforementioned problems, the bottleneck layer distillation loss value of the original second model is determined jointly by the first feature value, the second feature value, the first detection result, and the second detection result. This ensures that the bottleneck layer distillation loss value includes not only the differences between feature values but also the differences in detection results at each position, i.e., category differences, enabling the original second model to learn more semantic information.
[0040] Specifically, firstly, the probability of each predicted bounding box in the first detection result belonging to each category is mapped to the bottleneck layer of the trained first model, obtaining the probability of each position in the bottleneck layer belonging to each category, which serves as the first probability mapping value. Similarly, the probability of each predicted bounding box in the second detection result belonging to each category is mapped to the bottleneck layer of the original second model, obtaining the probability of each position in the bottleneck layer belonging to each category, which serves as the second probability mapping value. Further, based on the first and second mapped probability values, the category loss value of the original second model at each position in the bottleneck layer is calculated, and based on the first and second feature values, the feature loss value of the original second model at each position in the bottleneck layer is calculated. Finally, the category loss value and the feature loss value together constitute the comprehensive loss at each position in the bottleneck layer, and the distillation loss value of the bottleneck layer is calculated based on the comprehensive loss at each position.
[0041] By back-mapping the first and second detection results to the bottleneck layers of their respective models, the bottleneck layer distillation loss value can be obtained based on the class and feature differences at each position of the bottleneck layer. This enables the bottleneck layer of the original second model to learn class semantic information and optimizes the training effect of the original second model.
[0042] S130. Based on the first and second detection results, determine the detection layer distillation loss value of the original second model.
[0043] In this embodiment of the invention, after determining the bottleneck layer distillation loss value, the detection layer distillation loss value of the original second model is further calculated based on the first detection result and the second detection result. Specifically, firstly, the position of each first detection box in the first detection result and the position of each second detection box in the second detection result are obtained. Further, for each first detection box, the second detection box corresponding to the current first detection box is determined, and based on the position of the current first detection box and the position of the corresponding second detection box, the intersection-union ratio (CIU) between the current first detection box and the corresponding second detection box is calculated, and the position loss value of the second detection box is determined based on the CIU. Further, the confidence level of each first detection box is obtained in the first detection result, and the confidence level of each second detection box is obtained in the second detection result, and then the confidence level loss value of the current second detection box is calculated based on the confidence level of the current first detection box and the confidence level of the corresponding second detection box. Finally, the detection layer distillation loss value of the original second model is determined jointly based on the position loss value and the confidence level loss value.
[0044] The location loss value is calculated based on the location information of each predicted box output by the detection layer, and the confidence loss value is calculated based on the confidence of each predicted box. Finally, the detection layer distillation loss value is determined by the location loss value and the confidence loss value. This can comprehensively consider the location boundary of the detection box and the confidence of the detection box, thereby improving the training effect of the original second model.
[0045] S140. Based on the distillation loss values of the bottleneck layer and the detection layer, the original second model is trained, and the trained original second model is used as the target detection model.
[0046] In this embodiment of the invention, the original second model is trained based on the bottleneck layer distillation loss value and the detection layer distillation loss value determined in the above steps, and the trained original second model is used as the target detection model. Specifically, the total loss value of the original second model can be determined jointly by the bottleneck layer distillation loss value, the detection layer distillation loss value, the manual label classification loss, and the manual label regression loss. The total loss value is... sum_student The calculation formula is as follows:
[0047] Loss sum_student =Loss class_tag +Loss bbox_tag +Loss 预测框 +Loss FPN
[0048] Among them, Loss class_tag It is the loss value for manually labeled classification. bbox_tag It is the manually labeled regression loss value, Loss 预测框 This is the loss value of the detection layer distillation. FPN This is the distillation loss value at the bottleneck layer.
[0049] The final trained object detection model can be used to detect objects in input images: the image to be detected is input into the object detection model, and the model outputs the detection results for the image. The detection results include predicted bounding boxes in the image, the category of the object contained within the predicted bounding box, and the confidence score for that category.
[0050] The technical solution of this invention first inputs a sample image into a trained first model and an original second model. It then obtains the first feature value extracted from the bottleneck layer of the trained first model and the first detection result output by the detection layer, as well as the second feature value extracted from the bottleneck layer of the original second model and the second detection result output by the detection layer. Based on the first feature value, the second feature value, the first detection result, and the second detection result, it determines the bottleneck layer distillation loss value of the original second model. Based on the first and second detection results, it determines the detection layer distillation loss value of the original second model. Finally, based on the bottleneck layer distillation loss value and the detection layer distillation loss value, it trains the original second model and uses the trained original second model as the target detection model. During training, the detection results are back-mapped to the bottleneck layer to determine the bottleneck layer distillation loss value. This allows for simultaneous consideration of the feature value differences of the bottleneck layer and the differences in prediction results at each position, thus optimizing the model training effect.
[0051] Optionally, after completing the object detection model training, the following may also be included:
[0052] Acquire the image to be detected;
[0053] The image to be detected is input into the target detection model, and at least one target in the image to be detected is determined based on the output of the target detection model; the target detection model is trained based on the target detection model training method described in any embodiment of the present invention.
[0054] In this optional embodiment, the target detection model is trained using the target detection model training method provided in any embodiment of the present invention. The image to be detected can be an image containing at least one target. The image to be detected is input into the trained target detection model, and the target detection model can output the detection result for the specified target in the image to be detected. The detection result may include the prediction box where the target is located, the type information of the target, and the confidence level, etc.
[0055] Figure 2 This is a flowchart of a target detection model training method provided by an embodiment of the present invention. This embodiment further refines the above embodiment, providing specific steps for determining the bottleneck layer distillation loss value of the original second model based on a first feature value, a second feature value, a first detection result, and a second detection result. For example... Figure 2 As shown, the method includes:
[0056] S210. Input the sample image into the trained first model and the original second model, and obtain the first feature value extracted by the bottleneck layer of the trained first model and the first detection result output by the detection layer, as well as the second feature value extracted by the bottleneck layer of the original second model and the second detection result output by the detection layer.
[0057] S220. Map the class probability of the first predicted box in the first detection result to the bottleneck layer of the trained first model to obtain the first probability mapping value. Map the class probability of the second predicted box in the second detection result to the bottleneck layer of the original second model to obtain the second probability mapping value.
[0058] In this embodiment of the invention, the probability of the first predicted bounding box in the first detection result belonging to each category is mapped to the bottleneck layer of the trained first model, and the probability of each position in the bottleneck layer belonging to each category is used as the first probability mapping value. Similarly, the probability of the second predicted bounding box in the second detection result belonging to each category is mapped to the bottleneck layer of the original second model, and the probability of each position in the bottleneck layer belonging to each category is used as the second mapping probability value.
[0059] In a specific example, the bottleneck layer of the trained first model has a width of Weight and a height of Height. By mapping the probability of each first predicted box in the first detection result belonging to each category to the bottleneck layer of the trained first model, we can obtain the probability of each position (i, j) in the bottleneck layer belonging to each category. For example, if the total number of categories is 10, then each position in the bottleneck layer corresponds to 10 category probabilities.
[0060] S230. Based on the first probability mapping value and the second probability mapping value, determine the category loss value of the original second model at each position in the bottleneck layer.
[0061] In this embodiment of the invention, after mapping the first and second detection results to the bottleneck layer to obtain the first probability mapping value and the second probability mapping value, the category loss value of the original second model at each position in the bottleneck layer is determined based on the first and second probability mapping values. Specifically, the category loss value of the original second model at each position in the bottleneck layer can be calculated using the Kullback-Leible divergence method based on the first and second mapping probability values. The category loss value at position (i, j) in the bottleneck layer is then calculated. The calculation formula is as follows:
[0062]
[0063] Where i is the x-axis coordinate of the bottleneck layer, j is the y-axis coordinate of the bottleneck layer, and C is the total number of categories. It represents the probability that the position (i, j) of the bottleneck layer of the trained first model belongs to the z-th class. It is the probability that the position (i, j) of the bottleneck layer of the original second model belongs to the z-th category.
[0064] S240. Based on the feature difference between the first feature value and the second feature value, determine the feature loss value of the original second model at each position of the bottleneck layer.
[0065] In this embodiment of the invention, the difference between the first feature value output by the bottleneck layer of the trained first model and the second feature value output by the bottleneck layer of the original second model is calculated, and the feature loss value of the original second model at each position of the bottleneck layer is determined based on the difference.
[0066] For example, the first feature value corresponding to the bottleneck layer position (i, j) of the trained first model is The second eigenvalue corresponding to the bottleneck layer position (i,j) in the original second model is The feature loss value at that location is
[0067] S250. Based on the category loss value and feature loss value, determine the bottleneck layer distillation loss value of the original second model.
[0068] In this embodiment of the invention, after obtaining the class loss value and feature loss value of the original second model at each position of the bottleneck layer, the bottleneck layer distillation loss of the original second model is determined based on the class loss value and feature loss value. Specifically, the class loss value and feature loss value at each position can be added to obtain the comprehensive loss value at each position, and finally the comprehensive loss values of all positions are added to obtain the bottleneck layer distillation loss. Alternatively, the class loss value and feature loss value at each position of the bottleneck layer can be added to obtain the comprehensive loss value at each position, and then, based on the calibration mask matrix, the bottleneck layer positions are divided into foreground positions and background positions. The mean loss value of the foreground positions and the mean loss value of the background positions are calculated separately, and finally the mean loss value of the foreground positions and the mean loss value of the background positions are summed to obtain the bottleneck layer distillation loss. Among them, the mean loss value of the foreground positions can be calculated based on the comprehensive loss value of the foreground positions, the number of foreground positions, and the hard example weight corresponding to the foreground position. The hard example weight can be determined based on the confidence level of the output of the original second model at the foreground position. The higher the confidence level, the lower the hard example weight.
[0069] Optionally, based on the class loss value and the feature loss value, the bottleneck layer distillation loss value of the original second model is determined, including:
[0070] Based on the category loss value and feature loss value, determine the comprehensive loss value of the original second model at each position of the bottleneck layer;
[0071] Based on the comprehensive loss value and the calibration mask matrix, the mean foreground loss and mean background loss of the bottleneck layer are determined; the calibration mask matrix is determined based on the pre-calibrated foreground and background labels.
[0072] The bottleneck layer distillation loss value of the original second model is composed of the mean foreground loss and the mean background loss.
[0073] In this optional embodiment, a specific method is provided for determining the bottleneck layer distillation loss value of the original second model based on the category loss value and the feature loss value: First, based on the category loss value and the feature loss value at each position of the bottleneck layer, the comprehensive loss value of the original second model at each position of the bottleneck layer is determined. Specifically, the category loss value and the feature loss value at each position can be summed, and the summation result is used as the comprehensive loss value at that position. Since the positions in the bottleneck layer include the foreground position and the background position, in order to reduce the influence of the background parameter, different calculation methods can be used for the foreground position and the background position when calculating the comprehensive loss value: when the current position is the foreground position, the category loss value and the feature loss value at that position are directly summed to obtain the comprehensive loss value at that position; when the current position is the background position, the feature loss value at that position can be adjusted through hyperparameters, and the adjusted feature loss value is summed with the background loss value to obtain the comprehensive loss value at that position. The comprehensive loss value Feature_loss for the bottleneck layer position (i, j) is... i,j The calculation formula is as follows:
[0074]
[0075]
[0076] in, This is the class loss value of the original second model at position (i, j), M_Teacher i,j It is a mask matrix determined based on the first prediction result of the trained first model. It is the first feature value of the trained first model at position (i, j). It is the second eigenvalue of the original second model at position (i, j). It is the background weight.
[0077] After calculating the comprehensive loss value at each location in the bottleneck layer, the mean foreground loss for foreground locations and the mean background loss for background locations are determined from the comprehensive loss value based on the calibration mask matrix. Finally, the mean foreground loss and the mean background loss are summed to obtain the original bottleneck layer distillation loss value of the second model. The calibration mask matrix is determined based on manually calibrated foreground and background labels; in the calibration mask matrix, locations belonging to the foreground have a value of 1, and locations belonging to the background have a value of 0.
[0078] When calculating the distillation loss value of the bottleneck layer, the combined loss value of the foreground and background positions is considered. On the one hand, this can balance the impact of foreground and background distillation losses on the original second model. On the other hand, it can ensure that all background information participates in the distillation loss calculation, allowing the original second model to learn more background information and optimize the model training effect.
[0079] Optionally, based on the comprehensive loss value and the calibration mask matrix, the mean foreground loss of the bottleneck layer is determined, including:
[0080] Based on the calibration mask matrix, the comprehensive loss value for each foreground position is determined from the comprehensive loss value at each position in the bottleneck layer;
[0081] The confidence scores of the second predicted bounding boxes in the second detection results are mapped to the bottleneck layer of the original second model to obtain the second confidence score mapping value. Based on the second confidence score mapping value, the hard example weight of each foreground position in the bottleneck layer is determined. The higher the second confidence score mapping value of the foreground position, the smaller the corresponding hard example weight.
[0082] Based on the difficulty weights, the weighted average of the comprehensive loss values corresponding to the foreground positions in the bottleneck layer is calculated, and the weighted average is used as the mean foreground loss of the bottleneck layer.
[0083] In this optional embodiment, a specific method is provided for determining the mean foreground loss of the bottleneck layer based on the comprehensive loss value and the calibration mask matrix: First, based on the calibration mask matrix, the comprehensive loss value for each foreground position is determined from the comprehensive loss value at each position in the bottleneck layer. Further, the confidence of the second predicted box in the second detection result is mapped to the bottleneck layer of the original second model to obtain a second confidence mapping value. Based on the second confidence mapping value, the hard example weight for each foreground position in the bottleneck layer is determined, wherein the higher the second confidence mapping value, the smaller the corresponding hard example weight. Finally, based on the hard example weight, the comprehensive loss values for each foreground position in the bottleneck layer are weighted and summed, and the average of the weighted sums is calculated to obtain the mean foreground loss of the bottleneck layer. By determining the hard example weight for each foreground position in the bottleneck layer through the confidence of the second predicted box in the second detection result, the original second model can improve its learning weight for hard examples and perform targeted learning to address its own shortcomings during bottleneck layer distillation learning by distinguishing between hard and simple feature values.
[0084] Optionally, the mean background loss can be the average of the combined loss values of all background locations in the bottleneck layer.
[0085] Finally, the sum of the mean foreground loss and the mean background loss yields the bottleneck distillation loss value (Loss) of the original second model. FPN The specific calculation formula is as follows:
[0086]
[0087]
[0088] Where, num 背景 It is the number of background layers in the bottleneck layer of the original second model, num. 前景 M is the number of foreground elements in the original droplet model bottleneck layer, Weight is the width of the original second model bottleneck layer, and Height is the height of the original second model bottleneck layer. i,j It is a mask matrix determined based on manually labeled data. It is the confidence score of the original second model at position (i,j), Feature_loss i,j It is the combined loss value of the original second model at position (i,j).
[0089] S260. Based on the first and second detection results, determine the detection layer distillation loss value of the original second model.
[0090] S270. Based on the distillation loss values of the bottleneck layer and the detection layer, the original second model is trained, and the trained original second model is used as the target detection model.
[0091] The technical solution of this invention maps the detection results to the bottleneck layer, and then determines the bottleneck layer distillation loss value based on the difference between the feature values corresponding to each position in the bottleneck layer and the difference between the detection results corresponding to each position. Finally, the original second model is trained based on the bottleneck layer distillation loss value and the detection layer distillation loss value, which enables the original second model to learn more semantic information in addition to the feature values and improves the model training effect.
[0092] Figure 3 This is a flowchart of a target detection model training method provided by an embodiment of the present invention. This embodiment further refines the above embodiment, providing specific steps for determining the detection layer distillation loss value of the original second model based on the first detection result and the second detection result. For example... Figure 3 As shown, the method includes:
[0093] S310. Input the sample image into the trained first model and the original second model, and obtain the first feature value extracted by the bottleneck layer of the trained first model and the first detection result output by the detection layer, as well as the second feature value extracted by the bottleneck layer of the original second model and the second detection result output by the detection layer.
[0094] S320. Based on the first feature value, the second feature value, the first detection result, and the second detection result, determine the bottleneck layer distillation loss value of the original second model.
[0095] S330. Based on the position of the first prediction box in the first prediction result and the position of the second prediction box in the second prediction result, determine the position loss value of each second prediction box.
[0096] Cross-Union Ratio (CIRR) is a commonly used metric for evaluating object detection performance. In this embodiment of the invention, the positional loss value of each second predicted box is determined based on the position of the first predicted box in the first prediction result and the position of the second predicted box in the second prediction result. Specifically, firstly, within each predicted box included in the first detection result, a first predicted box corresponding to each second predicted box in the second prediction result is determined. Further, the CIRR of each second detection box and its corresponding first detection box is calculated, and finally, the positional loss value of each second detection box is determined based on the CIRR. A larger CIRR corresponds to a smaller positional loss value. The positional loss value of the i-th second predicted box in the second detection result is loss_Bbox. i The calculation formula is as follows:
[0097]
[0098] in, It is the i-th second prediction box. It is the first prediction box corresponding to the i-th second prediction box.
[0099] S340. Based on the confidence level of the first prediction box in the first prediction result and the confidence level of the second prediction box in the second prediction result, determine the confidence loss value of each second prediction box.
[0100] In this embodiment of the invention, in addition to calculating the position loss value of each second predicted box output by the original second model, it is also necessary to further calculate the confidence loss value of each second predicted box based on the confidence of the first predicted box in the first prediction result and the confidence of the second predicted box in the second prediction result.
[0101] Optionally, based on the confidence level of the first predicted bounding box in the first prediction result and the confidence level of the second predicted bounding box in the second prediction result, a confidence loss value for each second predicted bounding box is determined, including:
[0102] Based on the confidence level of the first predicted box in the first prediction result, the confidence loss weight of the first predicted box is determined; the higher the confidence level of the first predicted box, the smaller the confidence loss weight.
[0103] If the second prediction box belongs to the foreground, the confidence loss value of the second prediction box is determined based on the foreground hyperparameter, the confidence loss weight, the confidence of the second prediction box, and the confidence of the corresponding first prediction box.
[0104] If the second predicted box belongs to the background, the confidence loss value of the second predicted box is determined based on the background hyperparameter, the confidence loss weight, the confidence of the second predicted box, and the confidence of the corresponding first predicted box.
[0105] In this optional embodiment, a specific method is provided for determining the confidence loss value of each second prediction box based on the confidence level of the first prediction box in the first prediction result and the confidence level of the second prediction box in the second prediction result: First, the confidence loss weight of the first prediction box is determined based on the confidence level of the first prediction box in the first prediction result, wherein the higher the confidence level of the first prediction box, the smaller the corresponding confidence loss weight. Further, the confidence loss value of each second prediction box is calculated based on the confidence loss weight: When the second prediction box belongs to the foreground, the confidence loss value of the second prediction box is determined based on a pre-set foreground hyperparameter, the confidence loss weight of the first prediction box corresponding to the current second prediction box, the confidence level of the second prediction box, and the confidence level of the corresponding first prediction box; when the second prediction box belongs to the background, the confidence loss value of the second prediction box is determined based on a pre-set background hyperparameter, the confidence loss weight of the first prediction box corresponding to the current second prediction box, the confidence level of the second prediction box, and the confidence level of the corresponding first prediction box.
[0106] Specifically, the confidence loss value loss_P for the second prediction box i. i The calculation formula is as follows:
[0107]
[0108] in, It is the confidence score of the i-th second prediction box. It is the confidence score of the first predicted box corresponding to the i-th second predicted box. r and r are hyperparameters used to adjust the weights of the foreground and background. It is used to debug difficult sample samples, reduce the weight of simple sample samples, and increase the weight of difficult sample samples, so that the original second model can be optimized to address its own shortcomings.
[0109] S350. Based on the location loss value and confidence loss value, determine the detection layer distillation loss value of the original second model.
[0110] In this embodiment of the invention, after calculating the position loss value and confidence loss value of each second prediction box in the detection layer of the original second model, the position loss value and confidence loss value can be summed to obtain the comprehensive loss value of each second prediction box. Finally, the comprehensive loss values of all second prediction boxes are summed to obtain the distillation loss value of the detection layer of the original second model.
[0111] Alternatively, the weight of each first predicted box can be determined by calculating the intersection-union ratio (IU) between the first predicted box and its corresponding labeled box for each second predicted box. A higher IU results in a higher weight for the first predicted box, and a higher confidence level also results in a higher weight. Ultimately, the weight of the first predicted box is used to adjust the positional loss value of its corresponding second predicted box, preventing the original second model from learning incorrect black-box knowledge from the trained first model when the confidence level of the predicted boxes output by the trained first model is low.
[0112] Optionally, based on the location loss value and the confidence loss value, the detection layer distillation loss value of the original second model is determined, including:
[0113] Based on the position of the first predicted box, the position of the corresponding labeled box, and the confidence level of the first predicted box in the first detection result, determine the position loss weight of the first predicted box that matches each second predicted box;
[0114] The position loss value is processed by the position loss weight, and the detection layer distillation loss value of the original second model is determined based on the confidence loss value and the processed position loss value.
[0115] In this optional embodiment, a specific method is provided for determining the detection layer distillation loss value of the original second model based on the position loss value and the confidence loss value: First, based on the position of the first predicted box in the first detection result, the corresponding labeled box (human-labeled box), and the confidence of the first predicted box, the position loss weight of the first predicted box matching each second predicted box is determined. The position loss weight of the first predicted box matching each second predicted box is... i The calculation formula is as follows:
[0116]
[0117] in, It is the confidence score of the first predicted box corresponding to the i-th second predicted box. The first prediction box corresponding to the i-th second prediction box, It is the label box corresponding to the i-th second prediction box.
[0118] After calculating the positional loss weight of the first prediction box corresponding to each second prediction box, the positional loss value of the corresponding second prediction box is processed using the positional loss weight. Based on the confidence loss value and the processed positional loss value, the detection layer distillation loss value of the original second model is determined. Specifically, the confidence loss value and the processed positional loss value of each second prediction box are summed to obtain the comprehensive loss value of each second prediction box. Finally, the sum of the comprehensive loss values of all second prediction boxes is calculated as the detection layer distillation loss value of the original second model. Detection layer distillation loss value Loss 预测框 The calculation formula is as follows:
[0119]
[0120] Where s_sum is the number of predicted bounding boxes output by the original second model, and Weight i It is the position loss weight of the first predicted box corresponding to the i-th second predicted box, loss_Bbox i The loss value for the location of the i-th second predicted bounding box is loss_P. i It is the confidence loss value of the i-th second prediction box.
[0121] S360. Based on the distillation loss values of the bottleneck layer and the detection layer, the original second model is trained, and the trained original second model is used as the target detection model.
[0122] The technical solution of this invention determines the distillation loss value of the detection layer by determining the position loss value based on the position information of the prediction box in the prediction result, and the confidence loss value based on the confidence loss value of the detection box. Finally, the distillation loss value of the detection layer is determined by the confidence loss value and the position loss value, which can optimize the model training effect.
[0123] Figure 4 This is a schematic diagram of the structure of a target detection model training device provided in an embodiment of the present invention. Figure 4 As shown, the device includes:
[0124] The feature value acquisition module 410 is used to input the sample image into the trained first model and the original second model, and acquire the first feature value extracted by the bottleneck layer of the trained first model and the first detection result output by the detection layer, as well as the second feature value extracted by the bottleneck layer of the original second model and the second detection result output by the detection layer.
[0125] The bottleneck layer loss value determination module 420 is used to determine the bottleneck layer distillation loss value of the original second model based on the first feature value, the second feature value, the first detection result, and the second detection result.
[0126] The detection layer loss value determination module 430 is used to determine the detection layer distillation loss value of the original second model based on the first detection result and the second detection result.
[0127] The target detection model training module 440 is used to train the original second model based on the bottleneck layer distillation loss value and the detection layer distillation loss value, and use the trained original second model as the target detection model.
[0128] The technical solution of this invention first inputs a sample image into a trained first model and an original second model. It then obtains the first feature value extracted from the bottleneck layer of the trained first model and the first detection result output by the detection layer, as well as the second feature value extracted from the bottleneck layer of the original second model and the second detection result output by the detection layer. Based on the first feature value, the second feature value, the first detection result, and the second detection result, it determines the bottleneck layer distillation loss value of the original second model. Based on the first and second detection results, it determines the detection layer distillation loss value of the original second model. Finally, based on the bottleneck layer distillation loss value and the detection layer distillation loss value, it trains the original second model and uses the trained original second model as the target detection model. During training, the detection results are back-mapped to the bottleneck layer to determine the bottleneck layer distillation loss value. This allows for simultaneous consideration of the feature value differences of the bottleneck layer and the differences in prediction results at each position, thus optimizing the model training effect.
[0129] Optionally, the bottleneck layer loss value determination module 420 includes:
[0130] The reverse mapping value determination unit is used to map the class probability of the first predicted box in the first detection result to the bottleneck layer of the trained first model to obtain the first probability mapping value, and to map the class probability of the second predicted box in the second detection result to the bottleneck layer of the original second model to obtain the second probability mapping value.
[0131] The category loss value determination unit is used to determine the category loss value of the original second model at each position of the bottleneck layer based on the first probability mapping value and the second probability mapping value.
[0132] The feature loss value determination unit is used to determine the feature loss value of the original second model at each position of the bottleneck layer based on the feature difference between the first feature value and the second feature value.
[0133] The bottleneck layer loss determination unit is used to determine the bottleneck layer distillation loss value of the original second model based on the category loss value and the feature loss value.
[0134] Optionally, the bottleneck layer loss determination unit includes:
[0135] The comprehensive loss value determination subunit is used to determine the comprehensive loss value of the original second model at each position of the bottleneck layer based on the category loss value and the feature loss value.
[0136] The foreground loss determination subunit is used to determine the mean foreground loss and mean background loss of the bottleneck layer based on the comprehensive loss value and the calibration mask matrix; the calibration mask matrix is determined based on pre-calibrated foreground and background labels;
[0137] The distillation layer loss value determination subunit is used to construct the bottleneck layer distillation loss value of the original second model from the mean foreground loss and the mean background loss.
[0138] Optional, a foreground loss determination subunit, specifically used for;
[0139] Based on the calibration mask matrix, the comprehensive loss value for each foreground position is determined from the comprehensive loss value at each position of the bottleneck layer;
[0140] The confidence scores of the second predicted bounding boxes in the second detection results are mapped to the bottleneck layer of the original second model to obtain the second confidence score mapping value. Based on the second confidence score mapping value, the hard example weight of each foreground position in the bottleneck layer is determined. The higher the second confidence score mapping value of the foreground position, the smaller the corresponding hard example weight.
[0141] Based on the aforementioned difficulty weights, the weighted average of the comprehensive loss values corresponding to the foreground positions in the bottleneck layer is calculated, and the weighted average is used as the mean foreground loss of the bottleneck layer.
[0142] Optionally, the detection layer loss value determination module 430 includes:
[0143] The position loss value determination unit is used to determine the position loss value of each second prediction box based on the position of the first prediction box in the first prediction result and the position of the second prediction box in the second prediction result.
[0144] The confidence loss value determination unit is used to determine the confidence loss value of each second prediction box based on the confidence of the first prediction box in the first prediction result and the confidence of the second prediction box in the second prediction result.
[0145] The detection layer loss value determination unit is used to determine the detection layer distillation loss value of the original second model based on the location loss value and the confidence loss value.
[0146] Optionally, the detection layer loss value determination unit is specifically used for:
[0147] Based on the position of the first predicted box, the position of the corresponding labeled box, and the confidence level of the first predicted box in the first detection result, determine the position loss weight of the first predicted box that matches each second predicted box;
[0148] The position loss value is processed by the position loss weight, and the detection layer distillation loss value of the original second model is determined based on the confidence loss value and the processed position loss value.
[0149] Optionally, the confidence loss value determination unit is specifically used for:
[0150] Based on the confidence level of the first prediction box in the first prediction result, the confidence loss weight of the first prediction box is determined; the higher the confidence level of the first prediction box, the smaller the confidence loss weight.
[0151] If the second prediction box belongs to the foreground, the confidence loss value of the second prediction box is determined based on the foreground hyperparameter, the confidence loss weight, the confidence of the second prediction box, and the confidence of the corresponding first prediction box.
[0152] If the second predicted box belongs to the background, the confidence loss value of the second predicted box is determined based on the background hyperparameter, the confidence loss weight, the confidence of the second predicted box, and the confidence of the corresponding first predicted box.
[0153] The target detection model training device provided in this embodiment of the invention can execute the target detection model training method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0154] Figure 5 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0155] like Figure 5As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0156] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0157] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as object detection model training methods.
[0158] In some embodiments, the object detection model training method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the object detection model training method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the object detection model training method by any other suitable means (e.g., by means of firmware).
[0159] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0160] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0161] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0162] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0163] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0164] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0165] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0166] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for training an object detection model, characterized in that, include: The sample image is input into the trained first model and the original second model to obtain the first feature value extracted by the bottleneck layer of the trained first model and the first detection result output by the detection layer, as well as the second feature value extracted by the bottleneck layer of the original second model and the second detection result output by the detection layer. Based on the first feature value, the second feature value, the first detection result, and the second detection result, the bottleneck layer distillation loss value of the original second model is determined; Based on the first and second detection results, the detection layer distillation loss value of the original second model is determined; Based on the distillation loss values of the bottleneck layer and the detection layer, the original second model is trained, and the trained original second model is used as the target detection model.
2. The method according to claim 1, characterized in that, Based on the first feature value, the second feature value, the first detection result, and the second detection result, the bottleneck layer distillation loss value of the original second model is determined, including: The class probability of the first predicted box in the first detection result is mapped to the bottleneck layer of the trained first model to obtain the first probability mapping value. The class probability of the second predicted box in the second detection result is mapped to the bottleneck layer of the original second model to obtain the second probability mapping value. Based on the first probability mapping value and the second probability mapping value, determine the class loss value of the original second model at each position of the bottleneck layer; Based on the feature difference between the first feature value and the second feature value, determine the feature loss value of the original second model at each position of the bottleneck layer; Based on the category loss value and feature loss value, the bottleneck layer distillation loss value of the original second model is determined.
3. The method according to claim 2, characterized in that, Based on the category loss value and feature loss value, the bottleneck layer distillation loss value of the original second model is determined, including: Based on the category loss value and feature loss value, determine the comprehensive loss value of the original second model at each position of the bottleneck layer; Based on the comprehensive loss value and the calibration mask matrix, the mean foreground loss and mean background loss of the bottleneck layer are determined; the calibration mask matrix is determined based on the pre-calibrated foreground and background labels. The mean foreground loss and the mean background loss constitute the bottleneck layer distillation loss value of the original second model.
4. The method according to claim 3, characterized in that, Based on the comprehensive loss value and the calibration mask matrix, the mean foreground loss of the bottleneck layer is determined, including: Based on the calibration mask matrix, the comprehensive loss value for each foreground position is determined from the comprehensive loss value at each position of the bottleneck layer; The confidence scores of the second predicted bounding boxes in the second detection results are mapped to the bottleneck layer of the original second model to obtain the second confidence score mapping value. Based on the second confidence score mapping value, the hard example weight of each foreground position in the bottleneck layer is determined. The higher the second confidence score mapping value of the foreground position, the smaller the corresponding hard example weight. Based on the aforementioned difficulty weights, the weighted average of the comprehensive loss values corresponding to the foreground positions in the bottleneck layer is calculated, and the weighted average is used as the mean foreground loss of the bottleneck layer.
5. The method according to claim 1, characterized in that, Based on the first and second detection results, the detection layer distillation loss value of the original second model is determined, including: Based on the position of the first predicted box in the first detection result and the position of the second predicted box in the second detection result, determine the position loss value of each second predicted box; Based on the confidence level of the first predicted bounding box in the first detection result and the confidence level of the second predicted bounding box in the second detection result, determine the confidence loss value of each second predicted bounding box; Based on the location loss value and confidence loss value, the detection layer distillation loss value of the original second model is determined.
6. The method according to claim 5, characterized in that, Based on the location loss value and confidence loss value, the detection layer distillation loss value of the original second model is determined, including: Based on the position of the first predicted box, the position of the corresponding labeled box, and the confidence level of the first predicted box in the first detection result, determine the position loss weight of the first predicted box that matches each second predicted box; The position loss value is processed by the position loss weight, and the detection layer distillation loss value of the original second model is determined based on the confidence loss value and the processed position loss value.
7. The method according to claim 5, characterized in that, Based on the confidence scores of the first predicted bounding box in the first detection result and the second predicted bounding box in the second detection result, the confidence loss value for each second predicted bounding box is determined, including: Based on the confidence level of the first predicted bounding box in the first detection result, the confidence loss weight of the first predicted bounding box is determined; the higher the confidence level of the first predicted bounding box, the smaller the confidence loss weight. If the second prediction box belongs to the foreground, the confidence loss value of the second prediction box is determined based on the foreground hyperparameter, the confidence loss weight, the confidence of the second prediction box, and the confidence of the corresponding first prediction box. If the second predicted box belongs to the background, the confidence loss value of the second predicted box is determined based on the background hyperparameter, the confidence loss weight, the confidence of the second predicted box, and the confidence of the corresponding first predicted box.
8. A target detection method, characterized in that, include: Acquire the image to be detected; The image to be detected is input into the target detection model, and at least one target in the image to be detected is determined based on the output of the target detection model; The target detection model is trained based on the target detection model training method described in any one of claims 1-7.
9. A target detection model training device, characterized in that, include: The feature value acquisition module is used to input sample images into the trained first model and the original second model, and to acquire the first feature value extracted by the bottleneck layer of the trained first model and the first detection result output by the detection layer, as well as the second feature value extracted by the bottleneck layer of the original second model and the second detection result output by the detection layer. The bottleneck layer loss value determination module is used to determine the bottleneck layer distillation loss value of the original second model based on the first feature value, the second feature value, the first detection result, and the second detection result. The detection layer loss value determination module is used to determine the detection layer distillation loss value of the original second model based on the first detection result and the second detection result. The target detection model training module is used to train the original second model based on the bottleneck layer distillation loss value and the detection layer distillation loss value, and use the trained original second model as the target detection model.
10. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the target detection model training method of any one of claims 1-7 or the target detection method of claim 8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the object detection model training method of any one of claims 1-7 or the object detection method of claim 8.