Lightweight target detection edge deployment method based on high-frequency detail enhancement

By introducing a direction-aware high-frequency sparse feature pyramid and a collaboratively optimized regression loss function, the problem of lightweighting and high-frequency modeling of YOLO-like models in edge deployment is solved. This achieves a balance between high recall for small defects and high accuracy for large targets, making it suitable for lightweight target detection in industrial edge devices.

CN121746687BActive Publication Date: 2026-07-28GUANGXI ZHUANG AUTONOMOUS REGION CONSTR ENG QUALITY INSPECTION CENT CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUANGXI ZHUANG AUTONOMOUS REGION CONSTR ENG QUALITY INSPECTION CENT CO LTD
Filing Date
2025-12-25
Publication Date
2026-07-28

AI Technical Summary

Technical Problem

Existing YOLO-like models face challenges in industrial edge deployment scenarios, including lightweight constraints, lack of explicit modeling of the high-frequency directional characteristics of small defects, and lack of coordinated optimization between the detection architecture and the regression loss function. These issues result in excessive inference latency, low signal-to-noise ratio, and difficulty in achieving optimal performance for both large and small target detection.

Method used

We employ the DHF_SFPN module of the direction-aware high-frequency sparse feature pyramid and the co-optimized regression loss function dhf loss, combined with depthwise separable convolution and sparse gating mechanism, to construct the DHF-YOLO model. This model explicitly models the directional high-frequency features of defects and dynamically adjusts the regression weights through the hierarchical perception loss function, thereby achieving lightweight target detection.

Benefits of technology

Under strict computational resource constraints, it achieves high recall rate detection of high-density micro-defects on weld surfaces, while ensuring that the detection accuracy of large-size defects does not decrease. The number of model parameters and computational complexity are significantly reduced, meeting the real-time requirements of industrial edge devices and possessing excellent engineering feasibility and portability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121746687B_ABST
    Figure CN121746687B_ABST
Patent Text Reader

Abstract

The application discloses a lightweight target detection edge deployment method based on high-frequency detail enhancement, and a convolutional neural network architecture for edge deployment, wherein the core lies in taking a deep learning target detection model as a carrier, constructing a direction perception high-frequency sparse feature pyramid (DHF_SFPN), utilizing four-direction Sobel-like convolution to enhance sub-10-pixel defect edges at a P2 layer, combining SparseHFRGate sparse gating to suppress a background, cooperating with hierarchical perception dhf-loss to optimize gradient imbalance, embedding the module and loss into YOLO11 to form DHF-YOLO. The model parameter quantity is 2.29M, GFLOPs is 11.8, the input of 640*640 on a Jetson Nano reaches 32FPS, mAP@50 is 71.4%, and APs is 53.9%, so that high-precision and low-overhead edge deployment is realized, and both high-recall of micro defects and precision of large targets are considered.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the technical fields of computer vision, deep learning, data science and engineering applications, and specifically relates to a lightweight target detection edge deployment method based on high-frequency detail enhancement. Background Technology

[0002] Weld quality is crucial for ensuring the structural integrity and service safety of major equipment such as aerospace, rail transportation, and pressure vessels. Tiny defects on the weld surface (such as porosity and spatter), though occupying only a tiny area in the image domain (typically less than 10×10 pixels), can easily induce localized stress concentrations and evolve into fatigue crack initiations during long-term service, posing a potential failure risk. Therefore, developing high-precision, robust automated visual inspection technology is of great engineering significance for achieving stable detection and accurate location of such sub-pixel-level micro-defects.

[0003] Currently, deep learning-based object detection methods have become the mainstream technical path for achieving the aforementioned high-reliability detection requirements. Among them, single-stage detectors, such as YOLO11, have shown promising application prospects in industrial scenarios due to their high inference efficiency. However, industrial field inspection systems are mostly deployed on embedded edge devices (such as inspection drones and high-definition industrial camera systems), which have limited computing power, memory, and power consumption resources. This requires the model to balance high accuracy and lightweight design—any "heavy model" solution that simply increases parameters / computation to improve performance is difficult to implement. Under this constraint, the existing YOLO architecture still faces three major systemic bottlenecks when detecting high-density, sub-10 pixel level tiny defects. First, it does not consider the lightweight constraints of edge deployment. While existing enhancement modules (such as CBAM and DySample) can locally improve feature representation capabilities, the additional parameters and dynamic computation paths they introduce (such as pixel-wise softmax and channel-space joint modeling) significantly increase the computational complexity and memory access pressure of the model. On typical edge devices, this can easily lead to inference latency exceeding the real-time threshold of industrial online detection, making it difficult to meet the frame rate constraints in continuous operation scenarios. Second, they do not model the high-frequency, directional nature of minute defects. Existing methods mostly rely on global statistical features (such as channel mean / variance) or isotropic filtering operations (such as Laplacian and standard convolution), lacking the ability to explicitly model the sensitivity of defect edge direction. They cannot distinguish between high-frequency components of defects with clear orientation (such as transverse porosity chains and diagonal cracks) and isotropic background noise (such as periodic textures of weld beads and spatter), resulting in low signal-to-noise ratio in the high-frequency enhancement process, which can easily lead to false detections or feature diffusion. Third, they do not coordinately optimize the detection architecture and loss function. Mainstream solutions typically improve the backbone network or detection head independently, neglecting the matching relationship between the hierarchical characteristics of the feature pyramid and the geometric prior of the regression target. General loss functions (such as CIoU and EIoU) adopt a uniform regression strategy for targets of different scales, without dynamically adjusting the width / height direction optimization weights according to the feature hierarchy, which exacerbates the jitter in the localization of small targets. At the same time, strengthening shallow feature pathways to improve the recall rate of small targets can easily weaken the high-level semantic discrimination ability, resulting in a decrease in the detection accuracy of large targets (such as weld beads and undercut), which violates the core requirement of "taking both large and small targets into account" in industrial inspection, and makes it difficult to achieve the synergistic optimization of high recall for small defects and high accuracy for large targets under limited edge resources. Summary of the Invention

