Industrial part defect detection method based on multi-level dynamic feature enhancement YOLOv11 network

CN123015496APending Publication Date: 2026-10-30ZHEJIANG SCI-TECH UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611249048.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-18
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0006]本发明是为了克服现有技术中,针对现有传统机器视觉检测方法依赖人工设计特征、泛化能力差,以及常规YOLOv11网络在工业复杂背景下对多尺度缺陷特征提取不充分、浅层细节与深层语义融合不足的问题,提供了一种能够通过多级动态特征增强机制有效提升缺陷识别精度的基于多级动态特征增强YOLOv11网络的工业零部件缺陷检测方法

Benefits of technology

[0030]本发明与现有技术相比,有益效果是:(1)采用C3k2-MSFE模块对YOLOv11主干网络进行改进,通过不同尺度的特征提取路径获取缺陷区域的边缘、纹理和形态信息,使网络能够更充分地表征尺寸较小、特征不明显以及形态差异较大的表面缺陷;(2)在颈部网络中设置ACFM模块,对不同层级特征之间的对应关系进行协调,使浅层特征中的空间细节与深层特征中的语义信息得到有效交互,改善多尺度融合过程中缺陷信息被削弱的问题,增强网络对不同尺寸缺陷的适应能力;(3)利用EDHead分别完成缺陷分类和边界框回归,减少两类预测任务在特征处理过程中的相互影响,使检测模型能够兼顾缺陷类别判断与位置确定,提高检测结果的可靠性;(4)通过C3k2-MSFE、ACFM和EDHead之间的协同配合,形成从缺陷特征提取、跨层信息融合到分类定位输出的完整检测过程,可用于工业零部件表面缺陷的自动识别与定位,减少人工检测对经验的依赖,提高工业质量检测的效率和自动化程度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123015496A_ABST
    Figure CN123015496A_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of industrial machine vision and deep learning target detection, and particularly relates to an industrial part defect detection method based on a multi-level dynamic feature enhancement YOLOv11 network. The method comprises: acquiring an industrial part surface image, establishing a defect labeling data set, and inputting the image to be detected into an improved YOLOv11 network. A C3k2-MSFE module is set in the backbone network, defect features under different receptive fields are extracted through cross-stage feature shunting and local depth convolution and expansion depth convolution branches; an ACFM module is set in the neck network, local detail features and context features are dynamically weighted and fused according to feature responses of different spatial positions; an EDHead detection head is used to decouple defect classification and bounding box regression, and the depth separable convolution is used to reduce the calculation amount. The network outputs three scales of prediction results for an input image of 640*640 pixels, and after confidence screening and non-maximum suppression, the defect category, position and confidence are obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of industrial machine vision and deep learning target detection technology, specifically involving a method for detecting defects in industrial parts based on a multi-level dynamic feature enhancement YOLOv11 network. Background Technology

[0002] Industrial parts may develop quality problems such as micro-cracks, scratches, dents, burrs, defects, contamination, and assembly abnormalities during forming, machining, welding, coating, assembly, and transportation. These defects are characterized by large size range, irregular shape, low grayscale contrast, and random distribution; metal reflection, processing texture, oil stains, and light fluctuations can also create false features similar to real defects.

[0003] Manual visual inspection relies on operator experience, and prolonged operation can easily lead to fatigue, making it difficult to simultaneously meet the requirements of inspection consistency, cycle time, and traceability. Traditional machine vision methods typically require the design of thresholds, filters, or manual features for specific parts. When the part's material, surface texture, and lighting conditions change, the inspection rules need to be readjusted, resulting in limited generalization ability.

[0004] Single-stage object detection networks can simultaneously perform defect classification and localization, but directly using conventional YOLO networks may still have the following shortcomings: shallow details are attenuated during continuous downsampling, making it difficult to preserve small or low-contrast defects; different levels of features are fixedly spliced ​​or fused by convolution, making it impossible to dynamically adjust the contribution of local details and contextual information based on the defect location; when classification and localization tasks share too many convolution parameters, the feature requirements of the two tasks may interfere with each other; increasing large convolutions or complex attention will increase the computational load, which is not conducive to deployment in industrial settings.

