Complex scene target detection method and model based on knowledge distillation

By introducing dynamic mutual teaching distillation and multi-scale generator into the target detection model, the knowledge distillation process is optimized, solving the problems of accuracy and computational complexity in small target detection and achieving efficient target detection in complex scenes.

CN122199994APending Publication Date: 2026-06-12CHONGQING UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610130518.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-30
Publication Date
2026-06-12

AI Technical Summary

Technical Problem

Existing target detection models suffer from insufficient accuracy and high computational complexity in small target detection, and traditional knowledge distillation methods fail to effectively utilize intermediate layer features and background noise, resulting in wasted computational resources.

Method used

A knowledge-based object detection method for complex scenes is adopted, using RT-DETR-r50 as the teacher model and a fast Fourier transform backbone network for the student model. The method combines a dynamic mutual teaching distillation module, a multi-scale generator, and a multi-scale decoder distillation module. The feature distillation process is optimized through performance-aware dynamic stage switching, composite weight calculation, and adaptive masking strategy.

Benefits of technology

It significantly improves the accuracy and computational efficiency of small target detection, reduces the number of model parameters, enhances detection performance and robustness in complex scenes, reduces background noise interference, and shortens training time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122199994A_ABST
    Figure CN122199994A_ABST
Patent Text Reader

Abstract

The application discloses a complex scene target detection method and model based on knowledge distillation, and relates to the technical field of artificial intelligence and computer vision.The application balances performance and efficiency, the parameter quantity of the student model in the application is only 9.7M, the calculation cost is greatly reduced, and the accuracy on the SEU-PML, VisDrone2019 and AI-TOD three data sets reaches 72.5%, 36.5% and 36.1% respectively, the small target detection precision AP-s is significantly better than the YOLO series and the existing Transformer series model;the method provided by the application has stronger robustness, through a pixel importance mask mechanism, low-value background areas are automatically inhibited, the missing detection rate is extremely low in complex scenes such as weak light, serious occlusion and high density, and the perception ability is sharp;the convergence speed of the application is faster, a full-link supervision signal is constructed through multi-decoder logical distillation, combined with a hierarchical weighting and a nonlinear confidence weighting mechanism, feature confusion is effectively relieved, and the training stability and the convergence speed are significantly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence and computer vision technology, specifically to a method and model for object detection in complex scenes based on knowledge distillation. Background Technology

[0002] Object detection is one of the most challenging tasks in computer vision, with numerous existing applications including autonomous driving, face recognition, defect detection, and remote sensing image detection. However, small object detection remains challenging due to the lack of object information and the complexity of the detection scenario, hindering its further development in real-world scenarios.

[0003] Currently, there are three main types of deep learning-based object detection algorithms: two-stage algorithms R-CNN, SPP-Net, FastR-CNN, FasterR-CNN, R-FCN, and MaskR-CNN. Two-stage object detection algorithms achieve better detection accuracy, but they are slow and lack real-time performance. Single-stage models such as YOLO, SSD, RetinaNet, and EfficientDet use end-to-end convolutional neural networks to detect objects. Single-stage object detection algorithms not only maintain high detection accuracy but also have advantages such as fast detection speed and strong real-time performance. Transformer-based detectors, such as the DETR series, often have high detection accuracy due to the transformer's strong modeling ability for global features and do not require post-processing operations such as NMS. However, due to the high computational complexity of transformers, their detection speed is often very slow, and the training time required for the model is excessive. The introduction of RT-DETR changes this situation. RT-DETR combines CNN with transformers, greatly improving detection speed while maintaining detection accuracy. In particular, they designed an efficient hybrid encoder that effectively handles multi-scale features by decoupling intra-scale interactions and cross-scale fusion. RT-DETR outperforms the state-of-the-art YOLO detector of a relatively small size in both speed and accuracy. Therefore, this invention chooses RT-DETR as the baseline for research. However, as a generalized object detection network model, RT-DETR does not show a significant advantage in recognizing small objects. Small objects are relatively small in size, while RT-DETR has a large downsampling factor, leading to the loss of small object information during downsampling, making it difficult to learn small object features from deeper feature maps. Therefore, it is crucial to use more efficient strategies to improve the efficiency of object detection models.

[0004] Current technology still has the following problems:

[0005] (1) While detectors such as the Transformer series (e.g., DETR, DINO) have high accuracy, they also have high computational complexity; while lightweight models often struggle to capture sufficient target information in complex scenarios. Although existing research (e.g., MI-DETR) has improved performance through spectral features, there is still room for improvement in balancing detection accuracy and efficiency.

[0006] (2) Traditional knowledge distillation usually adopts a one-way strategy (teacher guides student), which ignores the situation that the student model may surpass the teacher in local features in the later stage of training, thus limiting the further optimization of the student model. There is a large difference in feature level between the teacher and student models. Simple feature mapping (such as uniform convolution) is difficult to take into account both shallow details (texture, edge) and deep semantics (global context), resulting in the loss of small target information or semantic ambiguity.

[0007] In object detection distillation, the image background occupies the majority of the image. Indiscriminate full-image distillation leads to a waste of computational resources on redundant background noise, hindering the learning of key object features. Existing DETR-type model distillation typically focuses only on the final output layer, ignoring the layer-by-layer refinement characteristic of the Transformer decoder. This results in slow convergence of the student model and failure to fully utilize the structured knowledge of intermediate layers.

[0008] Therefore, a new solution is needed to address the above problems. Summary of the Invention

[0009] The purpose of this invention is to provide a method and model for target detection in complex scenes based on knowledge distillation, so as to solve the technical problems mentioned in the background art.

[0010] To achieve the above objectives, the present invention provides the following technical solution: a complex scene target detection model based on knowledge distillation, including a teacher model, a student model, a dynamic mutual teaching distillation module, a multi-scale generator, and a multi-scale decoder distillation module;

[0011] The teacher model selected is RT-DETR-r50, which combines the advantages of CNN and Transformer, has a good balance between detection accuracy and speed, and loads pre-trained parameters to provide high-quality knowledge sources.

[0012] The student model adopts a backbone network based on fast Fourier transform, which reduces the number of parameters and enhances feature extraction capabilities by utilizing spectral characteristics, thus adapting to the small target detection needs in complex scenarios.

[0013] The dynamic mutual teaching distillation module is used to perform dynamic mutual teaching distillation on the features generated by the teacher model and the student model. The dynamic mutual teaching distillation module includes a performance-aware dynamic stage switching mechanism, composite weight calculation, an adaptive masking strategy based on pixel importance and hierarchical depth, and a loss function.