[0004] In response to the three major systemic bottlenecks faced by YOLO-like models in the above-mentioned industrial edge deployment scenarios: (1) Existing enhancement modules ignore lightweight constraints, resulting in excessive inference latency; (2) Lack of explicit modeling of the high-frequency directional characteristics of small defects, resulting in low signal-to-noise ratio; (3) The detection architecture and regression loss function are not optimized in a coordinated manner, making it difficult to balance the detection performance of large and small targets. This invention proposes a lightweight target detection edge deployment method based on high-frequency detail enhancement. The purpose is to provide a high-precision, low-overhead target detection scheme suitable for general edge computing devices. Under strictly limited computing resources, it can achieve high recall of high-density small defects (such as dense pores, spatter, etc.) on the weld surface, while ensuring that the detection accuracy of large-sized defects such as surface depressions and cracks does not decrease, fundamentally breaking through the performance trade-off bottleneck between "small target missed detection suppression" and "model lightweighting".

[0005] To achieve the above objectives, the specific solution of the present invention is as follows:

[0006] A lightweight object detection edge deployment method based on high-frequency detail enhancement includes the following steps:

[0007] S1: Acquire high-resolution images of weld defects and perform preprocessing and dataset partitioning;

[0008] S2, use the "Labelme" tool to accurately label the defect areas in the high-definition weld defect images after preprocessing and dataset segmentation in step S1, and generate corresponding bounding box labels;

[0009] S3. Based on the characteristics of the collected weld defects, construct the direction-aware high-frequency sparse feature pyramid DHF_SFPN module.

[0010] S4. To address the gradient imbalance problem of the general IoU loss in dense small target scenarios, a regression loss function dhf loss is designed and co-optimized with the DHF-SFPN module.

[0011] S5. Integrate the DHF_SFPN module built in step S3 and the dhf loss designed in step S4 into YOLO11 to build a new architecture DHF-YOLO that supports end-to-end training.

[0012] S6. Perform ablation experiments and comparative verification on the DHF-YOLO proposed in step S5.

[0013] Furthermore, step S1 specifically includes:

[0014] S11. Use an industrial-grade high-definition camera to acquire high-definition images of the weld surface under controlled lighting conditions. The high-definition images include four types of defects: porosity, spatter, cracks, and dents, and the image resolution is not less than 1920×1080.

[0015] S12, perform nonlocal mean denoising, gray world white balance, proportional scaling to 640×640 pixels and fill with black pixels on the high-definition image in sequence to form a benchmark dataset, and divide the benchmark dataset into training set and validation set according to defect category.

[0016] Furthermore, step S2 specifically includes:

[0017] S21. Load the folder of images to be labeled using Labelme software;

[0018] S22, Use the polygon tool to select the defect area and assign a defect category label;

[0019] S23. Save the annotation results in JSON format, which includes the vertex coordinates of the defect polygon, category name, image path and image size information.

[0020] Furthermore, step S3 specifically includes:

[0021] S31 dynamically constructs horizontal convolution, upsampling, and cross-scale fusion sub-modules based on the number of channels and spatial resolution of the input feature map to adapt to the dynamic resolution of YOLO11;

[0022] S32, introduce the DirHFE module into the shallow feature map of P2. The DirHFE uses four sets of fixed-direction Sobel-like convolution kernels to enhance the high-frequency response of linear defects. The P3–P5 levels only use 1×1 convolution for channel alignment.

[0023] S33, construct a top-down semantic fusion path, and use bilinear or nearest neighbor upsampling combined with depthwise separable convolution to complete lightweight cross-scale mapping;

[0024] S34, construct a bottom-up refined path, use depthwise separable convolution downsampling with a stride of 2, and embed SparseHFRGate gating at each bottom-up fusion stage. The SparseHFRGate generates spatial-channel joint weights based on local high-frequency energy and channel importance, and only retains the top 20% of regions with the highest response intensity.

[0025] S35, after each bottom-up fusion, the DragonScaleRefine lightweight refinement module is connected. The DragonScaleRefine is composed of depth convolution, pointwise convolution, GroupNorm and SiLU activation in sequence to enhance local texture consistency.

[0026] S36, before the deep feature output of P4 and P5, the PhoenixGateRebirth channel calibration module is connected. The PhoenixGateRebirth generates channel attention weights through SE-style global pooling and nonlinear mapping to stabilize the semantic response of large-scale targets.

[0027] Furthermore, the design of the DirHFE module described in step S32 includes the following steps:

[0028] S321 predefines four groups of 3×3 normalized Sobel-like directional convolution kernels, corresponding to the 0°, 45°, 90°, and 135° directions respectively;

[0029] S322 extracts high-frequency responses in four directions through grouped convolution in parallel, and then fuses them through 1×1 convolution and superimposes them onto the P2 features using learnable channel scaling factor residuals to preserve low-frequency semantics and enhance linear defect edges.

[0030] Furthermore, the design of the SparseHFRGate module described in step S34 includes the following steps:

[0031] S341 uses a fixed Laplacian convolution kernel to extract local high-frequency energy of fine-grained features, and generates spatial gating weights after sign robustness by the tanh-abs function.