[0005] Therefore, it is necessary to design a detection method that takes into account subtle defect features, multi-scale fusion capability, and inference efficiency. Summary of the Invention

[0006] This invention aims to overcome the problems of existing traditional machine vision inspection methods, such as reliance on manually designed features, poor generalization ability, and insufficient extraction of multi-scale defect features and fusion of shallow details and deep semantics by conventional YOLOv11 networks in complex industrial contexts. It provides an industrial component defect detection method based on a multi-level dynamic feature enhancement YOLOv11 network that can effectively improve defect recognition accuracy through a multi-level dynamic feature enhancement mechanism.

[0007] To achieve the above-mentioned objectives, the present invention adopts the following technical solution:

[0008] A defect detection method for industrial parts based on a multi-level dynamic feature-enhanced YOLOv11 network includes the following steps:

[0009] S1, Defect Dataset Construction: Collect surface images of industrial parts, and label the defective regions in the images with category and bounding box annotations to form an industrial parts defect image dataset;

[0010] S2, Image preprocessing and dataset partitioning: The acquired defect images are resized and pixel values ​​are normalized, and the industrial component defect image dataset is partitioned into training set, validation set and test set;

[0011] S3, Defect Detection Network Construction: The training set images are input into an improved YOLOv11 network, which includes a backbone network, a neck network, and a detection head connected in sequence. The backbone network is equipped with a C3k2-MSFE (Multi-Scale Feature Enhancement) module for multi-scale enhancement of image features at different levels. The neck network is equipped with an ACFM (Adaptive Contextual Feature Fusion) module for dynamic contextual fusion of spliced ​​features at the same scale. The detection head uses an EDHead (Efficient Decoupling) detection head to perform defect classification prediction and bounding box regression prediction on the fused features.

[0012] S4, Network Training and Parameter Update: Calculate the training loss based on the defect classification results and bounding box regression results output by EDHead, and update the parameters of the improved YOLOv11 network through backpropagation based on the training loss.

[0013] S5, Model Evaluation and Parameter Determination: Use the validation set to evaluate the network performance at different training stages, save the network parameters corresponding to the highest detection accuracy of the validation set, and obtain the trained industrial component defect detection model.

[0014] S6, Defect Identification and Result Output: Input the image of the industrial component to be detected into the industrial component defect detection model, perform confidence screening and redundant box suppression on the candidate detection boxes output by the model, and obtain the defect category, defect bounding box position and defect confidence.

[0015] Preferably, in step S1, the surface image of the industrial component is acquired by an area scan camera or a line scan camera, and bright field illumination, dark field illumination, coaxial illumination or a combination thereof are used during image acquisition; the defect includes at least one of cracks, scratches, pits, missing materials, surface foreign objects and abnormal surface morphology; the bounding box annotation records at least the defect category, the center coordinates of the bounding box, the width of the bounding box and the height of the bounding box.

[0016] Preferably, the backbone network takes a 3×640×640 image as input; the backbone network sequentially includes a first convolutional layer, a second convolutional layer, a first C3k2-MSFE module, a third convolutional layer, a second C3k2-MSFE module, a fourth convolutional layer, a first C3k2 module, a fifth convolutional layer, a second C3k2 module, an SPPF (spatial pyramid pooling) module, and a C2PSA (spatial attention) module; the backbone network provides 128×80×80, 128×40×40, and 256×20×20 feature maps to the neck network respectively.

[0017] Preferably, the C3k2-MSFE module includes a channel adjustment unit, a cross-stage splitting unit, a C3k feature processing branch, a multi-scale feature enhancement unit, a feature concatenation unit, and an output mapping unit. After the input features undergo channel transformation by the channel adjustment unit, they are divided into retained features and features to be processed by the cross-stage splitting unit. The features to be processed are processed by at least one C3k feature processing branch and then input into the local depth convolution branch and the dilated depth convolution branch in the multi-scale feature enhancement unit, respectively. The output features of the local depth convolution branch and the dilated depth convolution branch are concatenated with the retained features along the channel direction. The concatenated features are then processed by the output mapping unit to obtain the output features of the C3k2-MSFE module.

