Lightweight target detection method based on multi-scale edge enhancement and knowledge distillation

By employing a multi-scale edge enhancement module and a channel-based knowledge distillation mechanism, the problem of balancing multi-scale target detection and model efficiency and accuracy in remote sensing image target detection is solved, achieving efficient and lightweight remote sensing target detection that is suitable for resource-constrained remote sensing platforms.

CN121883809APending Publication Date: 2026-04-17CHINA ACADEMY OF SPACE TECHNOLOGY
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA ACADEMY OF SPACE TECHNOLOGY
Filing Date
2025-12-26
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Remote sensing image target detection faces challenges in multi-scale target detection and the balance between model efficiency and accuracy. Existing methods fail to adequately consider the edge and geometric structure information of remote sensing targets, resulting in poor performance in small target detection and increased model parameters and computational load, making it difficult to meet the actual deployment needs of resource-constrained environments.

Method used

A multi-scale edge enhancement module is adopted to strengthen target contour perception. Combined with channel-based knowledge distillation and adversarial knowledge distillation mechanisms, feature extraction and semantic transfer are performed through an improved YOLOv5n model to achieve lightweight target detection.

Benefits of technology

Achieving high-precision and high-efficiency target detection in remote sensing images under resource-constrained environments enhances the model's ability to perceive multi-scale targets and complex backgrounds, maintains the integrity and robustness of feature representation, and meets practical deployment requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121883809A_ABST
    Figure CN121883809A_ABST
Patent Text Reader

Abstract

The invention relates to a lightweight target detection method based on multi-scale edge enhancement and knowledge distillation, and the method comprises the steps: introducing a multi-scale edge enhancement module into a lightweight target detection network, and explicitly strengthening the edge features and geometric structure information of a target; and the model can still keep a clear target contour under a low-resolution or complex background. A channel type knowledge distillation mechanism is adopted, semantic features and channel information of a teacher model are migrated to a student model, the problem that the semantic understanding ability of a lightweight network is insufficient is compensated, and therefore the balance of high precision and high efficiency is achieved on the premise that the significant calculation amount is not increased. The channel type knowledge distillation method is also combined with an adversarial training mechanism to form adversarial knowledge distillation. According to the mechanism, by introducing a lightweight feature discriminator, features generated by a student network cannot be distinguished from teacher network features on a distribution level, so that deeper and more robust semantic feature representation is learned, and the upper limit performance of the model is 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 security and remote sensing information processing technology, specifically to a lightweight target detection method based on multi-scale edge enhancement and knowledge distillation. Background Technology

[0002] Remote sensing image target detection, as a key technology for the cross-integration of geographic information science and artificial intelligence, is an important way to achieve intelligent Earth observation. In recent years, YOLO-based models have achieved remarkable results in the field of natural image processing. Through end-to-end training, they can automatically learn deep feature representations of targets and have been attempted to be applied to the field of remote sensing image analysis, showing application potential in areas such as national defense and security, urban planning, and environmental monitoring.

[0003] However, general detection models face significant challenges when transferred to remote sensing images. Multi-scale target detection is the primary challenge. Due to differences in imaging height, sensor resolution, and target physical size, the scale of targets in remote sensing images varies greatly, ranging from large buildings of tens of pixels to small vehicles of a few pixels. Traditional detectors with fixed receptive fields struggle to adapt to such extreme scale variations: when expanding the receptive field to capture global information of large targets, they lose detailed features of small targets; conversely, when focusing on local features of small targets, they cannot effectively understand the overall structure of large targets. Complex background interference further exacerbates this challenge. Texture features of unstructured backgrounds such as vegetation cover, water surfaces, and building shadows can easily be confused with real targets. In environments where multiple scale targets coexist, background noise severely interferes with the extraction of effective features, leading to a higher false alarm rate.

[0004] Furthermore, the balance between model efficiency and accuracy is particularly prominent in remote sensing applications. Remote sensing platforms such as satellites and drones have strict limitations on computing power and real-time requirements, while existing high-precision detection models often improve performance by increasing network depth or complexity, leading to a sharp increase in the number of parameters and computational load, making it difficult to meet practical deployment needs. Therefore, developing a detection method capable of handling multi-scale targets while maintaining efficient inference speed remains a research hotspot in this field.

[0005] Knowledge distillation, as a model compression and performance enhancement technique, has been applied to target detection tasks. Existing solutions attempt to improve the performance of lightweight models through different forms of distillation, such as multi-scale feature fusion, attention mechanisms, or improved loss functions. However, in the specific scenario of remote sensing image target detection, existing methods still have limitations. For example, some methods fail to fully consider the crucial role of remote sensing target edges and geometric structure information in multi-scale feature extraction, resulting in poor detection performance for small targets or targets with blurred edges against complex backgrounds. Other methods fail to effectively achieve robust transfer of deep semantic information at the channel level during knowledge distillation, making it difficult for student models to learn feature representations with strong discriminative power against background noise from teacher models, thus limiting the performance ceiling of lightweight models. Therefore, how to explicitly strengthen target edge features in lightweight model design and design more effective knowledge transfer mechanisms to achieve high-precision and high-efficiency remote sensing target detection in resource-constrained environments is a pressing technical problem. Summary of the Invention