[0014] The multi-scale generator is used to address the feature alignment challenge of heterogeneous models by employing a differentiated convolution strategy;

[0015] The multi-scale decoder distillation module is used to incorporate the encoder output and the output of all decoder layers into the distillation framework to construct a complete supervision link. The multi-scale decoder distillation module includes a hierarchical weighting strategy, a nonlinear confidence weighting mechanism, and a strategy for collaborative optimization of three-way losses.

[0016] Furthermore, the performance-aware dynamic stage switching mechanism of the dynamic mutual teaching distillation module aims to adaptively adjust the direction of knowledge transfer according to the training process, thereby maximizing distillation benefits.

[0017] The performance-aware dynamic stage switching mechanism adaptively switches between the forward distillation stage and the peer-to-peer distillation stage based on the performance difference (mAP ratio) between the training epoch and the teacher model and the student model.

[0018] The forward distillation stage: in In the early stages of training or When the student model has weak performance, it urgently needs guidance on basic knowledge. The standard teacher-to-student one-way distillation is adopted to ensure that the student model can converge quickly and build basic feature expression capabilities.

[0019] The mutual teaching distillation phase occurs when training enters the later stages and the performance of both methods is similar. and At this time, the mutual teaching mode is activated, and the teacher model is allowed to be fine-tuned based on the features of the student feedback. This two-way interaction mechanism can stimulate the co-evolution between models, explore potential feature differences, and thus significantly improve the final detection effect.

[0020]

[0021] in, This is the current training round; A preset training round threshold is used to ensure that the model performs basic learning in the early stages of training; The mean average precision (MAP) of the student model on the current evaluation set is used to measure its object detection performance. This represents the average accuracy of the teacher model on the current evaluation set. The ratio of student-teacher model performance is the ratio of student-teacher performance to teacher performance. The closer the ratio is to 1, the closer the student's performance is to the teacher's performance. When the performance of the student model is much lower than that of the teacher model, that is During the forward distillation phase, the teacher model provides one-way guidance to the student model. This is the upper limit threshold for the performance ratio; when student performance is good enough, i.e., the ratio reaches or exceeds [a certain threshold]. At this point, the mutual teaching distillation stage begins.

[0022] Furthermore, the composite weight of the dynamic mutual teaching distillation module is calculated as follows:

[0023]

[0024] in: For the layer index of the neural network; For the first The pixel-level composite importance weight map corresponding to the layer feature map, the larger the value, the more important the pixel position; For the first Semantic importance weight graph of layers, semantic weights Based on channel activation intensity calculation, capture the main area of ​​the object; For the first The importance weight map of the layer's location is used to calculate the gradient edge response using the Sobel operator, aiming to enhance the perception of object boundaries; These are the weight coefficients for semantic weights; The weight coefficients are used to determine the positioning weights.

[0025] Furthermore, the adaptive masking strategy of the dynamic mutual teaching distillation module based on pixel importance and hierarchical depth includes at least the following steps:

[0026] mask The generation is no longer completely random, but rather related to pixel importance weights. Negative correlation, its formula is defined as:

[0027]

[0028] in, For the first The layer is a binary mask image to be generated, where 0 indicates masking and 1 indicates preservation; For the mask image in the 1st Layer, spatial location The value at; For the composite weighted graph at position The value at the location; rand For a position A random number generated independently and uniformly distributed in [0,1); For the first The base mask rate of a layer is an increasing function related to the network depth;

[0029] The physical meaning of this formula is that for highly important pixels, the threshold approaches 1, making it extremely difficult to trigger masking by random numbers; while for low-importance pixels, the probability of being masked increases significantly. This design ensures that the distillation process retains key target features while filtering out a large amount of background noise, thereby reducing computational redundancy and forcing the student model to reconstruct global features using limited information.

[0030] Furthermore, considering that feature maps at different levels have different redundancies, an incremental mask rate was designed. Shallow feature maps contain a large number of non-reproducible geometric details and have low information redundancy. Therefore, a low masking rate is assigned to avoid losing key localization clues. Deep feature maps have highly abstract semantics and strong correlation and redundancy between channels.

[0031] Therefore, a higher mask rate is assigned, which increases the difficulty of reconstruction;

[0032] The formula for calculating the incremental mask rate is:

[0033]

[0034] in, The initial mask rate for the shallowest layer; This represents the increment of the mask rate as the number of layers increases;

[0035] formula Explanation: Using layer 2 (or other designated starting point) as a baseline, the mask rate increases for every 3 layers added. This achieves a design that is "detailed on the surface (few masks), strong semantics on the deeper layers (many masks)". Mask generation logic: the probability of a pixel being masked (set to 0). Importance weight The lower the background level (e.g., the lower the probability of being masked), the higher the probability of being masked; the random number is greater than the survival probability. At that time, the pixel is masked.

[0036] Furthermore, the loss function of the dynamic mutual teaching distillation module is divided into a forward phase and a mutual teaching phase;

[0037] In the positive iteration phase, the loss function optimizes by minimizing the difference between student and pseudo-teacher features.

[0038]

[0039] In the peer-teaching phase, an additional back-distillation loss is introduced into the loss function, enabling the teacher model to adaptively adjust:

[0040]

[0041] in, For the first Forward distillation loss of the layer; For the first Back-distillation loss of the layer; Student Model No. The output feature map of the layer; Teacher Model No. The output feature map of the layer; These are adaptive masks applied to the student feature map and the teacher feature map, respectively; This is an optional adapter function used to align the number of feature channels for students or teachers for loss calculation; This indicates element-wise multiplication; These are the normalization coefficients; These are the weighting coefficients that control the intensity of forward and reverse losses, respectively.

[0042] Through this dynamic and focused distillation strategy, this method significantly improves detection performance in complex scenarios while ensuring training efficiency.

[0043] Furthermore, the multi-scale generator includes a high-resolution layer and a low-resolution layer;

[0044] The high-resolution layer corresponds to detail enhancement. Taking advantage of the high-resolution layer's rich spatial detail, a regular convolution is used as the generator. Regular convolution can preserve texture and edge information in the original feature map with pixel-level precision. This design ensures that the student model can accurately inherit the teacher model's ability to locate small targets, avoiding the loss of crucial geometric details in the early stages of distillation, thereby directly improving localization accuracy.