[0018] Preferably, the local depth convolution branch uses 3×3 depth convolution to extract local edge and texture features of defects in industrial parts; the dilated depth convolution branch uses 3×3 depth convolution with a dilation rate greater than 1 to expand the feature receptive field and extract contextual features of the defect region and its surrounding surface region; the C3k2-MSFE module also includes residual connections, which adjust the number of channels of the input features by 1×1 convolution when the number of channels of the input features is inconsistent with that of the output features, and then fuse them with the features output by the output mapping unit.

[0019] Preferably, the ACFM module includes a channel alignment unit, a local feature branch, a context feature branch, a weight generation unit, and a feature fusion unit; features from different network layers with the same spatial size are concatenated along the channel direction and input into the ACFM module, and then processed by the channel alignment unit to obtain aligned features; the aligned features are processed by the local feature branch and the context feature branch respectively to obtain local features L and context features G;

[0020] The weight generation unit generates a first weight α and a second weight β related to the spatial location based on the local feature L and the context feature G, and α+β=1 is satisfied at the same spatial location; the feature fusion unit dynamically weights the local feature and the context feature according to α⊙L+β⊙G, and after the dynamic weighting result is convolved and mapped, it performs residual fusion with the alignment feature to obtain the output feature of the ACFM module; where ⊙ represents element-wise multiplication.

[0021] Preferably, the neck network includes a top-down path and a bottom-up path:

[0022] The 256×20×20 feature output from the backbone network is upsampled and concatenated with the 128×40×40 feature to obtain the 384×40×40 feature. The 128×40×40 feature is then obtained through the ACFM module and the C3k2 module.

[0023] After further upsampling, it is concatenated with the 128×80×80 feature to obtain the 256×80×80 feature, and then processed by the ACFM module and C3k2 module to obtain the 64×80×80 feature;

[0024] Subsequently, the samples are downsampled sequentially and concatenated with the intermediate features of the corresponding size in the top-to-bottom path to obtain 256×40×40 features and 512×20×20 features. These are then processed by the ACFM module and the C3k2 module respectively, resulting in 128×40×40 features and 256×20×20 features.

[0025] Preferably, the EDHead detection head receives 64×80×80, 128×40×40 and 256×20×20 features output by the neck network, and maps them to a preset number of channels through a shared 1×1 convolution. The mapped features are then fed into a classification branch and a regression branch, which are independent of each other. The classification branch outputs the predicted scores for each defect category, and the regression branch outputs the discrete distance distribution of the bounding box in four directions. The bounding box coordinates are obtained by integrating the distribution.

[0026] Preferably, the training loss in step S4 includes classification loss, bounding box loss based on intersection-union ratio, and distribution focus loss, and the total loss is expressed as follows:

[0027] Total loss = ;

[0028] in, For classifying losses, The bounding box regression loss is calculated based on the intersection and union relationship between the predicted bounding box and the true bounding box. For distribution focus loss; These are the weighting coefficients for the corresponding loss terms.

[0029] Preferably, in step S6, the industrial parts to be inspected are transported to the image acquisition station. After receiving the image acquisition trigger signal, the image of the industrial parts to be inspected is acquired, and the image of the industrial parts to be inspected is input into the industrial parts defect detection model. When the confidence level of the detected defect reaches the preset threshold of the corresponding defect category, a detection record including the industrial parts identification, defect category, defect location and defect confidence level is generated, and the detection result is sent to at least one of the following: display device, marking device (e.g., inkjet printer, laser marking machine or label printing and attaching machine), alarm device or sorting device.

[0030] Compared with the prior art, the beneficial effects of this invention are: (1) The C3k2-MSFE module is used to improve the YOLOv11 backbone network, and the edge, texture and morphological information of the defect area are obtained through feature extraction paths of different scales, so that the network can more fully represent surface defects with small size, indistinct features and large morphological differences; (2) An ACFM module is set in the neck network to coordinate the correspondence between features of different levels, so that the spatial details in shallow features and the semantic information in deep features can interact effectively, improve the problem of the weakening of defect information in the multi-scale fusion process, and enhance the network's ability to... (3) Using EDHead to complete defect classification and bounding box regression respectively, reducing the mutual influence of the two prediction tasks in the feature processing process, so that the detection model can take into account both defect category judgment and location determination, and improve the reliability of the detection results; (4) Through the synergistic cooperation between C3k2-MSFE, ACFM and EDHead, a complete detection process from defect feature extraction, cross-layer information fusion to classification and positioning output is formed, which can be used for automatic identification and positioning of surface defects of industrial parts, reducing the dependence of manual inspection on experience, and improving the efficiency and automation of industrial quality inspection. Attached Figure Description