[0032] S342, the spatial gating weight is multiplied by the channel importance weight to obtain the spatial-channel joint weight, and only the top 20% of the positions with the highest response intensity of each channel are retained, while the rest are set to zero, in order to suppress background interference and improve the signal-to-noise ratio of small defects.

[0033] Furthermore, the design of the DragonScaleRefine lightweight refining module described in step S35 includes the following steps:

[0034] S351 executes 3×3 depthwise convolution and 1×1 pointwise convolution in sequence to achieve lightweight feature recombination;

[0035] S352 introduces a GroupNorm normalization layer with affine parameters after convolution, with the number of groups fixed at 4, and the scaling factor and offset initialized to 1 and 0 respectively.

[0036] S353, through the SiLU activation function, outputs refined features to enhance local texture consistency.

[0037] Furthermore, the construction of the PhoenixGateRebirth module described in step S36 includes the following steps:

[0038] S361 employs a lightweight SE structure: global average pooling → two 1×1 convolutional layers → SiLU activation → Sigmoid output, generating channel attention weights;

[0039] S362, the attention weights are multiplied back into the P4 / P5 feature maps channel by channel to adaptively enhance or suppress the semantic response of large-scale targets, thereby improving localization robustness and classification confidence.

[0040] Furthermore, step S4 specifically includes:

[0041] S41, based on WIoU v3 regression metric, introduces a center point distance normalization term to dynamically adjust the penalty weight, making the loss more sensitive to the positional shift of dense small defects;

[0042] S42, apply differentiated weights β according to the P2–P5 pyramid levels, with higher weights for shallower levels, to achieve level-aware weighting;

[0043] S43: When the maximum value of the bounding box coordinates exceeds 1.5, automatic global normalization is performed, and ε-truncation is applied to the normalized coordinates to prevent numerical anomalies.

[0044] S44 multiplies the weighted WIoU by the global scaling factor and outputs the final regression loss value.

[0045] Furthermore, step S5 specifically includes:

[0046] S51, replace the original YOLO11 Neck with DHF_SFPN, connect DirHFE to P2 layer, align channels with 1×1 convolution in P3–P5 layers, and deploy SparseHFRGate and DragonScaleRefine sequentially after each bottom-up fusion. PhoenixGateRebirth is superimposed before the output of P4 / P5, and the resulting multi-scale features are connected to the YOLO11 detection head.

[0047] S52, during the training phase, replaces the default bounding box regression loss with dhf-loss, selects the corresponding β factor weighting according to the hierarchical label, and together with the classification loss and confidence loss, constitutes the total loss function, driving end-to-end parameter optimization.

[0048] Furthermore, step S6 specifically includes:

[0049] S61, using mAP@50, mAP@50:95, APs, parameter quantity and GFLOPs as evaluation indicators, conducted four sets of ablation experiments to verify the independent and joint contributions of DHF_SFPN and dhf-loss to detection accuracy and lightweighting.

[0050] S62, under the same dataset and training strategy, DHF-YOLO is compared with YOLOv8, YOLO11 and their enhanced variants. DHF-YOLO achieves higher mAP@50 and APs with lower parameter count and GFLOPs, proving that it achieves the best balance between accuracy and edge deployment efficiency.

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

[0052] 1. Ultra-lightweight Neural Network Design for Edge Hardware: The proposed DHF_SFPN module employs depthwise separable convolution, channel-wise operations, and sparse gating mechanisms throughout, avoiding the introduction of high-overhead attention modules (such as Transformer, CBAM) or dynamic routing structures. While maintaining high accuracy, the model's parameter count (2.29M) and computational complexity (11.8 GFLOPs) are significantly lower than mainstream YOLO variants. It can achieve 32 FPS real-time inference (640×640 input) on Jetson Nano, with peak memory usage of <800MB, meeting the stringent deployment requirements of industrial edge devices for low latency, low power consumption, and small memory.

[0053] 2. High-frequency directional sensing mechanism improves signal-to-noise ratio and reduces post-processing burden: By predefining multi-directional Sobel-like convolution kernels through the DirHFE module, the directional high-frequency features of defects such as cracks and pores are explicitly modeled, effectively distinguishing isotropic background noise. This design achieves high recall detection of sub-10 pixel level micro-defects without additional post-processing (such as non-maximum suppression NMS threshold tuning or morphological filtering), significantly reducing false alarm rate at the edge and system maintenance costs.

[0054] 3. Hierarchical perceptual loss - joint architecture optimization, taking into account both large and small target detection: The DHF loss and DHF_SFPN are jointly designed, and the regression weights are dynamically adjusted according to the feature pyramid hierarchy (P2–P5) - the localization sensitivity of the shallow layer (P2) is enhanced to capture small targets, and the semantic response of the deep layer (P4 / P5) is stabilized to ensure the accuracy of large targets, thus breaking through the performance conflict between "small target recall" and "large target accuracy" in traditional methods.

[0055] 4. Plug-and-play integration, compatible with mainstream YOLO ecosystem, and strong engineering feasibility: This invention only requires replacing the Neck module in the YOLO11 architecture with DHF_SFPN and replacing the regression loss function with dhf loss to build a complete DHF-YOLO detection model, without modifying the backbone network, detection head structure, or training / inference interface. This design is fully compatible with the data flow and module specifications of existing YOLO series frameworks, supporting seamless integration into YOLO-based industrial vision inspection systems. Furthermore, since the model uses standard convolution operations and static computation graphs throughout, without dynamic control flow or platform-specific operators, it can be efficiently exported to general intermediate representations such as ONNX and adapted to mainstream edge inference engines (such as TensorRT, RKNN, and CANN), significantly reducing the engineering migration cost from algorithm development to edge deployment, and possessing excellent versatility, portability, and industrialization potential. Attached Figure Description

