A YOLO Model-Based Method for Detecting Surface Defects in Forgings

CN121481935BActive Publication Date: 2026-08-14WUHAN UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-17
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0005]有鉴于此,有必要提供一种基于YOLO模型的锻件表面缺陷检测方法,用以解决现有基于机器视觉的锻件表面缺陷检测方法对微细缺陷的检出率低且误检率高的问题

Benefits of technology

本发明首先对原始YOLO模型进行多维度改进得到目标检测模型。其中,目标检测模型将原始YOLO架构中颈部网络中的上采样模块替换为软最近邻插值模块、下采样模块替换为分组混洗卷积模块、特征拼接模块替换为特征调制融合模块;软最近邻插值模块和分组混洗卷积模块通过梯度自适应插值和空间自适应掩码,可以有效实现对裂纹等关键特征的提取,解决了原始YOLO模型上、下采样模块导致的缺陷边缘模糊和微细磁痕湮灭等问题。特征调制融合模块则可以有效强化特征并抑制噪声,避免了传统特征拼接操作导致的复杂背景下关键缺陷信号淹没的问题。以及,还新增空间深度转换卷积模块和CSPOK模块,空间深度转换卷积模块用于对原始YOLO架构中骨干网络输出的第二层特征图进行小目标信息提取,并将提取得到的含小目标信息的特征图输出至原始YOLO架构中第二个特征调制融合模块;CSPOK模块用于对第二个特征调制融合模块输出的特征图进行多尺度上下文信息提取以及融合,并将融合后的特征图输出至原始YOLO架构中颈部网络中的第二个瓶颈模块。新增的空间深度转换卷积模块和CSPOK模块可以优化对微小目标的特征提取和融合能力,从而提升对小目标的检测能力,并且还不会增加太多计算量。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121481935B_ABST
    Figure CN121481935B_ABST
Patent Text Reader

Abstract

This invention relates to a method for detecting surface defects in forgings based on the YOLO model, belonging to the field of image processing technology. The method includes: obtaining a target detection model by multi-dimensionally improving the original YOLO model; replacing the upsampling module in the neck network of the original YOLO architecture with a soft nearest neighbor interpolation module, the downsampling module with a grouped shuffling convolution module, and the feature stitching module with a feature modulation fusion module; and adding a spatial depth transformation convolution module and a CSPOK module to optimize the feature fusion capability for small targets; inputting the image of the forging to be detected into the trained target detection model to obtain the surface defect detection result. This invention can improve the model's ability to identify multi-scale, low-contrast defects on the surface of forgings in complex backgrounds.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to a method for detecting surface defects in forgings based on the YOLO model. Background Technology

[0002] Forgings are key basic components in fields such as machinery manufacturing, aerospace, and energy equipment, and their surface quality directly affects the mechanical properties and service life of the products. During the forging process, due to factors such as material inhomogeneity, fluctuations in process parameters, or die wear, defects such as cracks, folds, pits, and scratches are easily generated on the surface of forgings. These defects may propagate during subsequent processing or service, leading to stress concentration, fatigue fracture, or even catastrophic accidents, seriously affecting the safety and reliability of equipment.

[0003] Currently, the detection of surface defects in forgings still mainly relies on manual visual inspection. Manual inspection suffers from low efficiency, high labor intensity, and susceptibility to subjective factors, failing to meet the demands of modern intelligent manufacturing for efficient and automated inspection. In recent years, the rapid development of machine vision technology has provided new solutions for forging surface defect detection. Image processing-based automatic detection technology can achieve non-contact, high-precision defect identification, significantly improving detection efficiency and reliability. With breakthroughs in deep learning technology, target detection algorithms based on convolutional neural networks (CNNs) have shown great potential in the field of industrial defect detection. Among them, the YOLO series of algorithms achieves an excellent balance between detection speed and accuracy and is widely used in real-time target detection tasks. Compared to traditional algorithms, the YOLO algorithm can learn defect features end-to-end, adapting to defects of different sizes and shapes, while meeting the requirements of efficient and real-time detection. However, the YOLO algorithm still has some problems when detecting surface defects in forgings: 1. Under complex fluorescent backgrounds, the acquired images have low contrast and high noise, and the feature extraction capability of the detection model is insufficient, which can easily lead to false detections and false negatives.

