Steel coil end face defect detection method and system based on CBAM-BiFPN and multi-loss optimization

By adopting a detection method based on CBAM-BiFPN and multi-loss optimization, the problems of easy omission of small targets and insufficient feature fusion in high-resolution images are solved, and efficient and accurate steel coil end face defect detection is achieved, which is suitable for online quality inspection of high-speed production lines.

CN121147129APending Publication Date: 2025-12-16WUHAN TEXTILE UNIV

Patent Information

Application Number
CN202511228121.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-29
Publication Date
2025-12-16

AI Technical Summary

Technical Problem

Existing technologies are inefficient in high-resolution image processing, prone to missing small target defects, and suffer from insufficient feature fusion and sample imbalance, resulting in a high rate of missed detection of small targets. This problem has not been effectively solved, especially in the detection of defects on the end face of steel coils.

Method used

A detection method based on CBAM-BiFPN and multi-loss optimization is adopted, including image preprocessing, region extraction, image slicing and data augmentation. The YOLOv11 network, which combines the CBAM attention mechanism and the BiFPN feature fusion structure, is trained by multi-loss function optimization and performs spatial coordinate mapping and redundant region fusion of the detection results.

Benefits of technology

It significantly improves the accuracy and efficiency of steel coil end-face defect detection, reduces hardware costs, is suitable for online quality inspection on high-speed production lines, reduces missed and false detection rates, and improves production efficiency and the level of inspection automation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121147129A_ABST
    Figure CN121147129A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of computer vision and industrial defect detection, and discloses a steel coil end face defect detection method and system based on CBAM-BiFPN and multi-loss optimization, and the method comprises the steps: image preprocessing and region extraction: extracting a steel coil end face region through OpenCV and other image processing methods; dividing the high-resolution image into a plurality of small blocks and performing data enhancement; the method comprises the following steps: constructing a YOLOv11 network based on CBAM-BiFPN, introducing a CBAM attention mechanism and BiFPN feature fusion structure, and constructing an improved YOLOv11 detection network; multi-loss function joint optimization training is carried out, and model training is carried out in combination with loss functions such as Focal Loss and WIoU; and fusion of detection results and defect reconstruction output: reconstructing original image defects of all tile image detection results in a space coordinate mapping and redundant region fusion mode, and realizing high-precision overall detection output. Compared with a traditional method, the method still has the high recognition capability in a complex background and low-contrast scene, the detection precision and stability are obviously improved, and higher industrial adaptability and practical value are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to but is not limited to the technical field of computer vision and industrial defect detection, and particularly relates to a steel coil end face defect detection method and system based on CBAM-BiFPN and multi-loss optimization. BACKGROUND

[0002] Defect detection is an important link to ensure the safe operation of railways. By identifying surface defects such as cracks and wear in a timely manner, train accidents can be effectively prevented, the service life of the rails can be extended, maintenance costs can be reduced, and transportation efficiency can be improved. Traditional defect detection methods are mostly based on image overall input for target recognition, but in ultra-high resolution images, due to the small target, complex background, large GPU memory burden and other problems, the detection accuracy and real-time performance are both restricted.

[0003] However, the current high-resolution image defect detection has the following problems: (1) fixed block has problems of waste of computing power, memory overflow and target fragmentation. (2) There are defects such as one-way information transfer, weak scale association and parameter expansion in traditional feature fusion. (3) There are three big problems of sample imbalance, optimization conflict and boundary regression inaccuracy in target detection.

[0004] The existing defect detection for the steel coil end face scene has limitations: Patent No. CN116402763B proposes to introduce attention mechanism to optimize the feature extraction ability of YOLOv7 (You Only Look Once), realizing high-precision detection function for small targets and weak flaws, but does not introduce multi-scale feature fusion structure and lightweight adaptive block strategy; the literature "Defect Detection for Metal Shaft Surfaces Based on an Improved YOLOv5 Algorithm and Transfer Learning" has certain similarity with this paper in the basic network structure design, both of which adopt CBAM attention mechanism combined with BiFPN multi-scale fusion structure, but the literature mainly focuses on metal shaft surface defect detection, and this paper is aimed at steel coil end face image. In order to adapt to large size images and improve small target detection effect, this scheme introduces a tile-level detection strategy based on tile cutting, and designs a defect result coordinate reconstruction and fusion module in the post-processing stage to realize the visualization output of the end face defects. Patent No. CN116934685A proposes to optimize the target detection performance by introducing Focal Loss and CIoU, which performs well in difficult sample detection and box fitting accuracy, but still lacks in high resolution processing strategy, feature fusion depth, attention mechanism guidance, and multi-loss coordination; Patent No. CN116664478A proposes to fuse global multi-head self-attention and CBAM style channel and spatial attention mechanism, realizing precise positioning of fine-grained defects in complex texture background, enhancing the model's expression ability and stability of target features, but does not use lightweight structure or image adaptive cutting strategy, and does not use compound loss functions such as Focal Loss and WIoU, which still has obvious deficiencies in efficiency and accuracy when detecting large size images or small target aggregation areas.

[0005] At present, there is no effective solution to the related technical problems.

[0006] In view of the above analysis, the existing technology has the technical problems that need to be solved urgently:

[0007] High resolution image processing efficiency is low, small target defects are easy to miss detection, feature fusion is not sufficient, and sample imbalance leads to high small target miss detection rate. SUMMARY

[0008] In view of the problems existing in the prior art, the present application provides a steel coil end face defect detection method and system based on CBAM-BiFPN and multi-loss optimization.

[0009] The application is a steel coil end face defect detection method based on CBAM-BiFPN and multi-loss optimization, which specifically comprises:

[0010] S1: image preprocessing and region extraction, the steel coil end face region is extracted through image processing methods such as OpenCV to provide input for subsequent block detection;

[0011] S2: image slicing and data enhancement, the high-resolution image is divided into several small blocks and data enhancement is performed;

[0012] S3: CBAM-BiFPN-based YOLOv11 network construction, CBAM attention mechanism and BiFPN feature fusion structure are introduced to construct an improved YOLOv11 detection network with high-efficiency feature extraction capability;

[0013] S4: multi-loss function joint optimization training, model training is performed in combination with loss functions such as Focal Loss and Wiou;

[0014] S5: detection result fusion and defect reconstruction output, the detection results of each tile image are reconstructed into the original image defects through spatial coordinate mapping and redundant region fusion, realizing high-precision overall detection output.

[0015] Further, the S1 is as follows:

[0016] (1) image acquisition, the steel coil end face image is acquired through an industrial camera or a high-speed acquisition device, ensuring that the imaging angle is perpendicular to the end face, the image format is an RGB color image, the resolution is 5120*5120 pixels (px), and the steel coil end face region is completely covered;

[0017] (2) image preprocessing, the original RGB image is converted into a grayscale image, the weighted average method is used to simplify the image channel and retain key structural information, and the Gaussian blur is applied to the grayscale image;

[0018] (3) edge detection, the Canny edge detection algorithm is used to extract the image edge, double thresholds are set to highlight the steel coil region boundary and suppress irrelevant details, and an edge image is generated for subsequent contour extraction and region segmentation;

[0019] (4) image binarization, the Otsu algorithm or an adaptive threshold method is used to perform binarization processing on the image, the steel coil region and the background are significantly separated, and a black and white image is output, wherein the white region represents the possible steel coil region, and the black region is the background region;