[0056] Figure 1 This is a flowchart of a lightweight target detection edge deployment method based on high-frequency detail enhancement according to the present invention.

[0057] Figure 2 For the DHF_SFPN module.

[0058] Figure 3 This is a diagram of the YOLO11 architecture.

[0059] Figure 4 This is a diagram of the DHF-YOLO architecture.

[0060] Figure 5 This is the architecture diagram of YOLO11-P2.

[0061] Figure 6 This is a structural diagram of the DirHFE module.

[0062] Figure 7 This is a structural diagram of the SparseHFRGate module.

[0063] Figure 8 This is a structural diagram of the DragonScaleRefine module.

[0064] Figure 9 This is a structural diagram of the PhoenixGateRebirth module.

[0065] Figure 10 The graph shows the changes in precision and recall during the training and validation of DHF-YOLO.

[0066] Figure 11 This is a comparison chart of the detection results of YOLO11-P2 and DHF-YOLO. Detailed Implementation

[0067] The present invention will be further explained and described below with reference to the accompanying drawings and specific embodiments. It should be noted that the specific embodiments are not intended to limit the scope of the present invention.

[0068] like Figures 1 to 11 This specific embodiment provides a lightweight target detection edge deployment method based on high-frequency detail enhancement, including the following steps:

[0069] S1 involves collecting 4045 high-resolution images of weld defects and performing preprocessing and dataset partitioning; specifically:

[0070] The S11 uses an industrial-grade high-definition camera to acquire a total of 4,045 high-definition images of four typical weld surface defects: porosity, spatter, crack, and undercut, under controlled lighting conditions (illuminance stable at 800–1200 lux) and image resolution of no less than 1920×1080. All images are clearly focused, ensuring that the geometric shape and edge details of sub-10×10 pixel micro-defects (such as dense porosity groups and fine cracks) can be effectively distinguished in the raw data.

[0071] S12, perform a standardized preprocessing procedure on the 4045 high-definition images of the weld surface collected in step S11: First, use a nonlocal mean denoising algorithm to suppress random noise in the imaging process and preserve the sharpness of the defect edges; then perform white balance correction and use the gray world hypothesis to eliminate color shift caused by different light sources, so that the weld area presents a consistent metallic color; finally, scale all images to a resolution of 640×640 while keeping the aspect ratio unchanged, and fill the excess areas with black pixels. Finally, construct a benchmark dataset with a standardized structure and consistent quality, in which 3103 images are divided into a training set and the remaining 942 images are used as a validation set for model evaluation.

[0072] S2, using the "Labelme" tool, accurately annotate the defect regions in the high-resolution weld defect images after preprocessing and dataset segmentation in step S1, generating corresponding bounding box labels; specifically:

[0073] S21, launch the Labelme annotation software and load the folder containing the image to be annotated using the "Open Dir" function;

[0074] S22, select the target image in the "File List", use the "Create Polygons" tool to select the defect area with polygons, and simultaneously complete the defect category naming (such as adj, int, etc.); for a folder containing multiple images, you can switch to the next or previous image through the "Next Image" or "Prev Image" button and repeat the above annotation process;

[0075] S23. Complete the annotation process in step S22, and click the "Save" button to save the annotation results in JSON format to the specified folder. The JSON content includes the shape of the target detection box, the coordinates of all points constituting the target detection box, the label name, the image path, and the image pixels.

[0076] S3, based on the characteristics of weld defects such as small size, strong directionality, and dense distribution, constructs the DHF_SFPN module (see details). Figure 2 This involves using shallow directional enhancement, bidirectional sparse fusion, and deep semantic calibration to achieve efficient extraction and preservation of high-frequency details from minute defects; specifically:

[0077] S31, during the first forward propagation, dynamically constructs sub-modules such as horizontal convolution, upsampling, and cross-scale fusion based on the number of channels and spatial resolution of the input feature map, in order to support arbitrary input size and adapt to the dynamic resolution characteristics of YOLO11.

[0078] S32, in the lateral feature extraction path, a DirHFE module is introduced for the shallowest feature map (P2) (see details). Figure 6 This module employs four sets of fixed-direction Sobel-like convolution kernels to explicitly enhance the high-frequency response of linear structures such as cracks. The remaining layers (P3–P5) use only 1×1 convolutions for channel alignment to maintain computational lightweightness.

[0079] Furthermore, the design of the DirHEF module in step S32 also includes the following steps:

[0080] S321 predefines four sets of normalized Sobel-like directional convolution kernels, corresponding to the four main directions of 0° (horizontal), 45° (upper right diagonal), 90° (vertical) and 135° (upper left diagonal); each set of convolution kernels has a size of 3×3, and its value is normalized by dividing by 8.0 to control the high-frequency response amplitude and maintain gradient stability.

[0081] S322: The input feature map is grouped along the channel dimension, and four-way convolution is performed in parallel through group convolution to generate a multi-directional high-frequency response map with four times the number of channels. Then, a channel-wise 1×1 convolution layer is introduced to linearly fuse the four-way responses. Finally, the fused high-frequency components are adaptively weighted by a learnable channel scaling factor (initialized to σ(−2.0)≈0.12) and residually superimposed on the original input features, thereby explicitly enhancing the edge details of linear structures such as cracks while preserving low-frequency semantics.

[0082] S33, Construct a top-down semantic fusion path: Upsample the high-level feature maps sequentially through bilinear interpolation (shallow layer) or nearest neighbor upsampling (deep layer), and combine depthwise separable convolution (DWConv) to perform channel mapping and feature smoothing on the upsampling results to achieve lightweight cross-scale information fusion;