[0004] 2. Some shallow microcracks have weak magnetic leakage signals, resulting in extremely fine magnetic traces with low contrast to the background and insignificant visual features, leading to a high rate of missed detection for microcracks. Summary of the Invention

[0005] In view of this, it is necessary to provide a YOLO model-based method for detecting surface defects in forgings to solve the problems of low detection rate and high false detection rate of existing machine vision-based methods for detecting surface defects in forgings.

[0006] To address the above problems, this invention provides a method for detecting surface defects in forgings based on the YOLO model, comprising: A multi-dimensional improvement to the original YOLO model yields an object detection model. Specifically, this model replaces the upsampling module in the neck network of the original YOLO architecture with a soft nearest neighbor interpolation module, the downsampling module with a grouped shuffling convolution module, and the feature concatenation module with a feature modulation fusion module. Furthermore, it adds a spatial depth transformation convolution module and a CSPOK module. The spatial depth transformation convolution module extracts small target information from the second-layer feature map output by the backbone network in the original YOLO architecture and outputs the extracted feature map containing small target information to the second feature modulation fusion module in the original YOLO architecture. The CSPOK module extracts and fuses multi-scale contextual information from the feature map output by the second feature modulation fusion module and outputs the fused feature map to the second bottleneck module in the neck network of the original YOLO architecture. The target detection model is trained based on the dataset to obtain a trained target detection model. The image of the forging to be detected is then input into the trained target detection model to obtain the surface defect detection result.

[0007] In one possible implementation, the feature modulation fusion module is used to generate a weight coefficient matrix based on multiple input feature maps, perform weighted processing on the multiple feature maps based on the weight coefficient matrix, and fuse the weighted feature maps.

[0008] In one possible implementation, the feature modulation fusion module is used to perform global average pooling on multiple input feature maps to obtain global information, and then generate a weight coefficient matrix based on the global information using a multilayer perceptron and a Softmax function.

[0009] In one possible implementation, the soft nearest neighbor interpolation module is used to perform weighted fusion of nearest neighbor pixels in the input feature map based on a learnable weight matrix to generate an upsampled feature map.

[0010] In one possible implementation, the weight matrix is ​​determined based on the ratio of the resolution of the input feature map of the soft nearest neighbor interpolation module to the resolution of the preset output upsampled feature map.

[0011] In one possible implementation, the grouped shuffling convolution module is used to perform ordinary convolution and depthwise separable convolution on the input feature map respectively, and output the convolutional feature maps after splicing and shuffling.

[0012] In one possible implementation, training the object detection model based on the dataset includes: A dataset for fluorescent magnetic particle detection on the surface of forgings was constructed, and the dataset was enhanced and preprocessed. The object detection model is trained using the preprocessed dataset.

[0013] In one possible implementation, the method further includes: The trained object detection model is evaluated using precision, recall, and average precision across all classes.

[0014] The beneficial effects of this invention are: This invention first improves the original YOLO model in multiple dimensions to obtain a target detection model. Specifically, the target detection model replaces the upsampling module in the neck network of the original YOLO architecture with a soft nearest neighbor interpolation module, the downsampling module with a grouped shuffling convolution module, and the feature concatenation module with a feature modulation fusion module. The soft nearest neighbor interpolation module and the grouped shuffling convolution module, through gradient adaptive interpolation and spatial adaptive masking, can effectively extract key features such as cracks, solving the problems of blurred defect edges and annihilation of fine magnetic traces caused by the upsampling and downsampling modules in the original YOLO model. The feature modulation fusion module can effectively enhance features and suppress noise, avoiding the problem of key defect signals being submerged in complex backgrounds caused by traditional feature concatenation operations. Furthermore, a new Spatial Depth Transformation Convolutional (SDC) module and a CSPOK module have been added. The SDC module extracts small target information from the second-layer feature map output by the backbone network in the original YOLO architecture and outputs the extracted feature map containing small target information to the second feature modulation and fusion module in the original YOLO architecture. The CSPOK module extracts and fuses multi-scale contextual information from the feature map output by the second feature modulation and fusion module and outputs the fused feature map to the second bottleneck module in the neck network of the original YOLO architecture. The newly added SDC module and CSPOK module can optimize the feature extraction and fusion capabilities for small targets, thereby improving the detection capability of small targets, without increasing the computational cost too much.