[0045] The low-resolution layer corresponds to semantic expansion. To address the need for these low-resolution layers to capture long-range dependencies and global context, dilated convolution is employed. Lower dilation rates are used in lower-resolution layers, while higher dilation rates are used in the lowest-resolution layers. Dilated convolution significantly expands the receptive field without increasing the number of parameters or computational cost. This enables the generator to effectively aggregate global semantic information, helping student models understand object relationships and background context in complex scenes.

[0046] Through this design, the multi-scale generator achieves optimal feature alignment with minimal computational cost, ensuring comprehensive knowledge transfer from details to semantics and significantly improving the overall distillation effect.

[0047] Furthermore, the layered weighting strategy assigns low weights to the output of shallow decoders, medium weights to intermediate layers, and the highest weight of 1.0 to the final output layer, adapting to the inference characteristics of Transformer's layer-by-layer refinement.

[0048] Shallow features are relatively coarse and are given low weights as auxiliary supervision, mainly guiding the learning of basic features;

[0049] The intermediate layer features are gradually refined and given moderate weights to help the student model establish the correct reasoning trajectory.

[0050] The final output layer features are the most accurate, and are assigned the highest weight of 1.0 as the main supervision signal;

[0051] This progressive weighting not only ensures high accuracy of the final output, but also significantly improves training stability and convergence speed by utilizing the auxiliary supervision of intermediate layers.

[0052] Furthermore, the nonlinear confidence weighting dynamically adjusts the loss weights based on the nonlinear transformation of the teacher model's maximum class confidence. Low-confidence prediction weights are attenuated, while high-confidence prediction weights are enhanced to suppress noise interference. The loss is weighted using the teacher model's maximum class confidence and its nonlinear transformation power(x).

[0053]

[0054] in, This is a non-linear weighting function based on the maximum class confidence of the teacher model; the input x is the maximum class confidence of the teacher model for a certain prediction, 0≤x≤1, used to judge the reliability of the prediction; when x<0.5, it is a low confidence, and the prediction is likely to be a background or difficult-to-distinguish noise sample. Decaying weights reduces the interference of invalid samples on model training and avoids gradient oscillations; when x > 0.5, it indicates high confidence, suggesting a high probability of predicting a specific target. By increasing the weights, the model is forced to prioritize fitting high-quality target features, thereby improving detection accuracy.

[0055] This design cleverly modulates the gradient contribution: for low-confidence predictions, typically background or hard-to-distinguish samples, the gradient contribution is adjusted accordingly. Decrease its weights to reduce ineffective oscillations in the model due to noise; for high-confidence predictions (with clear targets), by... By increasing the weights, the model is forced to quickly fit high-quality targets. This dynamic weighting mechanism significantly improves the model's discriminative power and robustness in complex scenarios, achieving a dual optimization of efficiency and effectiveness.

[0056] Furthermore, the three-way loss collaborative optimization strategy is used to improve the distillation effect, and the total loss function of the three-way loss collaborative optimization strategy is defined as:

[0057]

[0058] in, For L1 bounding box loss; For GIoU bounding box loss; For classification cross-entropy loss;

[0059] The other loss functions are as follows:

[0060]

[0061] in, The number of real targets is used to normalize the loss and prevent the number of samples from affecting the optimization direction. The weight of the bounding box regression loss is increased to prioritize positioning accuracy; To assign hierarchical weights, adapting the feature importance of different decoder layers; The Sigmoid transformation of the maximum class confidence in this layer of the teacher model is used to dynamically enhance the localization constraint of high-confidence targets; The coordinates of the target bounding box predicted by the student model in the l-th layer decoder; The coordinates of the target bounding box output by the teacher model at the l-th layer decoder;

[0062]

[0063] in, This is the loss coefficient, used to balance the weight of positioning loss with other losses; The generalized intersection-union ratio of the bounding boxes of the student and teacher models is optimized by considering both the overlapping region and the bounding box area. It is a nonlinear confidence weighting function that enhances the weight of high-confidence targets and attenuates the weight of low-confidence noise, thus focusing on effective targets;

[0064]

[0065] in, The number of query vectors for the decoder is adapted to the query mechanism of the Transformer detector; To balance the ratio of query vectors to actual targets and avoid class imbalance;

[0066] In each distillation layer, the formula contains, For L1 bounding box loss; For GIoU bounding box loss; For classification cross-entropy loss; To convert the class scores of the teacher model into confidence scores in the 0-1 range, cross-entropy calculation is adapted. This is a binary cross-entropy function that measures the difference in class confidence between students and teachers in the model.

[0067] In each distillation layer, the method simultaneously calculates the L1 bounding box loss, GIoU bounding box loss, and classification cross-entropy loss, and uses the maximum class confidence of the teacher model. The loss is weighted by its nonlinear transformation. Predictions with high confidence from teachers receive a larger weight, while predictions with low confidence (potentially background or noise) are weighted less, thus achieving an adaptive distillation effect of "focusing on the target and suppressing noise." Finally, the three losses are accumulated at all levels according to their weights to form a unified multi-task, multi-level distillation objective function.

[0068] A knowledge distillation-based object detection method for complex scenes includes at least the following steps:

[0069] S1: Preprocess the original images in the object detection dataset;

[0070] S2: Divide the preprocessed dataset into a training set, a test set, and a validation set;

[0071] S3: Build a complex scene target detection model based on knowledge distillation. The complex scene target detection model based on knowledge distillation includes a teacher model, a student model, a dynamic mutual teaching distillation module, a multi-scale generator, and a multi-scale decoder distillation module.

[0072] S4: Select the preset teacher model and load the pre-trained parameters;

[0073] S5: The training set is used to train the complex scene target detection model based on knowledge distillation. The dynamic mutual teaching distillation module realizes bidirectional knowledge transfer and foreground region focusing between the teacher model and the student model. The multi-scale generator realizes feature alignment between heterogeneous models. The multi-decoder logic distillation module constructs a full-link supervision link. During the training process, the model parameters are adjusted in combination with the validation set. After the training is completed, the model performance is verified using the test set to obtain the target detection student model.

[0074] Compared with the prior art, the beneficial effects of the present invention are:

[0075] 1. This invention achieves a balance between performance and efficiency. The number of student model parameters in this invention is only 9.7M, which significantly reduces the computational cost. At the same time, the accuracy on the three datasets SEU-PML, VisDrone2019 and AI-TOD reaches 72.5%, 36.5% and 36.1% respectively. The small target detection accuracy AP-s is significantly better than the YOLO series and the existing Transformer series models.

[0076] 2. The method proposed in this invention is more robust. Through the pixel importance masking mechanism, it automatically suppresses low-value background areas and has an extremely low false negative rate in complex scenes such as low light, severe occlusion and high density, with keen perception capabilities.