[0031] Figure 1 This is a schematic diagram of the overall process of the industrial component defect detection method based on the multi-level dynamic feature enhancement YOLOv11 network of the present invention; Figure 2 This is a schematic diagram of an overall structure of the improved YOLOv11 network constructed in this invention; Figure 3 This is a schematic diagram of one structure of the C3k2-MSFE module in this invention; Figure 4 This is a schematic diagram of the ACFM feature fusion module in this invention; Figure 5 This is a schematic diagram of one structure of the EDHead detection head in this invention. Detailed Implementation

[0032] To more clearly illustrate the embodiments of the present invention, specific implementation methods will be described below with reference to the accompanying drawings. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings and other implementation methods can be obtained based on these drawings without any creative effort.

[0033] like Figure 1 As shown, this invention provides a method for detecting defects in industrial parts based on a multi-level dynamic feature-enhanced YOLOv11 network, comprising the following steps:

[0034] S1. Acquire surface images of industrial parts, establish a surface defect dataset, and generate a corresponding YOLO format annotation file for each image. The annotation file contains the category information and location coordinates of each defect. Acquire surface images of industrial parts using an image acquisition device, and mark the defect areas in the images using rectangular annotation boxes. Each annotation file records the defect category number, the coordinates of the center point of the annotation box, and the width and height of the annotation box. Each coordinate parameter is normalized according to the image size.

[0035] In step S1, the surface image of the industrial parts is acquired by an area scan camera or a line scan camera. Bright field illumination, dark field illumination, coaxial illumination or a combination thereof are used during image acquisition. The defects include at least one of the following: cracks, scratches, pits, missing materials, surface foreign objects, and abnormal surface morphology. The bounding box (rectangular annotation box) annotation records at least the defect category, the center coordinates of the bounding box, the width of the bounding box, and the height of the bounding box.

[0036] S2. Divide the surface defect dataset into a training set, a validation set, and a test set in a 6:2:2 ratio, and create corresponding image folders, label folders, and dataset configuration files. The training set is used to improve the parameters of the YOLOv11 network, the validation set is used to evaluate the network's detection performance during training, and the test set is used to verify the model's defect detection performance after training. The dataset configuration file records the storage paths of the training set, validation set, and test set, the number of defect categories, and the name of each defect category.

[0037] S3. The training set image is input into the improved YOLOv11 network, and features are processed sequentially through the backbone network, neck network and detection head to obtain the category prediction information and bounding box prediction information of surface defects of industrial parts.

[0038] Among them, such as Figure 2As shown, the backbone network is equipped with a C3k2-MSFE module for multi-scale enhancement of image features at different levels; the neck network is equipped with an ACFM module for dynamic context fusion of spliced ​​features at the same scale; and the detection head uses an EDHead detection head to perform defect classification prediction and bounding box regression prediction on the fused features.

[0039] The backbone network takes a 3×640×640 image as input; the backbone network sequentially includes a first convolutional layer, a second convolutional layer, a first C3k2-MSFE module, a third convolutional layer, a second C3k2-MSFE module, a fourth convolutional layer, a first C3k2 module, a fifth convolutional layer, a second C3k2 module, an SPPF module, and a C2PSA module; the backbone network provides 128×80×80, 128×40×40, and 256×20×20 feature maps to the neck network, respectively.

[0040] Step S3 includes:

[0041] S3.1 Input the training set images into the backbone network, and perform feature extraction through the Conv module, C3k2-MSFE module, C3k2 module, SPPF module and C2PSA module to obtain high-resolution feature map C3, medium-resolution feature map C4 and low-resolution feature map C5;