[0015] Furthermore, the target detection model is trained based on the dataset, and the trained target detection model is used to identify the surface defects of the forging in the image. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This invention provides a target detection model based on the YOLO11 architecture; Figure 2 A schematic diagram of an MFM module structure provided by the present invention; Figure 3 This invention provides a schematic diagram of a CSPOK module structure. Figure 4 This is a schematic diagram of a GSConv module structure provided by the present invention. Detailed Implementation

[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0019] In the description of the embodiments of this invention, unless otherwise stated, "a plurality of" means two or more. The terms "first," "second," etc., used in the embodiments of this invention are used to distinguish similar objects, and are not used to describe a specific order or sequence, nor to indicate or imply their relative importance or implicitly specify the number of indicated technical features. It should be understood that such data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class, and the number of objects is not limited; for example, a first object can be one or more.

[0020] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0021] This invention provides a method for detecting surface defects in forgings based on the YOLO model, comprising: Step 1: Improve the original YOLO model in multiple dimensions to obtain the object detection model.

[0022] The original YOLO architecture can be a newer version of the YOLO architecture, such as YOLOv11.

[0023] Then, it can be improved in multiple dimensions to obtain the object detection model. The improvements include: adding a P2 detection layer to the original YOLO architecture and designing a small object enhancement pyramid structure. Specifically, a Space-to-depth Convolutional (SPDConv) module and a CSPok (CSP-Omni-Kernel) module are added. The Space-to-depth Convolutional (SPDConv) module is used to extract small object information from the second layer feature map output by the backbone network in the original YOLO architecture, and outputs the extracted feature map containing small object information to the second feature modulation and fusion module in the original YOLO architecture. The CSPok module is used to extract and fuse multi-scale contextual information from the feature map output by the second feature modulation and fusion module, and outputs the fused feature map to the second bottleneck module in the neck network of the original YOLO architecture. The bottleneck module is the C3 module or C3k2 module in the YOLO architecture, etc. In addition, the improvements include replacing the upsampling module in the neck network of the original YOLO architecture with a soft nearest neighbor interpolation (SNI) module, the downsampling module with a group shuffle convolution (GSConv) module, and the feature concatenation module with a multi-scale feature modulation (MFM) module.

[0024] Reference Figure 1 This paper illustrates a target detection model based on the YOLO11 architecture provided by the present invention. The target detection model includes a backbone network, a neck network, and a detection network connected in sequence. The backbone network includes an Input module to a C2PSA module, used for multi-scale feature extraction of the input image, and outputs P1-P5 feature maps of different scales through the first to fifth C3k2 modules. The P1-P5 feature maps represent, respectively, a 1 / 2 scale feature map with 16 channels, a 1 / 4 scale feature map with 32 channels, a 1 / 8 scale feature map with 64 channels, a 1 / 16 scale feature map with 128 channels, and a 1 / 32 scale feature map with 256 channels. The P2 feature map is also the second layer feature map.

[0025] The neck network consists of the first SNI module to the eighth C3k2 module, which are used to fuse the multi-scale features output by the backbone network and output the P3-P5 fused feature map.

[0026] The detection network, known as the Detect part, is used to perform detection based on the P3-P5 fused feature map and output the detection results.

[0027] This embodiment mainly improves the neck network.

[0028] Step 2: Train the target detection model based on the dataset to obtain the trained target detection model, and input the image of the forging to be detected into the trained target detection model to obtain the surface defect detection result.

[0029] After constructing the target detection model, it can be trained using a fluorescent magnetic particle detection dataset of forging surfaces. The trained model is then used to detect images of the forging to be inspected, yielding the detection results. These results can include whether defects are present, the type of defect, and its location.

[0030] The YOLO-based forging surface defect detection method provided in this embodiment can be applied to a YOLO-based forging surface defect detection system. This system can be a software system running on a terminal device. The terminal device can be a tablet computer, in-vehicle device, augmented reality (AR) / virtual reality (VR) device, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), mobile phone, etc. This embodiment does not impose any restrictions on the specific type of terminal device.

[0031] In summary, this embodiment achieves the extraction of key features such as cracks by replacing the upsampling module in the neck network of the original YOLO architecture with a soft nearest neighbor interpolation module and the downsampling module with a grouped shuffling convolution module. This solves the problems of blurred defect edges and annihilation of fine magnetic traces caused by the upsampling and downsampling modules in the original YOLO model. Replacing the feature concatenation module with a feature modulation and fusion module effectively enhances features and suppresses noise, avoiding the problem of key defect signals being submerged in complex backgrounds caused by traditional feature concatenation operations. Furthermore, a spatial depth transformation convolution module and a CSPOK module are added to the original YOLO architecture, improving the detection capability for small targets without significantly increasing computational cost.