[0020] (5) morphological processing, morphological closing operation is performed on the binary image to fill the edge broken area, and then opening operation is performed to remove small isolated noise regions and retain the main target region structure;

[0021] (6) Contour extraction and target positioning, call the findContours function of OpenCV to extract the contour information of all connected regions, select the largest region contour as the steel coil main body based on the contour area, use the minAreaRect function to fit the minimum bounding rectangle of the main contour, extract the corner coordinates, width and height, and rotation angle;

[0022] (7) Region cropping and affine correction, construct an affine transformation matrix according to the fitted minimum bounding rectangle, rotate and correct the steel coil region to the horizontal or vertical direction, crop the original image using the coordinate information, and extract a sub-image containing the complete steel coil region, which provides input images for subsequent block and defect detection.

[0023] Further, the S2, the steps are as follows:

[0024] (1) Calculate the minimum bounding rectangle of the steel coil region, input the foreground image after morphological processing, use the contour extraction algorithm to identify the main contour, and fit its minimum bounding rectangle to obtain the center coordinates (cx, cy), width w, height h, and angle angle of the steel coil region, which are used for subsequent region extraction and rotation alignment;

[0025] (2) Self-adaptive determination of block parameters, according to the length and width of the steel coil rectangular region, self-adaptively calculate the number of cutting blocks and the size of each block, the target size is 512*512px, when cutting, preferentially cover the core area, and reserve 5-10% of the upper and lower or left and right overlap area;

[0026] (3) Sliding window cutting and numbering saving, for the cropped region, use a sliding window to traverse the steel coil region from left to right and from top to bottom by steps, save each tile block as an independent file, and record it in a unified naming format, save the corresponding label file at the same time, which is convenient for quickly building a training set;

[0027] (4) Foreground validity screening, remove invalid samples to ensure that the tiles for model training contain a certain amount of steel coil region or feature texture, and reduce false positives or training bias;

[0028] (5) Image defect labeling, use LabelMe and other data labeling tools that can generate YOLO format to label the defects in each tile image, including burrs, edge damage, edge cracks, lace patterns, and folds, save it as a.txt format required by YOLO training, each line is a defect target, and different defect types use standardized coding, which is used for subsequent model training;

[0029] (6) Data annotation quality check, overlay the image with the label and check it manually, make sure that each annotation box does not exceed the image boundary, count the number of defects of each type, judge whether there is serious class imbalance, ensure that each image has a corresponding.txt file and the format is correct without missing items;

[0030] (7) Image data augmentation processing, using Albumentations library and other data augmentation tools to ensure that the image and label coordinates change synchronously during the augmentation process, including random horizontal and vertical flipping, brightness and contrast disturbance, random rotation;

[0031] (8) Data set division and organization, according to the training set 70%, the verification set 20%, the test set 10% division, at the same time ensure that the tile generated by the same large image block does not appear repeatedly in multiple subsets, the class distribution is balanced, and the enhanced samples only appear in the training set.

[0032] Further, the S3, the step comprises:

[0033] (1) Using YOLO series target detection framework (such as YOLOv11 or YOLOv8) as the basic structure, selecting the appropriate version according to the training efficiency, deployability and performance requirements;

[0034] (2) Introducing CBAM attention module (Convolutional Block Attention Module), the module is embedded between the main network (Backbone) and the Neck structure; replacing the traditional FPN structure with BiFPN (Bidirectional Feature Pyramid Network);

[0035] (3) The detection head maintains the multi-branch structure of the YOLO series, and the output includes classification score, boundary box center point coordinate and width height, and the feature map scale and anchor are set according to the size of the defect target in the data.

[0036] Further, the S4, in the loss function design aspect, adopts a multi-strategy fusion mechanism, which is as follows:

[0037] (1) The classification loss adopts Focal Loss:

[0038] FocalLoss=-α t (1-p t ) γ log (p t )

[0039] Where γ controls the degree of attention to difficult samples, and the typical value is 2;

[0040] (2) Position loss adopts WIoU (Weighted IoU);

[0041] (3) The overall structure of the joint loss function is a multi-weighted combination:

[0042]

[0043] The weights of each loss term can be adjusted through experiments to adapt to the task characteristics.

[0044] Further, the S5 comprises:

[0045] (1) Detection result remapping processing, converting the detection box coordinates in each tile to the global coordinate system in the original 5120x5120px image:

[0046] (1.1) Record the original position information of the tile cutting. In the image preprocessing and blocking stage, record the starting position (top-left corner coordinates) of each tile image in the whole image as (xoffset, yoffset);

[0047] (1.2) Coordinate translation transformation. For the defect frame detected in each tile image, the original coordinates are Then the mapped original image coordinates are:

[0048]

[0049] Similarly, the top-left and bottom-right coordinates of the bounding box are also translated in the same way;

[0050] (1.3) Coordinate normalization restoration

[0051] x = x norm × w tile + x offset

[0052] y = y norm × h tile + y offset

[0053] (2) Redundant prediction suppression and boundary fusion, cross-tile prediction result fusion and redundancy suppression:

[0054] (2.1) Unified detection box format. All prediction boxes are converted to absolute coordinate format in the original image, including (x, y, w, h, score, class);

[0055] (2.2) Fusion repeated detection frame, using the cross-tile **non-maximum suppression (NMS)** method, setting the IoU threshold (such as 0.3), screening the predicted frame, and retaining the defect frame with the highest score; deleting the repeated frame with IoU greater than the threshold;

[0056] (2.3) Boundary detection fusion optimization, if some edge tiles are cropped, the detection frame may only show part of it, and the complete defect area can be reconstructed by merging the geometry of the adjacent tile detection frame (for example, the center point distance and area ratio rule);

[0057] (3) Full image defect reconstruction visualization output, after fusing all detection results, the intuitive visualization and structured output of the defect on the original steel coil end face image can be realized:

[0058] (3.1) Defect drawing and classification labeling: draw all predicted frames with different colors; label the defect class name and confidence beside each frame.

[0059] (3.2) Defect statistics generation: count the number of each type of defect in the whole image; output the structured information such as defect area, position, aspect ratio; for subsequent quality evaluation or qualified judgment logic.

[0060] (3.3) Output format diversification support: support saving the visual detection result picture in the form of.jpg / .png; at the same time, generate the defect data table in the form of.json / .xml / .csv for system integration.

[0061] (4) Detection precision improvement in multi-target scene:

[0062] (4.1) Region confidence fusion: when multiple frames appear in the same region, weighted average fusion coordinates and score are used to improve the stability of the results;

[0063] (4.2) Edge compensation mechanism: for defects with incomplete edge detection in the tile, a "candidate re-detection" mechanism is introduced to re-propagate the defect boundary through the neighborhood tile;

[0064] (4.3) Uncertainty area re-labeling mechanism: areas with confidence lower than the threshold but concentrated can be marked as "suspected defect area" to assist manual review.

[0065] Another purpose of the present application is to provide a steel coil end face defect detection system based on CBAM-BiFPN and multi-loss optimization, which specifically comprises:

[0066] An image preprocessing and region extraction module for extracting the steel coil end face region by OpenCV image processing method;

[0067] An image cutting module is configured to divide a high-resolution image into a plurality of small blocks;

[0068] A data enhancement module is configured to perform data enhancement;

[0069] A network construction module is configured to construct a CBAM-BiFPN-based YOLOv11 network, introduce a CBAM attention mechanism and a BiFPN feature fusion structure, and construct an improved YOLOv11 detection network with high efficient feature extraction capability.