[0042] like Figure 3 As shown, the C3k2-MSFE module includes a channel adjustment unit, a cross-stage splitting unit, a C3k feature processing branch, a multi-scale feature enhancement unit, a feature concatenation unit, and an output mapping unit. After the input features undergo channel transformation by the channel adjustment unit, they are divided into retained features and features to be processed by the cross-stage splitting unit. The features to be processed are processed by at least one C3k feature processing branch and then input into the local depth convolution branch and the dilated depth convolution branch in the multi-scale feature enhancement unit, respectively. The output features of the local depth convolution branch and the dilated depth convolution branch are concatenated with the retained features along the channel direction. The concatenated features are then processed by the output mapping unit to obtain the output features of the C3k2-MSFE module.

[0043] The local depth convolution branch uses 3×3 depth convolution to extract local edge and texture features of defects in industrial parts; the dilated depth convolution branch uses 3×3 depth convolution with a dilation rate greater than 1 to expand the feature receptive field and extract contextual features of the defect region and its surrounding surface region; the C3k2-MSFE module also includes residual connections, which adjust the number of channels of the input features by 1×1 convolution when the number of channels of the input features is inconsistent with that of the output features, and then fuse them with the features output by the output mapping unit.

[0044] The C3k2-MSFE module uses convolutional branches with different receptive fields to extract the texture, edge, and contextual information of defects, and fuses the features of each branch to enhance the representation ability of small defects, defects with blurred boundaries, and defects with complex shapes.

[0045] S3.2 Input feature maps C3, C4 and C5 into the neck network (Neck part), and perform multi-scale feature fusion using the bidirectional feature transfer structure and ACFM module;

[0046] like Figure 4 As shown, the ACFM module includes a channel alignment unit, a local feature branch, a context feature branch, a weight generation unit, and a feature fusion unit. Features from different network layers with the same spatial size are concatenated along the channel direction and input into the ACFM module, and then processed by the channel alignment unit to obtain aligned features. The aligned features are processed by the local feature branch and the context feature branch respectively to obtain local features L and context features G.

[0047] The weight generation unit generates a first weight α and a second weight β related to the spatial location based on the local feature L and the context feature G, and α+β=1 is satisfied at the same spatial location; the feature fusion unit dynamically weights the local feature and the context feature according to α⊙L+β⊙G, and performs residual fusion with the alignment feature after convolution mapping of the dynamic weighting result to obtain the output feature of the ACFM module.

[0048] Furthermore, the neck network includes a top-down path and a bottom-up path:

[0049] The 256×20×20 feature output from the backbone network is upsampled and concatenated with the 128×40×40 feature to obtain the 384×40×40 feature. The 128×40×40 feature is then obtained through the ACFM module and the C3k2 module.

[0050] After further upsampling, it is concatenated with the 128×80×80 feature to obtain the 256×80×80 feature, and then processed by the ACFM module and C3k2 module to obtain the 64×80×80 feature;

[0051] Subsequently, the samples are downsampled sequentially and concatenated with the intermediate features of the corresponding size in the top-to-bottom path to obtain 256×40×40 features and 512×20×20 features. These are then processed by the ACFM module and the C3k2 module respectively, resulting in 128×40×40 features and 256×20×20 features.

[0052] Specifically, feature map C5 is upsampled and fused with feature map C4 to obtain feature map M4; feature map M4 is upsampled and fused with feature map C3 to obtain high-resolution fused feature map P3; feature map P3 is downsampled and fused with feature map M4 to obtain medium-resolution fused feature map P4; feature map P4 is downsampled and fused with feature map C5 to obtain low-resolution fused feature map P5. The ACFM module assigns fusion weights according to the responses of features at different levels to enhance effective defect features and reduce background information interference.

[0053] S3.3 Input the feature maps P3, P4 and P5 output from the Neck section into the EDHead detection head. Through independent classification branches and bounding box regression branches, the defect category and defect location are predicted respectively to obtain the surface defect detection results of industrial parts.

[0054] like Figure 5 As shown, the EDHead detection head receives 64×80×80, 128×40×40 and 256×20×20 features output by the neck network, and maps them to a preset number of channels through a shared 1×1 convolution. The mapped features are then fed into a classification branch and a regression branch, which are independent of each other. The classification branch outputs the predicted scores for each defect category, and the regression branch outputs the discrete distance distribution of the bounding box in four directions. The bounding box coordinates are obtained by integrating the distribution.