[0006] In view of the above-mentioned technical problems, this invention proposes a lightweight target detection method based on multi-scale edge enhancement and knowledge distillation. It can enhance target contour perception by introducing a multi-scale edge enhancement module into a lightweight student network, and achieve robust semantic transfer by combining channel-based knowledge distillation with adversarial mechanisms. Thus, it can achieve high-precision and high-efficiency target detection in remote sensing images under resource-constrained environments.

[0007] The technical solution to the technical problem of this invention is: a lightweight target detection method based on multi-scale edge enhancement and knowledge distillation, comprising the following steps:

[0008] Step S1: Perform data preprocessing on the acquired remote sensing images;

[0009] Step S2: Use the improved YOLOv5n model to extract features from the preprocessed image. The improvement is to replace the core feature extraction module in the YOLOv5n model with a multi-scale edge enhancement module to strengthen the target edge and extract multi-scale features.

[0010] Step S3: Using the improved YOLOv5n model as the student network and the YOLOv5s model as the teacher network, introduce a channel-based knowledge distillation method to enable the student network to learn the channel-level semantic features of the teacher network.

[0011] Step S4: During the training phase, the student network is jointly optimized and trained using detection loss, distillation loss based on the channelized knowledge distillation, and adversarial loss, and the trained student network weights are saved.

[0012] Step S5: In the inference phase, remove the teacher network and branches related to knowledge distillation, and only load and run the trained student network weights to achieve lightweight target detection.

[0013] According to one technical solution of the present invention, the multi-scale edge enhancement module in step S2 processes the input feature map in the form of an edge enhancement stage, a spatial selection stage, and a local frequency domain selection stage.

[0014] According to one technical solution of the present invention, the edge enhancement stage specifically includes:

[0015] Step S211: Use multiple average pooling layers with different receptive field sizes to perform multi-scale smoothing on the input feature map to obtain low-frequency background information at each scale.

[0016] Step S212: Subtract the original input feature map from the smoothed feature maps at each scale to obtain the high-frequency edge information at the corresponding scale;

[0017] Step S213: Adaptively weighted fuse high-frequency edge information at different scales using learnable weights;

[0018] Step S214: After adjusting the fused edge information with a learnable scaling factor, add it to the original input feature map to obtain the edge-enhanced feature map.

[0019] According to a technical solution of the present invention, the spatial selection stage processes the edge-enhanced feature map, specifically including:

[0020] Step S221: Extract features in parallel through the first baseline branch, the second expanded receptive field branch, and the third global attention branch;

[0021] Step S222: Guided by the channel attention map generated by the third global attention branch, the features extracted by the second expanded receptive field branch are modulated element by element to screen key features;

[0022] Step S223: Add the modulated features and the features extracted by the first reference branch through residual connection to obtain the spatially selected feature map.

[0023] According to one technical solution of the present invention, the local frequency domain selection stage processes the spatially selected feature map, specifically including:

[0024] Step S231: Calculate the local average value of the input feature map as the low-frequency baseline;

[0025] Step S232: Calculate the difference between the input feature map and the local average value, and multiply the difference element-wise with the input feature map to extract high-frequency detail information;

[0026] Step S233: Using two sets of learnable scaling parameters, the original feature path and the high-frequency detail path are weighted and fused respectively to obtain the final output feature map after local frequency domain selection; wherein, the scaling parameter used for the high-frequency detail path is initialized to 0, and the scaling parameter used for the original feature path is initialized to 1.

[0027] According to one technical solution of the present invention, the channel-based knowledge distillation method in step S3 specifically includes:

[0028] Step S311: For each channel feature map of the corresponding layer of the teacher network and student network, perform Softmax normalization along the spatial dimension to convert it into a probability distribution within the channel;

[0029] Step S312: Use asymmetric KL divergence to measure the difference in probability distribution between the teacher network and the student network in each channel. The asymmetric KL divergence only applies constraints in the region where the teacher network has high activation values.

[0030] Step S313: Minimize the asymmetric KL divergence to guide the student network to focus on the key semantic regions in each channel.

[0031] According to one technical solution of the present invention, the channel-based knowledge distillation method further includes an adversarial knowledge distillation mechanism:

[0032] Step S321: Introduce a feature discriminator to determine whether the input feature map originates from the teacher network or the student network;

[0033] Step S322: Optimize the student network to minimize the detection loss and the asymmetric KL divergence loss while maximizing the discrimination error rate of the feature discriminator, so that the feature map distribution of the student network approximates the feature map distribution of the teacher network.

[0034] According to one technical solution of the present invention, the joint optimization training in step S4 specifically includes:

[0035] The detection loss is used to optimize target localization and classification tasks;

[0036] The distillation loss is a channel knowledge distillation loss based on asymmetric KL divergence;