[0070] An optimization training module is configured to perform model training in combination with loss functions such as FocalLoss and WIoU.

[0071] A defect reconstruction output module is configured to reconstruct defects of an original image by spatial coordinate mapping and redundant region fusion of each tile image detection result, and realize high-precision overall detection output.

[0072] In combination with the above technical solutions and the technical problems solved, the technical solutions to be protected by the present application have the following advantages and positive effects:

[0073] The steel coil end face defect detection method and system based on CBAM-BiFPN and multi-loss optimization provided by the present application have the following beneficial effects compared with the prior art: In view of the problems of memory overflow, low operation efficiency and easy compression of small target features in the steel coil end face defect detection, a fixed scale image cutting method is proposed, which uniformly divides the whole image into 512*512px tiles, and establishes a spatial coordinate mapping mechanism to accurately record the positions of each tile in the original image. After the detection is completed, the overall detection result is reconstructed by coordinate reflection mapping and redundant fusion algorithm, effectively balancing the detection integrity of small targets and the processing efficiency of high-resolution images, and significantly improving the detection accuracy and system stability. The technical solution can not only be widely used in steel coil end face online quality inspection systems, but also be extended to other high-resolution industrial detection scenarios, reducing hardware costs while improving detection automation level and production yield, and having significant industrialization and commercialization value.

[0074] Compared with the existing detection methods for metal shaft surfaces, gear end surfaces and steel belt surfaces, the present application significantly improves the globality of feature extraction, fine-grained defect recognition ability and real-time performance, effectively reduces the miss detection and false detection rates, and is especially suitable for online quality inspection of high-speed production lines. The technical solution can be directly embedded in the existing visual detection system of the steel coil production and logistics link, significantly reducing the artificial re-inspection rate, improving the production efficiency by more than 20%, and at the same time having the potential to expand to other large-size coil product detection scenarios (such as aluminum coil, copper coil), having significant commercial value, and bringing stable economic benefits and competitive advantage to enterprises.

[0075] The technical solution of the present application solves the technical problem that people have been eager to solve but have always failed to succeed: the search results show that CBAM+BiFPN has been used for defect detection scenes such as metal shaft surface, gear end surface, and steel strip surface, but has not been used for steel coil end surface. At the same time, there is no existing public scheme for tile cutting detection and subsequent splicing reconstruction process of high-resolution images. Therefore, the present application has substantial differences and innovation in scene applicability, processing flow and system design.

[0076] In the field of industrial steel coil end surface defect detection, the existing mainstream scheme generally believes that multi-level attention mechanism and complex feature fusion structure will bring significant computational burden and reasoning delay, making it difficult to meet the strict real-time requirements of industrial production lines. Therefore, most detection networks choose to simplify the feature fusion layer or only use a single attention module when designing, sacrificing the expression ability and detection accuracy of the model. To solve this technical problem, the present application innovatively integrates CBAM spatial-channel attention and global multi-head self-attention mechanism in the BiFPN bidirectional feature pyramid network, and combines lightweight optimization and multi-loss function design, effectively improving the model's perception ability and positioning accuracy for fine-grained defects, while significantly reducing computational complexity and reasoning delay, overcoming the bottleneck that traditional complex fusion structures are difficult to apply to high-speed real-time detection, and meeting the actual needs of industrial production lines for steel coil end surface defect detection. BRIEF DESCRIPTION OF DRAWINGS

[0077] Figure 1 is the steel coil end surface defect detection method flowchart provided by the embodiment of the present application based on CBAM-BiFPN and multi-loss optimization;

[0078] Figure 2 is the complete improved YOLOv11 model structure flowchart provided by the embodiment of the present application;

[0079] Figure 3 is the steel coil end surface defect detection system module diagram provided by the embodiment of the present application based on CBAM-BiFPN and multi-loss optimization;

[0080] Figure 4 is the detection result fusion process schematic diagram provided by the embodiment of the present application. DETAILED DESCRIPTION

[0081] In order to make the purpose, technical scheme and advantages of the present application clearer and more apparent, the following will further describe the present application with embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.

[0082] As Figure 1As shown, the embodiment of the application provides a steel coil end face defect detection method applied to steel manufacturing industry based on CBAM-BiFPN and multi-loss optimization, which comprises the following steps:

[0083] S1: image preprocessing and region extraction, the steel coil end face region is extracted by image processing methods such as OpenCV, providing input for subsequent block detection;

[0084] S2: image slicing and data enhancement, the high-resolution image is divided into several small blocks and data enhancement is performed;

[0085] S3: CBAM-BiFPN-based YOLOv11 network construction, CBAM attention mechanism and BiFPN feature fusion structure are introduced to construct an improved YOLOv11 detection network with high-efficiency feature extraction capability;

[0086] S4: multi-loss function joint optimization training, model training is performed in combination with loss functions such as Focal Loss and Wiou;

[0087] S5: detection result fusion and defect reconstruction output, the detection results of each tile image are reconstructed into the original image defects through spatial coordinate mapping and redundant region fusion, realizing high-precision overall detection output.

[0088] In the embodiment of the application, the data signal processing process runs through the whole process of image acquisition, preprocessing, feature extraction, training optimization and detection result reconstruction, forming an end-to-end defect detection signal flow. First, in the image preprocessing link, the end face region is segmented and the boundary is extracted by using OpenCV, and the original steel coil end face image collected in a complex scene is converted into a structured input signal. In this process, background interference is eliminated through methods such as grayscale, edge detection and morphological filtering, and finally the end face ROI region signal is obtained, providing standardized initial data for subsequent block and deep model input.

[0089] In the image slicing and enhancement stage, the high-resolution end face region image is divided into small blocks of fixed size, and each tile image is input to the subsequent network as an independent signal channel. In this process, random rotation, brightness disturbance, scale scaling and other enhancement operators are added, which essentially increases the diversity of data distribution by introducing noise and disturbance signals, thereby improving the robustness of the model to different defect patterns under different working conditions. The image signal after slicing is mapped to tensor data after enhancement, forming an input matrix in a high-dimensional feature space.

[0090] In the network construction link, CBAM (Convolutional Block Attention Module) and BiFPN (Bidirectional Feature Pyramid Network) are introduced to form an improved YOLOv11 detection network. CBAM weights the input signal through channel attention and spatial attention, improving the importance recognition of feature channels; BiFPN unifies signals from different scales into a fused feature map through multi-level bidirectional path feature fusion, thereby enhancing the ability to capture subtle defects on the coil end face. At this time, the signal is transmitted between the convolution layer, the normalization layer and the activation function layer, gradually compressing, extracting and reconstructing high-level semantic information.

[0091] In the model training stage, a multi-loss function joint optimization method is adopted. FocalLoss mainly deals with the problem of positive and negative class imbalance in signal samples, improving the sensitivity to small target defects; and WIoU (Weighted Intersection over Union) loss performs fine geometric constraints on the overlapping signals of the detection frame and the real frame, effectively avoiding positioning deviation. The two types of loss functions play a synergistic role in updating the weight parameters during gradient backpropagation, ensuring that the detection signal processing link has both stability and high precision.

[0092] Finally, in the detection result fusion and defect reconstruction output link, the multi-channel prediction signals obtained by the cut detection are spliced and restored through spatial coordinate mapping and redundant area weighted fusion. In this process, redundant signals detected repeatedly are filtered out, and the edge overlapping area is smoothed by weighted averaging. The defect area in the finally reconstructed end face image signal is completely and accurately labeled, realizing overall defect recognition in the large-format high-resolution scene and ensuring the real-time and reliability of the end face quality detection of the steel manufacturing industry.