[0055] S4. Calculate the training loss based on the matching between the network prediction results and the ground truth bounding boxes, and update the parameters of the improved YOLOv11 network through backpropagation; match the predicted boxes with the ground truth bounding boxes to determine the positive and negative samples participating in training, and calculate the classification loss, bounding box regression loss, and distribution focus loss respectively. Summate the various losses according to the set weights to obtain the total network loss, and update the trainable parameters in the network using the optimizer.

[0056] The training loss in step S4 includes classification loss, bounding box loss based on cross-union ratio, and distribution focus loss. The total loss is expressed as follows:

[0057] Total loss = ;

[0058] in, For classifying losses, The bounding box regression loss is calculated based on the intersection and union relationship between the predicted bounding box and the true bounding box. For distribution focus loss; These are the weighting coefficients for the corresponding loss terms.

[0059] S5. Use the improved YOLOv11 network with updated parameters to detect images on the validation set, and evaluate the network performance based on the detection results. Perform confidence filtering and non-maximum suppression on the predicted bounding boxes output by the network, and then compare the processed prediction results with the ground truth annotations on the validation set to calculate one or more evaluation metrics among precision, recall, mean precision (AP), and mean mean precision (mAP).

[0060] S6. Repeat steps S3 to S5 until the preset number of training rounds is reached or the training termination condition is met, then end the network training and save the network parameters corresponding to the optimal detection performance on the validation set.

[0061] S7. Input the test set images or the surface images of the industrial parts to be inspected into the trained improved YOLOv11 network. After feature extraction, feature fusion and detection head prediction, the network outputs the defect category, location and confidence level.

[0062] The prediction results are subjected to confidence screening and non-maximum suppression processing. The retained prediction bounding boxes are mapped to the original image coordinate system to form the final detection result of surface defects of industrial parts. The detection result is then sent to at least one of a display device, a marking device, an alarm device, or a sorting device.

[0063] In this embodiment, the network training environment is configured as follows:

[0064] A: The network training environment was built using Python 3.9, the deep learning framework used was PyTorch 2.0.1, and CUDA 11.8 and GPU were configured to accelerate network training.

[0065] B: Set the maximum number of training epochs to 200, the initial learning rate to 0.005, and use a cosine annealing strategy to dynamically decay the learning rate;

[0066] C: Set the batch size to 16, meaning that 16 images are input into the network for each batch;

[0067] D: The YOLOv11 network is improved by initializing pre-trained weights. After each training round, the total network loss is calculated, and the mAP metric is evaluated on the validation set. Training is stopped when the set number of rounds is reached, or when the validation set mAP does not significantly improve within 20 consecutive training rounds, and the model parameters corresponding to the highest validation set mAP are saved.

[0068] The experimental results of this invention are as follows: Table 1. Performance Comparison Data Between the Invention and Existing Detection Models

[0069] As shown in the table, the Precision, Recall, mAP50, and mAP@75 of the model of this invention reach 53.5%, 45.2%, 46.3%, and 28.1%, respectively. Compared with the original YOLO11s, these represent improvements of 3.6, 6.5, 6.9, and 4.5 percentage points, respectively. Compared with other comparative models, the model of this invention achieves the highest Recall, mAP@0.5, and mAP@0.75, indicating that it can reduce the missed detection of defects in industrial parts and improve the detection accuracy under different cross-union ratios.

[0070] The beneficial effects of this invention are as follows:

[0071] 1. By setting up a C3k2-MSFE module in the backbone network, the feature extraction branches of different receptive fields are used to obtain the texture, edge and context information of defects, which improves the network's ability to represent small defects, defects with blurred boundaries and defects with complex shapes.

[0072] 2. The ACFM module is used to adaptively weight and fuse features at different levels, which enhances the effective information related to the defect region, reduces background texture interference and detail loss during feature transfer, and improves the detection effect of multi-scale defects.