[0032] Furthermore, the target detection model is trained based on the dataset, and the trained target detection model is used to identify the surface defects of the forging in the image.

[0033] In some embodiments of the present invention, the MFM module is used to generate a weight coefficient matrix based on multiple input feature maps, perform weighted processing on the multiple feature maps based on the weight coefficient matrix, and fuse the weighted feature maps.

[0034] In some embodiments of the present invention, the MFM module is used to perform global average pooling on multiple input feature maps to obtain global information, and to generate a weight coefficient matrix based on the global information through a multilayer perceptron and a Softmax function.

[0035] Reference Figure 2 This diagram illustrates a schematic of an MFM module structure provided by the present invention. The MFM module includes a GAP (Global Average Pooling) layer, an MLP (Multi-Layer Perceptron) layer, a normalization layer, a Concat (Concatenation) layer, and a Conv (Convolutional) layer. The GAP layer is used to perform global average pooling on multiple input feature maps to obtain global information. The MLP and normalization layers are used to perform feature transformation, nonlinear mapping, and normalization using the Softmax function on the global information, respectively, to obtain a weight coefficient matrix. Then, the multiple feature maps, after being weighted based on the weight coefficient matrix, are sequentially concatenated and convolved by the Concat and Conv layers.

[0036] Continue to refer to Figure 1 Since small target detection is often limited by low resolution and receives less feature attention, this embodiment adds a P2 detection layer specifically optimized for small targets. By introducing lower-level convolutional features, it can better capture the detailed information of small targets and avoid losing this information in traditional high-level feature maps. However, directly adding the P2 feature map would lead to a surge in computation and interference from low-level feature noise in small target recognition. Therefore, a small target detection layer (P2 detection layer) is added to the original three detection layers (P3-P5 detection layers) of the neck network. The P2 feature map output from the P2 detection layer is added after two rounds of upsampling and feature modulation fusion at detection layers P4 and P5. Compared to directly adding the P2 feature map, the P2 feature map, after passing through SPDConv, obtains features rich in small target information and is fused with the P3 feature map. Then, the CSP idea and an improved Omni-Kernel based CSP-Omni-Kernel are used for feature fusion to obtain the fused features.

[0037] Reference Figure 3The diagram illustrates a CSPOK module structure provided by this invention. The CSPOK module includes: sequentially connected convolutional layers, a Split feature segmentation layer, parallel multi-scale feature extraction layers Omni-Kernel and Concat layers, and convolutional layers. The output of the second MFM module first passes through a convolutional layer, then the features are divided into two branches (OmniKernel branch and identity mapping branch) by the Split layer. One branch utilizes the OmniKernel multi-scale feature extraction layer for multi-scale feature extraction. The Omni-Kernel layer consists of three branches: a global branch, a large branch, and a local branch, which can effectively learn feature representations from global to local, ultimately improving the detection performance of small targets. The other branch undergoes identity mapping (the identity mapping branch retains the original features), and then the Concat layer concatenates the outputs of the two branches along the channel dimension. Finally, the convolutional layer performs feature fusion and outputs the results to the second C3k2 module of the neck network.

[0038] In some embodiments of the present invention, the SNI module is used to perform weighted fusion of nearest neighbor pixels in the input feature map based on a learnable weight matrix to generate an upsampled feature map; wherein, the weight matrix is ​​determined according to the ratio of the resolution of the input feature map of the soft nearest neighbor interpolation module to the resolution of the preset output upsampled feature map.

[0039] In object detection models, feature fusion typically requires upsampling feature maps at different levels, with nearest neighbor interpolation and transposed convolution being two commonly used methods. However, the upsampled feature maps mainly contain abstract high-level semantic information rather than the fine-grained details of the original image. While transposed convolution can learn more flexible upsampling methods, it introduces additional computational overhead and inference latency. Traditional nearest neighbor interpolation suffers from a "hard allocation" problem in the upsampling process of object detection, leading to jagged edges and misalignments in the feature map. The SNI module introduces a learnable soft weight allocation mechanism, enabling the upsampled feature locations to more smoothly fuse with surrounding pixel information, improving the accuracy of small object detection. The SNI module operates as follows: first, the input feature map is preprocessed, and then a learnable weight matrix is ​​used... α The surrounding original pixels are weighted and fused, and the output feature map is obtained after weighted fusion. Y It preserves the continuity of the original features while avoiding the jagged effect. The SNI module borrows the idea of ​​SoftMax softening the Max function, optimizing the "hard" operation of nearest neighbor interpolation, thereby alleviating feature misalignment problems and improving fusion results. Its mathematical expression is as follows:

[0040] in, ResolutionX and ResolutionY These are high-level feature maps (X ) and low-level feature maps ( Y (resolution).

[0041] The SNI module adjusts the influence of high-level semantic features on low-level features based on the scaling factor of the feature map. Specifically, as the scaling factor increases, the influence of high-level semantic features on low-level features weakens.

[0042] In some embodiments of the present invention, the GSConv module is used to perform ordinary convolution and depthwise separable convolution on the input feature map respectively, and output the convolutional feature maps after splicing and shuffling.

[0043] Reference Figure 4 This diagram illustrates a schematic of the GSConv module structure provided by the present invention. The GSConv module is a lightweight convolutional module composed of three core components: a standard 3×3 convolution, a 5×5 depthwise separable convolution, and a feature channel shuffle operation. The module first performs preliminary feature extraction and downsampling on the input feature map using a standard 3×3 convolution (Conv), effectively capturing local spatial features. Simultaneously, it uses a parallel 5×5 depthwise separable convolution (DWConv) for deep feature extraction. This convolution decomposes the standard convolution into channel-wise convolution and 1×1 point convolution, significantly reducing computation while capturing broader contextual information using a larger 5×5 receptive field. Subsequently, the module concatenates the output feature maps of the two convolutional branches through a Concact layer to achieve multi-scale feature fusion. Finally, a channel shuffle operation rearranges the concatenated features, promoting full interaction between features from different branches and effectively avoiding feature isolation problems caused by grouped convolutions.

[0044] In some embodiments of the present invention, the step of training the target detection model based on a dataset includes: A dataset for fluorescent magnetic particle detection on the surface of forgings was constructed, and the dataset was enhanced and preprocessed. The object detection model is trained using the preprocessed dataset.

[0045] Specifically, the images in the dataset can originate from a production line for magnetic particle inspection of steel forgings, and the dataset contains large-sized, small-sized, and multi-location magnetic indentation defects. The dataset is then expanded by performing image enhancement on the acquired raw images.

[0046] In some embodiments of the present invention, the images in the dataset may also include multiple forging surface defect categories; the multiple forging surface defect categories include at least one of crack defects, fold defects, pit defects, and scratch defects.

[0047] In some embodiments of the present invention, the method for detecting surface defects in forgings based on the YOLO model further includes: By using precision, recall, and the average precision across all classes... mAP The trained target detection model is evaluated.

[0048]

[0049] Among them, accuracy rate refers to the percentage of correct predictions being positive ( TP The percentage of all predictions is positive. TP + FP The recall rate refers to the proportion of correctly predicted positive ( ). TP The actual percentage of ) is positive ( TP + FN The proportion of ) C Represents the total number of detection categories. AP i Indicates the first i Average accuracy of the class TP Indicates a real example, FP Indicates a false positive example. FN This indicates a false negative.

[0050] To further and more intuitively understand the gain effect of each module on the YOLO11 network model, this embodiment sets up multiple ablation experiments, as shown in Table 1: Table 1 Ablation Experiment Results of the Improved YOLO11 Model

[0051] The above model was built and trained on a Linux server. The virtual environment used is described as follows: CPU model is Intel Core i9-9900X, GPU model is NAVID RTX 2070, operating system is Ubuntu 22.04, Python version is 3.11, PyTorch version is 2.4, and CUDA version is 12.6.

[0052] The dataset used for training, validation, and testing the above model contains a total of 8,650 defect images. The dataset is divided into training, validation, and testing sets in an 8:1:1 ratio, with 6,920 images in the training set, 865 images in the validation set, and 865 images in the testing set.

[0053] In Table 1, Small Object Feature Pyramid Networks (SOEP) refers to the local network structure consisting of SPDConv modules to CSPOK modules. SG refers to the SNI module and GSConv module. mAP@0.5 represents the average accuracy with an Intersection over Union (IoU) threshold of 0.5, and mAP@0.5:0.95 represents the average accuracy at different IoU thresholds (from 0.5 to 0.95, with a step size of 0.05).

[0054] As shown in Table 1, the optimized final model (YOLO11-SOEP-SG-MFM) improved mAP@0.5 and mAP@0.5:0.95 by 3.9% and 2.1% respectively compared to the original YOLO11 model. This demonstrates that the method in this example can effectively improve the detection performance of the model.

[0055] Existing object detection algorithms based on convolutional neural networks (CNNs) (such as YOLO and Faster R-CNN) have been applied to industrial inspection, but their upsampling and downsampling processes easily lead to the loss or blurring of semantic information and edge features of minute defects. Especially in fluorescent magnetic particle inspection scenarios, the magnetic trace signals of micro-cracks are weak and easily buried by background noise during feature fusion. Moreover, existing models mostly use simple concatenation or addition operations for multi-scale feature fusion, lacking the ability to adaptively weight channel and spatial information, and thus failing to effectively enhance defect features and suppress irrelevant background interference in complex backgrounds.

[0056] This invention directly addresses the practical challenges of fluorescent magnetic particle detection, making targeted and systematic improvements to the core structure of the YOLO11 model. It enhances the ability to identify multi-scale and feature-poor defects on the surface of forgings under complex backgrounds, and solves the problem of insufficient detection accuracy of existing intelligent fluorescent magnetic particle detection technologies for forging surface defects.

[0057] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.

[0058] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for detecting surface defects in forgings based on the YOLO model, characterized in that, include: A multi-dimensional improvement to the original YOLO model yields an object detection model. Specifically, this model replaces the upsampling module in the neck network of the original YOLO architecture with a soft nearest neighbor interpolation module, the downsampling module with a grouped shuffling convolution module, and the feature concatenation module with a feature modulation fusion module. Furthermore, it adds a spatial depth transformation convolution module and a CSPOK module. The spatial depth transformation convolution module extracts small target information from the second-layer feature map output by the backbone network in the original YOLO architecture and outputs the extracted feature map containing small target information to the second feature modulation fusion module in the original YOLO architecture. The CSPOK module extracts and fuses multi-scale contextual information from the feature map output by the second feature modulation fusion module and outputs the fused feature map to the second bottleneck module in the neck network of the original YOLO architecture. The target detection model is trained based on the dataset to obtain a trained target detection model. The image of the forging to be detected is then input into the trained target detection model to obtain the surface defect detection result.

2. The method for detecting surface defects in forgings based on the YOLO model according to claim 1, characterized in that, The feature modulation fusion module is used to generate a weight coefficient matrix based on multiple input feature maps, perform weighted processing on the multiple feature maps based on the weight coefficient matrix, and fuse the weighted feature maps.

3. The method for detecting surface defects in forgings based on the YOLO model according to claim 2, characterized in that, The feature modulation fusion module is used to perform global average pooling on multiple input feature maps to obtain global information, and then generate a weight coefficient matrix based on the global information using a multilayer perceptron and a Softmax function.

4. The method for detecting surface defects in forgings based on the YOLO model according to claim 1, characterized in that, The soft nearest neighbor interpolation module is used to perform weighted fusion of nearest neighbor pixels in the input feature map based on a learnable weight matrix to generate an upsampled feature map.

5. The method for detecting surface defects in forgings based on the YOLO model according to claim 4, characterized in that, The weight matrix is ​​determined based on the ratio of the resolution of the input feature map of the soft nearest neighbor interpolation module to the resolution of the preset output upsampled feature map.

6. The method for detecting surface defects in forgings based on the YOLO model according to claim 1, characterized in that, The grouped shuffling convolution module is used to perform ordinary convolution and depthwise separable convolution on the input feature map respectively, and output the convolution feature map after splicing and shuffling.

7. The method for detecting surface defects in forgings based on the YOLO model according to claim 1, characterized in that, The training of the target detection model based on the dataset includes: A dataset for fluorescent magnetic particle detection on the surface of forgings was constructed, and the dataset was augmented. The object detection model is trained using the preprocessed dataset.

8. The method for detecting surface defects in forgings based on the YOLO model according to claim 1, characterized in that, The method further includes: The trained object detection model is evaluated using precision, recall, and average precision across all classes.

Citation Information

Patent Citations

  • Steel surface defect detection method based on improved YOLO model

    CN116740051A

  • Dense pedestrian detection method based on improved YOLOv5s lightweight model

    CN119380377A