[0093] The embodiment of the present application provides a steel coil end face defect detection method based on CBAM-BiFPN and multi-loss optimization, which specifically comprises:

[0094] Step 1, image preprocessing and steel coil area extraction

[0095] Step 1.1, image acquisition

[0096] Step 1.1.1, acquire the steel coil end face image through an industrial camera or a high-speed acquisition device, ensure that the imaging angle is perpendicular to the end face, and avoid image distortion.

[0097] Step 1.1.2, the acquired image is an RGB color image with a resolution of 5120x5120px, which ensures complete coverage of the steel coil end face area.

[0098] Step 1.2, image preprocessing

[0099] Step 1.2.1, perform gray scale conversion on the original RGB image, use weighted average method to simplify image channels and retain key structural information. The specific steps are as follows:

[0100] (1) Read the original image matrix, get the three color channels (R, G, B) of the image, each pixel point contains three 8-bit values.

[0101] (2) Use weighted average method to calculate gray scale, according to the formula Gray = 0.299 * R + 0.587 * G + 0.114 * B, perform gray scale conversion on each pixel point in the image, ensure to retain image brightness and structural information while compressing data dimension.

[0102] (3) Output single-channel gray image matrix, used for subsequent noise suppression and edge detection

[0103] Step 1.2.2, apply Gaussian blur to the gray image, reduce image noise, suppress high-frequency interference, and improve edge detection stability. The specific steps are as follows:

[0104] (1) Select Gaussian kernel size and standard deviation: According to the image resolution and noise level, set the Gaussian filter kernel size to (5x5) or (3x3), and the standard deviation σ value to 1-1.5, which adapts to the characteristics of different steel coil images.

[0105] (2) Construct Gaussian filter: use two-dimensional Gaussian distribution function to construct smoothing kernel, the center weight is the largest, the edge weight gradually decays, and the weighted average is realized.

[0106] (3) Perform convolution operation on the entire gray image: apply Gaussian kernel sliding to each pixel point in the image and weighted sum its surrounding neighborhood, replace the center pixel value, and complete the blur smoothing process.

[0107] (4) Output Gaussian smoothed image, the image edge is well preserved but the noise is significantly suppressed, which is convenient for gradient calculation and double threshold judgment in subsequent Canny edge detection.

[0108] Step 1.3, edge detection

[0109] Step 1.3.1, use Canny edge detection algorithm to extract image edges, set double threshold to highlight steel coil area boundary and suppress irrelevant details. The specific steps are as follows:

[0110] (1) Calculate the image gradient. To find the area with the strongest brightness change in the image, which is the "possible edge". Use Sobel operator to calculate the brightness change rate of each pixel in horizontal direction (X axis) and vertical direction (Y axis), that is, gradient; get two gradient maps Gx and Gy, and calculate the gradient amplitude of each pixel and the direction θ = arctan(Gy / Gx).

[0111] (2) Non-maxima suppression (NMS). In order to refine the edge lines, remove the redundant pixels near the edge, and make the contour more clear, check whether each pixel point is the local maximum value in the gradient direction; if the gradient of a certain point is not the maximum value in its direction, set it to 0 (i.e. "suppress it").

[0112] (3) Double threshold detection. Set a higher threshold T_high and a lower threshold T_low; the pixel points greater than the high threshold are considered to be "strong edges" and are definitely retained; the pixel points less than the low threshold are considered to be "non-edges" and are directly discarded; the pixel points between the two thresholds are retained if they are connected to strong edges ("weak edges").

[0113] (4) Edge connection and output. By connecting strong edges and weak edges, a complete and continuous boundary contour is constructed; the final generated edge map is a binary image with pixel values of only 0 (background) and 255 (edge), which serves as the basis for subsequent contour extraction and positioning of the steel coil region.

[0114] Step 1.3.2, generate an edge image for subsequent contour extraction and region segmentation.

[0115] This step calls the Canny function in OpenCV to perform gradient calculation, non-maximum suppression, and double threshold judgment on the Gaussian blurred grayscale image, and extracts clear end face edge lines. This operation enhances the description ability of the steel coil end face structure and improves the accuracy and robustness of the target region contour extraction, providing structural support for the subsequent adaptive blocking and defect detection model input region.

[0116] Step 1.4, image binarization

[0117] Step 1.4.1, use Otsu algorithm or adaptive threshold method to perform binarization processing on the image, which significantly separates the steel coil region from the background. This step applies the global Otsu threshold algorithm or the adaptive local threshold method to the high-resolution steel coil end face grayscale image to achieve significant separation of the foreground steel coil region from the background. The specific steps are as follows:

[0118] (1) Divide the image into multiple small block regions;

[0119] (2) Calculate the local average brightness or weighted Gaussian mean for each small block;

[0120] (3) Subtract a constant C from the mean value to obtain the local threshold value of the region;

[0121] (4) Binaryzation judgment is made for each pixel point to generate a local binary image of the whole image. In the generated binary image, the foreground steel coil area is bright (255) and the background area is dark (0); this image can be used for subsequent: contour extraction, area positioning, automatic block cropping.

[0122] The Otsu method automatically selects the best segmentation point based on the histogram information of the whole image, and is suitable for uniform light scenes; the adaptive threshold method dynamically determines the threshold of each region according to the local statistical information of the image, and is suitable for complex light and reflection interference scenes. The above processing can effectively improve the positioning accuracy of the steel coil area and provide structural support for subsequent contour analysis and image block.

[0123] Step 1.4.2, output black and white image, where white area represents possible steel coil area, black is background area.

[0124] Step 1.5, morphological processing

[0125] Step 1.5.1, morphological closing operation is performed on the binary image to fill in the edge broken area and enhance the connectivity of the overall contour.

[0126] Morphological closing operation is applied to the binary image. By defining an elliptical or rectangular structural element, first perform dilation operation on the foreground target to connect the broken edges, and then perform erosion to restore the target shape, finally realize effective repair of small broken edges, fine seams and other defects of the steel coil area. The expansion of the white foreground area connects the broken edges; the erosion stage restores the shape of the expanded area, removes noise, and at the same time preserves the connected structure.

[0127] This processing significantly enhances the connectivity and structural integrity of the steel coil contour, providing continuous and stable foreground map support for subsequent region segmentation and defect detection.

[0128] Step 1.5.2, then perform opening operation to remove small isolated noise areas and preserve the main target area structure. Opening operation = erosion operation (Erosion) + dilation operation (Dilation).

[0129] Erosion stage: remove small, irregularly shaped noise areas; dilation stage: restore the original boundary of the target area and preserve the main shape of the steel coil.

[0130] After the binaryzation and closing operation of the steel coil end face image, although the main contour structure has been connected, there may still be a small number of isolated white pixel blocks or boundary noise points in the image. These impurities may be caused by gray level fluctuations, surface defects or edge detection errors. This step further removes these small non-target area noises by performing morphological opening operation, and preserves the integrity and purity of the main structure of the steel coil.

[0131] Step 1.6, Contour extraction and target positioning

[0132] Step 1.6.1, Call the findContours function of OpenCV to extract the contour information of all connected regions.

[0133] Step 1.6.2, Based on the contour area, filter out the largest region contour as the steel coil body.

[0134] Step 1.6.3, Use the minAreaRect function to fit the minimum bounding rectangle of the main contour, extract the corner coordinates, width and height, and rotation angle.