[0083] S34, constructing a bottom-up refined path: Low-level features are downsampled using depthwise separable convolutions with a stride of 2, and a designed SparseHFRGate gating mechanism is embedded at each bottom-up fusion stage (see details). Figure 7 This gating method generates spatial-channel joint weights based on local high-frequency energy and channel importance, and retains only the top-20% of regions with the highest response intensity, effectively suppressing dense background interference.

[0084] Furthermore, the design of the SparseHFRGate module in step S34 also includes the following steps:

[0085] S341 receives coarse-grained high-level features (x_coarse) and fine-grained low-level downsampled features (x_fine_down) from the bottom-up path as dual inputs. First, a fixed Laplacian convolution kernel (center weight 1, surrounding weights −1, globally normalized) is used to extract the local high-frequency energy of x_fine_down, and a sign-robust energy response map is obtained through the tanh-absolute value composite function (i.e., torch.tanh(hf).abs()). Subsequently, this energy map is convolved with 3×3 to generate spatial gating weights, while x_coarse is global average pooled and then convolved with one dimension to generate channel importance weights. The two are multiplied to form a spatial-channel joint soft gating, dynamically guiding the model to focus on high-response regions.

[0086] S342, based on joint gating, applies sparsity constraints: the spatial response map of each channel is flattened, and the top 20% of positions with the highest response intensity are selected (i.e., top-k, k = H×W×0.2), while the remaining positions are set to zero; the final output is a sparsely gating mask that has been truncated (clamped to [0.0, 1.0]), which is used to modulate feature transfer in the bottom-up fusion process, effectively suppressing interference from dense background or noise regions and improving the signal-to-noise ratio of small defects;

[0087] S35, after each bottom-up fusion, connects to the designed DragonScaleRefine (see details). Figure 8 The lightweight refinement module consists of depthwise convolution, pointwise convolution, GroupNorm (4 groups with affine parameters), and SiLU activation function, which is used to enhance local texture representation and improve feature consistency.

[0088] Furthermore, the design of DragonScaleRefine in step S35 also includes the following steps:

[0089] S351, Depthwise Convolution and Pointwise Convolution are performed sequentially on the bottom-up fused feature map: the depthwise convolution uses a 3×3 convolution kernel, full channel grouping, and zero bias setting to efficiently capture local spatial context while preserving channel independence; then, cross-channel information interaction is achieved through 1×1 pointwise convolution to complete lightweight feature reorganization.

[0090] S352 introduces a GroupNorm normalization layer with affine parameters (the number of groups is fixed at 4) after the convolution operation to alleviate the instability of normalization under small batch training or dynamic resolution input; the scaling factor (γ) and offset (β) of this GroupNorm layer are both set as learnable parameters and are set to 1 and 0 respectively during the initialization phase to ensure that the behavior in the early stage of forward propagation is close to the identity mapping.

[0091] S353 ultimately introduces nonlinear expressive power through the SiLU (Sigmoid-weighted Linear Unit) activation function, outputting a refined feature representation;

[0092] S36, for deep features (P4 and P5), introduces the constructed PhoenixGateRebirth module (see details). Figure 9 The channel calibration module stabilizes the semantic response of large-scale targets and prevents high-level feature degradation through SE-style global pooling and nonlinear mapping.

[0093] Furthermore, the construction of the PhoenixGateRebirth module in step S36 also includes the following steps:

[0094] S361 uses a lightweight SE structure to achieve channel semantic calibration for deep feature maps P4 and P5: First, it compresses the spatial dimension through global average pooling to generate channel description vectors; then, it passes through two 1×1 convolution layers, SiLU activation function and Sigmoid output layer to generate channel attention weights with values ​​in the range [0,1].

[0095] S362 applies the generated channel attention weights to the original P4 / P5 feature maps in a channel-by-channel multiplication manner to achieve adaptive enhancement or suppression of semantic response to large-scale targets (such as large-area depressions or spatter clusters). This mechanism effectively alleviates the semantic ambiguity or gradient diffusion problems caused by the excessively large receptive field of deep features, and significantly improves the robustness of YOLO11 in localization and classification confidence of large targets in complex weld seam scenarios.

[0096] S4 addresses the issues of gradient magnitude imbalance and insufficient localization sensitivity in dense small target scenarios using general IoU loss. It designs a dhf loss that is co-optimized with the hierarchical structure of the DHF-SFPN module.

[0097] Furthermore, the design of the dhf loss in step S4 also includes the following steps:

[0098] S41 addresses the gradient imbalance caused by amplified localization errors in general IoU-type losses due to dense small defects. WIoU v3 is used as the basic regression metric. This metric introduces a center point distance normalization term γ=ρ² / c² (where ρ² is the square of the Euclidean distance between the center points of the predicted box and the ground truth box, and c² is the square of the diagonal length of the minimum bounding rectangle) to dynamically adjust the penalty weights, making the loss more sensitive to the positional shift of small targets and the gradient distribution more stable.

[0099] S42, based on the pyramid level (levels, 0=P2, 1=P3, 2=P4, 3=P5) of the DHF-SFPN output feature map, differentiated loss weights are assigned to different levels, introducing a level-aware weighting mechanism based on WIoU v3 used in step S41. The shallowest layer P2 (level=0) corresponds to the smallest scale defect and is given the highest localization sensitivity (β=1.2), while the deepest layer P5 (level=3) corresponds to large targets and has its sensitivity appropriately reduced (β=0.9). Specifically, this is achieved by mapping a preset β factor vector [1.2, 1.1, 1.0, 0.9] to the level index, ensuring that the loss function is highly aligned with the semantic-scale division of the feature pyramid.

