High-speed strip steel defect detection method and system based on anomaly enhancement and image reconstruction
Through pseudo-exception enhancement and image reconstruction methods, the problem of difficult identification and slow detection of small defects on the surface of the strip is solved, and high-precision synchronous detection of high-speed strip defects is achieved.
Patent Information
- Application Number
- CN202510590244.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-08
- Publication Date
- 2025-08-08
AI Technical Summary
The prior art is difficult to identify defects that are small on the surface of the strip and have high background similarity, and the detection algorithm speed cannot match the production line speed, resulting in difficulty in controlling the strip quality.
The pseudo-exception enhancement method is used to generate scratch and stain pseudo-exceptions, combined with the U-Net image reconstruction network and SE module, and through group convolution and channel attention mechanism, a lightweight encoder-decoder structure is designed to generate an abnormal heat map for detection.
Effectively identify small defects and improve detection speed, meet synchronous detection needs, improve detection accuracy and speed, and reduce calculation time.
Smart Images

Figure CN120451674A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of pseudo-anomaly data enhancement technology in the field of visual anomaly detection, and specifically relates to a high-speed strip defect detection method and system based on anomaly enhancement and image reconstruction. Background Art
[0002] Strip steel, a crucial material foundation for national construction and the realization of the "four modernizations," has numerous downstream demand sectors, including construction, machinery, and power generation. Due to various factors, including rolling equipment, continuous casting billets, and processing techniques, strip steel often exhibits various surface defects, such as warping, inclusions, roller marks, pitting, dents, bulges, pressure points, black spots, streaks, holes, creases, scratches, bruises, edge cracks, dirt, insect bites, and foreign matter intrusion. These defects not only affect the strip steel's surface aesthetics but also its corrosion resistance, wear resistance, and fatigue resistance. Therefore, strip steel surface defect detection plays a profound role in controlling and improving strip steel quality.
[0003] Many surface defects in steel strips are highly similar to the background, making traditional machine vision methods completely unable to identify such targets. Therefore, deep learning methods are used. However, since defects occur with low probability during the production process, some types of steel strip defects are extremely rare, making it difficult to collect defect samples. Therefore, supervised learning methods that rely on large numbers of defect samples are also unsuitable. Therefore, the present invention uses an unsupervised learning method that only requires normal samples, establishes an image reconstruction model to generate a normal reconstructed image corresponding to the input image, and locates defects by finding the differences between the two images.
[0004] However, when directly deploying the unsupervised learning-based image reconstruction defect detection algorithm for surface defect detection of high-speed strip steel, there are still some technical challenges that need to be solved: (1) Some small defects that have a significant impact on the surface quality of the strip are difficult to identify. The size of these defects is very small, and their color is highly similar to the background, which is also a severe challenge for image reconstruction algorithms based on unsupervised learning. The reconstruction model trained only with normal samples lacks feature information of the defects. The strong generalization ability of the model will misjudge small defects as reasonable variations of the normal pattern, thereby retaining them in the reconstructed image, resulting in the inability to detect these small defects when subtracting the input image from the reconstructed image.
[0005] (2) The speed of the detection algorithm cannot keep up with the speed of the strip production line, and synchronous detection cannot be performed. The operating speed of the strip production line can reach up to 200m / min (the actual maximum speed of the straightening machine is 200), while the detection algorithm includes many steps such as image preprocessing, model inference, and image post-processing. As a result, the detection speed cannot keep up with the speed of the strip production line. It is necessary to improve the detection algorithm to reduce the weight and increase the detection speed. Summary of the Invention
[0006] The technical problem to be solved by the present invention is to address the deficiencies in the above-mentioned existing technologies and provide a high-speed strip steel defect detection method and system based on anomaly enhancement and image reconstruction, which is used to solve the technical problems in the current manufacturing industry that some important but not obvious defects are difficult to identify and the detection speed cannot keep up with the production line operation speed, making it difficult to control the quality of the strip steel, and to realize online synchronous detection of strip steel surface defects.
[0007] The present invention adopts the following technical solutions: The high-speed strip steel defect detection method based on anomaly enhancement and image reconstruction includes the following steps: The pseudo-anomaly enhancement method is used to generate scratch-type pseudo-anomalies and stain-type pseudo-anomalies, and the generated pseudo-anomalies are added to the normal samples to form pseudo-anomaly training samples; Integrate group convolution into the U-Net image reconstruction network and introduce the SE module to obtain the image reconstruction network. After mixing normal samples and pseudo-abnormal training samples, the image reconstruction network is trained to obtain a trained image reconstruction network. The image to be tested is input into the trained image reconstruction network to obtain a reconstructed image. An abnormality thermal map is generated based on the difference between the input image and the reconstructed image to complete the detection of surface defects of the strip.
[0008] Preferably, a pseudo-anomaly enhancement method is used to generate scratch-type pseudo-anomalies and stain-type pseudo-anomalies, specifically as follows: The local average grayscale floating method is used to simulate small defect features that are highly similar to the background and difficult to identify, generating scratch-like pseudo-anomalies; The contour random perturbation method is used to simulate block defect features with various shapes and generate stain-like pseudo anomalies; Use the gamma distribution to constrain the size of spurious anomalies.
[0009] Preferably, the scratch-related pseudo-anomaly is specifically: The area corresponding to the pseudo-anomaly in the sample image is extracted, and its average grayscale value is calculated as the reference value of the pseudo-anomaly grayscale value. On the basis of the reference value, the grayscale floating value is increased to obtain the grayscale value of the pseudo-anomaly area.
[0010] Preferably, the grayscale value of the pseudo-abnormal area as follows:
[0011] in, is the width of the pseudo-anomaly region, is the average gray value of the area corresponding to the pseudo-anomaly in the sample image, A floating value.
[0012] Preferably, the stain-related pseudo-anomaly is specifically: Use uniform distribution to describe randomness, so that the contour of the pseudo-anomaly is randomly disturbed on the basis of the ellipse. When the number of contour points is greater than 20, the length of the outer contour after being divided into 20 parts is calculated as the sampling interval. Every time the interval is repeated, a disturbance point is selected from the ellipse contour. If there are less than 20 points, all points are used directly. The coordinates of each intercepted point are disturbed, and the pixel value within the set range is randomly increased or decreased. The range is determined by the diagonal length. and irregularity coefficient Determine and use the clockwiseangle function to calculate the difference between each perturbation point and the center of the ellipse The angle, according to and Value, obtained using the atan2 function angle; basis The disturbance points are sorted clockwise according to the angle, and then the first point is added to the end of the point set to close the contour. The InterPLD function is used to perform cubic spline interpolation on the disturbance points to generate continuous contour points. The continuous contour points are used to generate a disturbed elliptical mask, and after Gaussian blur processing, the stain-like pseudo anomaly is obtained.
[0013] Preferably, for a set of points , cubic spline interpolation function satisfy:
[0014] in, is the generating point, 、 、 、 is a constant term.
[0015] Preferably, the image reconstruction network adopts an encoder-decoder structure. The input image first passes through a projection layer to map the input 3-channel RGB image to the specified feature dimension. The number of output channels is The feature map of The feature map is input to the encoder, which includes four downsampling layers. In the first three downsampling layers, the group convolution operation first filters the feature map to extract local features, and then the SE module performs channel weighting on the feature map. The fourth downsampling layer only reduces the spatial size. The encoder gradually reduces the spatial dimension of the image through convolution and pooling operations, while increasing the number of channels, extracting high-level features, and reducing the feature map size to ; The decoder will then gradually restore the spatial dimensions of the image through upsampling and convolution operations, while combining the low-level feature information from the encoder; the decoder includes four upsampling layers. The upsampling layer first expands the spatial size of the input feature map by 2 times through bilinear interpolation, and then uses convolution operations to adjust the number of channels of the feature map; the first upsampling layer is symmetrical with the fourth downsampling layer, only expanding the spatial size of the feature map. In the last three upsampling layers, bilinear interpolation and convolution operations are first used to adjust the spatial size of the feature map to twice the previous one and the number of channels to half the previous one; the upsampled feature map is then added to the feature map of the same layer encoder, and then a group convolution operation is performed on the feature map to extract spatial features. The SE module is then used to enhance the features of important channels, and the final output size is The feature map is given to the projection layer; The projection layer maps the final feature map back to a 3-channel image through a convolution operation, generating a reconstructed image of the same size as the input image.
[0016] Preferably, an abnormal thermodynamic map is generated by calculating the MSGMS loss of the input image and the reconstructed image, and the warm-colored parts in the abnormal thermodynamic map are regarded as defects on the surface of the steel strip.
[0017] Preferably, the MSGMS loss is calculated as follows:
[0018] in, Indicates the number of scales, Indicates the The weight of the scale, Indicates the The gradient operator of the scale, Represents the gradient magnitude similarity.
[0019] In a second aspect, an embodiment of the present invention provides a high-speed strip defect detection system based on anomaly enhancement and image reconstruction, comprising: The sample module uses a pseudo-anomaly enhancement method to generate scratch-type pseudo-anomalies and stain-type pseudo-anomalies, and adds the generated pseudo-anomalies to the normal samples to form pseudo-anomaly training samples; Network module, integrates group convolution into the U-Net image reconstruction network and introduces the SE module to obtain the image reconstruction network. After mixing normal samples and pseudo-abnormal training samples, the image reconstruction network is trained to obtain a trained image reconstruction network; The detection module inputs the image to be tested into the trained image reconstruction network to obtain a reconstructed image, generates an abnormality thermal map based on the difference between the input image and the reconstructed image, and completes the detection of surface defects of the strip.
[0020] In a third aspect, a computer device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned high-speed strip defect detection method based on anomaly enhancement and image reconstruction when executing the computer program.
[0021] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, comprising a computer program, which, when executed by a processor, implements the steps of the above-mentioned high-speed strip defect detection method based on abnormality enhancement and image reconstruction.
[0022] In a fifth aspect, a chip comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the high-speed strip defect detection method based on abnormality enhancement and image reconstruction are implemented.
[0023] In a sixth aspect, an embodiment of the present invention provides an electronic device, comprising a computer program, which, when executed by the electronic device, implements the steps of the above-mentioned high-speed strip defect detection method based on abnormality enhancement and image reconstruction.
[0024] Compared with the prior art, the present invention has at least the following beneficial effects: A high-speed strip steel defect detection method based on anomaly enhancement and image reconstruction employs pseudo-anomaly enhancement to address the difficulty of identifying some defects. Hard-to-detect defects are categorized as scratches and stains. A local average grayscale floating method is designed to generate scratch pseudo-anomalies, while a contour random perturbation method is used to generate stain pseudo-anomalies, providing local differentiation features for the model. A lightweight image reconstruction model with an encoder-decoder structure is designed to achieve high detection speeds and meet the requirements of simultaneous detection. Performance testing was conducted on a dataset of strip steel surface images, achieving advanced performance evaluation.
[0025] Furthermore, the scratch classification uses a local grayscale floating method to simulate the characteristics of defects with similar grayscale to the background but with subtle gradient variations. A gamma distribution is used to constrain the size, ensuring that the generated pseudo-anomalies conform to the statistical distribution of real small defects. The stain classification uses random contour perturbations to simulate the morphological diversity of blocky defects, avoiding the monotony of traditional fixed-shape generation. The gamma distribution controls the discreteness of defect sizes, ensuring that the generated pseudo-anomalies cover a range of defects from micro to medium sizes. The design of these two types of pseudo-anomalies essentially converts the physical characteristics of defects into mathematical modeling parameters, and through parameter randomization, generates defect samples that are more realistic.
[0026] Furthermore, the grayscale design of scratch-like pseudo-anomalies is based on the principle of local assimilation: by extracting the average grayscale of the normal area as a reference value and then superimposing a small range of floating values, the grayscale difference between the generated pseudo-anomaly and the surrounding background is controlled within a range that is difficult for the human eye to distinguish but perceptible to the model; this not only avoids the obvious artifacts caused by traditional noise addition, but also simulates the grayscale gradient characteristics of real scratch defects; the width parameter w controls the diffusion range of the grayscale change, forming a mapping relationship with the diffusion effect of the real scratch, so that the model learns the anomaly suppression ability of the local grayscale gradient pattern.
[0027] Furthermore, through the mathematical constraints of the floating value Δ, a controllable deviation of the pseudo-anomaly grayscale from the background is achieved. When Δ approaches 0, the pseudo-anomaly completely merges with the background, simulating extremely difficult-to-detect tiny scratches. As Δ increases, it simulates more obvious scratches. By adjusting the distribution range of Δ, pseudo-anomalies of varying contrast can be generated, covering a range of defect samples from mild to significant. This design enables the model to learn to suppress high-contrast defects while capturing the subtle features of weak-contrast defects during training, constructing a data augmentation space that covers the spectrum of defect detection difficulty.
[0028] Furthermore, the model generates irregular polygonal contours by randomly perturbing the elliptical base, simulating the uncertain shapes of real stains. Angle sorting and closing operations are used to ensure the geometric rationality of the contours. Interpolation of the perturbed discrete points eliminates jagged edges and generates a smooth contour curve. Gaussian blurring further reduces edge sharpness, simulating the optical diffusion effect of real stains. This design decouples the geometric characteristics of the stains into the base shape, perturbation intensity, and optical properties. By combining these parameters, a variety of pseudo-anomalies are generated, enhancing the model's generalization ability for complex defects.
[0029] Furthermore, the cubic spline interpolation function optimizes the polynomial parameters a, b, c, and d to ensure that the generated contour curve satisfies first- and second-order derivative continuity. This mathematical property ensures that the interpolated contour point set exhibits smooth curvature changes, avoiding the sudden changes in broken line segments caused by traditional linear interpolation and more closely resembling the natural edge morphology of real stains. The introduction of a constant term in the function allows for fine-tuning of the local curvature of the curve, such as maintaining low curvature in areas with dense disturbance points and increasing curvature in sparse areas. This physically driven interpolation method essentially generates pseudo-anomalous shapes that conform to the formation mechanism of material surface defects through mathematical model constraints.
[0030] Furthermore, the standard convolution is split into multiple groups of parallel computations, reducing the number of parameters per layer while retaining multi-channel feature extraction capabilities to meet the real-time requirements of high-speed inspection. A channel attention mechanism dynamically adjusts feature channel weights to strengthen responses to defect-sensitive channels and suppress interference from irrelevant channels. The encoder-decoder structure preserves multi-scale spatial information through symmetrical downsampling / upsampling paths, while the dimensional mapping of the projection layer achieves decoupling and reconstruction of high- and low-dimensional features. This design reduces computational time by 30% to 50% through structural optimization while ensuring reconstruction accuracy, resolving the mismatch between inspection speed and production line speed.
[0031] Furthermore, the input image and the reconstructed image are subjected to multi-level downsampling to extract gradient features at different scales. Small defects respond significantly in the fine-scale gradient map, while larger defects are easier to capture in the coarse-scale gradient map. The difference map of the gradient amplitude at each scale is calculated, and an abnormal heat map is generated through weighted fusion. The warm area corresponds to the defect location. Compared with traditional pixel-level difference detection, MSGMS is more sensitive to edge and texture changes, and is particularly suitable for detecting defects that are similar to the background grayscale but have local gradient mutations. This method utilizes the characteristics of high consistency in reconstruction of normal areas and large error in reconstruction of defective areas to enhance defect signals through multi-scale gradient analysis.
[0032] Furthermore, higher weights are assigned to enhance detection sensitivity for minor defects, such as sub-pixel defects like pitting and black spots; weights are gradually reduced to suppress interference from large-scale background noise. Weight distribution is achieved through exponential decay, allowing the model to focus more on fine-scale differences. The gradient operator uses the Sobel or Scharr operator. The latter offers higher accuracy in calculating gradients at 45° directions, making it suitable for detecting oblique scratches. This multi-scale weighting mechanism essentially constructs an attention filter that adapts to defect size, minimizing false positives while maintaining detection accuracy.
[0033] It can be understood that the beneficial effects of the second to sixth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here.
[0034] In summary, the present invention can effectively detect difficult-to-detect defects that are small in size and highly similar to the background, while maintaining a high detection speed to meet the requirements of synchronous detection.
[0035] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0037] Figure 1 Reconstruct the network graph for the U-Net image; Figure 2 is the surface defect map of the strip; Figure 3 is the indentation defect map; Figure 4 It is a pseudo-anomaly image of scratches; Figure 5 It is a stain defect diagram; Figure 6 This is a stain defect image; Figure 7 It is a pseudo-anomaly map of stains; Figure 8 Reconstructing network graphs for high-speed images based on pseudo-anomaly enhancement; Figure 9 This is the experimental result diagram for effectiveness analysis of pseudo-anomaly enhancement; Figure 10 A schematic diagram of a computer device provided in accordance with an embodiment of the present invention; Figure 11 The present invention is a block diagram of an electronic device according to an embodiment of the present invention.
[0038] Figure 12 Flow chart of the detection method of the present invention.
[0039] Among them, 60. Computer device; 61. Processor; 62. Memory; 63. Computer program; 600. Electronic device; 610. Processing unit; 620. Storage unit; 6201. Random access memory unit; 6202. Cache memory unit; 6203. Read-only memory unit; 6204. Program / Utility; 6205. Program module; 630. Bus; 640. Display unit; 650. Input / output interface; 660. Network adapter; 700. External device. DETAILED DESCRIPTION
[0040] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0041] In the description of the present invention, it is to be understood that the terms “include” and “comprise” indicate the presence of the described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or collections thereof.
[0042] It should also be understood that the terms used in the present specification are only for the purpose of describing particular embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms unless the context clearly indicates otherwise.
[0043] It should be further understood that the term "and / or" as used in the present specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in the present invention generally indicates that the associated objects are in an "or" relationship.
[0044] It should be understood that although the terms "first," "second," and "third" may be used to describe preset ranges in embodiments of the present invention, these preset ranges should not be limited to these terms. These terms are merely used to distinguish one preset range from another. For example, without departing from the scope of embodiments of the present invention, the first preset range may also be referred to as the second preset range, and similarly, the second preset range may also be referred to as the first preset range.
[0045] The word "if," as used herein, may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to the determination" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)," depending on the context.
[0046] The accompanying drawings illustrate various schematic diagrams of structures according to embodiments disclosed herein. These figures are not drawn to scale; for clarity, some details are exaggerated and some details may be omitted. The shapes of the various regions and layers shown in the figures, as well as their relative sizes and positional relationships, are merely exemplary and may deviate in practice due to manufacturing tolerances or technical limitations. Those skilled in the art may design regions / layers with different shapes, sizes, and relative positions as needed.
[0047] The present invention provides a high-speed strip defect detection method based on anomaly enhancement and image reconstruction. The method provides defect feature information to the model through a pseudo-anomaly enhancement method, constructs an image reconstruction network using an encoder-decoder structure, and incorporates group convolution to reduce the amount of computation and improve the inference speed. The channel attention mechanism is introduced to enable the network to adaptively focus on important features, while accelerating the convergence of the model. The method of the present invention provides a solution to the problem of high-speed strip surface defect detection in industry. To address the problem of difficulty in identifying some tiny strip defects, a pseudo-anomaly enhancement method is designed to generate different categories of pseudo-anomalies based on real defect features, provide defect feature information to the detection model, and improve the detection model's sensitivity to defects and generalization ability. To meet the requirements of synchronous detection, an improved image reconstruction network is designed by incorporating group convolution and channel attention mechanisms, which significantly improves the detection speed while balancing detection accuracy. It can achieve high-precision defect detection synchronized with the strip production line. The detection accuracy and detection speed have been verified through experiments, proving the effectiveness of the method of the present invention.
[0048] Example 1 See also Figure 12 The present invention provides a high-speed strip steel defect detection method based on abnormality enhancement and image reconstruction, comprising the following steps: S1, reference network selection; For the research on high-speed strip surface defect detection based on image reconstruction, selecting a suitable image reconstruction network is very important for improving defect detection capabilities. The network must have high inference speed and strong defect localization capabilities.
[0049] The present invention adopts U-Net image reconstruction network as the reference network for strip surface defect detection. U-Net is a convolutional neural network with a classic encoder-decoder structure. The network structure of U-Net is as follows Figure 1 shown.
[0050] The core concept of the U-Net network is to achieve high-precision reconstruction of the input image through symmetrical encoder and decoder paths combined with skip connections. The encoder path gradually extracts high-level image features through multiple layers of convolution and downsampling, while the decoder path gradually restores the image's spatial resolution through upsampling and convolution. Skip connections directly pass high-resolution features from the encoder to the decoder, helping the network to better recover detailed information. This structure of the U-Net makes it highly effective in image reconstruction tasks, especially in scenarios requiring high-precision output.
[0051] S2, Pseudo-abnormal enhancement Detection models based on image reconstruction are typically trained using a complete set of positive samples. This results in a model that only learns the distribution of normal samples and identifies any areas that deviate from this distribution as defects. This results in strong generalization capabilities. However, due to a lack of defect feature information, the model is less sensitive to complex defects and may not accurately identify defects that differ slightly from normal samples. However, some surface defects on steel strips are small and their color closely resembles the background, making them unrecognizable by models trained on positive samples. To address this issue, the present invention introduces pseudo-anomalies to enhance the training samples.
[0052] The introduction of pseudo-anomalies can significantly improve the performance and detection effect of the model. Pseudo-anomalies refer to synthetic defects artificially added to the original defect-free image, which are used to enhance the diversity and richness of training data. This method can solve the problem of insufficient defect features in unsupervised learning and guide the model to better learn the respective characteristics of normal samples and abnormal samples. However, the existing pseudo-anomaly generation methods do not perform well in the strip surface defect detection task faced by the present invention. Therefore, this project designs a pseudo-anomaly enhancement method to make the generated pseudo-anomalies more consistent with the characteristics of the actual anomalies and obtain better detection effects.
[0053] There are many types of surface defects on strip steel, and different defects have their own morphological characteristics, such as Figure 2 Among them, the surface defects that are difficult to detect can be divided into scratch defects and stain defects according to their morphological characteristics, and the pseudo-anomaly enhancement methods are correspondingly divided into scratch pseudo-anomalies and stain pseudo-anomalies.
[0054] (1) Scratch-type pseudo-anomalies Scratch defects are characterized by a long, thin shape similar to a line, with a portion of them being significantly different from the background image, making them relatively easy to detect. Figure 2 Indentation is a kind of scratch defect with a high incidence rate on industrial production lines and has a great impact on the quality of steel strips. Its color is very light and it is in the shape of a vertical line. The difference with the background image of the steel strip is very small. After zooming in and observing from the perspective of pixels, it is almost impossible to distinguish whether there is a defect. Indentation defects are as follows: Figure 3 Therefore, it is necessary to design pseudo-anomalies to simulate such defects, help the model learn defect characteristics, and improve recognition capabilities.
[0055] Existing effective methods for generating scratch-like pseudo-anomalies include random line generation, Gaussian noise simulation, and texture replacement. However, when these pseudo-anomalies are used in network training, the resulting network is unable to detect these difficult-to-detect scratch defects. This paper, based on the fact that scratches have minimal grayscale differences from the background image and are vertically shaped, has designed a new pseudo-anomaly enhancement method that achieves excellent results.
[0056] 1) Random size First, real-world defects often exhibit randomness and uncertainty in their location, length, width, and grayscale values. By introducing random pseudo-anomalies into the training data, we can better simulate these complexities, preventing the model from overfitting to specific anomaly patterns and making it more practical in real-world applications.
[0057] set up is the width of the pseudo-anomaly. In reality, most scratches are narrow, and the narrow defect features are less obvious and difficult to be noticed by the model. Therefore, the gamma distribution is used to describe the randomness of the pseudo-anomaly width.
[0058] The present invention selects shape parameters 2, which satisfies most of the features with small width, and the scale parameter =0.2, controls the dispersion of the distribution so that most values are concentrated between 1 and 10, and selects the cutoff range to be between 1 and 20 pixels. Therefore, the pseudo anomaly width The probability density function of is shown in the following formula (1): (1) set up is the length of the pseudo-anomaly, which is a random integer within the length range. Since the scratch length in actual conditions has no special distribution pattern, the randomness of the pseudo-anomaly length is described by uniform distribution. The probability density function of is shown in the following formula (2): (2) in, 、 for The value ranges are 600 and 1024 respectively.
[0059] 2) Random coordinates set up is the starting coordinate of the pseudo anomaly, and the width and length of the sample image are and , The value of is a random integer between 0 and the image width minus the pseudo-anomaly width. The value of is a random integer between 0 and the image length minus the pseudo-anomaly length, so as to ensure that the pseudo-anomaly does not exceed the image boundary. The pseudo-anomaly coordinates also have no special distribution pattern, and they are described using uniform distribution. The probability density function of is shown in equations (3) and (4): (3) (4) 3) Local average grayscale fluctuation Since the grayscale value difference between the scratch defect and the background image is very small, the area corresponding to the pseudo-anomaly in the sample image is extracted, and its average grayscale value is calculated as the reference value of the pseudo-anomaly grayscale value. On the basis of the reference value, the grayscale floating value is added to obtain the grayscale value of the pseudo-anomaly area.
[0060] Using the coordinates of a pseudo-anomaly and size 、 , extract the corresponding area in the sample image, and then use the mean function to calculate the average gray value of the area. The mean function is a function in the NumPy library used to calculate the average value of elements in an array. It is often used in data processing and statistical analysis. It calculates the average value by summing all elements in the array and then dividing it by the total number of elements. The average gray value of the area corresponding to the pseudo-anomaly in the sample image The calculation principle can be expressed by formula (5) as follows: (5) in, is a two-dimensional array of the areas corresponding to pseudo-anomalies in the sample image, is an array The elements, is an array The total number of elements in .
[0061] The scratch defect shows a higher grayscale value than the background image in the image, so increasing the grayscale value based on the reference value can accurately simulate the grayscale value of the scratch defect. In order to make the pseudo-anomaly random and more consistent with the actual defect situation, a floating value is selected as the added grayscale value, and the floating interval is selected from 5 to 40. On the actual production line, the color of this type of defect is mostly very close to the strip background, which is in line with the characteristics of the right-skewed distribution. Therefore, the gamma distribution is used to describe the randomness of the floating value, and the floating value The probability density function of is expressed as follows: (6) in, is the shape parameter, which is 3, ensuring that the distribution has a certain right skewness while avoiding being too concentrated or too dispersed. The scale parameter is set to 0.2, which meets the requirement that most values are concentrated between 5 and 20.
[0062] Therefore, the pseudo-abnormal gray value It can be expressed as: (7) According to the characteristics of the actual scratch defect, when the pseudo-anomaly width is particularly small, its gray value is set to 255, that is, pure white, and the pseudo-anomaly minimum width threshold is set to 5, then the pseudo-anomaly gray value It can be expressed as: (8) 4) Scratch-related pseudo-abnormal results The final scratch-like pseudo-anomaly is as follows Figure 4 As shown in the figure, this pseudo-anomaly generation method, by simulating the characteristics of scratch defects in real industrial scenarios, can effectively enhance the model's ability to identify subtle defects and help the model learn about scratch defects with less obvious characteristics. Furthermore, by adjusting the pseudo-anomaly generation parameters, the model's generalization performance for different types of scratch defects can be further optimized, providing a more reliable solution for strip surface quality inspection.
[0063] (2) Stain-related pseudo-anomalies The characteristic of stain defects is that they are block-shaped, part of which is obviously different from the background image, and the detection difficulty is relatively low, such as Figure 2 However, some stains are very small and can be easily overlooked in large-scale background images, such as Figure 5 Therefore, a stain-type pseudo-anomaly enhancement method is designed. According to the characteristics of this type of anomaly, block-shaped pseudo-anomalies with various sizes and shapes are generated to simulate real anomalies, achieving good results.
[0064] 1) Random size Real defects often exhibit randomness and uncertainty in their location, area, shape, and grayscale values, making their characteristics complex and diverse. Introducing random pseudo-anomalies into the training data can better simulate these complex defect characteristics. This is done to prevent the model from overfitting to specific anomaly patterns during training. This strategy for preventing overfitting not only improves the model's generalization capabilities but also enhances its reliability and adaptability in real-world applications.
[0065] In order to simulate the morphology of actual defects, an ellipse is selected as the basic shape of stain-type pseudo-anomalies. The ellipse has high morphological flexibility. By adjusting parameters such as the center position, size, aspect ratio, and rotation angle of the ellipse, the morphology and distribution of the pseudo-anomalies can be precisely controlled, thereby increasing the diversity of the pseudo-anomalies.
[0066] In order to achieve the randomness of the size of the pseudo-anomaly and make the characteristics of the defect complex and diverse, the width of the pseudo-anomaly ellipse is randomly generated within a certain range. and height Since small stain defects are more difficult to be successfully identified, when designing random sizes, we tend to generate more small sizes. This requirement is consistent with the characteristics of the right-skewed distribution. In the right-skewed distribution, the gamma distribution can be adjusted by adjusting the shape parameter and scale parameters , the shape of the distribution is flexibly shaped, so the gamma distribution is chosen to describe the randomness of the ellipse size, the width of the ellipse and The probability density function of can be expressed by equations (9) and (10): (9) (10) Among them, the shape parameter Set to 2, scale parameter Set to 0.2, and Represent the width and length of the sample image respectively, is the minimum aspect ratio, set to 0.1, The maximum aspect ratio is set to 2.
[0067] 2) Random coordinates There is no special distribution pattern for the position of pseudo-anomalies, and uniform distribution is used to describe their randomness. In order to achieve the randomness of the position of pseudo-anomalies and ensure that the pseudo-anomalies do not exceed the boundaries of the image, the center coordinates of the pseudo-anomaly ellipse The probability density function of is expressed as follows using equations (11) and (12): (11) (12) 3) Random perturbation of contour The outer contours of stain defects on strip production lines are often irregular, such as Figure 3-6 As shown, in order to simulate the irregular shape of the actual defect, the ellipse contour perturbation method is used to randomly perturb the contour of the pseudo-anomaly on the basis of the ellipse.
[0068] First, in order to maintain the basic shape and size of the ellipse and ensure that the outer contour can be uniformly disturbed, when the number of contour points is greater than 20, the length of the outer contour after being divided into 20 parts is calculated as the sampling interval. Every time the interval is reached, a disturbance point is selected from the ellipse contour. If the number of points is less than 20, all the points are used directly. Let the outer contour point set be , the number is , perturbation point set The calculation formula is shown in the following formula (13): (13) Among them, the sampling interval , the number of disturbance points .
[0069] The coordinates of each intercepted point are disturbed, and the pixel values within a certain range are randomly increased or decreased. The range is determined by the diagonal length. and irregularity coefficient Determine the coordinates of the point after disturbance Expressed using equations (14) and (15): (14) (15) in, , which means taking a random number between -1 and 1.
[0070] Use the clockwiseangle function to calculate the distance between each perturbation point and the center of the ellipse The principle is to calculate the vector of the disturbance point relative to the center point, and use the dot product and cross product of the vectors to calculate the angle, as shown in formula (16): (16) Among them, the vector of the disturbance point relative to the center point is , the reference vector .
[0071] according to and Value, obtained using the atan2 function Angle. Based on The perturbation points are sorted clockwise by angle, and the first point is added to the end of the point set to close the contour.
[0072] In order to make the intervals between contour points smoother, the InterPLD function is used to perform cubic spline interpolation on the disturbance points to generate more continuous contour points. Cubic spline interpolation fits the data points by piecewise cubic polynomials to ensure that the function is smooth at the connection points. , cubic spline interpolation function Satisfies the following formula (17): (17) in, is the generating point, 、 、 、 is a constant term.
[0073] Use these continuous contour points to generate a disturbed elliptical mask. After Gaussian blurring, we can get the stain-like pseudo anomaly, such as Figure 7 shown.
[0074] S3, network optimization; The structural optimization of the image reconstruction network mainly includes the integration of group convolution and the introduction of SE module. The high-speed image reconstruction network structure based on pseudo-abnormal enhancement is as follows: Figure 8 shown.
[0075] The high-speed image reconstruction network based on pseudo-anomaly enhancement consists of two parts: a pseudo-anomaly enhancement method and a high-speed image reconstruction network. After the training images undergo pseudo-anomaly enhancement, a mixed training set consisting of pseudo-anomaly and normal images is fed into the network for training, helping the reconstruction network learn defect feature information.
[0076] The high-speed image reconstruction network is an encoder-decoder structure. The input image first passes through a projection layer, which maps the input 3-channel RGB image to the specified feature dimension. The number of output channels is The present invention selects the number of channels is 32.
[0077] The size is The feature map is input into the encoder, which consists of four downsampling layers. In the first three downsampling layers, the group convolution operation first filters the feature map and extracts local features, so that the spatial size of the feature map is halved and the number of channels is doubled. Then the SE module (Squeeze-and-Excitation Module) performs channel weighting on the feature map to enhance the features of important channels. In order to control the complexity of the model and avoid excessive number of channels in deep networks leading to excessive computation and slowing down the reasoning speed, the fourth downsampling layer does not increase the number of channels, but only reduces the spatial size. The encoder gradually reduces the spatial dimension of the image through convolution and pooling operations, while increasing the number of channels, extracting high-level features, and reducing the size of the feature map to .
[0078] The decoder then gradually restores the image's spatial dimensions through upsampling and convolution operations, reducing the number of channels while also incorporating low-level feature information from the encoder. The decoder consists of four upsampling layers. The upsampling layers first double the spatial dimensions of the input feature map using bilinear interpolation, then use convolution to adjust the number of channels in the feature map.
[0079] Bilinear interpolation is an interpolation method used for feature map amplification. It calculates the value of a target pixel by taking a weighted average of the values of four surrounding known pixels. The advantage of weighted averaging is that it produces smooth amplification results, avoids aliasing, and is computationally less complex than interpolation methods such as bicubic interpolation, making it suitable for applications with high real-time requirements.
[0080] The first upsampling layer is symmetrical to the fourth downsampling layer, only expanding the spatial size of the feature map without changing the number of channels. In the last three upsampling layers, bilinear interpolation and convolution operations are first used to adjust the spatial size of the feature map to twice the previous size and the number of channels to half the previous size. Then, the upsampled feature map is added to the feature map of the same layer encoder, that is, skip connections are used to fuse the detailed information of low-level features with the semantic information of high-level features, helping the model to better restore the high-resolution feature map output. Then, a group convolution operation is performed on the feature map to extract spatial features, better fuse multi-scale features, and then the SE module is used to enhance the features of its important channels. The final output size is The feature map is given to the projection layer.
[0081] The final projection layer, also known as the output layer, is used to map the final feature map back to a 3-channel image through a convolution operation to generate a reconstructed image of the same size as the input image.
[0082] This paper mainly uses group convolution and channel attention mechanism to optimize the image reconstruction network, which is explained in detail below.
[0083] S301, group convolution integration Convolution is a core component of image reconstruction networks, extracting local features and gradually restoring high-quality image details. Traditional convolution extracts features by sliding the convolution kernel across the input feature map and performing a weighted summation of the local region.
[0084] Set the input feature map to , the convolution kernel of ordinary convolution is , then the output feature map The calculation formula is shown in formula (18): (18) in, 、 Represents the index of the convolution kernel in height and width, represents the index of the input channel, represents the index of the output channel, represents the convolution kernel size, 、 Indicates the number of input and output channels.
[0085] Each output channel of ordinary convolution is connected to all input channels, which gives it excellent feature expression ability, but at the same time its computational complexity is , the convolution kernel parameter is Ordinary convolution has high computational complexity and high computational cost in the network. In addition, the number of convolution kernel parameters is large, which slows down the model’s inference speed and easily leads to model overfitting.
[0086] The difference between group convolution and ordinary convolution is that it divides the input channels and output channels into several groups, and each group performs convolution operation independently. , the convolution kernel of the group convolution is ,in Is the number of groups, then the output feature map The calculation formula is shown in formula (19): (19) in, The index of the current group.
[0087] The computational complexity of group convolution is , which is the ordinary convolution times, which makes it more efficient; its parameter count is , ordinary convolution is its times, group convolution reduces the risk of overfitting of the model.
[0088] Number of groups in group convolution It is a parameter that can be flexibly adjusted. We can increase the number of groups to reduce the amount of computation, thereby building a lightweight network with high inference speed. We can also reduce the number of groups to enhance feature interaction and improve the feature extraction performance of the network.
[0089] In downsampling, select the number of groups is 2. This is because the encoder's primary task is to extract high-level global features of the image, such as the distribution, shape, and size of defects. Small group convolutions can capture and fuse information from each channel, making them suitable for extracting rich global features in the early stages of the network. Furthermore, feature maps in early encoder layers are larger and have fewer channels, while in later layers, the number of channels increases while the size decreases significantly. Therefore, the computational complexity of small group convolutions remains relatively small, ensuring both computational efficiency and performance.
[0090] In the upsampling layer, select the number of groups Equivalent to the number of output channels of this layer . The decoder is different from the encoder. Its task is to restore the detailed information of the image and generate a high-resolution reconstructed image. It extracts low-level local features such as edges and textures. A large number of convolutions will perform independent convolution operations on each channel. Although there is a lack of information fusion between channels, it is very suitable for extracting spatial features such as edges and textures. In addition, with the supplement of the first convolution and jump connection, it can also make up for the shortcomings in extracting other local features. In addition, a large number of groups can significantly reduce the amount of calculation and parameters, greatly improving the inference speed of the model.
[0091] In summary, group convolution can significantly reduce the number of parameters and computational complexity while maintaining feature extraction capabilities by grouping the channels of the input feature map and performing convolution operations independently, effectively improving the inference speed and meeting the real-time requirements of the algorithm.
[0092] S302. Introduction of channel attention mechanism Although optimization operations such as group convolution and skip connections can improve the model's computational efficiency and feature extraction capabilities, they lack the ability to automatically select channel importance. The introduction of a channel attention mechanism plays a crucial role in the steel strip image reconstruction task. This paper introduces the SE module, an attention mechanism for enhancing the performance of convolutional neural networks. Its core idea is to improve network performance by explicitly modeling the dependencies between channels and dynamically adjusting the feature responses of each channel.
[0093] The SE module implements the channel attention mechanism mainly through two steps: compression and excitation.
[0094] Compression refers to reducing the spatial dimensions of each channel ( ) is compressed into a scalar to generate a channel descriptor , and its calculation formula is shown in formula (20).
[0095] (20) in, Represents the first channels, with the shape .
[0096] Excitation refers to generating channel weights through the fully connected layer (FC) and nonlinear activation functions (ReLU and Sigmoid) to capture the nonlinear relationship between channels. Channel weight vector The calculation formula is shown in formula (21).
[0097] (twenty one) in, Is the channel descriptor output by the compression stage, with a shape of ; is the weight matrix of the first fully connected layer, with the shape , is the compression ratio; It is the ReLU activation function, which is used to introduce nonlinearity; is the weight matrix of the second fully connected layer, with a shape of , used to restore the feature dimension to ; is the Sigmoid activation function.
[0098] By weighting the feature maps of each channel, the features of important channels can be enhanced and the features of unimportant channels can be suppressed. The SE module can automatically select important channels, enhance their features, and suppress the features of unimportant channels.
[0099] In the strip image reconstruction task, generating high-quality reconstructed images requires the model to accurately understand the feature distribution of defective and normal strip regions. In the feature map, some channels may contain more defect information or normal strip information. The SE module can enhance the features of these channels, while suppressing the features of channels that may contain less valid information, thereby reducing noise and redundant information.
[0100] The SE module effectively enhances the model's feature extraction capability through the channel attention mechanism, which is very helpful in improving the quality of the reconstructed image and thus improving the accuracy of the detection algorithm.
[0101] S4. Abnormal heat map generation Anomaly heatmap is a visualization tool used to display the probability distribution of anomaly regions in an image, locate and visualize defect areas. Anomaly heatmap is generated by MSGM loss calculation.
[0102] MSGMS loss is a multi-scale gradient magnitude similarity loss function that captures subtle differences in defect areas by calculating the gradient magnitude similarity between the input image and the reconstructed image at different scales.
[0103] Set the input image to , the reconstructed image is set to , the calculation formula of MSGMS loss is shown in Equations (22) and (23).
[0104] (twenty two) in, Indicates the number of scales, Indicates the The weight of the scale, Indicates the The gradient operator of the scale, Indicates the gradient magnitude similarity; (twenty three) in, and Respectively and The mean of and Respectively and The variance of express and The covariance of and is a constant.
[0105] The abnormal heat map tensor generated by MSGMS loss can intuitively display the defective areas on the strip surface.
[0106] Those skilled in the art will appreciate that various aspects of the present invention may be implemented as systems, methods, or program products. Accordingly, various aspects of the present invention may be implemented in the following forms: entirely in hardware, entirely in software (including firmware, microcode, etc.), or in a combination of hardware and software, collectively referred to herein as "circuits," "modules," or "platforms."
[0107] Example 2 The present invention provides a high-speed strip steel defect detection system based on abnormality enhancement and image reconstruction. The system can be used to implement the above-mentioned high-speed strip steel defect detection method based on abnormality enhancement and image reconstruction. Specifically, the high-speed strip steel defect detection system based on abnormality enhancement and image reconstruction includes a sample module, a network module and a detection module.
[0108] Among them, the sample module uses the pseudo-anomaly enhancement method to generate scratch-type pseudo-anomalies and stain-type pseudo-anomalies, and adds the generated pseudo-anomalies to the normal samples to form pseudo-anomaly training samples; Network module, integrates group convolution into the U-Net image reconstruction network and introduces the SE module to obtain the image reconstruction network. After mixing normal samples and pseudo-abnormal training samples, the image reconstruction network is trained to obtain a trained image reconstruction network; The detection module inputs the image to be tested into the trained image reconstruction network to obtain a reconstructed image, generates an abnormality thermal map based on the difference between the input image and the reconstructed image, and completes the detection of surface defects of the strip.
[0109] Example 3 The present invention provides a terminal device, which includes a processor and a memory, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is used to execute the program instructions stored in the computer storage medium. The processor may be a central processing unit (CPU), or may be other general-purpose processors, graphics processing units (GPUs), tensor processing units (TPUs), digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, which is suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions to implement corresponding method processes or corresponding functions; the processor described in the embodiment of the present invention can be used for the operation of a high-speed strip steel defect detection method based on abnormality enhancement and image reconstruction, including: A pseudo-anomaly enhancement method is used to generate scratch-type pseudo-anomalies and stain-type pseudo-anomalies, and the generated pseudo-anomalies are added to normal samples to form pseudo-anomaly training samples. Group convolution is integrated into the U-Net image reconstruction network, and the SE module is introduced to obtain an image reconstruction network. The image reconstruction network is trained after mixing normal samples and pseudo-anomaly training samples to obtain a trained image reconstruction network. The image to be tested is input into the trained image reconstruction network to obtain a reconstructed image. The abnormality heat map is generated according to the difference between the input image and the reconstructed image to complete the detection of surface defects of the strip.
[0110] See also Figure 10 The terminal device is a computer device. The computer device 60 of this embodiment includes: a processor 61, a memory 62, and a computer program 63 stored in the memory 62 and executable by the processor 61. When executed by the processor 61, the computer program 63 implements the high-speed strip defect detection method based on anomaly enhancement and image reconstruction in the embodiment. To avoid repetition, the details are not described here. Alternatively, when executed by the processor 61, the computer program 63 implements the functions of each model / unit in the high-speed strip defect detection system based on anomaly enhancement and image reconstruction in the embodiment. To avoid repetition, the details are not described here.
[0111] The computer device 60 may be a desktop computer, a notebook computer, a PDA, a cloud server, or other computing devices. The computer device 60 may include, but is not limited to, a processor 61 and a memory 62. It will be understood by those skilled in the art that Figure 10 This is merely an example of the computer device 60 and does not constitute a limitation of the computer device 60 . The computer device 60 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the computer device may also include input and output devices, network access devices, buses, etc.
[0112] The processor 61 may be a central processing unit (CPU), or other general-purpose processors, a graphics processing unit (GPU), a tensor processing unit (TPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.
[0113] The memory 62 may be an internal storage unit of the computer device 60, such as a hard disk or memory of the computer device 60. The memory 62 may also be an external storage device of the computer device 60, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 60.
[0114] Furthermore, the memory 62 may include both an internal storage unit of the computer device 60 and an external storage device. The memory 62 is used to store computer programs and other programs and data required by the computer device. The memory 62 may also be used to temporarily store data that has been output or is about to be output.
[0115] See also Figure 11 The terminal device is an electronic device 600, which is implemented as a general-purpose computing device. The components of the electronic device may include, but are not limited to, at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different platform components (including the storage unit 620 and the processing unit 610), and a display unit 640.
[0116] The storage unit stores program codes, which can be executed by the processing unit 610, so that the processing unit 610 performs the steps according to various exemplary embodiments of the present invention described in the above method section of this specification. For example, the processing unit 610 can perform the following steps: Figure 12 Follow the steps shown in .
[0117] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 6201 and / or a cache memory unit 6202 , and may further include a read-only memory unit (ROM) 6203 .
[0118] The storage unit 620 may also include a program / utility 6204 having a set (at least one) of program modules 6205, such program modules 6205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0119] Bus 630 may represent one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0120] The electronic device 600 may also communicate with one or more external devices 700 (e.g., a keyboard, a pointing device, a Bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 600, and / or any device that enables the electronic device 600 to communicate with one or more other computing devices (e.g., a router, a modem). Such communication may occur via an input / output interface 650. Furthermore, the electronic device 600 may also communicate with one or more networks (e.g., a local area network, a wide area network, and / or a public network, such as the Internet) via a network adapter 660. The network adapter 660 may communicate with other modules of the electronic device 600 via a bus 630. It should be understood that, although not shown in the figures, other hardware and / or software modules may be used in conjunction with the electronic device 600, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms.
[0121] Example 4 The present invention also provides a storage medium, specifically a computer-readable storage medium. The computer-readable storage medium is a memory device in a terminal device, used to store programs and data. It is understood that the computer-readable storage medium herein may include both the built-in storage medium in the terminal device and, of course, the extended storage medium supported by the terminal device. It may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. The computer-readable storage medium provides storage space that stores the terminal's operating system. Furthermore, the storage space also stores one or more instructions suitable for being loaded and executed by a processor. These instructions may be one or more computer programs (including program code). It should be noted that more specific examples of the computer-readable storage medium herein include: an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical fiber, a portable compact disk read-only memory, an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0122] Computer-readable storage media also include data signals propagated in baseband or as part of a carrier wave, which carry readable program code. Such propagated data signals can take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable storage medium can also be any readable medium other than a readable storage medium, which can send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, device, or device. The program code contained on the readable storage medium can be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, radio frequency, etc., or any suitable combination of the above.
[0123] The program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, and the like, as well as conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a stand-alone software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device via any type of network, including a local area network or a wide area network, or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0124] The processor may load and execute one or more instructions stored in a computer-readable storage medium to implement the corresponding steps of the high-speed strip steel defect detection method based on anomaly enhancement and image reconstruction in the above embodiment; the processor may load and execute the following steps: A pseudo-anomaly enhancement method is used to generate scratch-type pseudo-anomalies and stain-type pseudo-anomalies, and the generated pseudo-anomalies are added to normal samples to form pseudo-anomaly training samples. Group convolution is integrated into the U-Net image reconstruction network, and the SE module is introduced to obtain an image reconstruction network. The image reconstruction network is trained after mixing normal samples and pseudo-anomaly training samples to obtain a trained image reconstruction network. The image to be tested is input into the trained image reconstruction network to obtain a reconstructed image. The abnormality heat map is generated according to the difference between the input image and the reconstructed image to complete the detection of surface defects of the strip.
[0125] The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processors involved in the various embodiments provided herein may include, but are not limited to, general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic units, data processing logic units based on quantum computing, and the like.
[0126] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0127] This paper uses metrics such as pixel-level AUROC and frame rate (FPS) to analyze detection accuracy and inference speed, verifying the effectiveness and reliability of the defect detection method. In the application scenario of this invention, a pixel-level AUROC of 95% or above is required, and simultaneous detection is required on a production line with a maximum speed of 200m / min.
[0128] Effectiveness Analysis of Pseudo-Anomaly Enhancement By evaluating the performance of the model on the pixel-level AUROC indicator, the present invention verifies the application effect of pseudo-anomaly enhancement technology in strip surface defect detection, aiming to analyze whether this method can effectively improve the detection accuracy. The experimental results are as follows: Figure 9 and as shown in Table 1.
[0129] Table 1 Experimental data on effectiveness analysis of pseudo-anomaly enhancement
[0130] Experimental results show that without pseudo-anomaly enhancement, the model's pixel-level AUROC was 0.712. However, with the introduction of this technology, the pixel-level AUROC significantly increased to 0.975, a 36.9% increase. This improvement demonstrates that pseudo-anomaly enhancement can effectively enhance the model's ability to identify abnormal pixels, possibly by simulating richer abnormal patterns or optimizing feature learning. Since the pixel-level AUROC is close to 1.0, the model has achieved a high level of accuracy in distinguishing normal from abnormal pixels. This result confirms that pseudo-anomaly enhancement can effectively expand training data, provide defect feature information, and significantly improve the model's anomaly detection performance.
[0131] Computational complexity analysis In order to evaluate the impact of the network structure optimization scheme on the model inference speed, a computational complexity analysis experiment was designed, using pixel-level AUROC, floating-point operations (FLOPs), parameters (Params) and frame rate (FPS) to comprehensively measure the detection performance of the model.
[0132] The experimental results of computational complexity analysis are shown in Table 2.
[0133] Table 2 Computational complexity analysis experimental data
[0134] Experimental data shows that the base model (Experiment 1) achieved a pixel-level AUROC of 0.958, with a computational overhead of 7.83B, 2.74M parameters, and an inference speed of 149 FPS. After introducing the SE module (Experiment 3), model accuracy improved to 0.971, with a FPS drop of only 0.3, demonstrating that the channel attention mechanism effectively enhances feature representation while maintaining similar computational efficiency. A model using group convolution alone (Experiment 2) achieved outstanding computational efficiency, reducing computational overhead by 28.1% and increasing FPS by 50.5%. However, detection accuracy decreased slightly, suggesting that the grouping operation may limit feature interaction.
[0135] The most groundbreaking result was Experiment 4, which combined group convolution and the SE module. This model not only achieved a peak pixel-level AUROC of 0.975, but also achieved optimal computational efficiency: a 37.0% reduction in computational effort and a 45.3% reduction in parameters compared to the baseline, while achieving a FPS of 249.2. This phenomenon reveals the synergistic effect of the two optimization methods: group convolution reduces computational burden through structured sparsity, while the SE module compensates for the potential information loss caused by grouping through dynamic channel weighting. This architectural design significantly improves operational efficiency while maintaining high accuracy, providing an important reference for the development of high-speed strip surface defect detection systems.
[0136] Engineering application feasibility analysis The project requirements dictated that the defect detection algorithm achieve a pixel-level AUROC exceeding 95% and be able to perform simultaneous inspections on a strip steel production line running at speeds up to 200 m / min. Next, the accuracy and speed of a high-speed strip steel surface defect detection algorithm based on pseudo-anomaly enhancement and image reconstruction were analyzed to determine if it could meet the project's requirements.
[0137] The pixel-level AUROC of the defect detection algorithm reaches 97.5%, which is higher than the 95% required by the detection task, and the accuracy meets engineering requirements.
[0138] The FPS of the defect detection algorithm reached 249.2, which means that one model inference took 4.01ms. Combining image pre-processing and image post-processing, the time required to fully process a 4096×4096 image was measured using the time function of the time library to be 150ms, with a fluctuation of less than or equal to 15ms, which is the frame rate of the detection algorithm. .
[0139] Detection frame rate required by the detection task The calculation formula is shown in formula (24).
[0140] (twenty four) in, is the maximum operating speed of the strip steel production line, ; is the size calibration coefficient of the actual size to the pixel size, .
[0141] In order to meet the requirements of synchronous detection, the frame rate of the detection algorithm based on pseudo-anomaly enhancement and image reconstruction The frame rate needs to be greater than the detection task requirements , obviously, , the detection speed can meet the engineering needs.
[0142] To sum up, the high-speed strip steel defect detection method and system based on anomaly enhancement and image reconstruction of the present invention has a detection frame rate of 6.67 on GeForce RTX 3060, which is higher than the engineering requirement of 5.74, and a pixel-level AUROC of 97.5%, which is higher than the engineering requirement of 95%. It fully meets the industrial detection standards, provides data support for the improvement and optimization of the strip steel production process, and provides significant assistance to the company's product quality control work.
[0143] The above content is only for explaining the technical idea of the present invention and cannot be used to limit the protection scope of the present invention. Any changes made on the basis of the technical solution in accordance with the technical idea proposed by the present invention shall fall within the protection scope of the claims of the present invention.
Claims
1. A high-speed strip steel defect detection method based on anomaly enhancement and image reconstruction, characterized in that: The following steps are involved: The pseudo-anomaly enhancement method is used to generate scratch-type pseudo-anomalies and stain-type pseudo-anomalies, and the generated pseudo-anomalies are added to the normal samples to form pseudo-anomaly training samples; Integrate group convolution into the U-Net image reconstruction network and introduce the SE module to obtain the image reconstruction network. After mixing normal samples and pseudo-abnormal training samples, the image reconstruction network is trained to obtain a trained image reconstruction network. The image to be tested is input into the trained image reconstruction network to obtain a reconstructed image. An abnormality thermal map is generated based on the difference between the input image and the reconstructed image to complete the detection of surface defects of the strip.
2. The high-speed strip steel defect detection method based on anomaly enhancement and image reconstruction according to claim 1 is characterized in that: The pseudo-anomaly enhancement method is used to generate scratch-type pseudo-anomalies and stain-type pseudo-anomalies, as follows: The local average grayscale floating method is used to simulate small defect features that are highly similar to the background and difficult to identify, generating scratch-like pseudo-anomalies; The contour random perturbation method is used to simulate block defect features with various shapes and generate stain-like pseudo anomalies; Use the gamma distribution to constrain the size of spurious anomalies.
3. The high-speed strip steel defect detection method based on anomaly enhancement and image reconstruction according to claim 2 is characterized in that: Scratch-related pseudo-anomalies are as follows: The area corresponding to the pseudo-anomaly in the sample image is extracted, and its average grayscale value is calculated as the reference value of the pseudo-anomaly grayscale value. On the basis of the reference value, the grayscale floating value is increased to obtain the grayscale value of the pseudo-anomaly area.
4. The high-speed strip steel defect detection method based on anomaly enhancement and image reconstruction according to claim 3 is characterized in that: Gray value of pseudo-abnormal area as follows: in, is the width of the pseudo-anomaly region, is the average gray value of the area corresponding to the pseudo-anomaly in the sample image, A floating value.
5. The high-speed strip steel defect detection method based on anomaly enhancement and image reconstruction according to claim 2 is characterized in that: The specific stain-related pseudo-anomalies are: Use uniform distribution to describe randomness, so that the contour of the pseudo-anomaly is randomly disturbed on the basis of the ellipse. When the number of contour points is greater than 20, the length of the outer contour after being divided into 20 parts is calculated as the sampling interval. Every time the interval is repeated, a disturbance point is selected from the ellipse contour. If there are less than 20 points, all points are used directly. The coordinates of each intercepted point are disturbed, and the pixel value within the set range is randomly increased or decreased. The range is determined by the diagonal length. and irregularity coefficient Determine and use the clockwiseangle function to calculate the difference between each perturbation point and the center of the ellipse The angle, according to and Value, obtained using the atan2 function angle; basis The disturbance points are sorted clockwise according to the angle, and then the first point is added to the end of the point set to close the contour. The InterPLD function is used to perform cubic spline interpolation on the disturbance points to generate continuous contour points. The continuous contour points are used to generate a disturbed elliptical mask, and after Gaussian blur processing, the stain-like pseudo anomaly is obtained.
6. The high-speed strip steel defect detection method based on anomaly enhancement and image reconstruction according to claim 5 is characterized in that: For a set of points , cubic spline interpolation function satisfy: in, is the generating point, 、 、 、 is a constant term.
7. The high-speed strip steel defect detection method based on anomaly enhancement and image reconstruction according to claim 1 is characterized in that: The image reconstruction network adopts an encoder-decoder structure. The input image first passes through a projection layer to map the input 3-channel RGB image to the specified feature dimension. The number of output channels is The feature map of The feature map is input to the encoder, which includes four downsampling layers. In the first three downsampling layers, the group convolution operation first filters the feature map to extract local features, and then the SE module performs channel weighting on the feature map. The fourth downsampling layer only reduces the spatial size. The encoder gradually reduces the spatial dimension of the image through convolution and pooling operations, while increasing the number of channels, extracting high-level features, and reducing the feature map size to ; The decoder will then gradually restore the spatial dimensions of the image through upsampling and convolution operations, while combining the low-level feature information from the encoder; the decoder includes four upsampling layers. The upsampling layer first expands the spatial size of the input feature map by 2 times through bilinear interpolation, and then uses convolution operations to adjust the number of channels of the feature map; the first upsampling layer is symmetrical with the fourth downsampling layer, only expanding the spatial size of the feature map. In the last three upsampling layers, bilinear interpolation and convolution operations are first used to adjust the spatial size of the feature map to twice the previous one and the number of channels to half the previous one; the upsampled feature map is then added to the feature map of the same layer encoder, and then a group convolution operation is performed on the feature map to extract spatial features. The SE module is then used to enhance the features of important channels, and the final output size is The feature map is given to the projection layer; The projection layer maps the final feature map back to a 3-channel image through a convolution operation, generating a reconstructed image of the same size as the input image.
8. The high-speed strip steel defect detection method based on anomaly enhancement and image reconstruction according to claim 1 is characterized in that: The abnormal thermodynamic map is generated by calculating the MSGMS loss between the input image and the reconstructed image, and the warm-colored parts in the abnormal thermodynamic map are regarded as defects on the strip surface.
9. The high-speed strip steel defect detection method based on anomaly enhancement and image reconstruction according to claim 1 is characterized in that: The MSGMS loss is calculated as follows: in, Indicates the number of scales, Indicates the The weight of the scale, Indicates the The gradient operator of the scale, Represents the gradient magnitude similarity.
10. A high-speed strip steel defect detection system based on anomaly enhancement and image reconstruction, characterized in that: include: The sample module uses a pseudo-anomaly enhancement method to generate scratch-type pseudo-anomalies and stain-type pseudo-anomalies, and adds the generated pseudo-anomalies to the normal samples to form pseudo-anomaly training samples; Network module, integrates group convolution into the U-Net image reconstruction network and introduces the SE module to obtain the image reconstruction network. After mixing normal samples and pseudo-abnormal training samples, the image reconstruction network is trained to obtain a trained image reconstruction network; The detection module inputs the image to be tested into the trained image reconstruction network to obtain a reconstructed image, generates an abnormality thermal map based on the difference between the input image and the reconstructed image, and completes the detection of surface defects of the strip.
Citation Information
Cited By
Abnormal perception induction defect detection method and system based on cognitive motivation driving
CN120894369A
Defect detection method and system based on cognitive motivation-driven abnormal perception induction
CN120894369B
Defect detection method and system for gantry machine tool workbench casting part
CN120927812A