[0037] The adversarial loss is used to optimize the feature discriminator so that it can accurately distinguish the source of the feature;

[0038] The detection loss, distillation loss, and adversarial loss are weighted and summed to obtain the total loss function, which is used to guide the training of the student network. The total loss function is:

[0039] ;

[0040] in, For target detection loss, For distillation loss, To combat the losses, , The weighting coefficients of the two losses are used to balance the relative importance of different loss terms in the overall optimization objective.

[0041] According to one technical solution of the present invention, the data preprocessing in step S1 includes: adjusting the remote sensing image to a uniform size, performing standardization processing, and performing data augmentation operations including Mosaic, random rotation, scaling and flipping.

[0042] According to one technical solution of the present invention, step S5 specifically comprises:

[0043] During model deployment, only the trained YOLOv5n student network weights, which integrate the multi-scale edge enhancement module, are loaded and initialized for forward inference.

[0044] Compared with the prior art, the present invention has the following beneficial effects:

[0045] This invention presents a lightweight target detection method based on multi-scale edge enhancement and knowledge distillation. By introducing a multi-scale edge enhancement module and a channel-based knowledge distillation mechanism, it addresses both the structural feature preservation and semantic information transfer issues in remote sensing image target detection, effectively improving the overall performance of the lightweight detection model.

[0046] The edge enhancement module significantly improves the model's ability to perceive multi-scale targets and complex backgrounds, ensuring the integrity of feature representation; the channel-based knowledge distillation mechanism enables efficient transfer of semantic layer features, allowing the student model to maintain a small number of parameters and fast inference speed while possessing recognition capabilities close to those of the teacher model.

[0047] Furthermore, by introducing an adversarial knowledge distillation mechanism, the student model not only learns the explicit semantic information of the teacher model, but also imitates its deep expression at the feature distribution level, thereby obtaining more discriminative and robust feature representations, and exhibiting better generalization ability and detection accuracy in extremely complex scenarios.

[0048] The method of this invention has a simple structure, high computational efficiency, and excellent detection accuracy, meeting the lightweight requirements of practical deployment and improving the detection capability of the model in practical applications. Attached Figure Description

[0049] Figure 1 The flowchart illustrates a lightweight target detection method based on multi-scale edge enhancement and knowledge distillation according to an embodiment of the present invention.

[0050] Figure 2 This schematic diagram illustrates the structure of a multi-scale edge enhancement module according to one embodiment of the present invention.

[0051] Figure 3 This schematic diagram illustrates the structure of a teacher-student joint distillation detection network according to one embodiment of the present invention.

[0052] Figure 4 A schematic diagram illustrating a channel-type knowledge distillation mechanism according to one embodiment of the present invention;

[0053] Figure 5 The schematic diagram illustrates the structure of a feature discriminator according to one embodiment of the present invention. Detailed Implementation

[0054] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the accompanying drawings used in the embodiments will be briefly described below. Obviously, the drawings described below are merely some embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings without any creative effort.

[0055] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments. The embodiments cannot be described in detail here, but the embodiments of the present invention are not limited to the following embodiments.

[0056] This invention presents a lightweight object detection method based on multi-scale edge enhancement and knowledge distillation. By introducing a multi-scale edge enhancement module into the lightweight object detection network, the edge features and geometric structure information of the target are explicitly strengthened, enabling the model to maintain a clear target outline even in low-resolution or complex backgrounds. Simultaneously, a channel-based knowledge distillation mechanism is employed to transfer the semantic features and channel information of the teacher model to the student model, compensating for the insufficient semantic understanding ability of the lightweight network. This achieves a balance between high accuracy and high efficiency without significantly increasing computational cost. As a further optimization of this invention, the channel-based knowledge distillation method is combined with an adversarial training mechanism to form adversarial knowledge distillation. This mechanism introduces a lightweight feature discriminator, forcing the features generated by the student network to be indistinguishable from those of the teacher network at the distribution level, thereby learning deeper and more robust semantic feature representations and further improving the upper limit performance of the lightweight model.

[0057] like Figure 1 and Figure 5 As shown, specifically, a lightweight target detection method based on multi-scale edge enhancement and knowledge distillation according to the present invention includes the following steps:

[0058] Step S1: Perform data preprocessing on the acquired remote sensing images;

[0059] Step S2: Use the improved YOLOv5n model to extract features from the preprocessed image. The improvement is to replace the core feature extraction module in the YOLOv5n model with a multi-scale edge enhancement module to strengthen the target edge and extract multi-scale features.

[0060] Step S3: Using the improved YOLOv5n model as the student network and the YOLOv5s model as the teacher network, introduce a channel-based knowledge distillation method to enable the student network to learn the channel-level semantic features of the teacher network.

[0061] Step S4: During the training phase, the student network is jointly optimized and trained using detection loss, distillation loss based on the channelized knowledge distillation, and adversarial loss, and the trained student network weights are saved.

[0062] Step S5: In the inference phase, remove the teacher network and branches related to knowledge distillation, and only load and run the trained student network weights to achieve lightweight target detection.