[0135] Step 1.7, Region cropping and affine correction

[0136] Step 1.7.1, According to the fitted minimum bounding rectangle, construct an affine transformation matrix to rotate and correct the steel coil region to the horizontal or vertical direction.

[0137] Step 1.7.2, Use the coordinate information to crop the original image and extract a sub-image containing the complete steel coil region, providing input images for subsequent block and defect detection.

[0138] Step 2, Lightweight adaptive image blocking In the steel coil end face image processing flow of the present application, the target region is located by fitting the minimum bounding rectangle, combined with adaptive tile size and overlapping sliding window method, to complete the lightweight block processing of the steel coil end face image. By controlling the tile step and the coverage area, both high-resolution perception of defects and reduction of overall reasoning resource consumption are achieved, providing a structure-optimized input image set for subsequent high-precision target detection.

[0139] Step 2.1, Calculate the minimum bounding rectangle of the steel coil region. Accurately locate the overall region boundary of the steel coil; obtain its geometric size and orientation information for subsequent image alignment and block region limitation; exclude background interference to ensure that the image cutting is only performed within the valid region.

[0140] Step 2.1.1, Input is the foreground image after morphological processing

[0141] Step 2.1.2, Use contour extraction algorithm to identify the main contour

[0142] Step 1, Use the findContours() function of OpenCV to extract the outer contour of the steel coil region in the processed binary image;

[0143] Step 2, Only keep the largest contour, excluding small noise.

[0144] Step 2.1.3 Minimum Bounding Rectangle Fitting. Use minAreaRect() to fit the minimum bounding rectangle for the main contour; return information such as center point (cx, cy), width and height (w, h), and angle angle.

[0145] Summary of the role: Accurately obtain the position, size, and rotation angle of the steel coil area; as the spatial range of the subsequent blocking area; if angle ≠ 0, it can be used to judge whether image rotation alignment is needed (executed in step 2.2).

[0146] Step 2.2, adaptive determination of blocking parameters. Automatically set the tile size and number according to the size of the steel coil area; ensure that the target area is covered and resources are not wasted; add edge overlap strategy to improve defect boundary detection accuracy.

[0147] Step 2.2.1, get the size of the cropped area, confirm the height and width of the target area through the w, h of the bounding rectangle.

[0148] Step 2.2.2, determine the tile size. Fix the size of each tile (512x512px) considering the network input requirements; use a uniform standard to facilitate model training and inference.

[0149] Step 2.2.3, set the sliding window stride. To prevent cutting off defects at the edge of the tile, set the sliding window to 80-90% of the tile size; generate partially overlapping tiles.

[0150] Step 2.3, sliding window cropping and numbered saving

[0151] Cut the steel coil area into multiple tiles effectively and standardly; keep each tile as a separate image and number it for subsequent target detection training; reduce the tile size to improve the recognition effect of YOLO on small defects. Summary of the role: Achieve adaptive control of image blocking; improve small defect detection capability; control the number of tiles to reduce model inference resource occupation.

[0152] Step 2.3.1, generate tile blocks by traversing the area. Double loop, sliding window with stride as step from (0, 0) to (w, h); crop a tile block of tile_size x tile_size each time.

[0153] Step 2.3.2, save images and naming standards. Save each tile as an independent.jpg file; the naming format includes the original image number + row and column index; ensure clear structure and easy data management of the training set.

[0154] Step 2.3.3 foreground validity screening. Remove invalid samples, reduce model training difficulty; ensure that the tile contains a certain amount of steel coil area or feature texture; reduce false positives or training bias, improve convergence speed and accuracy.

[0155] Step 1: Binary each tile image and calculate the foreground ratio (white pixel ratio).

[0156] Step 2: Set threshold for screening. Usually set threshold to 5%~10%; if the white area (steel coil effective area) ratio is lower than the threshold, it is judged as invalid tile.

[0157] In the steel coil end face image processing flow, the present application completes the lightweight blocking processing of the steel coil end face image by fitting and positioning the target area through the minimum circumscribed rectangle, combining adaptive tile size and overlapping sliding window mode. By controlling the tile step and the coverage area, high-resolution perception of defects is realized, and the overall inference resource consumption is reduced, providing structure-optimized input graph set for subsequent high-precision target detection.

[0158] Step 3: Data labeling and enhancement.

[0159] Manual or semi-automatic defect labeling is performed on the blocked images to form the labeled data set for training, and data enhancement is performed by rotating, brightness disturbance, affine transformation, etc. to improve the model generalization ability. Due to the characteristics of small size, large shape change and uneven class distribution of steel coil end face defects, accurate defect labeling and diversified data enhancement processing are the key to training high-robustness detection model. This step constructs a high-quality and high-diversity data set by standardized image labeling process combined with multiple image enhancement techniques, to improve the learning ability and generalization ability of the model.

[0160] Step 3.1 Image defect labeling

[0161] Step 3.1.1: Use LabelMe and other graphical data labeling tools to make target detection labels. These tools support generating labels in formats required by YOLO series model training, have visual operation interface, class management function and automatic saving mechanism, and are convenient for batch operation.

[0162] Step 3.1.2: Label the defects in each blocked tile image, including burrs, edge damage, edge cracks, lace patterns, and folds. Use rectangular bounding boxes to accurately enclose the defect targets, ensuring that the bounding box is close to the actual defect edge area and avoids excessive background interference.

[0163] Step 3.1.3 Save as.txt format required for YOLO training: class_id center_x center_y width height, one defect target per line.

[0164] class_id: defect type number; center_x, center_y: boundary box center point coordinates; width, height: boundary box width and height; all coordinate values are normalized decimals (relative to image size).

[0165] Step 3.1.4 Different defect types use standardized coding (0 for burr, 1 for edge damage, 2 for edge crack, etc.), used for subsequent model training.

[0166] Step 3.2 Data annotation quality check. Technical methods are as follows:

[0167] (1) Visualize the annotation file: use scripts or tools to superimpose the annotation box on the original image, manually check the position and category of the bounding box, and check for missing, mislabeling or offset phenomena.

[0168] (2) Coordinate legality verification: automatically detect whether each boundary box has coordinate out-of-bounds, negative numbers or exceeds the image size, to ensure that all boxes are effectively distributed within the image range.

[0169] (3) Class balance statistics: count all the annotation files, analyze the number of samples of each category, and determine whether there is a lack of certain defects or complete absence, to identify class imbalance problems in advance.

[0170] (4) Format specification detection: check whether each image has a corresponding.txt file, whether the file format is correct, and whether the fields are complete, to avoid errors in subsequent training.

[0171] Step 3.3 Image data augmentation processing. Use data augmentation tools such as Albumentations library to ensure that the image and label coordinates change synchronously during the augmentation process. Steps are as follows:

[0172] (1) Random horizontal and vertical flipping: flip the image left and right or up and down to improve the model's ability to adapt to the orientation of the defect.

[0173] (2) Brightness and contrast perturbation: simulate different shooting light conditions by adjusting the brightness and contrast of the image to increase image diversity and enhance the model's ability to resist light interference.

[0174] (3) Random rotation: slightly rotate the image (angle range controlled within ±10°) to improve the model's ability to adapt to the direction variation of edge defects.