[0100] S43, to improve training robustness, has a built-in automatic coordinate normalization mechanism: when the maximum value of the input bounding box coordinates exceeds 1.5 (using pixel coordinates instead of normalized coordinates), the image size is automatically estimated and global normalization is performed to avoid numerical instability caused by inconsistent coordinate scales; at the same time, ε truncation is applied to the normalized coordinates (clamp to [ε, 1−ε], ε=1e−7) to prevent division by zero or boundary overflow in IoU calculation;

[0101] S44, the final loss value is composed of the weighted WIoU multiplied by the global scaling factor 0.42. This factor was determined through experimental tuning and is used to control the overall magnitude of the regression loss and ensure the numerical stability of the end-to-end training process.

[0102] S5, replace the YOLO11 with the DHF_SFPN module built in step S3 (see the specific architecture). Figure 3 The original feature pyramid network (Neck) is integrated with the DHF loss designed in step S4 as the bounding box regression loss function to form a new end-to-end trainable detection architecture—DHF-YOLO (see details). Figure 4 ).

[0103] Furthermore, the integration of the DHF-YOLO architecture in step S5 also includes the following steps:

[0104] S51 replaces the original feature pyramid network (Neck part) in the YOLO11 architecture with the DHF_SFPN module. Specifically, the four-level feature maps P2, P3, P4, and P5 output from the backbone are used as inputs to DHF_SFPN: layer P2 is cascaded with the DirHFE module using 1×1 convolutions to enhance high-frequency details; layers P3 to P5 use only 1×1 convolutions for channel alignment. Then, top-down semantic fusion and bottom-up refinement are performed, with the SparseHFRGate gating mechanism and DragonScaleRefine refinement module deployed sequentially at each bottom-up fusion node. Furthermore, the PhoenixGateRebirth channel calibration module is overlaid on the final output branches of P4 and P5. After the above processing, the four multi-scale feature maps output by DHF_SFPN are directly connected to the original YOLO11 detection head for subsequent classification and bounding box regression tasks.

[0105] S52, during the model training phase, the default bounding box regression loss function (such as CIoU or EIoU) used by YOLO11 is replaced with dhf loss. Specifically, for each bounding box predicted by the detector head and its corresponding ground truth box, the feature pyramid level identifier to which it belongs is recorded simultaneously. The dhf loss first automatically determines whether normalization is needed based on the numerical range of the bounding box coordinates. Then, it calculates the basic regression error based on WIoU v3 metric, and selects the corresponding β factor from the preset weight vector [1.2, 1.1, 1.0, 0.9] according to the level identifier for weighting, generating a level-sensitive regression loss. This loss term, together with the classification loss and the target confidence loss, constitutes the total loss function, which is used to drive the end-to-end parameter optimization of DHF-YOLO (training parameters are detailed in Table 1).

[0106] Table 1 DHF-YOLO Training Parameters

[0107]

[0108] S6. Conduct systematic ablation experiments and multi-model comparisons to verify DHF-YOLO from step S5. Evaluate its performance against mainstream architectures and enhanced variants such as YOLOv8 and YOLO11 (YOLOv8-P2, YOLO11-P2, which adds a small object detection (P2) branch to YOLOv8 and YOLO11; see YOLO11-P2 for detailed architecture details) from two core dimensions: detection accuracy (including mAP@50, mAP@50:95, APs) and model lightweighting (including Params and GFLOPs). Figure 5 The comprehensive performance advantages of this technology in weld defect detection tasks.

[0109] Furthermore, step S6, the DHF-YOLO ablation experiment and comparative verification, also includes the following steps:

[0110] S61. The reason for choosing detection accuracy (including mAP@50, mAP@50:95, and APs) and model lightweighting (including Params and GFLOPs) as evaluation metrics is to comprehensively consider the model's performance and efficiency. First, mAP (mean Average Precision) is a widely used evaluation standard in the field of object detection. mAP@50 represents the average accuracy when the IoU threshold is 0.5, while mAP@50:95 considers the average accuracy at IoU thresholds increasing by 0.05 from 0.5 to 0.95. This helps to comprehensively measure the model's performance under different positioning accuracy requirements. APs specifically refers to the accuracy of small target detection, which is particularly important for small and complex objects such as weld defects. Second, Params and GFLOPs represent the number of model parameters and the number of floating-point operations, respectively. They directly affect the model's storage requirements and inference speed. Lower parameter count and computational complexity mean higher deployment efficiency and wider applicability, especially in resource-constrained industrial inspection environments.

[0111] S62, the ablation experiments focused on verifying the independent contributions of the DHF_SFPN module as a whole and the dhf loss function to the performance of DHF-YOLO. Specifically, four sets of control experiments were designed (Table 2): (1) YOLO11-P2 and the default loss function as the baseline; (2) only replacing Neck with DHF_SFPN, while keeping the loss function unchanged; (3) using only dhf loss and YOLO11-P2; (4) integrating both DHF_SFPN and dhf loss, i.e., the complete DHF-YOLO architecture. All experiments were conducted under the same training strategy and data partitioning. The results show that introducing DHF_SFPN alone significantly improves APs (+6.03%) and mAP@50:95 (+7.14%), indicating that its multi-scale fusion mechanism effectively enhances the characterization ability of small defects. Using DHF loss alone also improves mAP@50 (+1.3%) and localization stability. When both are used together, the performance gains are additive, with mAP@50 reaching 71.4%, mAP@50:95 reaching 49.5%, and APs reaching 53.9%. It is worth noting that, thanks to the lightweight design of the DHF_SFPN module (such as depthwise separable convolution and channel compression), the number of parameters of the complete model is reduced from 2.86M to 2.29M, and GFLOPs are reduced from 13.4 to 11.8. While significantly improving detection accuracy, it further improves computational efficiency and achieves model lightweighting, fully verifying the effectiveness, synergy, and engineering practicality of the proposed module and loss function.