[0063] First, the original remote sensing images are standardized and enhanced preprocessed to improve data quality and model generalization ability. The core improvement lies in using YOLOv5n, which integrates a multi-scale edge enhancement module, as a lightweight student network. This module explicitly enhances the edge and structural features of the input image through multi-stage processing, effectively addressing the challenges of varying target scales and complex backgrounds in remote sensing images. To improve the performance ceiling of this lightweight network, channelized knowledge distillation with YOLOv5s as the teacher is introduced, aiming to transfer more robust and deeper channel semantic information from the teacher network to the student network. During training, by jointly optimizing the loss of the target detection task itself, the knowledge distillation loss, and the adversarial training loss, the student network not only masters detection capabilities but also approximates the teacher network's internal feature representation. After training, during the inference or deployment phase, the teacher model and distillation-related computations are completely decoupled, and only the lightweight student model is used for forward inference, thus meeting the efficiency and lightweight requirements of resource-constrained platforms while maintaining accuracy.

[0064] In some embodiments of the present invention, preferably, step S1 specifically involves performing data augmentation operations on the acquired remote sensing image, including a combination of various methods such as rotation, scaling, cropping, translation, flipping, color perturbation, noise addition, image blending, and perspective transformation, to simulate different imaging environments and enhance sample diversity, thereby improving the model's generalization ability.

[0065] In some embodiments of the present invention, the multi-scale edge enhancement module in step S2 processes the input feature map including an edge enhancement stage, a spatial selection stage, and a local frequency domain selection stage. The improved YOLOv5n model is used to extract multi-scale features from the processed image based on enhanced target edges, effectively suppressing background noise and better extracting target features. This improvement is mainly reflected in replacing the core feature extraction module of the original network with the multi-scale edge enhancement module proposed in this invention.

[0066] The edge enhancement stage is primarily responsible for extracting and fusing multi-scale high-frequency edge information from the original features, initially strengthening the target contour. The spatial selection stage, building on the previous stage, uses a parallel branching structure and attention-guided modulation to filter regions critical to the detection task from a spatial context perspective, suppressing background noise. The local frequency domain selection stage further calibrates the features from a frequency domain perspective, dynamically adjusting the contributions of low-frequency and high-frequency components to highlight texture details relevant to target discrimination. These three stages sequentially enhance and filter features from coarse to fine, and from spatial to frequency domains, collectively improving the network's ability to extract and discriminate multi-scale targets in remote sensing images, especially their edge and geometric structural features.

[0067] In some embodiments of the present invention, the edge enhancement stage specifically includes:

[0068] Step S211, Multi-scale low-frequency information extraction: Use multiple average pooling layers with different receptive field sizes to perform multi-scale smoothing on the input feature map to obtain low-frequency background information at each scale;

[0069] See Figure 2 Let the input feature map be... The feature map X is downsampled to multiple different scales using AdaptiveAvgPool2d. Using kernel size Average pooling layer pairs of 3×3, 5×5 and 7×7 respectively Perform a smoothing operation to extract low-frequency background information.

[0070] Step S212: Obtain high-frequency edge information: Subtract the original input feature map from the smoothed feature maps at each scale to obtain the high-frequency edge information at the corresponding scale. , is represented as: ;

[0071] By performing a difference operation, high-frequency residuals at the corresponding scale are extracted. These residuals mainly contain detailed information such as edges and textures at that scale.

[0072] Step S213, Adaptive weighted fusion: Adaptive weighted fusion of high-frequency edge information at different scales is performed using learnable weights;

[0073] Specifically, through a set of learnable weights (Generated via fully connected layers and Softmax), edge information at different scales is weighted and fused to obtain fused edge features. , is represented as:

[0074] ;

[0075] This allows the network to automatically determine the relative importance of edge information at each scale based on the input content.

[0076] Step S214, Feature Modulation and Residual Output: The fused edge information is modulated using learnable scaling factors. After adjustment, it is added to the original input feature map to obtain the edge-enhanced feature map. , is represented as:

[0077] .

[0078] By Initializing the feature maps to 0 during the initial training phase degenerates them into identity mappings, ensuring training stability. Simultaneously, the feature maps after multi-scale edge enhancement also need to be processed. The feature maps are then stitched together to obtain the stitched feature maps. .

[0079] The edge enhancement stage can strengthen the multi-scale edge information contained in the input feature map, making the network sensitive to the target contour in the early layers. This provides a feature base rich in edge details for subsequent spatial and frequency domain screening, which helps to improve the model's detection rate for small and blurry targets.

[0080] In some embodiments of the present invention, to further optimize the edge enhancement effect, a dual-domain filtering mechanism is introduced on the basis of edge enhancement. The spatial selection stage processes the feature map after edge enhancement, specifically including:

[0081] Step S221: Extract features in parallel through the first baseline branch, the second expanded receptive field branch, and the third global attention branch;

[0082] Step S222: Guided by the channel attention map generated by the third global attention branch, the features extracted by the second expanded receptive field branch are modulated element by element to screen key features;