[0077] 3. The present invention has a faster convergence speed. The multi-decoder logic distillation constructs the full-link supervision signal. Combined with the hierarchical weighting and nonlinear confidence weighting mechanism, it effectively alleviates feature confusion and significantly improves training stability and convergence speed.

[0078] 4. The feature alignment of this invention is more efficient. Through a multi-scale generator and a differentiated convolution strategy, it perfectly solves the feature alignment problem of heterogeneous models, while taking into account both shallow detail preservation and deep semantic expansion. Attached Figure Description

[0079] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the 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.

[0080] Figure 1 The flowchart of the overall knowledge distillation-based target detection method for complex scenes provided by this invention;

[0081] Figure 2 A schematic diagram of the knowledge distillation-based target detection model for complex scenes provided by this invention;

[0082] Figure 3 A schematic diagram of the dynamic mutual teaching distillation module provided by the present invention;

[0083] Figure 4 A schematic diagram of the multi-scale generator provided by the present invention;

[0084] Figure 5 A visual comparison chart of the detection results of different models provided by this invention. Detailed Implementation

[0085] 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.

[0086] Example 1:

[0087] See Figure 2 A complex scene target detection model based on knowledge distillation, including a teacher model, a student model, a dynamic mutual teaching distillation module, a multi-scale generator, and a multi-scale decoder distillation module;

[0088] The teacher model selected is RT-DETR-r50, which combines the advantages of CNN and Transformer, and has a good balance between detection accuracy and speed. Pre-trained parameters are loaded to provide high-quality knowledge sources.

[0089] The student model uses a backbone network based on fast Fourier transform, which reduces the number of parameters and enhances feature extraction capabilities by utilizing spectral characteristics, thus adapting to the needs of small target detection in complex scenarios.

[0090] See Figure 3 The dynamic mutual teaching distillation module is used to perform dynamic mutual teaching distillation on the features generated by the teacher model and the student model. The dynamic mutual teaching distillation module includes a performance-aware dynamic stage switching mechanism, composite weight calculation, an adaptive masking strategy based on pixel importance and hierarchical depth, and a loss function.

[0091] A multi-scale generator is used to address the feature alignment challenge of heterogeneous models by employing a differentiated convolution strategy;

[0092] The multi-scale decoder distillation module is used to incorporate the encoder output and the output of all decoder layers into the distillation framework to build a complete supervision link. The multi-scale decoder distillation module includes a hierarchical weighting strategy, a nonlinear confidence weighting mechanism, and a strategy for collaborative optimization of three-way loss.

[0093] Dynamic mutual teaching distillation module:

[0094] In practical applications of knowledge distillation, improving its efficiency and effectiveness faces two major bottlenecks. First, traditional one-way distillation strategies (teacher-guided student) typically assume that the teacher's model is always superior to the student's. However, in the later stages of training, the student model's performance may approach or even surpass the teacher's on certain local features. At this point, forced one-way instruction is not only inefficient but may also limit the student model's further optimization potential. Second, object detection tasks suffer from a severe foreground-background imbalance problem. Since the background region occupies the majority of the image, if all feature points are distilled indiscriminately, the model will waste computational resources on a large amount of redundant background noise, severely hindering the learning efficiency of key target features.

[0095] To address the aforementioned efficiency bottleneck, this invention proposes a performance-aware dynamic stage switching mechanism (such as...). Figure 2 (As shown). This mechanism aims to adaptively adjust the direction of knowledge transfer according to the training progress, thereby maximizing distillation gains. This invention divides the training process into two phases:

[0096] Forward distillation stage: In the early stages of training or When the student model has weak performance, it urgently needs guidance on basic knowledge. The standard teacher-to-student one-way distillation is adopted to ensure that the student model can converge quickly and build basic feature expression capabilities.

[0097] The mutual teaching distillation phase occurs when training enters the later stages and the performance of both methods is similar. and At this time, the mutual teaching mode is activated, and the teacher model is allowed to be fine-tuned based on the features of the student feedback. This two-way interaction mechanism can stimulate the co-evolution between models, explore potential feature differences, and thus significantly improve the final detection effect.

[0098]

[0099] in, This is the current training round; A preset training round threshold is used to ensure that the model performs basic learning in the early stages of training; The mean average precision (MAP) of the student model on the current evaluation set is used to measure its object detection performance. This represents the average accuracy of the teacher model on the current evaluation set. The ratio of student-teacher model performance is the ratio of student-teacher performance to teacher performance. The closer the ratio is to 1, the closer the student's performance is to the teacher's performance. When the performance of the student model is much lower than that of the teacher model, that is During the forward distillation phase, the teacher model provides one-way guidance to the student model. This is the upper limit threshold for the performance ratio; when student performance is good enough, i.e., the ratio reaches or exceeds [a certain threshold]. At this point, the mutual teaching distillation stage begins.

[0100] To further improve the focus and efficiency of feature learning, this invention not only focuses on "what to learn" (weights) but also addresses the problem of "how to learn robustly" (masking) by introducing a hierarchical adaptive masking mechanism. This invention argues that efficient distillation should focus on key pixels rich in semantic and location information, rather than applying force evenly across the entire image. Therefore, a composite weight calculation formula is introduced:

[0101]

[0102] in: For the layer index of the neural network; For the first The pixel-level composite importance weight map corresponding to the layer feature map, the larger the value, the more important the pixel position; For the first Semantic importance weight graph of layers, semantic weights Based on channel activation intensity calculation, capture the main area of ​​the object; For the first The importance weight map of the layer's location is used to calculate the gradient edge response using the Sobel operator, aiming to enhance the perception of object boundaries; These are the weight coefficients for semantic weights; The weight coefficients are used to determine the positioning weights.

[0103] In traditional masked image modeling, while random masks can force the model to learn context, they can easily destroy the integrity of key features in distillation tasks. Therefore, this invention proposes an adaptive masking strategy based on pixel importance and hierarchical depth.

[0104] mask The generation is no longer completely random, but rather related to pixel importance weights. Negative correlation, its formula is defined as:

[0105]

[0106] in, For the first The layer is a binary mask image to be generated, where 0 indicates masking and 1 indicates preservation; For the mask image in the 1st Layer, spatial location The value at; For the composite weighted graph at position The value at the location; rand For a position A random number generated independently and uniformly distributed in [0,1); For the first The base mask rate of a layer is an increasing function related to the network depth;