[0175] Step 3.4 Dataset division and organization. Training set 70%, validation set 20%, test set 10%. Division constraints: tiles from the same large image (i.e., the same original steel coil image) should not appear in different subsets to avoid data leakage; the class distribution is as balanced as possible to ensure that each defect class is covered in each subset; data augmentation is only used for the training set, and the original distribution is preserved in the validation and test sets. The following files are included in the / dataset / folder: / images / train / , / images / val / , / images / test / , / labels / train / , / labels / val / , / labels / test / .

[0176] This step builds a high-quality, high-diversity, and structurally standard dataset by precise labeling, diverse augmentation, and reasonable division, effectively addressing the issues of insufficient samples, uneven class distribution, and large direction variation in steel coil defect data, providing a solid data foundation for the subsequent training and optimization of deep detection models.

[0177] Step 4: Model structure design and training

[0178] This step builds a target detection model with high precision, robustness, and good industrial deployment adaptability based on the dataset constructed in Step Three and the characteristics of the steel coil end face defect detection task. The model is based on the YOLO series detection framework, and to address the issues of high proportion of small defect targets, blurred boundaries, and weak features in actual applications, it introduces the channel-spatial joint attention mechanism CBAM (Convolutional Block Attention Module) and the bidirectional feature fusion network BiFPN (Bidirectional Feature Pyramid Network) for structural improvement. Meanwhile, a joint loss function strategy (Focal Loss + WIoU) is adopted to improve the training stability and prediction ability of the model.

[0179] This design ultimately builds a detection model with YOLO-CBAM-BiFPN structure, which is suitable for multi-class defect recognition and positioning tasks of steel coil end face images in the steel industry, balancing high precision and real-time detection requirements.

[0180] Step 4.1 Model structure building

[0181] Base framework selection

[0182] For example Figure 2In terms of target detection base framework selection, the YOLO series architecture (such as YOLOv8 or YOLOv11) is adopted as the backbone detection network, which takes into account the detection speed and recognition accuracy, and has end-to-end prediction capability, and is suitable for efficient deployment scenarios in industry. The model main body is composed of three parts: Backbone (main network): used to extract the low-level and high-level semantic features of the image; Neck (feature fusion layer): realizes the integration of multi-scale semantic information; Head (detection head): outputs the position of the bounding box, class probability and confidence, etc.

[0183] 4.1.2 Feature extraction network improvement

[0184] To enhance the performance of the YOLO structure in detecting small targets and weak edge targets on the end face of a steel coil, the present application proposes two structural improvements:

[0185] Introducing CBAM attention mechanism module

[0186] The CBAM module is a lightweight attention mechanism that combines channel attention and spatial attention, which can enhance the model's response capability to key areas.

[0187] Insertion position: the CBAM module is embedded between the backbone network Backbone and the feature fusion layer Neck to enhance the global semantic information during feature transmission; in another embodiment, the CBAM module can also be inserted after the key residual block inside the Backbone to adapt to different network depths or lightweight computing needs, but the present application preferably adopts the deployment method between Backbone and Neck.

[0188] Function realization: the module is divided into two stages: Channel Attention: through maximum pooling and average pooling, the importance in the channel dimension is extracted; Spatial Attention: through the compression operation of the feature map along the channel dimension, the spatial saliency region is obtained; purpose: to enhance the model's response to weak features in the defect area (such as burr, edge crack) on the end face of the steel coil, and to suppress background noise interference; structural advantages: without a large number of additional parameters, it can effectively improve the feature expression ability and detection sensitivity.

[0189] Replace the traditional FPN structure with the BiFPN multi-scale feature fusion structure

[0190] Although FPN can realize multi-scale feature fusion, its information transmission efficiency is limited. The present application introduces the BiFPN structure to optimize the Neck module:

[0191] BiFPN introduces bottom-up+top-down connection and increases learnable fusion weights on the basis of FPN; uses weighted summation instead of simple element-level addition operation, significantly improves the information interaction ability between multi-layer features; effectively improves the ability to detect different size defect targets (such as coexistence of large area edge damage and small burr); Enhance the high semantic expression ability of low-level features and improve the small target detection accuracy.

[0192] 4.1.3 Detection head and output module design

[0193] The detection head part adopts the standard multi-branch output structure of the YOLO series, and outputs different size target frame candidate information according to different scale feature maps. The detection head mainly outputs the following contents: class probability distribution of each anchor area (anchor frame) domain (used for classification); center point coordinates, width and height of the target frame (used for boundary frame positioning); confidence score of target existence (used for confidence filtering). The number and size of anchors are configured according to the target size distribution after tile cutting in step two, which improves the matching quality and optimizes the positive and negative sample distribution effect.

[0194] Step 4.2 Multi-loss function joint optimization

[0195] In order to solve the problems of "class imbalance", "small target difficult to detect" and "low positioning accuracy" in target detection task, the present application introduces a multi-strategy fusion mechanism in the design of loss function, and constructs a data-driven optimization objective function more suitable for actual industrial detection tasks.

[0196] 4.2.1 Classification loss: FocalLoss

[0197] FocalLoss is specially designed for uneven sample class distribution, which can focus on difficult classification samples and prevent easy classification samples from dominating the gradient descent direction in the training process.

[0198] FocalLoss = -α t (1-p t ) γ log (p t )

[0199] Where γ∈[1,5] controls the focus intensity of difficult samples, and the typical value is 2; applicable scene: suitable for the case where the number of "burr" and other categories is much larger than that of "edge crack" and other rare categories in steel coil end face defect classification; effect: improve the model's learning ability for "difficult to distinguish" targets and prevent underfitting.

[0200] 4.2.2 Boundary frame regression loss: Wiou (Weighted IoU)

[0201] Compared with traditional IoU and CIoU, WIoU further introduces "region uncertainty" weight to guide the model to dynamically adjust the focus during training. By designing a boundary weight function, different gradient feedback strengths are given to different target sizes and position errors; it is more suitable for position regression tasks of irregular steel coil defects (such as edge cracks); and it improves the robustness and accuracy of frame fitting in small target detection.

[0202] 4.2.3 Total loss function combination

[0203]

[0204] The overall loss function is a weighted combination of multiple terms, where: L cls is the Focal Loss classification loss; L loc is the WIoU bounding box regression loss; L obj is the object confidence loss (usually BCE); the coefficient λ is adjusted through experiments to adapt to the task target.

[0205] Step 4.3 Model training process

[0206] This step will train and validate the model optimized in step three on the dataset constructed in step three. The training process includes the following content:

[0207] Training parameter settings: initial learning rate: 0.001 (Cosine Annealing scheduling strategy can be used); BatchSize: 16-64, depending on GPU memory; optimizer: SGD, momentum 0.937, weight decay 5e-4; Epoch: recommended 100-300 rounds; Warm-up phase: use linear warming-up strategy for the first few epochs to avoid initial gradient explosion.

[0208] Training strategy: pre-training phase: first initialize model parameters on small resolution images or public datasets; fine-tuning phase: fine-tune on real steel coil image datasets to improve model adaptation to actual scenarios; validation monitoring: use validation set to dynamically monitor loss changes, mAP indicators, and PR curves to detect overfitting trends early and perform EarlyStopping processing.

[0209] Model saving and evaluation: save the model weights with the highest mAP or the lowest validation set loss during training; finally calculate the Precision (accuracy), Recall (recall), mAP (average detection accuracy), etc. on the test set; evaluate the model's performance on different defect types and scales.

[0210] Step 4.4 Model export and deployment