[0083] Step S223: Add the modulated features and the features extracted by the first reference branch through residual connection to obtain the spatially selected feature map.

[0084] The spatial selection stage employs a three-way parallel branching process to handle the stitched feature maps. The first baseline branch uses a 3x3 depthwise separable convolution (DWConv). 3x3 The input is processed to preserve core local semantic information. The second branch, which expands the receptive field, employs sequential 5x5 and 7x7 depthwise separable convolutions (DWConv). 5x5 ,DWConv 7x7 The receptive field is gradually expanded to capture more macroscopic contextual information, which is important for understanding the overall structure and relational background of large targets. The third global attention branch first processes the concatenated feature maps. Channel pooling is performed to compress the spatial dimensions, and then a channel attention map is generated through a standard 3x3 convolution. This figure reflects the global spatial importance of the features of each channel.

[0085] Feature map after stitching Multi-branch feature extraction is as follows:

[0086] , , ,

[0087] ;

[0088] in, Indicates the kernel size as Depth-separable convolution, This represents a standard 3×3 convolution. This indicates a channel pooling operation.

[0089] Subsequently, modulation and fusion are performed:

[0090]

[0091] in, This indicates element-wise multiplication.

[0092] Finally, the modulated features With reference feature branch Add them together to get the space selection output:

[0093] .

[0094] For feature maps of different scales, convolution kernels of different sizes (3×3, 5×5, 7×7) are used for feature extraction to fully capture the edge features of targets of different sizes, so that the model can simultaneously focus on the overall shape of large targets and the local details of small targets.

[0095] The local frequency domain selection stage, based on spatial selection, performs fine-tuning of the features from a frequency domain perspective. In some embodiments of the present invention, the local frequency domain selection stage processes the spatially selected feature map, specifically including:

[0096] Step S231: Calculate the local average value of the input feature map as the low-frequency baseline;

[0097] Let the input feature map be For the input feature map Perform average pooling (AvgPool) to calculate the local mean map M of the input features, represented as: ;

[0098] Step S232: Calculate the difference between the input feature map and the local average value to extract high-frequency detail information;

[0099] By calculating the difference This yields local high-frequency detail components, and then the difference is multiplied element-wise with the input features to obtain... This process is equivalent to a local high-frequency filter, which can highlight details and textures such as edges and corners.

[0100] Step S233: Using two sets of learnable scaling parameters, the original feature path and the high-frequency detail path are weighted and fused respectively to obtain the final output feature map after local frequency domain selection; wherein, the scaling parameter used for the high-frequency detail path is initialized to 0, and the scaling parameter used for the original feature path is initialized to 1.

[0101] We use two learnable scaling factors, a and b, to perform a weighted fusion of the original path (low-frequency baseline path) and the high-frequency detail path: By initializing coefficient a to 1 and b to 0, the network's output can be made equal to its input in the early stages of training. This means it degenerates into an identity mapping, thus ensuring the stability of the gradient flow and preventing divergence during initial training due to drastic changes in features. During training, the network learns to dynamically adjust the values ​​of a and b, achieving adaptive frequency domain calibration of the features. For example, for regions requiring fine edge discrimination, the network may learn to increase the value of b to enhance high-frequency details; for smooth background regions, it may decrease the value of b to suppress noise.

[0102] In some embodiments of this invention, the improved YOLOv5n model is used as the student model, and YOLOv5s is used as the teacher model. A channel-based knowledge distillation method is introduced to improve detection accuracy through semantic information alignment at the channel level. See also Figure 3 A teacher-student joint distillation network was built, with YOLOv5s as the teacher network and YOLOv5n, which integrates the edge enhancement module, as the student network. Feature transfer and semantic guidance are achieved through channel-based knowledge distillation.

[0103] During the training phase, the teacher model infers from the input image, generating intermediate layer features and the final prediction results, which serve as a source of knowledge guidance.

[0104] During the feature distillation stage, the student model focuses on learning information in channels with high semantic contribution based on the channel weights of the teacher model, thereby achieving joint learning of structure and semantics.

[0105] In the output distillation stage, the class prediction and confidence information of the teacher model are transferred to the student model through soft label distillation, so that the student network gradually approaches the performance of the teacher model in classification and localization tasks.

[0106] Ultimately, a two-layer structure of feature layer distillation and output layer distillation is formed, enabling the student model to learn the deep semantic information of the teacher model, thereby enhancing the student's ability to learn edge structure features and achieving a balance between accuracy and lightweight design.

[0107] The channel-based knowledge distillation method in step S3 specifically includes:

[0108] Step S311: For each channel feature map of the corresponding layer of the teacher network and student network, perform Softmax normalization along the spatial dimension to convert it into a probability distribution within the channel;

[0109] See Figure 4 The specific execution process of channel-based knowledge distillation is as follows: First, channel probability distribution transformation is performed, that is, for each channel feature map of the corresponding layer of the teacher network and student network. Softmax normalization is performed along each spatial dimension to convert it into a probability distribution within the channel. , for:

[0110] ;

[0111] .

[0112] Step S312: Use asymmetric KL divergence to measure the difference in probability distribution between the teacher network and the student network in each channel. The asymmetric KL divergence only applies constraints in the region where the teacher network has high activation values.

[0113] The asymmetric KL divergence is expressed as:

[0114]

[0115] Where C represents the set of channels involved in distillation. The temperature coefficient controls the smoothness of the probability distribution. This loss enables the student network to focus on key semantic regions that mimic the judgments of the teacher network.

[0116] Step S313: Minimize the asymmetric KL divergence to guide the student network to focus on the key semantic regions in each channel.

[0117] By employing asymmetric KL divergence as the distillation loss, more accurate and efficient knowledge transfer is achieved. This helps avoid wasting student network capacity by imitating unimportant or noisy feature responses in the teacher network. Instead, it concentrates resources on learning semantic patterns that are crucial for task discrimination, thus achieving a semantic understanding capability that is closer to that of the teacher network within the limited capacity of the student network.

[0118] In some embodiments of the present invention, the channel-based knowledge distillation method further includes an adversarial knowledge distillation mechanism:

[0119] Step S321: Introduce a feature discriminator to determine whether the input feature map originates from the teacher network or the student network;

[0120] Step S322: Optimize the student network to minimize the detection loss and the asymmetric KL divergence loss while maximizing the discrimination error rate of the feature discriminator, so that the feature map distribution of the student network approximates the feature map distribution of the teacher network.

[0121] See Figure 5 The specific structure and data flow of the introduced feature discriminator D first involve receiving feature maps. ,go through One convolutional layer, Sizes are 1, 2, 3, and 4. Specifically:

[0122]

[0123]

[0124] in: This represents the convolution operation. and The first The weights and biases of the convolutional layers. For the first The activation function of the layer.

[0125] Global average pooling and classification: pooling the feature map of each channel into a scalar. Then we have:

[0126]

[0127]

[0128] in Output .

[0129] Finally, a two-dimensional probability vector is output. :

[0130]

[0131] in Indicates the first The probability that a sample is identified as "fake" (student). This represents the probability of being judged as "true" (teacher).

[0132] Discriminator loss calculation and optimization: This is used to force the features generated by the student model to be indistinguishable from those of the teacher model at the distribution level, thereby learning deeper and more robust representations. The discriminator's adversarial loss function. for:

[0133] ,

[0134] Where B represents the batch size. The first batch Teacher feature map, Indicates the first in the batch Student feature map, This represents the probability value of the "true" (teacher) label in the discriminator D's prediction output for feature map F.

[0135] The physical meaning of this loss function is: to maximize the discriminator's classification of teacher features as "true". And the student's characteristics were judged as "false". The sum of logarithmic probabilities.

[0136] According to one technical solution of the present invention, the joint optimization training in step S4 specifically includes:

[0137] The detection loss is used to optimize target localization and classification tasks;

[0138] The distillation loss is a channel knowledge distillation loss based on asymmetric KL divergence;

[0139] The adversarial loss is used to optimize the feature discriminator so that it can accurately distinguish the source of the feature;

[0140] The detection loss, the distillation loss, and the adversarial loss are weighted and summed to obtain the total loss function, which is used to guide the training of the student network.

[0141] Detection loss The loss function of YOLOv5n is adopted, where the detection loss of the object detection stream consists of three components: a loss that helps the network learn to locate the object's position. To help networks learn to adjust the size of objects Loss that helps the network learn to recognize object categories The loss used to evaluate the prediction is:

[0142]

[0143] Where l represents The number of layers output in the middle. , and These are the weights of different layers of the three loss functions. , and Used to balance the effects of different loss terms.

[0144] The total loss function is:

[0145] ;

[0146] in, For target detection loss, For distillation loss, To combat the losses, , To balance the weighting coefficients of the two losses, by adjusting and It can control the balance between the model's basic detection performance, semantic alignment, and feature distribution mimicry.

[0147] The improved YOLOv5n model is jointly trained using detection loss and distillation loss, and the trained model weights are saved. Detection loss guides the student model to complete target localization, classification, and confidence prediction. Distillation loss consists of feature layer distillation loss and output layer distillation loss. Feature layer distillation constrains the intermediate layer features of the student model to maintain consistency with the teacher model, while output layer distillation optimizes the final prediction distribution of the student model. During training, the student model gradually learns the expressive characteristics of the teacher model under joint optimization, achieving a balance between semantic understanding and edge structure preservation. Adversarial loss maximizes the error rate of the feature discriminator, i.e., it allows the feature maps of the student network to "deceive" the discriminator. This forces the features generated by the student network to be indistinguishable from those of the teacher network at the distribution level, thereby learning deeper and more robust semantic feature representations and further improving the upper limit performance of the lightweight model. After training, the final optimized student model weights are saved for deployment during the inference phase.

[0148] In some embodiments of the present invention, step S5 specifically includes:

[0149] The inference phase loads pre-trained model weights, achieving lightweight design. During inference, the model only loads the trained student model weights; the teacher model and distillation-related modules are removed. The student model, learning teacher knowledge and edge enhancement features during training, can independently complete the detection task, achieving fast and efficient target recognition. This method significantly reduces computational and storage overhead during inference while maintaining high detection accuracy, thus meeting the lightweight requirements for practical deployment.

[0150] According to one aspect of the present invention, an electronic device is provided, comprising: one or more processors, one or more memories, and one or more computer programs; wherein the processor is connected to the memory, and the one or more computer programs are stored in the memory; when the electronic device is running, the processor executes the one or more computer programs stored in the memory to cause the electronic device to perform a lightweight target detection method based on multi-scale edge enhancement and knowledge distillation as described in any of the above technical solutions.

[0151] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.

[0152] The memory can be an internal storage unit of the terminal device, such as a hard drive or RAM. Alternatively, it can be an external storage device, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, the memory can include both internal and external storage units. The memory is used to store the computer program and other programs and data required by the terminal device. It can also be used to temporarily store data that has been output or will be output.

[0153] According to one aspect of the present invention, a computer-readable storage medium is provided for storing computer instructions, which, when executed by a processor, implement a lightweight target detection method based on multi-scale edge enhancement and knowledge distillation as described in any of the above technical solutions.

[0154] For example, computer-readable storage media can be read-only memory (ROM), random access memory (RAM), read-only optical disc (CD-ROM), magnetic tape, floppy disk, and optical data storage devices. They can be implemented using computer-executable program code, thus allowing them to be stored in a storage device for execution by a computing device, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Therefore, this invention is not limited to any particular hardware and software combination.

[0155] In summary, this invention proposes a lightweight target detection method based on multi-scale edge enhancement and knowledge distillation. By introducing a multi-scale edge enhancement module, the edge and geometric features of the target are explicitly strengthened within the lightweight network. This module extracts and filters key edge information from different scales and frequency domains through three stages: edge enhancement, spatial selection, and local frequency domain selection. This effectively suppresses noise interference from complex backgrounds in remote sensing images, improves the model's contour perception and discrimination capabilities for multi-scale targets (especially small targets and targets with blurred edges), and provides higher-quality feature representations for subsequent detection tasks.

[0156] This invention designs a channel-based knowledge distillation method incorporating an adversarial mechanism. By converting the channel feature maps of the teacher and student networks into probability distributions and using asymmetric KL divergence for constraint, the student network can focus on the key semantic regions determined by the teacher network, achieving more accurate channel-level knowledge transfer. The introduced adversarial training mechanism further forces the features generated by the student network to be difficult to distinguish from the features of the teacher network at the distribution level, thereby learning deeper and more robust semantic representations. This effectively compensates for the insufficient semantic understanding ability of the lightweight student network and improves its performance ceiling.

[0157] This invention employs a strategy of jointly optimizing detection loss, channel distillation loss, and adversarial loss during the training phase. This multi-task learning framework enables the model to optimize basic detection performance while simultaneously considering semantic alignment and feature distribution mimicry, achieving an effective balance between accuracy, lightweight design, and robustness. By adjusting the weight coefficients, the emphasis on different optimization objectives can be flexibly controlled.

[0158] This invention retains only a lightweight student network integrating a multi-scale edge enhancement module during the inference phase, completely removing the computationally intensive teacher network and distillation branches. This allows the method to maintain detection accuracy close to that of the teacher network while possessing the advantages of fewer parameters, faster inference speed, and lower memory consumption. It is highly suitable for deployment on remote sensing platforms with limited computing resources and energy consumption, such as satellites and drones, meeting the lightweight and real-time requirements of practical applications.

[0159] The method of this invention has a clear structure, high modularity, and is easy to implement and integrate. Both the multi-scale edge enhancement module and the channel-based knowledge distillation mechanism can be used as plug-and-play components, adaptable to other object detection frameworks based on convolutional neural networks, and possess good versatility and scalability.

[0160] Furthermore, it should be noted that the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code.

[0161] Embodiments of the present invention are described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0162] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable data processing terminal equipment to cause a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0163] It should also be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0164] Finally, it should be noted that the above description represents a preferred embodiment of the present invention. It should be pointed out that although preferred embodiments have been described, those skilled in the art, once they understand the basic inventive concept of the present invention, can make various improvements and modifications without departing from the principles described herein. These improvements and modifications should also be considered within the scope of protection of the present invention. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the embodiments of the present invention.

Claims

1. A lightweight target detection method based on multi-scale edge enhancement and knowledge distillation, characterized in that, Includes the following steps: Step S1: Perform data preprocessing on the acquired remote sensing images; Step S2: Use the improved YOLOv5n model to extract features from the preprocessed image. The improvement is to replace the core feature extraction module in the YOLOv5n model with a multi-scale edge enhancement module to strengthen the target edge and extract multi-scale features. Step S3: Using the improved YOLOv5n model as the student network and the YOLOv5s model as the teacher network, introduce a channel-based knowledge distillation method to enable the student network to learn the channel-level semantic features of the teacher network. Step S4: During the training phase, the student network is jointly optimized and trained using detection loss, distillation loss based on the channelized knowledge distillation, and adversarial loss, and the trained student network weights are saved. Step S5: In the inference phase, remove the teacher network and branches related to knowledge distillation, and only load and run the trained student network weights to achieve lightweight target detection.