[0107] The physical meaning of this formula is that for highly important pixels, the threshold approaches 1, making it extremely difficult to trigger masking by random numbers; while for low-importance pixels, the probability of being masked increases significantly. This design ensures that the distillation process retains key target features while filtering out a large amount of background noise, thereby reducing computational redundancy and forcing the student model to reconstruct global features using limited information.

[0108] Furthermore, considering that feature maps at different levels have different redundancies, an incremental mask rate was designed. Shallow feature maps contain a large number of non-reproducible geometric details and have low information redundancy. Therefore, a low masking rate is assigned to avoid losing key localization clues. Deep feature maps have highly abstract semantics and strong correlation and redundancy between channels.

[0109] Therefore, a higher mask rate is assigned, which increases the difficulty of reconstruction;

[0110] The formula for calculating the incremental mask rate is:

[0111]

[0112] in, The initial mask rate for the shallowest layer; This represents the increment of the mask rate as the number of layers increases;

[0113] formula Explanation: Using layer 2 (or other designated starting point) as a baseline, the mask rate increases for every 3 layers added. This achieves a design that is "detailed on the surface (few masks), strong semantics on the deeper layers (many masks)". Mask generation logic: the probability of a pixel being masked (set to 0). Importance weight The lower the background level (e.g., the lower the probability of being masked), the higher the probability of being masked; the random number is greater than the survival probability. At that time, the pixel is masked.

[0114] The loss function of the dynamic mutual teaching distillation module is divided into a forward phase and a mutual teaching phase;

[0115] In the positive iteration phase, the loss function optimizes by minimizing the difference between student and pseudo-teacher features.

[0116]

[0117] In the peer-teaching phase, an additional back-distillation loss is introduced into the loss function, enabling the teacher model to adaptively adjust:

[0118]

[0119] in, For the first Forward distillation loss of the layer; For the first Back-distillation loss of the layer; Student Model No. The output feature map of the layer; Teacher Model No. The output feature map of the layer; These are adaptive masks applied to the student feature map and the teacher feature map, respectively; This is an optional adapter function used to align the number of feature channels for students or teachers for loss calculation; This indicates element-wise multiplication; These are the normalization coefficients; These are the weighting coefficients that control the intensity of forward and reverse losses, respectively.

[0120] Through this dynamic and focused distillation strategy, this method significantly improves detection performance in complex scenarios while ensuring training efficiency.

[0121] Multiscale generator:

[0122] Feature alignment between heterogeneous models is a core challenge in knowledge distillation. Direct feature mapping often ignores the differences in information carrying capacity between feature maps at different levels, leading to a significant reduction in distillation effectiveness. Specifically, shallow, high-resolution feature maps mainly carry detailed information such as texture and edges, which is crucial for small object detection; while deep, low-resolution feature maps focus on global semantics and contextual relationships. If a uniform convolutional structure is simply used for feature alignment, either insufficient receptive field leads to the loss of deep semantics, or excessive pooling blurs shallow details. This "one-size-fits-all" approach not only fails to fully utilize the multi-scale advantages of the teacher model but may also introduce feature noise, reducing the effectiveness of distillation.

[0123] To balance detail preservation and global awareness during feature alignment, thereby improving the quality and effectiveness of feature transfer, this invention designs a multi-scale generator (e.g., one that incorporates differentiated convolution strategies) that incorporates differential convolution strategies. Figure 4 (As shown).

[0124] The multi-scale generator includes high-resolution layers and low-resolution layers;

[0125] High-resolution layers are used for detail enhancement. Leveraging the rich spatial details inherent in high-resolution layers, a standard convolutional layer is employed as the generator. This standard convolutional layer preserves texture and edge information from the original feature map with pixel-level precision. This design ensures that the student model accurately inherits the teacher model's ability to locate small targets, avoiding the loss of crucial geometric details in the early stages of distillation, thereby directly improving localization accuracy.

[0126] The low-resolution layers correspond to semantic expansion. To address the need for these layers to capture long-range dependencies and global context, dilated convolutions are employed. Lower dilation rates are used in the lower-resolution layers, while higher dilation rates are used in the lowest-resolution layers. Dilated convolutions significantly expand the receptive field without increasing the number of parameters or computational cost. This allows the generator to effectively aggregate global semantic information, helping student models understand object relationships and background context in complex scenes.

[0127] Through this design, the multi-scale generator achieves optimal feature alignment with minimal computational cost, ensuring comprehensive knowledge transfer from details to semantics and significantly improving the overall distillation effect.

[0128] Multi-scale decoder distillation module:

[0129] Existing detection model distillation methods typically focus only on the final output layer of the teacher model. This approach has significant efficiency and performance drawbacks: First, Transformer-based detectors exhibit layer-by-layer refinement inference, with intermediate decoder layers containing a progressive inference process from coarse to fine. Distilling only the final result is equivalent to discarding the rich supervisory signals from the intermediate processes, causing the student model to require longer training cycles to discover the correct inference path, resulting in low convergence efficiency. Second, features at different levels differ significantly in their semantic abstraction; directly mixing and distilling these features can easily lead to optimization conflicts, impacting the final detection performance.

[0130] To fully utilize the structured knowledge of intermediate layers to accelerate convergence and improve performance, this invention proposes a multi-scale decoder distillation module. This module innovatively incorporates the Encoder output and all Decoder layer outputs into the distillation framework, constructing a complete knowledge transfer chain from feature encoding to layer-by-layer decoding.

[0131] The layered weighting strategy assigns low weights to the output of shallow decoders, medium weights to intermediate layers, and the highest weight of 1.0 to the final output layer, which is adapted to the inference characteristics of Transformer's layer-by-layer refinement.

[0132] Shallow features are relatively coarse and are given low weights as auxiliary supervision, mainly guiding the learning of basic features;

[0133] The intermediate layer features are gradually refined and given moderate weights to help the student model establish the correct reasoning trajectory.

[0134] The final output layer features are the most accurate, and are assigned the highest weight of 1.0 as the main supervision signal;

[0135] This progressive weighting not only ensures high accuracy of the final output, but also significantly improves training stability and convergence speed by utilizing the auxiliary supervision of intermediate layers.

[0136] Nonlinear confidence weighting dynamically adjusts the loss weights based on the nonlinear transformation of the teacher model's maximum class confidence. Prediction weights are reduced for low confidence and strengthened for high confidence, suppressing noise interference. The loss is weighted using the teacher model's maximum class confidence and its nonlinear transformation power(x).

[0137]