[0112] Table 2 Ablation Experiment

[0113]

[0114] S63, the comparative experiments focused on a comprehensive comparison of the optimized DHF-YOLO architecture with mainstream models such as YOLOv8 and YOLO11, as well as enhanced variants (such as YOLOv8-P2 and YOLO11-P2). During the experiments, all models were trained and tested on the same dataset to ensure fairness. Specifically, a benchmark dataset was first prepared using the same preprocessing procedures and data partitioning strategies, and then hyperparameters were adjusted according to their respective best practices to achieve optimal performance. DHF-YOLO significantly outperformed existing mainstream models in weld defect detection (Table 3). Compared to YOLOv8 (mAP@50=63.2%, APs=38.5%) and YOLO11 (mAP@50=65.8%, APs=41.2%), DHF-YOLO not only achieved a significant leap in overall detection accuracy (mAP@50 reached 71.4%), but also made breakthrough progress in small target detection capabilities (APs reached 53.9%). Even compared to improved models that specifically introduce the P2 branch to enhance the perception of minute defects, DHF-YOLO maintains a comprehensive lead. Its mAP@50 is 3.7 and 2.7 percentage points higher than YOLOv8-P2 (67.7%) and YOLO11-P2 (68.7%), respectively, and its APs are significantly higher at 53.9%, surpassing YOLO11-P2's 49.9% and YOLOv8-P2's 46.0%. Notably, this performance improvement did not come at the expense of efficiency—DHF-YOLO has only 2.29M parameters, lower than all the comparison models, and its GFLOPs are 11.8, significantly lower than YOLOv8-P2 (17.9) and YOLO11-P2 (13.4). It even achieves a mAP@50 gain of more than 8 percentage points with a computational cost only slightly higher than YOLOv8 (8.7 GFLOPs). This fully demonstrates that DHF-YOLO, through the efficient multi-scale fusion mechanism of DHF_SFPN and the hierarchical perception optimization of dhf loss, achieves more accurate and efficient modeling of minute defects without relying on high-cost resolution expansion. Thus, it achieves the best balance between detection accuracy and model lightweighting, demonstrating outstanding practical value and industrial deployment potential.

[0115] Table 3 Comparative Experiments

[0116]

[0117] S63. After completing the horizontal comparison of accuracy and lightweighting metrics in steps S61 and S62, this invention further conducts end-to-end edge deployment field tests to comprehensively evaluate the engineering applicability of DHF-YOLO in real industrial edge scenarios. Specifically, the trained DHF-YOLO model is exported to ONNX format and optimized for FP16 accuracy and accelerated for layer fusion using the TensorRT 8.6 toolchain. It is then deployed on three typical edge computing platforms widely used in industrial quality inspection and intelligent inspection: NVIDIA Jetson Nano (4GB RAM, Max-N power mode), Rockchip RK3588 (8GB LPDDR4, integrated NPU), and Huawei Atlas 200 DK (Ascend 310 AI chip). All tests use a uniform input resolution of 640×640, continuously inferring 1000 frames of weld seam images, and recording the average inference frame rate (FPS), peak memory usage (MB), and average power consumption (W). The results are shown in Table 4.

[0118] Table 4. End-to-end deployment performance of DHF-YOLO on typical edge devices

[0119]

[0120] The results show that DHF-YOLO not only significantly outperforms the comparison models in accuracy, but also achieves high frame rate, low memory, and low power consumption operation on real-world edge hardware—stable at 32 FPS even on the resource-constrained Jetson Nano, meeting the basic requirements of industrial online inspection for real-time performance (≥25 FPS). Simultaneously, its peak memory usage is controlled below 800 MB, far below the device's available memory limit, avoiding latency jitter caused by frequent memory swapping. Crucially, this performance is achieved without enabling a dedicated NPU or sparse acceleration, fully validating the effectiveness of DHF-YOLO's architecture design and lightweight strategy, demonstrating its feasibility, robustness, and superiority as a general-purpose industrial vision edge intelligence solution.

Claims

1. A lightweight target detection edge deployment method based on high-frequency detail enhancement, characterized in that, Includes the following steps: S1: Acquire high-resolution images of weld defects and perform preprocessing and dataset partitioning; S2, use the "Labelme" tool to accurately annotate the defect areas in the high-definition weld defect images after preprocessing and dataset segmentation in step S1, and generate corresponding bounding box labels; S3. Based on the characteristics of the collected weld defects, construct the direction-aware high-frequency sparse feature pyramid DHF_SFPN module. S4. To address the gradient imbalance problem of the general IoU loss in dense small target scenarios, a regression loss function dhf loss is designed and co-optimized with the DHF-SFPN module. S5. Integrate the DHF_SFPN module built in step S3 and the dhf loss designed in step S4 into YOLO11 to build a new architecture DHF-YOLO that supports end-to-end training. S6. Perform ablation experiments and comparative verification on the DHF-YOLO proposed in step S5. Step S3 specifically includes: S31 dynamically constructs horizontal convolution, upsampling, and cross-scale fusion sub-modules based on the number of channels and spatial resolution of the input feature map to adapt to the dynamic resolution of YOLO11; S32, introduce the DirHFE module into the shallow feature map of P2. The DirHFE uses four sets of fixed-direction Sobel-like convolution kernels to enhance the high-frequency response of linear defects. The P3–P5 levels only use 1×1 convolution for channel alignment. S33, construct a top-down semantic fusion path, and use bilinear or nearest neighbor upsampling combined with depthwise separable convolution to complete lightweight cross-scale mapping; S34, construct a bottom-up refined path, use depthwise separable convolution downsampling with a stride of 2, and embed SparseHFRGate gating at each bottom-up fusion stage. The SparseHFRGate generates spatial-channel joint weights based on local high-frequency energy and channel importance, and only retains the top 20% of regions with the highest response intensity. S35, after each bottom-up fusion, the DragonScaleRefine lightweight refinement module is connected. The DragonScaleRefine is composed of depth convolution, pointwise convolution, GroupNorm and SiLU activation in sequence to enhance local texture consistency. S36, before the deep feature output of P4 and P5, the PhoenixGateRebirth channel calibration module is connected. The PhoenixGateRebirth generates channel attention weights through SE-style global pooling and nonlinear mapping to stabilize the semantic response of large-scale targets.