[0211] After training, the model is exported in a lightweight deployment format: support export in ONNX, TensorRT or OpenVINO format, can be deployed in edge devices (Jetson, industrial camera host board) or embedded systems; the actual test inference speed can reach more than 30 frames / second, meeting the real-time detection needs of the steel coil production line; support for industrial camera continuous image stream input and real-time output of detection results.

[0212] The technical advantages of this step are as follows:

[0213] CBAM attention mechanism: enhances the model's ability to perceive key areas of steel coil defects and suppress the influence of complex backgrounds; BiFPN structure: improves the model's detection ability in multi-scale defect (such as burr, edge crack) coexistence scenarios; FocalLoss+WIoU multi-loss optimization strategy: improves the model's ability to classify difficult samples and small target position regression; efficient deployment and real-time inference: support cross-platform deployment, with industrial usability, adapting to the needs of steel production line automatic detection.

[0214] Step five: detection result fusion and defect reconstruction output

[0215] As Figure 4 , after the target detection model inference is completed, a set of detection result fusion and reconstruction mechanism is designed for the processing procedure of the original high-resolution steel coil end face image being divided into multiple tile sub-images for independent detection. Through global coordinate remapping, cross-tile redundancy fusion, defect frame completion reconstruction, and structured result output, the detection results on all tile images are accurately restored to the original complete image, realizing accurate positioning and visual display of defect information, and providing reliable basis for subsequent quality evaluation, traceable analysis, automatic grading, or industrial feedback.

[0216] Step 5.1 detection result remapping processing

[0217] Since the model input is a small size tile image (such as 512x512px), the coordinate system of the detection result is based on the local area. Therefore, it is necessary to convert the coordinates of the detection frame in each tile back to the global coordinate system in the original 5120x5120px image.

[0218] Step 5.1.1 Record the original position information of tile cutting. In the image preprocessing and blocking stage (step two), record the starting position (top-left corner coordinates) of each tile image in the whole image as (xoffset, yoffset).

[0219] Step 5.1.2 Coordinate translation transformation. For the defect frame detected in each tile image, the original coordinates are Then the mapped coordinates in the original image are:

[0220]

[0221] Similarly, the top-left and bottom-right coordinates of the bounding box are also translated in the same way.

[0222] Step 5.1.3 Coordinate normalization restoration

[0223] The model output is in the form of normalized coordinates in the range of 0 to 1 in YOLO format, which needs to be restored to the absolute pixel coordinates of the original image according to the following formula:

[0224] x = x norm × w tile + x offset

[0225] y = y norm × h tile + y offset

[0226] Step 5.2 Redundant prediction suppression and boundary fusion

[0227] Considering that there is a certain overlap between tile images, the same defect may be covered by multiple tile detection boxes, resulting in repeated predictions. To improve detection consistency, redundant prediction elimination and defect boundary merging are needed.

[0228] Step 5.2.1 Unified detection box format

[0229] All prediction boxes are converted to absolute coordinate format in the original image:

[0230] (x, y, w, h, score, class)

[0231] Step 5.2.2 Cross-tile non-maximum suppression (NMS) processing

[0232] (1) Set and exchange IoU threshold

[0233] (2) Group the detection results by class, and perform standard or Soft-NMS algorithm for each group:

[0234] Standard NMS: delete all redundant boxes with IoU exceeding the threshold compared to the current highest score box;

[0235] Soft-NMS: reduce the score of redundant boxes instead of directly deleting them, which is more suitable for dense defects;

[0236] The result is that each class of defect retains the prediction box with the highest score and reasonable position, eliminating repeated detection.

[0237] Step 5.2.3 Boundary detection fusion optimization

[0238] Some defects are located at tile edges, only partial boxes are shown, geometric merging with candidate boxes of adjacent tiles: if two boxes are close in distance, and have consistent class and similar area, they can be merged into a larger prediction box to improve defect integrity recovery; heuristic rules (such as area ratio, centroid overlap) or DBSCAN clustering can be used for merging

[0239] Step 5.3. Full image defect reconstruction visualization output

[0240] Step 5.3.1 Defect drawing and classification labeling: draw all prediction boxes with different colors; label the defect class name and confidence next to each box.

[0241] Step 5.3.2 Defect statistics generation: count the number of each class of defects in the whole image; output structured information such as defect area, position, aspect ratio; for subsequent quality evaluation or qualification decision logic.

[0242] Step 5.3.3 Output format diversification support: support saving the visualization detection result image in.jpg / .png format; at the same time, generate defect data table in.json / .xml / .csv format for system integration.

[0243] Step 5.4 Detection accuracy improvement mechanism in multi-target scene

[0244] To further improve the accuracy of the fused results, the system designs the following strategies:

[0245] Region confidence fusion: when multiple boxes appear in the same region, use weighted average to fuse coordinates and score, improve result stability; edge compensation mechanism: for defects detected incompletely at tile edges, introduce a "candidate re-detection" mechanism to re-propagate defect boundaries through adjacent tiles; uncertainty area re-labeling mechanism: areas with confidence below a threshold but concentrated can be labeled as "suspected defect areas" to assist manual review.

[0246] The comparison optimization effect of the improved YOLOv11 network is shown in the following table, and the test environment is NVIDIA RTX 3060, CUDA 11.8, and the input size is 512x512px:

[0247]

[0248] The multi-module collaborative optimization significantly outperforms the baseline model, meeting the high-precision real-time detection needs of industrial scenes.

[0249] As Figure 3 shown, the steel coil end face defect detection system based on CBAM-BiFPN and multi-loss optimization provided by the embodiment of the application specifically comprises:

[0250] An image preprocessing and region extraction module is configured to extract the steel coil end face region by using an image processing method such as OpenCV;

[0251] An image slicing module is configured to divide the high-resolution image into a plurality of small blocks;

[0252] A data enhancement module is configured to perform data enhancement;

[0253] A network construction module is configured to construct a CBAM-BiFPN-based YOLOv11 network, introduce a CBAM attention mechanism and a BiFPN feature fusion structure, and construct an improved YOLOv11 detection network with high-efficiency feature extraction capability;

[0254] An optimization training module is configured to perform model training in combination with loss functions such as FocalLoss and WIoU;

[0255] A defect reconstruction output module is configured to reconstruct the original defect map by using a spatial coordinate mapping and a redundant region fusion method based on the detection results of the tile images, and realize high-precision overall detection output.

[0256] The steel coil end face defect detection method and system disclosed by the present application, which fuses the CBAM-BiFPN structure and the multi-loss function optimization, can significantly improve the defect detection precision and robustness while maintaining the detection speed. The CBAM attention mechanism effectively enhances the model's feature attention ability to the defect area, and the BiFPN feature fusion structure improves the information transmission efficiency between different scale features, which can better capture the multi-scale and small target defect information in the steel coil end face. At the same time, the optimization strategy combining the multi-loss function such as FocalLoss and WIoU effectively solves the problems of sample imbalance and insufficient positioning accuracy. Compared with the traditional method, the present application still has strong recognition ability in complex background and low contrast scenes, and the detection precision and stability are obviously improved, which has stronger industrial adaptability and practical value. The above implementation effects are jointly produced by the model structure and the loss function optimization strategy, which has clear technical feasibility and significant application prospect.