[0138] in, This is a non-linear weighting function based on the maximum class confidence of the teacher model; the input x is the maximum class confidence of the teacher model for a certain prediction, 0≤x≤1, used to judge the reliability of the prediction; when x<0.5, it is a low confidence, and the prediction is likely to be a background or difficult-to-distinguish noise sample. Decaying weights reduces the interference of invalid samples on model training and avoids gradient oscillations; when x > 0.5, it indicates high confidence, suggesting a high probability of predicting a specific target. By increasing the weights, the model is forced to prioritize fitting high-quality target features, thereby improving detection accuracy.

[0139] This design cleverly modulates the gradient contribution: for low-confidence predictions, typically background or hard-to-distinguish samples, the gradient contribution is adjusted accordingly. Decrease its weights to reduce ineffective oscillations in the model due to noise; for high-confidence predictions (with clear targets), by... By increasing the weights, the model is forced to quickly fit high-quality targets. This dynamic weighting mechanism significantly improves the model's discriminative power and robustness in complex scenarios, achieving a dual optimization of efficiency and effectiveness.

[0140] A three-way loss co-optimization strategy was adopted to improve distillation performance. The total loss function of the three-way loss co-optimization strategy is defined as:

[0141]

[0142] in, For L1 bounding box loss; For GIoU bounding box loss; For classification cross-entropy loss;

[0143] The other loss functions are as follows:

[0144]

[0145] in, The number of real targets is used to normalize the loss and prevent the number of samples from affecting the optimization direction. The weight of the bounding box regression loss is increased to prioritize positioning accuracy; To assign hierarchical weights, adapting the feature importance of different decoder layers; The Sigmoid transformation of the maximum class confidence in this layer of the teacher model is used to dynamically enhance the localization constraint of high-confidence targets; The coordinates of the target bounding box predicted by the student model in the l-th layer decoder; The coordinates of the target bounding box output by the teacher model at the l-th layer decoder;

[0146]

[0147] in, This is the loss coefficient, used to balance the weight of positioning loss with other losses; The generalized intersection-union ratio of the bounding boxes of the student and teacher models is optimized by considering both the overlapping region and the bounding box area. It is a nonlinear confidence weighting function that enhances the weight of high-confidence targets and attenuates the weight of low-confidence noise, thus focusing on effective targets;

[0148]

[0149] in, The number of query vectors for the decoder is adapted to the query mechanism of the Transformer detector; To balance the ratio of query vectors to actual targets and avoid class imbalance;

[0150] In each distillation layer, the formula contains, For L1 bounding box loss; For GIoU bounding box loss; For classification cross-entropy loss; To convert the class scores of the teacher model into confidence scores in the 0-1 range, cross-entropy calculation is adapted. This is a binary cross-entropy function that measures the difference in class confidence between students and teachers in the model.

[0151] In each distillation layer, the method simultaneously calculates the L1 bounding box loss, GIoU bounding box loss, and classification cross-entropy loss, and uses the maximum class confidence of the teacher model. The loss is weighted by its nonlinear transformation. Predictions with high confidence from teachers receive a larger weight, while predictions with low confidence (potentially background or noise) are weighted less, thus achieving an adaptive distillation effect of "focusing on the target and suppressing noise." Finally, the three losses are accumulated at all levels according to their weights to form a unified multi-task, multi-level distillation objective function.

[0152] Example 2:

[0153] See Figure 1 A knowledge distillation-based object detection method for complex scenes includes at least the following steps:

[0154] S1: Preprocess the original images in the object detection dataset;

[0155] S2: Divide the preprocessed dataset into a training set, a test set, and a validation set;

[0156] S3: Based on Example 1, a complex scene target detection model based on knowledge distillation is built. The complex scene target detection model based on knowledge distillation includes a teacher model, a student model, a dynamic mutual teaching distillation module, a multi-scale generator, and a multi-scale decoder distillation module.

[0157] S4: Select the preset teacher model and load the pre-trained parameters;

[0158] S5: The training set is used to train the object detection model for complex scenes based on knowledge distillation. The dynamic mutual teaching distillation module realizes bidirectional knowledge transfer and foreground region focusing between the teacher model and the student model. The multi-scale generator realizes feature alignment between heterogeneous models. The multi-decoder logic distillation module constructs a full-link supervision link. During the training process, the model parameters are adjusted in combination with the validation set. After the training is completed, the model performance is verified using the test set to obtain the object detection student model.

[0159] The specific preprocessing steps in S1 are as follows: all images in the original image are uniformly processed, those images with excessive noise are removed, and each image is cropped to a size of 640×640.

[0160] The specific method for splitting the dataset in S2 is as follows: the original dataset is re-divided into three parts: training set, test set and validation set, according to the ratio of 7:1:2.

[0161] The concept and specific content of the knowledge distillation network architecture designed in S3 for small target detection in complex scenes are as follows: In the feature distillation stage, this invention designs a new dynamic mutual teaching distillation to improve the effect and efficiency of feature distillation. A new multi-scale decoder distillation is also proposed, which is compatible with the RT-DETR decoder structure in the Logits distillation stage and can distill the outputs of multiple decoders.

[0162] The specific content of selecting the teacher model to be used in S4 is as follows: This invention selects RT-DETR-r50 as the teacher network.

[0163] The calculation principle of the measurement and evaluation indicators involved in S5 is as follows: The evaluation indicators used in this invention include precision, recall, mean accuracy (AP), number of model parameters (Params), and number of floating-point operations (GFLOPs). At the same time, in order to compare the various indicators of the models more fairly, this invention converts the mAP of all models to the mAP under the COCO index. In order to better compare the detection ability of the models for small targets, this invention introduces AP-s from the COCO index to evaluate the accuracy of small targets.

[0164]

[0165]

[0166]

[0167] Model parameter count (Params): This is typically used to evaluate model complexity. A higher parameter count may mean the model has stronger representational power and can better adapt to the training data, but it may also increase the risk of overfitting. Conversely, a lower parameter count may result in an insufficiently representative model that struggles to capture complex relationships in the data.

[0168] Floating-point operations (GFLOPs): This measures the total number of floating-point operations performed by a model during inference or training. It is one of the metrics for calculating the computational complexity of a model and is used to evaluate the model's computational resource requirements and efficiency.

[0169] Small object detection accuracy (AP-s): This measures the average detection accuracy of the model for small objects. It is calculated as the average detection accuracy for all IoU thresholds between 0.5 and 0.95, with a step size of 0.05, assuming the area of ​​the detection box is less than 32 square pixels.