[0073] 3. The EDHead decoupled detection head is used to perform defect classification and bounding box regression tasks separately, reducing feature interference between the two tasks. This improves the accuracy of defect category discrimination and location while controlling the computational load of the detection head.

[0074] 4. This invention can automatically identify and locate different types of defects on the surface of industrial parts, reducing the reliance on experience for manual inspection. It is applicable to the quality inspection of parts in the industrial production process and provides technical support for the rapid screening of surface defects.

[0075] The above description is merely a detailed explanation of preferred embodiments and principles of the present invention. For those skilled in the art, there may be changes in specific implementation methods based on the ideas provided by the present invention, and these changes should also be considered within the scope of protection of the present invention.

Claims

1. A method for detecting defects in industrial parts based on a multi-level dynamic feature-enhanced YOLOv11 network, characterized in that, Includes the following steps: S1, Defect Dataset Construction: Collect surface images of industrial parts, and label the defective regions in the images with category and bounding box annotations to form an industrial parts defect image dataset; S2, Image preprocessing and dataset partitioning: The acquired defect images are resized and pixel values ​​are normalized, and the industrial component defect image dataset is partitioned into training set, validation set and test set; S3, Defect Detection Network Construction: The training set images are input into an improved YOLOv11 network, which includes a backbone network, a neck network, and a detection head connected in sequence. The backbone network is equipped with a multi-scale feature enhancement (C3k2-MSFE) module to enhance image features at different levels at multiple scales. The neck network is equipped with an adaptive contextual feature fusion (ACFM) module to perform dynamic contextual fusion on spliced ​​features of the same scale. The detection head uses an efficient decoupled EDHead detection head to perform defect classification prediction and bounding box regression prediction on the fused features. S4, Network Training and Parameter Update: Calculate the training loss based on the defect classification results and bounding box regression results output by EDHead, and update the parameters of the improved YOLOv11 network through backpropagation based on the training loss. S5, Model Evaluation and Parameter Determination: Use the validation set to evaluate the network performance at different training stages, save the network parameters corresponding to the highest detection accuracy of the validation set, and obtain the trained industrial component defect detection model. S6, Defect Identification and Result Output: Input the image of the industrial component to be detected into the industrial component defect detection model, perform confidence screening and redundant box suppression on the candidate detection boxes output by the model, and obtain the defect category, defect bounding box position and defect confidence.

2. The method for detecting defects in industrial parts based on a multi-level dynamic feature-enhanced YOLOv11 network according to claim 1, characterized in that, In step S1, the surface image of the industrial component is acquired by an area scan camera or a line scan camera, and bright field illumination, dark field illumination, coaxial illumination or a combination thereof are used during image acquisition. The defects include at least one of the following: cracks, scratches, pits, missing materials, surface foreign objects, and abnormal surface morphology; the bounding box annotation records at least the defect category, the center coordinates of the bounding box, the width of the bounding box, and the height of the bounding box.

3. The method for detecting defects in industrial parts based on a multi-level dynamic feature-enhanced YOLOv11 network according to claim 1, characterized in that, The backbone network takes a 3×640×640 image as input; the backbone network sequentially includes a first convolutional layer, a second convolutional layer, a first C3k2-MSFE module, a third convolutional layer, a second C3k2-MSFE module, a fourth convolutional layer, a first C3k2 module, a fifth convolutional layer, a second C3k2 module, a spatial pyramid pooling SPPF module, and a spatial attention C2PSA module; the backbone network provides 128×80×80, 128×40×40, and 256×20×20 feature maps to the neck network, respectively.

4. The method for detecting defects in industrial parts based on a multi-level dynamic feature-enhanced YOLOv11 network according to claim 3, characterized in that, The C3k2-MSFE module includes a channel adjustment unit, a cross-stage splitting unit, a C3k feature processing branch, a multi-scale feature enhancement unit, a feature concatenation unit, and an output mapping unit. After the input features undergo channel transformation by the channel adjustment unit, they are divided into retained features and unprocessed features by the cross-stage splitting unit. The unprocessed features are processed by at least one C3k feature processing branch and then input into the local depth convolution branch and the dilated depth convolution branch in the multi-scale feature enhancement unit, respectively. The output features of the local depth convolution branch and the dilated depth convolution branch are concatenated with the retained features along the channel direction. The concatenated features are then processed by the output mapping unit to obtain the output features of the C3k2-MSFE module.