2. The method according to claim 1, characterized in that, Step S1 specifically includes: S11. Use an industrial-grade high-definition camera to acquire high-definition images of the weld surface under controlled lighting conditions. The high-definition images include four types of defects: porosity, spatter, cracks, and dents, and the image resolution is not less than 1920×1080. S12, perform nonlocal mean denoising, gray world white balance, proportional scaling to 640×640 pixels and fill with black pixels on the high-definition image in sequence to form a benchmark dataset, and divide the benchmark dataset into training set and validation set according to defect category.

3. The method according to claim 1, characterized in that, Step S2 specifically includes: S21. Load the folder of images to be labeled using Labelme software; S22, Use the polygon tool to select the defect area and assign a defect category label; S23. Save the annotation results in JSON format, which includes the vertex coordinates of the defect polygon, category name, image path and image size information.

4. The method according to claim 1, characterized in that, The design of the DirHFE module described in step S32 includes the following steps: S321 predefines four groups of 3×3 normalized Sobel-like directional convolution kernels, corresponding to the 0°, 45°, 90°, and 135° directions respectively; S322 extracts high-frequency responses in four directions through grouped convolution in parallel, and then fuses them through 1×1 convolution and superimposes them onto the P2 features using learnable channel scaling factor residuals to preserve low-frequency semantics and enhance linear defect edges.

5. The method according to claim 1, characterized in that, The design of the SparseHFRGate module described in step S34 includes the following steps: S341 uses a fixed Laplacian convolution kernel to extract local high-frequency energy of fine-grained features, and generates spatial gating weights after sign robustness by the tanh-abs function. S342, the spatial gating weight is multiplied by the channel importance weight to obtain the spatial-channel joint weight, and only the top 20% of the positions with the highest response intensity of each channel are retained, while the rest are set to zero, in order to suppress background interference and improve the signal-to-noise ratio of small defects.

6. The method according to claim 1, characterized in that, The design of the DragonScaleRefine lightweight refining module described in step S35 includes the following steps: S351 executes 3×3 depthwise convolution and 1×1 pointwise convolution in sequence to achieve lightweight feature recombination; S352 introduces a GroupNorm normalization layer with affine parameters after convolution, with the number of groups fixed at 4, and the scaling factor and offset initialized to 1 and 0 respectively. S353, through the SiLU activation function, outputs refined features to enhance local texture consistency.

7. The method according to claim 1, characterized in that, The construction of the PhoenixGateRebirth module described in step S36 includes the following steps: S361 employs a lightweight SE structure: global average pooling → two 1×1 convolutional layers → SiLU activation → Sigmoid output, generating channel attention weights; S362, the attention weights are multiplied back into the P4 / P5 feature maps channel by channel to adaptively enhance or suppress the semantic response of large-scale targets, thereby improving localization robustness and classification confidence.

8. The method according to claim 1, characterized in that, Step S4 specifically includes: S41, based on WIoU v3 regression metric, introduces a center point distance normalization term to dynamically adjust the penalty weight, making the loss more sensitive to the positional shift of dense small defects; S42, apply differentiated weights β according to the P2–P5 pyramid levels, with higher weights for shallower levels, to achieve level-aware weighting; S43: When the maximum value of the bounding box coordinates exceeds 1.5, automatic global normalization is performed, and ε-truncation is applied to the normalized coordinates to prevent numerical anomalies. S44 multiplies the weighted WIoU by the global scaling factor and outputs the final regression loss value.

9. The method according to claim 1, characterized in that, Step S5 specifically includes: S51, replace the original YOLO11 Neck with DHF_SFPN, connect DirHFE to P2 layer, align channels with 1×1 convolution in P3–P5 layers, and deploy SparseHFRGate and DragonScaleRefine sequentially after each bottom-up fusion. PhoenixGateRebirth is superimposed before the output of P4 / P5, and the resulting multi-scale features are connected to the YOLO11 detection head. S52, during the training phase, dhf-loss is used to replace the default bounding box regression loss. The corresponding β factor is selected based on the hierarchical label and weighted according to the hierarchical loss. Together with the classification loss and confidence loss, it forms the total loss function, driving end-to-end parameter optimization. Step S6 specifically includes: S61, using mAP@50, mAP@50:95, APs, parameter quantity and GFLOPs as evaluation indicators, conducted four sets of ablation experiments to verify the independent and joint contributions of DHF_SFPN and dhf-loss to detection accuracy and lightweighting. S62, under the same dataset and training strategy, DHF-YOLO is compared with YOLOv8, YOLO11 and their enhanced variants. DHF-YOLO achieves higher mAP@50 and APs with lower parameter count and GFLOPs, proving that it achieves the best balance between accuracy and edge deployment efficiency.