[0170] In the above formulas: TP is the number of correctly identified positive samples; TN is the number of correctly identified negative samples; FP is the number of negative samples that were incorrectly identified as positive samples; and FN is the number of positive samples that were incorrectly identified as negative samples.

[0171] Based on the two embodiments above, a specific experimental procedure is proposed:

[0172] This invention takes detection accuracy as an example. Three publicly recognized datasets are used to verify the effectiveness of the proposed method. Dataset A, after preprocessing, has 3648 images used for training, 518 for validation, and 1024 for testing. Dataset B, after preprocessing, has 6471 images used for training, 548 for validation, and 1610 for testing. Dataset C, after preprocessing, has 9812 images used for training, 1402 for validation, and 2804 for testing. The following metrics are used to evaluate the performance of the testing method: Precision, Recall, Mean Average Precision (mAP), Small Object Detection Precision (AP-s), Number of Model Parameters (Params), and Number of Floating-Point Operations (GFLOPs).

[0173] The method proposed in this invention is compared with several excellent detection methods. The detection accuracy on dataset A is shown in Table 1, the detection accuracy on dataset B is shown in Table 2, and the detection accuracy on dataset C is shown in Table 3. The visualization comparison results are as follows: Figure 5 The strong generalization ability and robustness of the proposed method were demonstrated by the detection results of three datasets. All experiments show that the proposed method has the best measurement performance among all methods, while also having a fast measurement speed and meeting the requirements of lightweight design.

[0174] Table 1 shows the comparison results on dataset A (the best result for each metric is shown in bold).

[0175]

[0176] Table 2 shows the comparison results on dataset B (best results for each metric are shown in bold).

[0177]

[0178] Table 3 shows the comparison results on dataset C (the best result for each metric is shown in bold).

[0179]

[0180] In summary:

[0181] This invention reconstructs the distillation paradigm through innovation in three dimensions, and has significant advantages and positive effects.

[0182] First, in terms of model lightweighting and running efficiency, the number of student model parameters obtained by distillation in this invention is only 9.7M, which greatly reduces the computing cost while ensuring high performance, achieving a dual breakthrough in performance and efficiency.

[0183] Secondly, in terms of detection accuracy, especially small target detection, this invention achieved the best detection performance on the SEU-PML, VisDrone2019 and AI-TOD datasets, with accuracies of 72.5%, 36.5% and 36.1%, respectively. The small target detection accuracy AP-s is significantly better than the YOLO series and the existing Transformer series detection models, proving the effectiveness of the model in handling high-resolution features and small targets.

[0184] Furthermore, regarding robustness in complex environments, thanks to the pixel importance masking mechanism in dynamic mutual teaching distillation, the model can automatically suppress attention to low-value background areas. Qualitative analysis shows that the model still maintains keen perception in low-light, severely occluded, and high-density scenes, with an extremely low false negative rate.

[0185] Finally, the multi-scale generator proposed in this invention effectively solves the problem of feature alignment in heterogeneous models, while the multi-decoder logic distillation effectively alleviates the feature confusion problem between dense targets through the supervision signal of the whole link, significantly improving the stability and convergence speed of training.

[0186] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.

Claims

1. A complex scene target detection model based on knowledge distillation, characterized by: This includes a teacher model, a student model, a dynamic interactive teaching distillation module, a multi-scale generator, and a multi-scale decoder distillation module; The teacher model selected is RT-DETR-r50. The student model adopts a backbone network based on fast Fourier transform, which reduces the number of parameters and enhances feature extraction capabilities by utilizing spectral characteristics, thus adapting to the small target detection needs in complex scenarios. The dynamic mutual teaching distillation module is used to perform dynamic mutual teaching distillation on the features generated by the teacher model and the student model. The dynamic mutual teaching distillation module includes a performance-aware dynamic stage switching mechanism, composite weight calculation, an adaptive masking strategy based on pixel importance and hierarchical depth, and a loss function. The multi-scale generator is used to address the feature alignment challenge of heterogeneous models by employing a differentiated convolution strategy; The multi-scale decoder distillation module is used to incorporate the encoder output and the output of all decoder layers into the distillation framework to construct a complete supervision link. The multi-scale decoder distillation module includes a hierarchical weighting strategy, a nonlinear confidence weighting mechanism, and a strategy for collaborative optimization of three-way losses.

2. The complex scene target detection model based on knowledge distillation according to claim 1, characterized in that: The performance-aware dynamic stage switching mechanism of the dynamic mutual teaching distillation module aims to adaptively adjust the direction of knowledge transfer according to the training process, thereby maximizing distillation benefits. The performance-aware dynamic stage switching mechanism adaptively switches between the forward distillation stage and the mutual teaching distillation stage based on the performance differences between the training rounds and the teacher and student models. The forward distillation stage: in In the early stages of training or When the student model has weak performance, it urgently needs guidance on basic knowledge. The standard teacher-to-student one-way distillation is adopted to ensure that the student model can converge quickly and build basic feature expression capabilities. The mutual teaching distillation phase occurs when training enters the later stages and the performance of both methods is similar. and At this time, the mutual teaching mode is activated, and the teacher model is allowed to be fine-tuned based on the features of the student feedback. This two-way interaction mechanism can stimulate the co-evolution between models, explore potential feature differences, and thus significantly improve the final detection effect. in, This is the current training round; A preset training round threshold is used to ensure that the model performs basic learning in the early stages of training; This represents the average accuracy of the student model on the current evaluation set, used to measure its object detection performance. This represents the average accuracy of the teacher model on the current evaluation set. The ratio of student-teacher model performance is the ratio of student-teacher performance to teacher performance. The closer the ratio is to 1, the closer the student's performance is to the teacher's performance. When the performance of the student model is much lower than that of the teacher model, that is During the forward distillation phase, the teacher model provides one-way guidance to the student model. This is the upper limit threshold for the performance ratio; when student performance is good enough, i.e., the ratio reaches or exceeds [a certain threshold]. At this point, the mutual teaching distillation stage begins.

3. The complex scene target detection model based on knowledge distillation according to claim 2, characterized in that: The composite weight calculation for the dynamic mutual teaching distillation module is as follows: in: For the layer index of the neural network; For the first The pixel-level composite importance weight map corresponding to the layer feature map, the larger the value, the more important the pixel position; For the first Semantic importance weight graph of layers, semantic weights Based on channel activation intensity calculation, capture the main area of ​​the object; For the first The importance weight map of the layer's location is used to calculate the gradient edge response using the Sobel operator, aiming to enhance the perception of object boundaries; These are the weight coefficients for semantic weights; The weight coefficients are used to determine the positioning weights.

