Target detection model training method, device and computer readable storage medium
By constructing a distillation loss adjustment parameter based on probability distribution differences, the knowledge of the teacher model is transferred to the student model, which solves the problem of insufficient detection capability of the student model in object detection and achieves more efficient object detection results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-27
- Publication Date
- 2026-04-07
AI Technical Summary
Currently, the target detection student models obtained by the target detection model training method based on knowledge distillation do not have high detection capabilities.
By acquiring sample images, object detection is performed using a student model and a teacher model. A distillation loss based on the difference between the first and second probability distributions is constructed, and the parameters of the student model are adjusted to transfer the knowledge of the teacher model.
This improved the object detection capability of the student model, enabling it to learn the positive class anchor box ranking of the teacher model during knowledge distillation, thereby enhancing detection performance.
Smart Images

Figure CN115424032B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a method, apparatus and computer-readable storage medium for training a target detection model based on knowledge distillation. Background Technology
[0002] Object detection technology is widely used in surveillance, such as for pedestrian detection, vehicle detection, license plate detection, and traffic sign detection. Currently, most object detection methods are based on object detection models. Compared to smaller object detection models, larger models offer higher detection accuracy, but both training and application require more storage and computational overhead.
[0003] Applying knowledge distillation to the training of object detection models can solve the aforementioned problems, achieving better detection accuracy with lower storage and computational overhead. Specifically, knowledge distillation utilizes the knowledge learned by a large object detection model (the teacher model) to train a smaller object detection model (the student model), thus transferring the knowledge learned by the teacher model to the network structure of the student model, which is then used in applications. However, current knowledge distillation-based object detection model training methods do not yield sufficiently high object detection capabilities in the resulting student models. Summary of the Invention
[0004] This application provides a method, device, and computer-readable storage medium for training a target detection model based on knowledge distillation, which can solve the problem that the target detection capability of the target detection student model obtained by the current target detection model training method based on knowledge distillation is not high enough.
[0005] To address the aforementioned technical problems, this application provides a technical solution: a method for training a target detection model based on knowledge distillation. The method includes: acquiring sample images, which include several positive anchor boxes for detecting several targets; performing target detection on the sample images using a student target detection model and a teacher target detection model, respectively, to obtain a first target detection result and a second target detection result, where the first and second target detection results include the probability that each positive anchor box is a foreground box; constructing a first distillation loss based on the difference between the first and second probability distributions, where the first probability distribution characterizes the distribution characteristics of the probability that each positive anchor box is a foreground box in the first target detection result, and the second probability distribution characterizes the distribution characteristics of the probability that each positive anchor box is a foreground box in the second target detection result; and adjusting the parameters of the student target detection model based at least on the first distillation loss.
[0006] To solve the above-mentioned technical problems, another technical solution adopted in this application is: to provide a target detection model training device, which includes a processor and a memory connected to the processor, wherein the memory stores program instructions; the processor is used to execute the program instructions stored in the memory to implement the above method.
[0007] To solve the above-mentioned technical problems, another technical solution adopted in this application is to provide a computer-readable storage medium storing program instructions that, when executed, can implement the above-mentioned method.
[0008] In this application, the distribution characteristics (second probability distribution) of the probability that each positive anchor box is a foreground box in the second object detection result obtained by the object detection teacher model are used as new knowledge and passed to the object detection student model through the first distillation loss. This enables the object detection student model to learn the ranking of positive anchor boxes obtained by the object detection teacher model during the knowledge distillation process, thereby improving the object detection capability of the trained object detection student model based on knowledge distillation in related technologies. Attached Figure Description
[0009] Figure 1 This is a flowchart illustrating an embodiment of the target detection model training method based on knowledge distillation in this application;
[0010] Figure 2 This is a schematic diagram showing the target detection results of the student model and the teacher model for target A.
[0011] Figure 3 This is a flowchart illustrating another embodiment of the target detection model training method based on knowledge distillation in this application;
[0012] Figure 4 yes Figure 3 A detailed flowchart of the S22 process;
[0013] Figure 5 This is a schematic diagram of the structure of an embodiment of the target detection model training device of this application;
[0014] Figure 6 This is a schematic diagram of the structure of an embodiment of the computer-readable storage medium of this application. Detailed Implementation
[0015] 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 a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0016] The terms "first," "second," and "third" used in this application are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first," "second," or "third" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0017] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments without conflict.
[0018] Figure 1 This is a flowchart illustrating an embodiment of the object detection model training method based on knowledge distillation according to this application. It should be noted that if substantially the same result is obtained, this embodiment does not necessarily reflect that result. Figure 1 The illustrated process sequence is limited. For example... Figure 1 As shown, this embodiment may include:
[0019] S11: Obtain the sample image.
[0020] The sample image includes several positive anchor boxes used to detect several targets.
[0021] The execution subject of this embodiment is an object detection model training device, which can be any electronic device with object detection model training capability, such as a mobile phone, a computer, or even a server.
[0022] The sample image can be labeled with the real object detection results, which may include the true probability that a positive anchor box is a foreground box, the ground-truth bounding box of the object within the positive anchor box, and the regions of each object, foreground region, and background region, etc. The object can be any object requiring detection, such as people, vehicles, animals (e.g., cats, dogs), etc. Anchor boxes are predefined prior boxes based on the object. After obtaining the anchor boxes included in the sample image, positive anchor boxes can be determined from the anchor boxes included in the sample image based on the similarity between each anchor box and the ground-truth bounding box of the object. Specifically, it is possible, but not limited to, obtaining the similarity between each anchor box and the ground-truth bounding box of the object, and identifying anchor boxes with similarity greater than a similarity threshold as positive anchor boxes for object detection. Similarity can be measured using metrics such as IOU, GIOU, DIOU, CIOU, etc. The positive anchor boxes used for object detection will also be referred to as the target-corresponding positive anchor boxes in the following text.
[0023] S12: Use the student object detection model and the teacher object detection model to perform object detection on the sample images respectively, and obtain the first object detection result and the second object detection result accordingly.
[0024] Both the first and second object detection results include the probability that each positive anchor box is a foreground box.
[0025] The teacher model for object detection is larger than the student model for object detection. That is, compared to the teacher network, the student model has a simpler network structure (fewer parameters, lighter weight), requiring less storage and computational overhead. For example, the teacher model could be ResNet50-RetinaNet or ResNet18-RetinaNet.
[0026] The probability that a positive anchor box is a foreground box can also be called the confidence level of the positive anchor box, which is positively correlated with the quality of the positive anchor box. The first and second object detection results can also include the probability that each positive anchor box is a foreground box, the predicted bounding box of the object within each positive anchor box, the object classification result for each pixel in the sample image, etc. Hereinafter, the object classification result obtained by the student object detection model is referred to as the first object classification result, and the object classification result obtained by the teacher object detection model is referred to as the second object classification result. Both the first and second object classification results for pixels include the probability that the pixel belongs to each object.
[0027] The sample images can be feature extracted using the student object detection model and the teacher object detection model, respectively, to obtain the first feature map and the second feature map. The student object detection model is used to obtain the first object detection result based on the first feature map, and the teacher object detection model is used to obtain the second object detection result based on the second feature map.
[0028] There is at least one first feature map and one second feature map. Different first feature maps have different scales and are used for target detection at different scales; different second feature maps have different scales and are used for target detection at different scales. Taking the second feature map as an example, the feature extractor in the student model for target detection is an FPN. The FPN includes L feature extraction layers. By processing the sample image sequentially through the L feature extraction layers, a feature pyramid (including L second feature maps of different sizes) can be obtained.
[0029] S13: Construct the first distillation loss based on the difference between the first probability distribution and the second probability distribution.
[0030] The first probability distribution characterizes the distribution characteristics of the probability that each positive anchor box in the first target detection result is a foreground box, and the second probability distribution characterizes the distribution characteristics of the probability that each positive anchor box in the second target detection result is a foreground box.
[0031] For the first probability distribution, the probabilities of each positive anchor box being a foreground box in the first target detection result can be integrated, and the probabilities of each positive anchor box being a foreground box in the integrated first target detection result are within a preset probability range; the distribution of the probabilities of each positive anchor box being a foreground box in the integrated first target detection result is determined as the first probability distribution.
[0032] For the second probability distribution, the probabilities of each positive anchor box being a foreground box in the second target detection result can be integrated. The probabilities of each positive anchor box being a foreground box in the integrated second target detection result are within a preset probability range. The distribution of the probabilities of each positive anchor box being a foreground box in the integrated second target detection result is determined as the second probability distribution.
[0033] The integration function (such as the SoftMax function) and integration parameter (such as τ mentioned later) used to obtain the first probability distribution and the second probability distribution can be the same or different.
[0034] For example, there are M targets in total, and the number of positive anchor boxes corresponding to the k-th target is N. k (k∈{1,M}), the total number of positive class anchor boxes corresponding to M targets is:
[0035]
[0036] The probability sequences of the W positive anchor boxes that are foreground boxes in the first and second object detection results are respectively: By integrating the results using the SoftMax function S(·,τ)=SoftMax(· / τ), the first probability distribution is obtained. The second probability distribution is τ can be 1, 2, etc.
[0037] S14: Adjust the parameters of the student model for object detection based at least on the first distillation loss.
[0038] The first distillation loss can be expressed as:
[0039] In some embodiments, a third distillation loss may also be obtained before S14 to adjust the parameters of the target detection student model based on the first distillation loss and the third distillation loss in S14.
[0040] The third distillation loss is constructed based on the difference between the target's third probability distribution and its fourth probability distribution. Specifically, for each target, a third sub-distillation loss can be obtained between the target's third probability distribution and its fourth probability distribution. The target's third probability distribution represents the distribution characteristics of the probability that each positive anchor box used to detect the target in the first target detection result is a foreground box, and the target's fourth probability distribution represents the distribution characteristics of the probability that each positive anchor box used to detect the target in the second target detection result is a foreground box. The third sub-distillation loss of each target is weighted to obtain the third distillation loss. The weighting method can be weighted averaging, weighted summation, etc.
[0041] For example, the probability sequences of each positive anchor box used to predict that target j is a foreground box in the first target detection result and the second target detection result are respectively Using the SoftMax function S(·,τ)=SoftMax(· / τ) respectively, To integrate and obtain The loss from the third sub-distillation of target j can be expressed as:
[0042] The loss during the third distillation can be expressed as:
[0043]
[0044] Comparing the first probability distribution with the third probability distribution (or the second probability distribution with the fourth probability distribution), the distribution features represented by the first probability distribution (or the second probability distribution) are global for detecting positive anchor boxes of all targets, while the distribution features represented by the third probability distribution (or the fourth probability distribution) are local for detecting positive anchor boxes of a single target.
[0045] Understandably, for at least some of the targets to be detected (e.g., targets that are difficult to detect, such as those that are blurry or indistinct, denoted as target A), the quality of the predicted bounding box of target A detected by the teacher model is higher than that detected by the student model, and the teacher and student models do not detect the predicted bounding box of target A from the same positive class anchor box. Figure 2 To clarify, the teacher object detection model detects the predicted bounding box of target A from the positive class anchor box a1 corresponding to target A, and in the second object detection result, the quality of a2 is higher than that of a1. The student object detection model detects the predicted bounding box of target A from the positive class anchor box a2 corresponding to target A, and in the first object detection result, the quality of a1 is higher than that of a2. Therefore, it can be determined that the order of the positive class anchor boxes corresponding to each target obtained by the teacher and student object detection models is different.
[0046] In this application, the ranking of positive anchor boxes corresponding to each target reflects the distribution characteristics of the probability that all positive anchor boxes are foreground boxes (having global properties) and the distribution characteristics of the probability that a single positive anchor box corresponding to a target is a foreground box (having local properties). By adjusting the parameters of the target detection student model using the first distillation loss, the globally-property distribution characteristics learned by the target detection teacher model can be transferred to the student model as knowledge, allowing the student model to imitate and achieve the distillation of this globally-property distribution characteristic knowledge. Similarly, by adjusting the parameters of the target detection student model using the third distillation loss, the locally-property distribution characteristics learned by the target detection teacher model can be transferred to the student model as knowledge, allowing the student model to imitate and achieve the distillation of this locally-property distribution characteristic knowledge. Thus, the ranking of positive anchor boxes corresponding to each target obtained by the target detection student model becomes increasingly closer to the ranking of positive anchor boxes corresponding to each target obtained by the target detection teacher model.
[0047] Through the implementation of this embodiment, this application uses the distribution characteristics (second probability distribution) of the probability that each positive anchor box is a foreground box in the second object detection result obtained by the object detection teacher model as new knowledge, and passes it to the object detection student model through the first distillation loss. This enables the object detection student model to learn the ranking of positive anchor boxes obtained by the object detection teacher model during the knowledge distillation process, further improving the object detection performance of the object detection student model based on knowledge distillation in related technologies.
[0048] Furthermore, in some embodiments, a second distillation loss can be obtained before S14 so that the parameters of the target detection model can be adjusted in S14 based on the second distillation loss. The second distillation loss can be obtained as follows:
[0049] Figure 3 This is a flowchart illustrating another embodiment of the object detection model training method based on knowledge distillation proposed in this application. It should be noted that if substantially the same result is obtained, this embodiment is not necessarily identical. Figure 3 The illustrated process sequence is limited. For example... Figure 3 As shown, this embodiment may include:
[0050] S21: Obtain the feature difference values of each pixel between the first feature map and the second feature map.
[0051] The feature difference value of a pixel is the difference between the features of the pixel in the first feature map and the features in the second feature map.
[0052] The first feature map and the second feature map are of the same size. The first feature map includes the features of each pixel obtained by the student model for object detection, and the second feature map includes the features of each pixel obtained by the teacher model for object detection.
[0053] S22: Obtain the weight of each pixel.
[0054] In some embodiments, the weight of each pixel can be obtained based on its region in the sample image. The higher the importance of the region in the sample image (e.g., a user-defined important region) and the richer the information it conveys (e.g., the foreground region), the greater the weight of the pixel. For example, the foreground region contains more information than the background region, so pixels in the foreground region are given a higher weight.
[0055] In some embodiments, the weight of each pixel can be determined based on the difference between the first target classification result and the second target classification result of each pixel. The weight of a pixel is positively correlated with the difference between the first target classification result and the second target classification result of the pixel.
[0056] In some embodiments, a first weight influence value for each pixel can be obtained based on the region of each pixel in the sample image; a second weight influence value can be obtained based on the difference between the first target classification result and the second target classification result of each pixel; and the weight of a pixel can be obtained based on at least one of the first weight influence value and / or the second weight influence value. For example, refer to [reference needed]. Figure 4 S22 may include the following sub-steps:
[0057] S221: Based on the region of each pixel in the sample image, obtain the first weight influence value of each pixel.
[0058] The weight of a pixel is positively correlated with its first weight influence value, and the first weight influence value of pixels in the foreground region is greater than that of pixels in the background region.
[0059] It's understandable that the foreground region contains more information than the background region. Therefore, assigning a larger first weight to pixels in the foreground region allows the subsequent second distillation loss to better convey distillation knowledge. For example, the first weight λ of pixels in the foreground region... fg =5.0, the first weight influence value λ of the pixels in the background region. bg =1.0.
[0060] S222: Obtain the weight of each pixel based at least on the first weight influence value of each pixel.
[0061] In some embodiments, the weights of each pixel may be obtained based solely on the first weight influence value.
[0062] In some embodiments, prior to S222, a second weight influence value for each pixel can be obtained based on the difference between the second target classification results and the second target classification results of each pixel. The second weight influence value of a pixel is obtained based on the difference between the first target classification result and the second target classification result (hereinafter also referred to as the classification difference value), and the second weight influence value can be the classification difference value of the pixel itself, or it can be positively correlated with the classification difference value of the pixel. Therefore, in S222, the weight of each pixel can be obtained based on the first weight influence value and the second weight influence value, and the second weight influence value of the pixel is positively correlated with the pixel's weight. Specifically, for each pixel, the first weight influence value and the second weight influence value of the pixel can be multiplied, added, averaged, etc., to obtain the pixel's weight.
[0063] The greater the weight of a pixel, the greater the classification difference value at that pixel, or the higher its importance, or the richer the information it contains.
[0064] S23: The feature difference values of each pixel are weighted based on the weight of each pixel to obtain the weighted processing result.
[0065] Weighted processing methods can include weighted summation, weighted average, and so on.
[0066] S24: Construct the second distillation loss based on the weighted processing results.
[0067] The following examples illustrate S21 to S24, where the weights are the dot product of the first and second weight influence values. The first target classification result for each pixel (the probability matrix of each pixel belonging to each target) is as follows: The second objective classification result is: H, W, and C represent the width, height, and number of probability channels (target number), respectively, and the weight matrix for each pixel. It can be represented as:
[0068]
[0069] in, This represents the matrix of first weight influence values for each pixel. This represents the probability matrix of each pixel belonging to the c-th target in the first target classification result. This represents the probability matrix of each pixel belonging to the c-th target in the second target classification result. This represents the second weighted influence value matrix for each pixel belonging to the c-th target, and ⊙ represents the dot product.
[0070] Furthermore, the feature difference values of each pixel can be expressed as:
[0071]
[0072] Among them, the l-th feature extraction layer of the object detection student model and the FPN in the object detection student model includes Q feature channels, and the corresponding first feature map includes Q first feature sub-maps, and the second feature map includes Q second feature sub-maps. This represents the first feature sub-map obtained from the q-th feature channel of the l-th layer of the FPN in the student object detection model. This represents the second feature sub-map obtained from the q-th feature channel of the l-th layer in the object detection teacher model.
[0073] Furthermore, the second distillation loss can be expressed as:
[0074]
[0075] Among them, H l Wl These represent the width and height of the feature map obtained in the l-th layer, respectively.
[0076] Through the implementation of this embodiment, this application can use the second feature map obtained by the object detection teacher model as knowledge, allowing the object detection student model to imitate it, thus achieving knowledge distillation. However, the second feature map is high-dimensional, making it difficult for the object detection student model to imitate it. Considering that the classification difference value at pixels with larger weights in the first and second feature maps is greater / more important / more information-rich, a second distillation loss is constructed by assigning weights to pixels and using the weights and feature difference values. This allows the second distillation loss to better guide the object detection student model to imitate the second feature map, controlling the distillation degree by region, and improving distillation efficiency while minimizing the impact on distillation results.
[0077] Furthermore, in some embodiments, before S13, an initial loss can be constructed based on the difference between the true object detection result and the first object detection result. Therefore, in S14, the parameters of the object detection student model can be adjusted based on the first distillation loss and the initial loss, further improving the object detection capability of the student model. The initial loss is denoted as L. ori .
[0078] After adjusting the parameters of the student model for target detection based on the first distillation loss, second distillation loss, third distillation loss, and the original loss, the final loss L all It can be represented as:
[0079] L all =L ori +αL RM +βL PF ;
[0080] L RM =L LRM +L GRM ;
[0081] Here, α and β represent weights, for example, set to 1 and 0.25 respectively.
[0082] Figure 5 This is a schematic diagram of the structure of an embodiment of the object detection model training device of this application. Figure 5 As shown, the target detection model training device includes a processor 21 and a memory 22 coupled to the processor 21.
[0083] The memory 22 stores program instructions for implementing the methods of any of the above embodiments; the processor 21 executes the program instructions stored in the memory 22 to implement the steps of the above method embodiments. The processor 21 may also be referred to as a CPU (Central Processing Unit). The processor 21 may be an integrated circuit chip with signal processing capabilities. The processor 21 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor may be a microprocessor or any conventional processor.
[0084] Figure 6 This is a schematic diagram of the structure of an embodiment of the computer-readable storage medium of this application. Figure 6 As shown, the computer-readable storage medium 30 of this application embodiment stores program instructions 31, which, when executed, implement the methods provided in the above embodiments of this application. The program instructions 31 can form a program file and be stored in the computer-readable storage medium 30 in the form of a software product, so that a computer device (which may be a personal computer, server, or network device, etc.) or processor can execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned computer-readable storage medium 30 includes various media capable of storing program code, such as a USB flash drive, portable hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, or terminal devices such as computers, servers, mobile phones, and tablets.
[0085] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.
[0086] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated units described above can be implemented in hardware or as software functional units. The above are merely embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made based on the description and drawings of this application, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A method for training a target detection model based on knowledge distillation, characterized in that, include: Acquire a sample image, the sample image including a plurality of positive class anchor boxes for detecting a plurality of targets; The sample images are subjected to object detection using a student object detection model and a teacher object detection model, respectively, yielding a first object detection result and a second object detection result. The first and second object detection results include the probability that each positive anchor box is a foreground box. A first distillation loss is constructed based on the difference between a first probability distribution and a second probability distribution. The first probability distribution characterizes the distribution features of the probability that each positive anchor box is a foreground box in the first object detection result, and the second probability distribution characterizes the distribution features of the probability that each positive anchor box is a foreground box in the second object detection result. For each target, a third sub-distillation loss is obtained between the third probability distribution and the fourth probability distribution of the target. The third probability distribution of the target represents the distribution characteristics of the probability that each positive anchor box used to detect the target is a foreground box in the first target detection result, and the fourth probability distribution of the target represents the distribution characteristics of the probability that each positive anchor box used to detect the target is a foreground box in the second target detection result. The third sub-distillation loss of each target is weighted to obtain the third distillation loss. Based on the first distillation loss and the third distillation loss, the parameters of the target detection student model are adjusted.
2. The method according to claim 1, characterized in that, Before constructing the first distillation loss based on the difference between the first probability distribution and the second probability distribution, the method further includes: The probabilities of each positive anchor box being a foreground box in the first target detection result are integrated, and the probabilities of each positive anchor box being a foreground box in the integrated first target detection result are within a preset probability range. The distribution features of the probability distribution of each positive anchor box as a foreground box in the integrated first target detection results are determined as the first probability distribution.
3. The method according to claim 1, characterized in that, Before constructing the first distillation loss based on the difference between the first probability distribution and the second probability distribution, the method further includes: The probabilities of each positive anchor box being a foreground box in the second target detection result are integrated, and the probabilities of each positive anchor box being a foreground box in the integrated second target detection result are within a preset probability range; The distribution features of the probability distribution of each positive anchor box as a foreground box in the integrated second target detection results are determined as the second probability distribution.
4. The method according to claim 1, characterized in that, The method further includes: The sample image is used to extract features using the student object detection model and the teacher object detection model, respectively, to obtain a first feature map and a second feature map. The feature difference values of each pixel point between the first feature map and the second feature map are obtained. The feature difference value of each pixel point is the difference between the feature of the pixel point in the first feature map and the feature of the pixel point in the second feature map. Obtain the weight of each pixel; The feature difference values of each pixel are weighted based on the weight of each pixel to obtain the weighted processing result. The second distillation loss is constructed based on the weighted processing results; The step of adjusting the parameters of the target detection student model based on the first distillation loss and the third distillation loss includes: The parameters of the target detection student model are adjusted based on the first distillation loss, the second distillation loss, and the third distillation loss.
5. The method according to claim 4, characterized in that, The step of obtaining the weights of each pixel includes: Based on the region of each pixel in the sample image, a first weight influence value is obtained for each pixel; wherein, the weight of each pixel is positively correlated with the first weight influence value of the pixel, and the first weight influence value of the pixels in the foreground region is greater than the first weight influence value of the pixels in the background region. The weights of each pixel are obtained based at least on the first weight influence value of each pixel.
6. The method according to claim 5, characterized in that, The first target detection result includes the first target classification result of each pixel in the first feature map, and the second target detection result includes the second target classification result of each pixel in the second feature map. The first target classification result and the second target classification result of the pixel include the probability that the pixel belongs to each of the targets. Before obtaining the weights of each pixel based at least on the first weight influence value, the method further includes: Based on the difference between the first target classification result and the second target classification result of each pixel, a second weight influence value is obtained for each pixel; the second weight influence value of the pixel is positively correlated with the difference between the first target classification result and the second target classification result of the pixel. The step of obtaining the weights of each pixel based at least on the first weight influence value includes: The weight of each pixel is obtained based on the first weight influence value and the second weight influence value of each pixel, wherein the second weight influence value of the pixel is positively correlated with the weight of the pixel.
7. The method according to claim 6, characterized in that, The step of obtaining the weight of each pixel based on the first weight influence value and the second weight influence value of each pixel includes: For each pixel, the first weight influence value and the second weight influence value of the pixel are multiplied by a dot to obtain the weight of the pixel.
8. The method according to claim 1, characterized in that, The sample images are labeled with the real target detection results, and the method further includes: Based on the difference between the real target detection result and the first target detection result, an original loss is constructed; The step of adjusting the parameters of the target detection student model based on the first distillation loss and the third distillation loss includes: The parameters of the target detection student model are adjusted based on the first distillation loss, the original loss, and the third distillation loss.
9. A target detection model training device, characterized in that, Includes a processor and a memory connected to the processor, wherein, The memory stores program instructions; The processor is configured to execute the program instructions stored in the memory to implement the method of any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program instructions that can be executed by a processor to implement the method as described in any one of claims 1-8.
Citation Information
Patent Citations
Target detection model training and identity verification method and device
CN114067401A