5. The method for detecting defects in industrial parts based on a multi-level dynamic feature-enhanced YOLOv11 network according to claim 4, characterized in that, The local depth convolution branch uses 3×3 depth convolution to extract local edge and texture features of defects in industrial parts; the dilated depth convolution branch uses 3×3 depth convolution with a dilation rate greater than 1 to expand the feature receptive field and extract contextual features of the defect region and its surrounding surface region; the C3k2-MSFE module also includes residual connections, which adjust the number of channels of the input features by 1×1 convolution when the number of channels of the input features is inconsistent with that of the output features, and then fuse them with the features output by the output mapping unit.

6. The method for detecting defects in industrial parts based on a multi-level dynamic feature-enhanced YOLOv11 network according to claim 1, characterized in that, The ACFM module includes a channel alignment unit, a local feature branch, a context feature branch, a weight generation unit, and a feature fusion unit. Features from different network layers with the same spatial size are concatenated along the channel direction and input into the ACFM module, and then aligned by the channel alignment unit. The alignment features are processed by local feature branches and context feature branches respectively to obtain local feature L and context feature G; The weight generation unit generates a first weight α and a second weight β related to the spatial location based on the local feature L and the context feature G, and α+β=1 is satisfied at the same spatial location; The feature fusion unit dynamically weights the local features and context features according to α⊙L+β⊙G, and after convolution mapping, the dynamic weighting result is fused with the alignment features to obtain the output features of the ACFM module; where ⊙ represents element-wise multiplication.

7. The method for detecting defects in industrial parts based on a multi-level dynamic feature-enhanced YOLOv11 network according to claim 3, characterized in that, The neck network includes a top-down path and a bottom-up path: The 256×20×20 feature output from the backbone network is upsampled and concatenated with the 128×40×40 feature to obtain the 384×40×40 feature. The 128×40×40 feature is then obtained through the ACFM module and the C3k2 module. After further upsampling, it is concatenated with the 128×80×80 feature to obtain the 256×80×80 feature, and then processed by the ACFM module and C3k2 module to obtain the 64×80×80 feature; Subsequently, the samples are downsampled sequentially and concatenated with the intermediate features of the corresponding size in the top-to-bottom path to obtain 256×40×40 features and 512×20×20 features. These are then processed by the ACFM module and the C3k2 module respectively, resulting in 128×40×40 features and 256×20×20 features.

8. The method for detecting defects in industrial parts based on a multi-level dynamic feature-enhanced YOLOv11 network according to claim 7, characterized in that, The EDHead detection head receives 64×80×80, 128×40×40, and 256×20×20 features output from the neck network, and maps them to a preset number of channels through a shared 1×1 convolution. The mapped features are then fed into a classification branch and a regression branch, which are independent of each other. The classification branch outputs the predicted scores for each defect category, while the regression branch outputs the discrete distance distribution of the bounding box in four directions. The bounding box coordinates are obtained by integrating the distribution.

9. The method for detecting defects in industrial parts based on a multi-level dynamic feature-enhanced YOLOv11 network according to claim 1, characterized in that, The training loss in step S4 includes classification loss, bounding box loss based on cross-union ratio, and distribution focus loss. The total loss is expressed as follows: Total loss = ; in, For classifying losses, The bounding box regression loss is calculated based on the intersection and union relationship between the predicted bounding box and the true bounding box. For distribution focus loss; These are the weighting coefficients for the corresponding loss terms.

10. The method for detecting defects in industrial parts based on a multi-level dynamic feature-enhanced YOLOv11 network according to claim 1, characterized in that, In step S6, the industrial parts to be inspected are transported to the image acquisition station. After receiving the image acquisition trigger signal, the image of the industrial parts to be inspected is acquired and input into the industrial parts defect detection model. When the confidence level of the detected defect reaches the preset threshold of the corresponding defect category, a detection record including the industrial parts identifier, defect category, defect location and defect confidence level is generated, and the detection result is sent to at least one of the display device, marking device, alarm device or sorting device.