2. The lightweight target detection method based on multi-scale edge enhancement and knowledge distillation according to claim 1, characterized in that, The multi-scale edge enhancement module in step S2 processes the initial input feature map through an edge enhancement stage, a spatial selection stage, and a local frequency domain selection stage.

3. The lightweight target detection method based on multi-scale edge enhancement and knowledge distillation according to claim 2, characterized in that, The edge enhancement stage specifically includes: Step S211: Use multiple average pooling layers with different receptive field sizes to perform multi-scale smoothing on the input feature map to obtain low-frequency background information at each scale. Step S212: Subtract the original input feature map from the smoothed feature maps at each scale to obtain the high-frequency edge information at the corresponding scale; Step S213: Adaptively weighted fuse high-frequency edge information at different scales using learnable weights; Step S214: After adjusting the fused edge information with a learnable scaling factor, add it to the original input feature map to obtain the edge-enhanced feature map.

4. The lightweight target detection method based on multi-scale edge enhancement and knowledge distillation according to claim 2, characterized in that, The spatial selection stage processes the edge-enhanced feature map, specifically including: Step S221: Extract features in parallel through the first baseline branch, the second expanded receptive field branch, and the third global attention branch; Step S222: Guided by the channel attention map generated by the third global attention branch, the features extracted by the second expanded receptive field branch are modulated element by element to screen key features; Step S223: Add the modulated features and the features extracted by the first reference branch through residual connection to obtain the spatially selected feature map.

5. The lightweight target detection method based on multi-scale edge enhancement and knowledge distillation according to claim 2, characterized in that, The local frequency domain selection stage processes the spatially selected feature map, specifically including: Step S231: Calculate the local average value of the input feature map as the low-frequency baseline; Step S232: Calculate the difference between the input feature map and the local average value, and multiply the difference element-wise with the input feature map to extract high-frequency detail information; Step S233: Using two sets of learnable scaling parameters, the original feature path and the high-frequency detail path are weighted and fused respectively to obtain the final output feature map after local frequency domain selection; wherein, the scaling parameter used for the high-frequency detail path is initialized to 0, and the scaling parameter used for the original feature path is initialized to 1.

6. The lightweight target detection method based on multi-scale edge enhancement and knowledge distillation according to claim 1, characterized in that, The channel-based knowledge distillation method in step S3 specifically includes: Step S311: For each channel feature map of the corresponding layer of the teacher network and student network, perform Softmax normalization along the spatial dimension to convert it into a probability distribution within the channel; Step S312: Use asymmetric KL divergence to measure the difference in probability distribution between the teacher network and the student network in each channel. The asymmetric KL divergence only applies constraints in the region where the teacher network has high activation values. Step S313: Minimize the asymmetric KL divergence to guide the student network to focus on the key semantic regions in each channel.

7. The lightweight target detection method based on multi-scale edge enhancement and knowledge distillation according to claim 6, characterized in that, The channel-based knowledge distillation method also includes an adversarial knowledge distillation mechanism: Step S321: Introduce a feature discriminator to determine whether the input feature map originates from the teacher network or the student network; Step S322: Optimize the student network to minimize the detection loss and the asymmetric KL divergence loss while maximizing the discrimination error rate of the feature discriminator, so that the feature map distribution of the student network approximates the feature map distribution of the teacher network.

8. The lightweight target detection method based on multi-scale edge enhancement and knowledge distillation according to claim 1, characterized in that, The joint optimization training in step S4 specifically involves: The detection loss is used to optimize target localization and classification tasks; The distillation loss is a channel knowledge distillation loss based on asymmetric KL divergence; The adversarial loss is used to optimize the feature discriminator so that it can accurately distinguish the source of the feature; The detection loss, distillation loss, and adversarial loss are weighted and summed to obtain the total loss function, which is used to guide the training of the student network. The total loss function is: ; in, For target detection loss, For distillation losses, To combat the losses, , The weighting coefficients of the two losses are used to balance the relative importance of different loss terms in the overall optimization objective.

9. The lightweight target detection method based on multi-scale edge enhancement and knowledge distillation according to claim 1, characterized in that, The data preprocessing in step S1 includes: adjusting the remote sensing image to a uniform size, performing standardization processing, and performing data augmentation operations including Mosaic, random rotation, scaling, and flipping.

10. The lightweight target detection method based on multi-scale edge enhancement and knowledge distillation according to claim 1, characterized in that, Step S5 specifically involves: During model deployment, only the trained YOLOv5n student network weights, which integrate the multi-scale edge enhancement module, are loaded and initialized for forward inference.