[0257] The application mainly applies to the field of steel coil end face defect detection, and is especially suitable for automatic defect recognition of high-resolution steel coil images. First, the application effectively solves the calculation resource bottleneck in large-format image processing through lightweight adaptive blocking technology, ensuring the efficiency and real-time performance of the detection process, and meeting the demand for rapid response of industrial production lines. Secondly, combined with the CBAM-BiFPN attention mechanism, the application significantly improves the fusion effect of multi-scale features and the key feature extraction capability of defect areas, enhancing the recognition accuracy of the model for small and complex defects. Thirdly, the combination of FocalLoss and WIoU multi-loss function optimization enables the model to have stronger recognition ability for difficult-to-distinguish defect samples, reduces the false detection rate and the missed detection rate, and improves the stability and reliability of the detection results.

[0258] In addition, the automatic detection process of the application greatly reduces the work intensity of manual inspection, reduces the error risk caused by human factors, and improves the production safety. In the long-term application, this technology not only significantly improves the accuracy and processing speed of steel coil defect detection, but also effectively saves production costs and human resources, promoting the intelligent and digital transformation of the steel coil manufacturing industry. This method is compatible with existing production lines, easy to integrate and promote, and brings significant economic benefits and competitive advantages to enterprises.

[0259] The potential application fields of the application are not limited to the above. The following are some specific application fields or related product embodiments, which can further prove the creativity and technical value of the application:

[0260] (1) Steel coil production line online quality inspection

[0261] In the hot rolling, cold rolling and subsequent finishing links, the end face of the steel coil is detected in real time for defects, and defects such as cracks, indentations, edge burrs, and delamination are automatically identified.

[0262] (2) Steel coil storage and logistics sorting

[0263] Before the steel coil is stored, the end face defects are detected automatically to perform grading storage or return processing, reducing the workload of manual inspection.

[0264] (3) Quality inspection of coiled metal products

[0265] It can be extended to end face defect detection of large-format coiled products such as aluminum coils, copper coils, and stainless steel coils.

[0266] (4) High-resolution industrial detection

[0267] It is suitable for other high-resolution and high-detail industrial vision detection tasks, such as large gear end face detection and metal bar section detection.

[0268] It should be noted that embodiments of the present application can be realized by hardware, software, or a combination of software and hardware. The hardware portion can be realized by a special logic; the software portion can be stored in a memory and executed by a proper instruction execution system, such as a microprocessor or a specially designed hardware. A person of ordinary skill in the art can understand that the above-mentioned apparatus and method can be realized by computer executable instructions and / or included in processor control codes, such as a carrier medium, such as a magnetic disk, CD or DVD-ROM, a programmable memory, such as a read-only memory (firmware), or a data carrier, such as an optical or electronic signal carrier. The apparatus of the present application and its modules can be realized by a hardware circuit, such as a very large scale integrated circuit or a gate array, a semiconductor, such as a logic chip, a transistor, or a programmable hardware device, such as a field programmable gate array, a programmable logic device, or the like, by software executed by various types of processors, or by a combination of the above-mentioned hardware circuit and software, such as firmware.

[0269] The above description is merely a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any modification, equivalent replacement, and improvement within the technical range disclosed by the present application, and within the spirit and principle of the present application, should be covered within the protection scope of the present application.

Claims

1. A method for detecting end-face defects in steel coils based on CBAM-BiFPN and multi-loss optimization, characterized in that, include: Step 1: Preprocess and extract regions from the end face image of the steel coil to obtain a standardized steel coil region; Step two: Divide the image of the steel coil area into multiple small blocks and perform data augmentation; Step 3: Feature extraction and target detection are performed using the YOLOv11 detection network, which integrates convolutional channel attention mechanism and bidirectional feature pyramid structure. Step four: Train the detection network by jointly optimizing multiple loss functions, including classification loss and localization loss; Step 5: Spatial mapping and fusion of the detection results of each small block are performed to output the overall defect detection results.

2. The method as described in claim 1, characterized in that, Step one includes: The RGB color image is converted to grayscale; Gaussian blur is applied to the grayscale image; boundary is extracted using an edge detection algorithm; the edge image is binarized; morphological operations are performed to remove noise; the maximum contour is extracted and the minimum bounding rectangle is fitted; affine correction and cropping are performed based on the rectangle to obtain a standardized sub-image.

3. A method for slicing and enhancing an image of the end face of a steel coil, characterized in that, include: The number and size of the cut blocks are calculated based on the length and width of the steel coil area, with a target block resolution of 512 x 512 pixels. Maintain a 5 to 10% overlap between the cut pieces; Perform defect labeling, and the types of defects labeled include burrs, edge damage, edge cracks, lace patterns, and folds; Enhancement is applied to the sliced ​​image, including flipping, brightness perturbation, contrast perturbation, and rotation.

4. The method as described in claim 3, characterized in that, The enhanced data is divided into a training set of 70%, a validation set of 20%, and a test set of 10%, and the small blocks of the same original image do not appear in multiple subsets at the same time.

5. A steel coil defect detection network based on attention mechanism and bidirectional feature fusion, characterized in that, Based on the YOLOv11 architecture, the network embeds the convolutional channel attention module into the feature extraction part and replaces the feature fusion part with a bidirectional feature pyramid structure. The detection head outputs the target category, center point coordinates, and width and height parameters.

6. The network as described in claim 5, characterized in that, The attention module is deployed between the backbone feature extraction part and the feature fusion part, and the bidirectional feature pyramid structure realizes multi-scale feature transfer through weighted fusion of multi-layer features.

7. A multi-loss joint optimization method for steel coil defect detection, characterized in that, The total loss function of the optimization method consists of classification loss, localization loss, and target confidence loss. The classification loss adopts the form of focus loss, the localization loss adopts the form of weighted intersection-union ratio, and the total loss is the weighted sum of the three losses.

8. The optimization method as described in claim 7, characterized in that, The focus loss improves training performance by assigning higher weights to samples that are difficult to classify, with the adjustment parameter valued at 2.

9. A method for reconstructing defect detection results in steel coils, characterized in that, include: Map the bounding box coordinates of each segment back to the original global coordinates; Non-maximum suppression is applied to duplicate detection boxes that cross blocks, with an intersection-union ratio threshold of 0.3; Perform geometric merging and reconstruction of the defect region on the defect detection box at the edge of the cut block; Output the fused overall detection results and generate image files and structured data files.

10. A steel coil end face defect detection system, characterized in that, include: The image preprocessing module is used to crop and correct the image of the steel coil; The image slicing and enhancement module is used to segment steel coil images and perform defect annotation and enhancement. The detection network module is used to perform object detection based on convolutional channel attention and bidirectional feature fusion. An optimized training module is used to train the detection network using a multi-loss joint optimization method. The results fusion module is used to map the block detection results back to the original image and output the overall defect detection results.

Citation Information

Patent Citations

  • A YOLOv7 hot-rolled strip surface defect detection method based on attention mechanism

    CN116402763B

  • Steel surface defect detection algorithm based on deep learning

    CN116664478A

  • Steel surface defect detection algorithm based on Focal module and deformable convolution

    CN116934685A

  • YOLOv8 target detection method based on attention mechanism and multi-scale feature fusion

    CN116883801A

  • Unmanned aerial vehicle inspection small target detection method and system based on improved YOLOv7 model

    CN118397488A

Cited By

  • Visual inspection method for cleaning effect of precast concrete member mold

    CN121391861A

  • Steel rail damage detection method and system based on deep learning

    CN121661050A

  • A Deep Learning-Based Method and System for Rail Damage Detection

    CN121661050B

  • Steel coil end face defect detection method and system, training method and electronic equipment

    CN121883480A

  • Self-adaptive slicing multi-target screw bending defect detection method

    CN122134727A