4. The complex scene target detection model based on knowledge distillation according to claim 3, characterized in that: The adaptive masking strategy of the dynamic mutual teaching distillation module based on pixel importance and hierarchical depth includes at least the following steps: mask The generation is no longer completely random, but rather related to pixel importance weights. Negative correlation, its formula is defined as: in, For the first The layer is a binary mask image to be generated, where 0 indicates masking and 1 indicates preservation; For the mask image in the 1st Layer, spatial location The value at; For the composite weighted graph at position The value at the location; rand For a position A random number generated independently and uniformly distributed in [0,1); For the first The base mask rate of a layer is an increasing function related to the network depth; Furthermore, considering that feature maps at different levels have different redundancies, an incremental mask rate was designed. , The formula for calculating the incremental mask rate is: in, The initial mask rate for the shallowest layer; This represents the increment of the mask rate as the number of layers increases.

5. The complex scene target detection model based on knowledge distillation according to claim 4, characterized in that: The loss function of the dynamic mutual teaching distillation module is divided into a positive phase and a mutual teaching phase. In the positive iteration phase, the loss function optimizes by minimizing the difference between student and pseudo-teacher features. In the peer-teaching phase, an additional back-distillation loss is introduced into the loss function, enabling the teacher model to adaptively adjust: in, For the first Forward distillation loss of the layer; For the first Back-distillation loss of the layer; Student Model No. The output feature map of the layer; Teacher Model No. The output feature map of the layer; These are adaptive masks applied to the student feature map and the teacher feature map, respectively; An adapter function that allows selection, used to align the number of feature channels for students or teachers for loss calculation; This indicates element-wise multiplication; These are the normalization coefficients; These are the weighting coefficients that control the intensity of forward and reverse losses, respectively.

6. The complex scene target detection model based on knowledge distillation according to claim 1, characterized in that: The multi-scale generator includes high-resolution layers and low-resolution layers; The high-resolution layer corresponds to detail enhancement. To take advantage of the high-resolution layer's rich spatial detail, ordinary convolution is used as the generator. The low-resolution layer corresponds to semantic extension. To address the characteristic that this low-resolution layer needs to capture long-distance dependencies and global context, dilated convolution is used.

7. The complex scene target detection model based on knowledge distillation according to claim 1, characterized in that: The layered weighting strategy assigns low weights to the output of shallow decoders, medium weights to intermediate layers, and the highest weight of 1.0 to the final output layer, adapting to the inference characteristics of Transformer's layer-by-layer refinement. Shallow features are relatively coarse and are given low weights as auxiliary supervision, mainly guiding the learning of basic features; The intermediate layer features are gradually refined and given moderate weights to help the student model establish the correct reasoning trajectory. The final output layer features are the most accurate and are assigned the highest weight of 1.0 as the main supervision signal.

8. The complex scene target detection model based on knowledge distillation according to claim 7, characterized in that: The nonlinear confidence weighting is a dynamic adjustment of the loss weights based on the nonlinear transformation of the teacher model's maximum class confidence. Low-confidence prediction weights are weakened, while high-confidence prediction weights are strengthened to suppress noise interference. The loss is weighted using the teacher model's maximum class confidence and its nonlinear transformation power(x). in, This is a non-linear weighting function based on the maximum class confidence of the teacher model; the input x is the maximum class confidence of the teacher model for a certain prediction, 0≤x≤1, used to judge the reliability of the prediction; when x<0.5, it is a low confidence, and the prediction is likely to be a background or difficult-to-distinguish noise sample. Decaying weights reduces the interference of invalid samples on model training and avoids gradient oscillations; when x > 0.5, it indicates high confidence, suggesting a high probability of predicting a specific target. By increasing the weights, the model is forced to prioritize fitting high-quality target features, thereby improving detection accuracy.

9. The complex scene target detection model based on knowledge distillation according to claim 8, characterized in that: The three-way loss collaborative optimization strategy is used to improve distillation performance, and the total loss function of the three-way loss collaborative optimization strategy is defined as: in, For L1 bounding box loss; For GIoU bounding box loss; For classification cross-entropy loss; The other loss functions are as follows: in, The number of real targets is used to normalize the loss and prevent the number of samples from affecting the optimization direction. The weight of the bounding box regression loss is increased to prioritize positioning accuracy; To assign hierarchical weights, adapting the feature importance of different decoder layers; The Sigmoid transformation of the maximum class confidence in this layer of the teacher model is used to dynamically enhance the localization constraint of high-confidence targets; The coordinates of the target bounding box predicted by the student model in the l-th layer decoder; The coordinates of the target bounding box output by the teacher model at the l-th layer decoder; in, This is the loss coefficient, used to balance the weight of positioning loss with other losses; The generalized intersection-union ratio of the bounding boxes of the student and teacher models is optimized by considering both the overlapping region and the bounding box area. It is a nonlinear confidence weighting function that enhances the weight of high-confidence targets and attenuates the weight of low-confidence noise, thus focusing on effective targets; in, The number of query vectors for the decoder is adapted to the query mechanism of the Transformer detector; To balance the ratio of query vectors to actual targets and avoid class imbalance; In each distillation layer, the formula contains, For L1 bounding box loss; For GIoU bounding box loss; For classification cross-entropy loss; To convert the class scores of the teacher model into confidence scores in the 0-1 range, cross-entropy calculation is adapted. This is a binary cross-entropy function that measures the difference in confidence between the student and teacher model categories.

10. A method for target detection in complex scenes based on knowledge distillation, characterized in that: At least the following steps are included: S1: Preprocess the original images in the object detection dataset; S2: Divide the preprocessed dataset into a training set, a test set, and a validation set; S3: Construct a complex scene target detection model based on knowledge distillation as described in any one of claims 1-9, wherein the complex scene target detection model based on knowledge distillation includes a teacher model, a student model, a dynamic mutual teaching distillation module, a multi-scale generator, and a multi-scale decoder distillation module. S4: Select the preset teacher model and load the pre-trained parameters; S5: The training set is used to train the complex scene target detection model based on knowledge distillation. The dynamic mutual teaching distillation module realizes bidirectional knowledge transfer and foreground region focusing between the teacher model and the student model. The multi-scale generator realizes feature alignment between heterogeneous models. The multi-decoder logic distillation module constructs a full-link supervision link. During the training process, the model parameters are adjusted in combination with the validation set. After the training is completed, the model performance is verified using the test set to obtain the target detection student model.