Machine Vision-Based Defect Detection System for Seamless Steel Pipe Production

By segmenting and analyzing seamless steel pipe images, and adjusting the defect probability based on texture consistency and deviation angle, the accuracy problem of machine vision technology in seamless steel pipe defect identification is solved, achieving efficient defect detection.

CN121437477BActive Publication Date: 2026-05-26山东聊城九阳钢管制造有限公司

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
山东聊城九阳钢管制造有限公司
Filing Date
2025-11-07
Publication Date
2026-05-26

Smart Images

  • Figure CN121437477B_ABST
    Figure CN121437477B_ABST
Patent Text Reader

Abstract

This application discloses a machine vision-based defect detection system for seamless steel pipe production, relating to the field of image analysis technology. The system includes: an acquisition device for acquiring a first inspection image of the seamless steel pipe; a processing device for acquiring multiple segmented regions based on the first inspection image; acquiring a first segmented region from each segmented region; acquiring a texture consistency value based on the first segmented region; acquiring a first defect probability based on the texture consistency value; and if the first defect probability is greater than or equal to a first preset value, inputting the first segmented region into a defect detection model to obtain defect information in the first segmented region. This application's segmentation of the first inspection image into multiple segmented regions eliminates interference from irrelevant background and noise in the image, allowing defect identification to focus more specifically on a single region, thus solving the problem of traditional overall analysis being easily interfered with by redundant information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image analysis technology, specifically a machine vision-based defect detection system for seamless steel pipe production. Background Technology

[0002] Seamless steel pipe is a type of steel pipe without weld seams, featuring a hollow cross-section and smooth, flat inner and outer surfaces. It is manufactured from hot-rolled steel, or, when necessary, cold-worked hot-rolled pipes to achieve the required shape, dimensions, and properties. It is a key basic material in energy, transportation, and military industries, and its surface quality directly affects the product's service life and safety performance. Currently, the industry mainly relies on manual visual inspection, infrared image detection, eddy current testing, and ultrasonic testing to detect defects in seamless steel pipe production.

[0003] In the process of seamless steel pipe production defect detection based on machine vision, the detection quality depends on the image quality of the acquired seamless steel pipe. The image quality of the seamless steel pipe is limited by the resolution of the acquisition device (e.g., a camera) and the surface texture noise of the seamless steel pipe production process. These factors affect the ability of traditional machine vision technology to identify the specific location and shape of defect areas in seamless steel pipes. Summary of the Invention

[0004] The purpose of this application is to provide a machine vision-based defect detection system for seamless steel pipe production, in order to solve the technical problem that existing machine vision technologies are unable to accurately identify defects in seamless steel pipes.

[0005] To achieve the above objectives, this application provides the following technical solution:

[0006] This application proposes a technical solution for a machine vision-based defect detection system for seamless steel pipe production. The machine vision-based defect detection system for seamless steel pipe production includes:

[0007] Acquisition device, used to acquire the first inspection image of the seamless steel pipe;

[0008] A processing device is used to acquire multiple segmented regions based on the first detected image;

[0009] Furthermore, based on each segmented region, the first segmented region is obtained one by one; the first segmented region is any segmented region in each segmented region for which the corresponding first defect probability has not been obtained;

[0010] And, for each first segmented region, perform the following steps:

[0011] Based on the first segmented region, a texture consistency value is obtained; the texture consistency value is used to characterize at least the degree of disorder of the texture in the first detected image;

[0012] Based on the texture consistency value, a first defect probability is obtained; the first defect probability is used to characterize at least the probability of having a defect in the first segmentation region;

[0013] If the first defect probability is greater than or equal to the first preset value, the first segmented region is input into the defect detection model to obtain defect information in the first segmented region; the defect information includes any one or more combinations of defect type, location and size.

[0014] As a specific solution in the technical solution of this application, the processing device is further used to smooth the first detected image by using a filtering algorithm to remove high-frequency noise and obtain a denoised image;

[0015] Furthermore, the denoised image is converted to grayscale to obtain a grayscale image;

[0016] Furthermore, a threshold segmentation algorithm is used to segment the grayscale image to obtain the seamless steel pipe image;

[0017] Furthermore, the seamless steel pipe image is divided into multiple equally divided regions to obtain multiple segmented regions.

[0018] As a specific solution in this application, the processing device is further configured to obtain an average grayscale image based on each segmented region; the size of the average grayscale image is the same as the size of each segmented region, and the pixel value of each pixel in the average grayscale image is equal to the average pixel value of the corresponding pixel in each segmented region.

[0019] Furthermore, based on the first segmented region and the average grayscale image, a pixel difference value is obtained; the pixel difference value is used at least to characterize the magnitude of the pixel value difference between each pixel point in the first segmented region and the average grayscale image;

[0020] And, based on the pixel difference value, the texture consistency value is obtained.

[0021] As a specific solution in this application, the processing device is further configured to traverse the first segmented region and obtain the first pixel point one by one; the first pixel point is any pixel point in the first segmented region;

[0022] Furthermore, for each first pixel, the following steps are performed until each first pixel obtains the corresponding pixel difference value;

[0023] Based on the first pixel, a second pixel is obtained; the second pixel is a pixel in the average grayscale image with the same coordinates as the first pixel.

[0024] Based on the first pixel and the second pixel, a pixel difference is obtained; the pixel difference is equal to the absolute value of the difference between the pixel value of the first pixel and the pixel value of the second pixel.

[0025] And, after each pixel has obtained a corresponding pixel difference value, the pixel difference value is obtained based on each pixel difference value.

[0026] As a specific solution in this application, the processing device is further configured to obtain a deviation angle value based on the first segmented region; the deviation angle value is at least used to characterize the degree to which the first segmented region is close to the edge of the first detected image;

[0027] Furthermore, the first defect probability is obtained based on the deviation angle value and the texture consistency value.

[0028] As a specific solution in this application, the processing device is further configured to obtain a horizontal distance based on the first segmented region; the horizontal distance is the distance between the center pixel of the first segmented region and the center line of the seamless steel pipe image; the center line of the seamless steel pipe image is parallel to the extension direction of the seamless steel pipe in the seamless steel pipe image;

[0029] Furthermore, based on the first detection image, a length value, a height value, and a radius value are obtained; the length value is the total pixel length of the seamless steel pipe in the first detection image, and the direction of the total pixel length is parallel to the center line of the seamless steel pipe image; the height value is the object distance when the first detection image was captured; and the radius value is the design radius of the seamless steel pipe.

[0030] In addition, the deviation angle value is obtained based on the horizontal distance, the length value, the height value, and the radius value.

[0031] As a specific solution in this application, the processing device is further configured to obtain a plurality of texture extension lines from the first segmented region based on the Sobel operator; the width of the texture extension line is one pixel;

[0032] Furthermore, a first correction coefficient is obtained based on each texture extension line; the first correction coefficient is used at least to characterize the magnitude of the length and angle difference of each texture extension line.

[0033] And, the first defect probability is adjusted based on the first correction coefficient.

[0034] As a specific solution in the technical solution of this application, the processing device is further used to acquire, one by one, the texture extension lines that have not acquired the corresponding extension feature values ​​based on each texture extension line;

[0035] In addition, perform the following steps for each texture extension line:

[0036] Based on the texture extension line, the number of pixels and the extension angle are obtained; the number of pixels is the total number of pixels in the texture extension line; the extension angle is the acute angle formed by the extension direction of the texture extension line and the center line of the seamless steel pipe image.

[0037] Based on the number of pixels and the included angle of extension, obtain the extension feature value corresponding to the texture extension line;

[0038] Furthermore, after obtaining the extension feature values ​​corresponding to all texture extension lines, the first correction coefficient is obtained based on each extension feature value.

[0039] As a specific solution in this application, the acquisition device is further configured to: if the first defect probability is greater than or equal to a second preset value, or less than the first preset value, then re-capture and acquire a second detection image; the second detection image has a second segmented region, and the portion of the second segmented region located in the seamless steel pipe is the same as the portion of the first segmented region located in the seamless steel pipe;

[0040] The processing device is further configured to acquire the second segmented region based on the second detected image;

[0041] Furthermore, based on the second segmented region, a second defect probability is obtained; the second defect probability is used at least to characterize the probability of having a defect in the second segmented region;

[0042] Furthermore, if the second defect probability is greater than or equal to the first preset value, the first segmented region is replaced with the second segmented region.

[0043] As a specific solution in this application, it also includes an early warning device, which is used to issue an alarm if the second defect probability is greater than or equal to the second preset value and less than the first preset value.

[0044] Compared with the prior art, the beneficial effects of this application are:

[0045] This application divides the first detection image into multiple segmentation regions, eliminating interference from irrelevant backgrounds and noise in the image. This allows defect identification to focus on a single region more effectively, solving the problem of traditional overall analysis being susceptible to interference from redundant information. By combining the first defect probability with a texture consistency value, the likelihood of each segmentation region containing a defect is numerically quantified, reducing misjudgments or missed judgments caused by local noise and slight texture fluctuations, thus improving the scientific accuracy of the judgment. Furthermore, by inputting only the segmentation regions with a higher first defect probability into the defect detection model, the computational load can be reduced, improving efficiency. At the same time, it can ensure that the defect detection model accurately outputs information such as defect type, location, and size, effectively improving the accuracy and industrial applicability of seamless steel pipe defect detection. Attached Figure Description

[0046] Figure 1 This is a schematic flowchart of a machine vision-based defect detection method for seamless steel pipe production proposed in an embodiment of this application.

[0047] Figure 2 This is a schematic diagram of the structure of a machine vision-based defect detection system for seamless steel pipe production proposed in an embodiment of this application;

[0048] Figure 3 This is an image of a seamless steel pipe obtained from an embodiment of this application. Detailed Implementation

[0049] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0050] The terms "first," "second," etc., in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. For example, the first and second segmented regions mentioned below belong to different segmented regions. It should be understood that such names can be used interchangeably where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or modules is not necessarily limited to those steps or modules explicitly listed, but may include other steps or modules not explicitly listed or inherent to these processes, methods, products, or devices. The division of modules in the embodiments of this application is merely a logical division. In actual applications, there may be other division methods. For example, multiple modules may be combined into or integrated into another system, or some features may be ignored or not performed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interface, and the indirect coupling or communication connection between modules may be electrical or other similar forms. None of these are limited in the embodiments of this application. Furthermore, the modules or sub-modules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed among multiple circuit modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the embodiments of this application.

[0051] To address the technical problem mentioned in the background art that existing machine vision technology is insufficient for accurately identifying defects in seamless steel pipes, this application proposes an embodiment of a machine vision-based defect detection method for seamless steel pipe production. Specifically, as shown... Figure 1 As shown, the machine vision-based seamless steel pipe production defect detection method includes steps S100 to S600.

[0052] Step S100: Obtain the first inspection image of the seamless steel pipe.

[0053] In this embodiment, the first inspection image of the seamless steel pipe is acquired using an acquisition device. The acquisition device can be any device capable of acquiring inspection images of the seamless steel pipe (e.g., the first inspection image and the second inspection image mentioned below), such as an industrial camera or an infrared camera.

[0054] Step S200: Based on the first detected image, obtain multiple segmentation regions.

[0055] In this embodiment, the purpose of obtaining multiple segmented regions based on the first detection image is to focus on defects in the segmented regions and eliminate interference from irrelevant regions. In this embodiment, any reasonable method can be used to obtain multiple segmented regions based on the first detection image. For example, the first detection image can be divided into multiple segmented regions by equal division. Alternatively, step S200, obtaining multiple segmented regions based on the first detection image, includes steps S210 to S240.

[0056] Step S210: The first detection image is smoothed using a filtering algorithm to remove high-frequency noise and obtain a denoised image.

[0057] In this embodiment, any reasonable filtering algorithm can be used to smooth the first detected image. For example, the filtering algorithm can be a Gaussian filter, a median filter, or a bilateral filter, etc.

[0058] Step S220: Convert the denoised image to grayscale to obtain a grayscale image.

[0059] It is important to understand that converting an image (i.e., a denoised image) to grayscale is a mature technology in the computer field, which will not be elaborated on here.

[0060] Step S230: Use a threshold segmentation algorithm to segment the grayscale image to obtain the seamless steel pipe image.

[0061] It's important to understand that thresholding is one of the most commonly used methods in image segmentation. Its core idea is to utilize the difference in grayscale values ​​between the target region (i.e., the seamless steel pipe image) and the background region in an image. By setting one or more thresholds, all pixels in the image are divided into different categories, thus achieving separation of the target and background. In other words, using thresholding to segment grayscale images to obtain seamless steel pipe images is a mature technology, and will not be elaborated upon here. Figure 3 This is an image of a seamless steel pipe obtained according to one embodiment of this application.

[0062] Step S240: Divide the seamless steel pipe image into multiple equally divided regions to obtain multiple segmented regions.

[0063] In this embodiment, the size of the segmented regions is not limited and can be set according to requirements. For example, the length of each segmented region can be equal to its width; or, the length of each segmented region can be twice its width, etc.

[0064] Step S300: Based on each segmented region, obtain the first segmented region one by one.

[0065] In this embodiment, the first segmented region is any segmented region in the various segmented regions for which the corresponding first defect probability has not been obtained. That is to say, in this embodiment, the method for obtaining the first defect probability corresponding to any segmented region is the same as the method for obtaining the first defect probability corresponding to the first segmented region.

[0066] In this embodiment, the following steps are performed for each first segmented region:

[0067] Step S400: Based on the first segmented region, obtain the texture consistency value.

[0068] In this embodiment, the texture consistency value is used at least to characterize the degree of disorder of the texture in the first detection image. That is, the texture consistency value can be any value that can characterize the degree of disorder of the texture in the first detection image. For example, the texture consistency value can be the variance or standard deviation of the pixel values ​​corresponding to each pixel in the first detection image. It should be noted that seamless steel pipes are stretched or rolled along their axial direction during the production process, so they have inherent production textures (e.g., inherent production textures parallel to the axis or Gaussian noise without obvious directional textures), and the images captured by the acquisition device are also affected by their resolution, which will also produce noise textures. Therefore, the overall difference in texture of all segmented regions can be calculated. The smaller the difference, the higher the noise texture consistency, that is, the lower the overall disorder of the first detection image, and the higher the reliability of the subsequently obtained first defect probability; if the overall disorder of the first detection image is high, it means that the texture of the first detection image itself is messy or the noise is extremely large, that is, the reliability of the subsequently obtained first defect probability is lower. Based on this, step S400, based on the first segmented region, obtains the texture consistency value, including steps S410 to S430.

[0069] Step S410: Obtain the average grayscale image based on each segmented region.

[0070] In this embodiment, the size of the average grayscale image is the same as the size of each segmented region, and the pixel value of each pixel in the average grayscale image is equal to the average pixel value of the corresponding pixel in each segmented region. Specifically, the formula for calculating the pixel value of each pixel in the average grayscale image is as follows:

[0071]

[0072] in, This represents the pixel value corresponding to the pixel in the nth row and mth column of the average grayscale image. Indicates the total number of partitioned regions; This represents the pixel value corresponding to the pixel in the nth row and mth column of the i-th segmented region.

[0073] Step S420: Based on the first segmented region and the average grayscale image, obtain the pixel difference value.

[0074] In this embodiment, the pixel difference value is used at least to characterize the magnitude of the pixel value difference between each pixel in the first segmented region and the average grayscale image. That is, the core function of the pixel difference value is to quantify the degree of difference in pixel values ​​between the first segmented region and the average grayscale image, thereby reflecting the degree of texture disorder. In other words, in this embodiment, any reasonable value can be used as the pixel difference value, as long as the pixel difference value can reflect the magnitude of the pixel value difference between each pixel in the first segmented region and the average grayscale image. For example, the pixel difference value can be the difference between the average pixel value of each pixel in the first segmented region and the average pixel value of each pixel in the average grayscale image. Alternatively, step S420, obtaining the pixel difference value based on the first segmented region and the average grayscale image, includes steps S421 to S424.

[0075] Step S421: Traverse the first segmented region and obtain the first pixel point one by one.

[0076] In this embodiment, the first pixel is any pixel in the first segmented region.

[0077] For each first pixel, the following steps are performed until each first pixel has a corresponding pixel difference value;

[0078] Step S422: Obtain the second pixel based on the first pixel.

[0079] In this embodiment, the second pixel is the pixel in the average grayscale image that has the same coordinates as the first pixel.

[0080] Step S423: Obtain the pixel difference based on the first pixel and the second pixel.

[0081] In this embodiment, the pixel difference is equal to the absolute value of the difference between the pixel value of the first pixel and the pixel value of the second pixel. Specifically, the calculation formula for the pixel difference based on the first pixel and the second pixel is as follows:

[0082]

[0083] in, This represents the pixel difference corresponding to the pixel in the nth row and mth column of the i-th segmentation region; This represents the pixel value corresponding to the pixel in the nth row and mth column of the i-th segmentation region; This represents the pixel value corresponding to the pixel in the nth row and mth column of the average grayscale image. This indicates that the absolute value is being calculated.

[0084] Step S424: After each pixel has obtained a corresponding pixel difference value, obtain the pixel difference value based on each pixel difference value.

[0085] In this embodiment, the pixel difference value can be obtained based on the individual pixel differences in any reasonable manner. For example, the pixel difference value can be the average of the individual pixel differences; or, the calculation formula for obtaining the pixel difference value based on the individual pixel differences is as follows:

[0086]

[0087] in, This represents the pixel difference value corresponding to the i-th segmented region (i.e., the first segmented region); This indicates the total number of rows corresponding to the pixels in the segmented region; This indicates the total number of columns corresponding to the pixels in the segmented region; This represents the pixel difference corresponding to the pixel in the nth row and mth column of the i-th segmented region.

[0088] Step S430: Obtain the texture consistency value based on the pixel difference value.

[0089] In this embodiment, the texture consistency value can be obtained based on the pixel difference value using any reasonable method. For example, the texture consistency value can be the average of the pixel difference values; or, in step S430, the formula for calculating the texture consistency value based on the pixel difference value is as follows:

[0090]

[0091] in, Indicates the texture consistency value; Indicates the total number of partitioned regions; This represents the pixel difference value corresponding to the i-th segmented region. In this embodiment, if... The larger the value, the greater the overall noise and texture difference in the first detection image, meaning the greater the disorder of pixel values ​​corresponding to each pixel in the first detection image, and the lower the texture consistency value. The smaller; if The smaller the value, the higher the texture consistency value. The larger.

[0092] Step S500: Based on the texture consistency value, obtain the first defect probability.

[0093] In this embodiment, the first defect probability is used to characterize at least the probability of having a defect in the first segmented region. The first defect probability can be obtained based on the texture consistency value in any reasonable manner. For example, the first defect probability corresponding to the first segmented region can be the ratio of the pixel difference value to the texture consistency value corresponding to the first segmented region. If the first defect probability is the ratio of the pixel difference value to the texture consistency value corresponding to the first segmented region, then the larger the texture consistency value, the smaller the first defect probability. Similarly, if the first defect probability is the ratio of the pixel difference value to the texture consistency value corresponding to the first segmented region, then the larger the pixel difference value, the larger the first defect probability.

[0094] It is important to note that due to the cylindrical geometry of seamless steel pipes and the viewing angle effect during camera imaging, the distortion of the curved surface area of ​​the seamless steel pipe varies significantly. Especially when defects such as scratches and cracks exist on the pipe surface, the different directions and locations of these defects will cause them to exhibit varying degrees of distortion in the image (i.e., geometric deformation or image distortion). Furthermore, the sensitivity of defects in different directions to distortion also varies: defects parallel to the pipe axis are less affected by distortion; while defects perpendicular to the axis or at an angle, because their extension direction is consistent with the distortion direction, are prone to severe pixel compression, breakage, or blurring, making it difficult to accurately identify their true size and shape. Therefore, to obtain a more accurate first defect probability, in one embodiment of this application, step S500, based on the texture consistency value, obtains the first defect probability, including steps S510 and S520.

[0095] Step S510: Based on the first segmented region, obtain the deviation angle value.

[0096] In this embodiment, the deviation angle value is used at least to characterize the degree to which the first segmented region is close to the edge of the first detected image. In this embodiment, any reasonable method can be used to obtain the deviation angle value based on the first segmented region. For example, step S510, obtaining the deviation angle value based on the first segmented region, may include steps S511 to S513.

[0097] Step S511: Obtain the horizontal distance based on the first segmented region.

[0098] In this embodiment, the horizontal distance is the distance between the center pixel of the first segmented region and the center line of the seamless steel pipe image. The center line of the seamless steel pipe image is parallel to the extension direction of the seamless steel pipe in the image.

[0099] Step S512: Based on the first detected image, obtain the length value, height value, and radius value.

[0100] In this embodiment, the length value is the total pixel length of the seamless steel pipe in the first detection image, and the direction of the total pixel length is parallel to the center line of the seamless steel pipe image. The height value is the object distance when the first detection image was captured. The radius value is the design radius of the seamless steel pipe.

[0101] Step S513: Obtain the deviation angle value based on the horizontal distance, the length value, the height value, and the radius value.

[0102] As mentioned earlier, seamless steel pipes can be approximated as cylindrical structures in shape, and their cylindrical curved surface characteristics will affect images taken from a top-down perspective. Specifically, in seamless steel pipe images obtained from a top-down perspective, the image projection has a relatively small impact on the characterization of defects in the central area of ​​the steel pipe image; however, as the defect location moves closer to the edge of the steel pipe, the defect distortion caused by the viewing angle becomes more significant, and its influence on the defect characterization results increases accordingly. Based on this, the deviation angle value can be positively correlated with the horizontal distance and radius value, and negatively correlated with the length and height value. That is to say, in this embodiment, the deviation angle value can be obtained in any reasonable way based on the horizontal distance, the length value, the height value, and the radius value, as long as the deviation angle value is positively correlated with the horizontal distance and radius value and negatively correlated with the length and height value.

[0103] In a specific embodiment of this application, step S513, based on the horizontal distance, the length value, the height value, and the radius value, calculates the deviation angle value using the following formula:

[0104]

[0105] in, This represents the deviation angle value corresponding to the i-th segmented region (i.e., the first segmented region); Indicates horizontal distance; Indicates the radius value; Indicates the length value; Indicates the height value; This represents the arctangent function.

[0106] Step S520: Obtain the first defect probability based on the deviation angle value and the texture consistency value.

[0107] In this embodiment, the larger the deviation angle value corresponding to a certain segmented region, the closer the segmented region is to the edge, meaning the probability of distortion in that segmented region is also greater, and the probability of the first defect corresponding to that segmented region should be reduced. In other words, in this embodiment, the first defect probability is negatively correlated with the deviation angle value. In the embodiments of this application, the first defect probability can be obtained based on the deviation angle value and the texture consistency value using any reasonable method. Specifically, step S520: the calculation formula for obtaining the first defect probability based on the deviation angle value and the texture consistency value can be as follows:

[0108]

[0109] in, This represents the probability of the first defect corresponding to the i-th segmented region (i.e., the first segmented region); This represents the pixel difference value corresponding to the i-th segmented region (i.e., the first segmented region); Indicates the texture consistency value; This represents the deviation angle value corresponding to the i-th segmented region (i.e., the first segmented region); This represents a normalization function used to normalize the value within the parentheses to the range [0, 1]. The larger the value within the parentheses, the closer the normalized value is to 1. In this embodiment, the larger the deviation angle value, the smaller the probability of the first defect; conversely, the smaller the deviation angle value, the larger the probability of the first defect.

[0110] It is important to note that due to the rolling process of seamless steel pipes, the normal texture is parallel to the axis of the seamless steel pipe (i.e., the center line mentioned above). Different defects in different directions will have different sensitivities to distortion. For vertically oriented defects (i.e., parallel to the axis of the seamless steel pipe), the main extension direction is orthogonal to the main distortion direction; distortion only slightly affects its width, but has little impact on key features such as length and continuity. However, horizontally oriented defects (i.e., the circumferential direction of the seamless steel pipe) extend in the same direction as the distortion compression, causing the entire defect to be severely "compressed" into a small pixel area, resulting in a significant underestimation of its true length, blurred boundaries, and even potential breakage into multiple small segments. In other words, if the first defect probability only considers pixel difference values ​​(i.e., the degree of texture disorder in the segmented area) and deviation angle values ​​(i.e., whether the segmented area is close to the edge of the first detection image), it does not consider the different impacts of distortion caused by the cylindrical structure of the seamless steel pipe and camera perspective effects on different defects. That is, defects perpendicular to or at a certain angle to the steel pipe axis are prone to pixel compression and texture breakage because their extension direction is consistent with the distortion direction. Defects parallel to the axis are less affected, and the distortion sensitivity varies depending on the length of the defect. Simply considering the pixel difference value and the deviation angle value as the first defect probability cannot accurately reflect these differences, potentially leading to missed detections (e.g., short defects perpendicular to the axis are underestimated due to distortion) or misjudgments (e.g., long defects parallel to the axis are overestimated due to local noise). Therefore, after obtaining the first defect probability based on the deviation angle value and the texture consistency value in step S520, the method further includes steps S530 to S550.

[0111] Step S530: Based on the Sobel operator, obtain multiple texture extension lines from the first segmented region.

[0112] In this embodiment, the width of the texture extension line is one pixel.

[0113] Step S540: Obtain the first correction coefficient based on each texture extension line.

[0114] In this embodiment, the first correction coefficient is used at least to characterize the magnitude of the length and angle differences of each texture extension line. The first correction coefficient can be obtained based on each texture extension line in any reasonable manner; for example, the first correction coefficient can be the variance or standard deviation of the direction of each texture extension line. To extract features from each texture extension line to obtain an accurate first correction coefficient and thus adjust the first defect probability, in one embodiment of this application, step S540, obtaining the first correction coefficient based on each texture extension line, includes steps S541 to S544.

[0115] Step S541: Based on each texture extension line, obtain the texture extension lines for which the corresponding extension feature value has not been obtained one by one.

[0116] Perform the following steps for each texture extension line:

[0117] Step S542: Based on the texture extension line, obtain the number of pixels and the extension angle.

[0118] In this embodiment, the number of pixels is the total number of pixels in the texture extension line, and the extension angle is the acute angle formed by the extension direction of the texture extension line and the center line of the seamless steel pipe image.

[0119] Step S543: Based on the number of pixels and the extension angle, obtain the extension feature value corresponding to the texture extension line.

[0120] In this embodiment, any reasonable method can be used to obtain the extension feature value corresponding to each texture extension line. For example, in step S543, the calculation formula for obtaining the extension feature value corresponding to the texture extension line based on the number of pixels and the extension angle can be as follows:

[0121]

[0122] in, This represents the extension feature value corresponding to the t-th texture extension line among all texture extension lines; represents the included angle corresponding to the t-th texture extension line; cos represents the cosine function. This represents the number of pixels corresponding to the t-th texture extension line. In this embodiment, the larger the extension angle (i.e., the closer it is to 90°), the smaller the extension feature value; the more pixels there are, the larger the extension feature value.

[0123] Step S544: After obtaining the extension feature values ​​corresponding to all texture extension lines, obtain the first correction coefficient based on each extension feature value.

[0124] In this embodiment, if there are more texture extension lines with larger included angles corresponding to each texture extension line in a certain segmented region, and more texture extension lines with fewer pixels (i.e., shorter texture extension lines), then the first defect probability corresponding to that segmented region should be amplified. In other words, if in step S550, the adjusted first defect probability is positively correlated with the first correction coefficient, then in step S544, the first correction coefficient should be inversely proportional to each extension feature value; if the adjusted first defect probability is negatively correlated with the first correction coefficient, then in step S544, the first correction coefficient should be positively proportional to each extension feature value. To avoid redundancy, only the embodiment where the first defect probability is positively correlated with the first correction coefficient is described below. Specifically, in this embodiment, the calculation formula for obtaining the first correction coefficient based on each extension feature value is as follows:

[0125]

[0126] in, This represents the first correction coefficient corresponding to the i-th segmented region (i.e., the first segmented region); This represents the total number of texture extension lines in the i-th segmentation region; This represents the extended feature value corresponding to the t-th texture extension line among all texture extension lines. In this embodiment, the core design of the above calculation formula is to quantify the overall degree of distortion interference of defect textures in the first segmentation region by using the ratio of the total number of texture extension lines to the sum of all extended feature values, thereby providing a precise basis for adjusting the first defect probability. Considering the adjustment requirements of the first defect probability, when the first correction coefficient is too large, it indicates that the defect textures in this region are more likely to be underestimated due to distortion (for example, short defects with a vertical axis may be misjudged as defect-free due to distortion). In this case, it is necessary to amplify the first defect probability by using a larger first correction coefficient to compensate for the deviation of the initial first defect probability. When the first correction coefficient is too small, it indicates that the defect textures in this region are less affected by distortion, and the reliability of the initial first defect probability is high. There is no need for excessive correction to avoid misjudgment due to excessive correction (for example, misjudging a defect-free normal texture as a defect).

[0127] Step S550: Adjust the first defect probability based on the first correction coefficient.

[0128] In this embodiment, the formula for adjusting the first defect probability based on the first correction coefficient is as follows:

[0129]

[0130] in, This represents the adjusted first defect probability of the i-th segmentation region (i.e., the first segmentation region); This represents the probability of the first defect in the i-th segmented region before adjustment. This represents the first correction coefficient corresponding to the i-th segmented region (i.e., the first segmented region); This represents a normalization function used to normalize the value within the brackets to the range [0, 1]. The larger the value within the brackets, the closer the normalized value is to 1.

[0131] Step S550: After adjusting the first defect probability based on the first correction coefficient, the method further includes steps S560 to S590.

[0132] Step S560: If the first defect probability is greater than or equal to the second preset value, or less than the first preset value, then re-capture the second detection image.

[0133] In this embodiment, the second detection image has a second segmentation region, and the portion of the second segmentation region located in the seamless steel pipe is the same as the portion of the first segmentation region located in the seamless steel pipe.

[0134] In this embodiment, the first preset value and the second preset value can be set according to requirements. For example, the first preset value can be 0.8 or 0.9, etc.; the second preset value can be 0.4 or 0.5, etc.

[0135] Step S570: Based on the second detected image, obtain the second segmented region.

[0136] It should be noted that the second segmentation region can be obtained based on the second detection image by referring to step S200, which will not be elaborated here.

[0137] Step S580: Based on the second segmentation region, obtain the second defect probability.

[0138] In this embodiment, the second defect probability is used at least to characterize the probability of having a defect in the second segmented region. The second defect probability is obtained based on the second segmented region, referring to steps S300 to S500, which will not be elaborated here.

[0139] In this embodiment, the core purpose of steps S560 to S580 is to verify the first defect probability in the fuzzy range (i.e., greater than or equal to the second preset value and less than the first preset value) by secondary image acquisition and probability calculation, thereby making up for the uncertainty of a single detection and improving the rigor and accuracy of seamless steel pipe defect judgment.

[0140] It should be clear that after obtaining the second defect probability based on the second segmentation region in step S580, the method further includes: if the second defect probability is greater than or equal to a second preset value and less than the first preset value, then an alarm is issued.

[0141] In this embodiment, if two tests cannot determine whether the second segmented area has a defect, it means that the only way to alert relevant personnel is to manually review whether the second segmented area has a defect. In this embodiment, the alarm can be issued by an alarm device, such as a buzzer, a flashing light, or a display. The display can directly show relevant warning text such as "Whether a certain area has a defect cannot be determined, please manually review."

[0142] Step S590: If the second defect probability is greater than or equal to the first preset value, then the first segmented region is replaced with the second segmented region.

[0143] Step S600: If the first defect probability is greater than or equal to the first preset value, then input the first segmented region into the defect detection model to obtain the defect information in the first segmented region.

[0144] In this embodiment, the defect information includes any one or a combination of defect type, location, and size. It should be noted that in the field of computer vision, obtaining defect information from an image (i.e., the first segmented region) based on a defect detection model is a mature technology, and will not be elaborated upon here.

[0145] The embodiment of the seamless steel pipe production defect detection method based on machine vision proposed in this application divides the first detection image into multiple segmented regions, which can eliminate the interference of irrelevant background and noise in the image, making defect identification more targeted and focusing on a single region, thus solving the problem that traditional overall analysis is easily interfered with by redundant information. By combining the first defect probability with texture consistency value to quantify the possibility of each segmented region containing a defect, the misjudgment or missed judgment caused by local noise and slight texture fluctuations is reduced, improving the scientific nature of the judgment. Furthermore, only inputting the segmented regions with a higher first defect probability into the defect detection model can reduce the amount of computation and improve efficiency, while ensuring that the defect detection model accurately outputs information such as defect type, location, and size, effectively improving the accuracy and industrial applicability of seamless steel pipe defect detection.

[0146] Having introduced the embodiments of the machine vision-based seamless steel pipe production defect detection method proposed in this application, the embodiments of the machine vision-based seamless steel pipe production defect detection system proposed in this application are described below, such as... Figure 2 As shown, the machine vision-based seamless steel pipe production defect detection system 10 includes:

[0147] Acquisition device 11 is used to acquire the first inspection image of the seamless steel pipe;

[0148] Processing device 12 is used to acquire multiple segmented regions based on the first detected image;

[0149] Furthermore, based on each segmented region, the first segmented region is obtained one by one; the first segmented region is any segmented region in each segmented region for which the corresponding first defect probability has not been obtained;

[0150] And, for each first segmented region, perform the following steps:

[0151] Based on the first segmented region, a texture consistency value is obtained; the texture consistency value is used to characterize at least the degree of disorder of the texture in the first detected image;

[0152] Based on the texture consistency value, a first defect probability is obtained; the first defect probability is used to characterize at least the probability of having a defect in the first segmentation region;

[0153] If the first defect probability is greater than or equal to the first preset value, the first segmented region is input into the defect detection model to obtain defect information in the first segmented region; the defect information includes any one or more combinations of defect type, location and size.

[0154] As a specific embodiment of this application, the processing device 12 is further configured to smooth the first detected image using a filtering algorithm to remove high-frequency noise and obtain a denoised image;

[0155] Furthermore, the denoised image is converted to grayscale to obtain a grayscale image;

[0156] Furthermore, a threshold segmentation algorithm is used to segment the grayscale image to obtain the seamless steel pipe image;

[0157] Furthermore, the seamless steel pipe image is divided into multiple equally divided regions to obtain multiple segmented regions.

[0158] As a specific embodiment of this application, the processing device 12 is further configured to obtain an average grayscale image based on each segmented region; the size of the average grayscale image is the same as the size of each segmented region, and the pixel value of each pixel in the average grayscale image is equal to the average pixel value of the corresponding pixel in each segmented region.

[0159] Furthermore, based on the first segmented region and the average grayscale image, a pixel difference value is obtained; the pixel difference value is used at least to characterize the magnitude of the pixel value difference between each pixel point in the first segmented region and the average grayscale image;

[0160] And, based on the pixel difference value, the texture consistency value is obtained.

[0161] As a specific embodiment of this application, the processing device 12 is further configured to traverse the first segmented region and obtain the first pixel point one by one; the first pixel point is any pixel point in the first segmented region;

[0162] Furthermore, for each first pixel, the following steps are performed until each first pixel obtains the corresponding pixel difference value;

[0163] Based on the first pixel, a second pixel is obtained; the second pixel is a pixel in the average grayscale image with the same coordinates as the first pixel.

[0164] Based on the first pixel and the second pixel, a pixel difference is obtained; the pixel difference is equal to the absolute value of the difference between the pixel value of the first pixel and the pixel value of the second pixel.

[0165] And, after each pixel has obtained a corresponding pixel difference value, the pixel difference value is obtained based on each pixel difference value.

[0166] As a specific embodiment of this application, the processing device 12 is further configured to obtain a deviation angle value based on the first segmented region; the deviation angle value is at least used to characterize the degree to which the first segmented region is close to the edge of the first detected image;

[0167] Furthermore, the first defect probability is obtained based on the deviation angle value and the texture consistency value.

[0168] As a specific embodiment of this application, the processing device 12 is further configured to obtain a horizontal distance based on the first segmented region; the horizontal distance is the distance between the center pixel of the first segmented region and the center line of the seamless steel pipe image; the center line of the seamless steel pipe image is parallel to the extension direction of the seamless steel pipe in the seamless steel pipe image;

[0169] Furthermore, based on the first detection image, a length value, a height value, and a radius value are obtained; the length value is the total pixel length of the seamless steel pipe in the first detection image, and the direction of the total pixel length is parallel to the center line of the seamless steel pipe image; the height value is the object distance when the first detection image was captured; and the radius value is the design radius of the seamless steel pipe.

[0170] In addition, the deviation angle value is obtained based on the horizontal distance, the length value, the height value, and the radius value.

[0171] As a specific embodiment of this application, the processing device 12 is further configured to obtain a plurality of texture extension lines from the first segmented region based on the Sobel operator; the width of the texture extension line is one pixel;

[0172] Furthermore, a first correction coefficient is obtained based on each texture extension line; the first correction coefficient is used at least to characterize the magnitude of the length and angle difference of each texture extension line.

[0173] And, the first defect probability is adjusted based on the first correction coefficient.

[0174] As a specific embodiment of this application, the processing device 12 is further configured to acquire, one by one, the texture extension lines that have not acquired the corresponding extension feature values, based on each texture extension line;

[0175] In addition, perform the following steps for each texture extension line:

[0176] Based on the texture extension line, the number of pixels and the extension angle are obtained; the number of pixels is the total number of pixels in the texture extension line; the extension angle is the acute angle formed by the extension direction of the texture extension line and the center line of the seamless steel pipe image.

[0177] Based on the number of pixels and the included angle of extension, obtain the extension feature value corresponding to the texture extension line;

[0178] Furthermore, after obtaining the extension feature values ​​corresponding to all texture extension lines, the first correction coefficient is obtained based on each extension feature value.

[0179] As a specific embodiment of this application, the acquisition device 11 is further configured to, if the first defect probability is greater than or equal to a second preset value and less than the first preset value, re-capture and acquire a second detection image; the second detection image has a second segmented region, and the portion of the second segmented region located in the seamless steel pipe is the same as the portion of the first segmented region located in the seamless steel pipe;

[0180] The processing device 12 is further configured to acquire the second segmented region based on the second detected image;

[0181] Furthermore, based on the second segmented region, a second defect probability is obtained; the second defect probability is used at least to characterize the probability of having a defect in the second segmented region;

[0182] Furthermore, if the second defect probability is greater than or equal to the first preset value, the first segmented region is replaced with the second segmented region.

[0183] As a specific embodiment of this application, it also includes an early warning device 13, which is used to issue an alarm if the second defect probability is greater than or equal to a second preset value and less than the first preset value.

[0184] The embodiment of the seamless steel pipe production defect detection system based on machine vision proposed in this application divides the first detection image into multiple segmented regions, which can eliminate the interference of irrelevant background and noise in the image, making defect identification more targeted and focusing on a single region, thus solving the problem that traditional overall analysis is easily interfered with by redundant information. By combining the first defect probability with a texture consistency value to numerically quantify the possibility of each segmented region containing a defect, the system reduces misjudgment or missed judgment caused by local noise and slight texture fluctuations, thereby improving the scientific nature of the judgment. Furthermore, by only inputting the segmented regions with a higher first defect probability into the defect detection model, the system can reduce the amount of computation and improve efficiency, while ensuring that the defect detection model accurately outputs information such as defect type, location, and size, thereby effectively improving the accuracy and industrial applicability of seamless steel pipe defect detection.

[0185] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0186] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the methods, apparatuses, and devices described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0187] In the several embodiments provided in this application, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between devices or modules may be electrical, mechanical, or other forms.

[0188] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0189] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium.

[0190] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.

[0191] The computer program product includes one or more computer instructions. When the computer program is loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video optical disc), or a semiconductor medium (e.g., solid-state disk (SSD)).

[0192] Although embodiments of this application have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles of this application.

Claims

1. A machine vision-based defect detection system for seamless steel pipe production, characterized in that, include: Acquisition device, used to acquire the first inspection image of the seamless steel pipe; Processing device, configured to acquire multiple segmented regions based on the first detected image, including: A filtering algorithm is used to smooth the first detected image and remove high-frequency noise to obtain a denoised image. Furthermore, the denoised image is converted to grayscale to obtain a grayscale image; Furthermore, a threshold segmentation algorithm is used to segment the grayscale image to obtain the seamless steel pipe image; Furthermore, the seamless steel pipe image is divided into multiple equally divided regions to obtain multiple segmented regions; Furthermore, based on each segmented region, the first segmented region is obtained one by one; the first segmented region is any segmented region in each segmented region for which the corresponding first defect probability has not been obtained; And, for each first segmented region, perform the following steps: Based on the first segmented region, a texture consistency value is obtained; the texture consistency value is used to characterize at least the degree of disorder of the texture in the first detected image; Based on the texture consistency value, a first defect probability is obtained; the first defect probability is used to characterize at least the probability of having a defect in the first segmentation region; If the first defect probability is greater than or equal to the first preset value, the first segmented region is input into the defect detection model to obtain defect information in the first segmented region; the defect information includes any one or more combinations of defect type, location and size. The step of obtaining a texture consistency value based on the first segmented region includes: Based on the first segmented region, an deviation angle value is obtained; the deviation angle value is at least used to characterize the degree to which the first segmented region is close to the edge of the first detected image; The first defect probability is obtained based on the deviation angle value and the texture consistency value; The step of obtaining the deviation angle value based on the first segmented region includes: Based on the first segmented region, a horizontal distance is obtained; the horizontal distance is the distance between the center pixel of the first segmented region and the center line of the seamless steel pipe image; the center line of the seamless steel pipe image is parallel to the extension direction of the seamless steel pipe in the seamless steel pipe image; Based on the first detection image, a length value, a height value, and a radius value are obtained; the length value is the total pixel length of the seamless steel pipe in the first detection image, and the direction of the total pixel length is parallel to the center line of the seamless steel pipe image; the height value is the object distance when the first detection image was captured; and the radius value is the design radius of the seamless steel pipe. The deviation angle value is obtained based on the horizontal distance, the length value, the height value, and the radius value.

2. The seamless steel pipe production defect detection system based on machine vision according to claim 1, characterized in that, The processing device is further configured to acquire an average grayscale image based on each segmented region; the size of the average grayscale image is the same as the size of each segmented region, and the pixel value of each pixel in the average grayscale image is equal to the average pixel value of the corresponding pixel in each segmented region. And, based on the first segmented region and the average grayscale image, obtain pixel difference values; The pixel difference value is used at least to characterize the magnitude of the pixel value difference between each pixel in the first segmented region and the average grayscale image; And, based on the pixel difference value, the texture consistency value is obtained.

3. The seamless steel pipe production defect detection system based on machine vision according to claim 2, characterized in that, The processing device is further configured to traverse the first segmented region and acquire the first pixel point one by one; the first pixel point is any pixel point in the first segmented region; Furthermore, for each first pixel, the following steps are performed until each first pixel obtains the corresponding pixel difference value; Based on the first pixel, a second pixel is obtained; the second pixel is a pixel in the average grayscale image with the same coordinates as the first pixel. Based on the first pixel and the second pixel, obtain the pixel difference; The pixel difference is equal to the absolute value of the difference between the pixel value of the first pixel and the pixel value of the second pixel; And, after each pixel has obtained a corresponding pixel difference value, the pixel difference value is obtained based on each pixel difference value.

4. The seamless steel pipe production defect detection system based on machine vision according to claim 1, characterized in that, The processing device is further configured to obtain multiple texture extension lines from the first segmented region based on the Sobel operator; The width of the texture extension line is one pixel; And, based on each texture extension line, obtain the first correction coefficient; The first correction factor is used at least to characterize the magnitude of the difference in length and angle of each texture extension line; And, the first defect probability is adjusted based on the first correction coefficient.

5. The seamless steel pipe production defect detection system based on machine vision according to claim 4, characterized in that, The processing device is further configured to, based on each texture extension line, acquire the texture extension lines for which the corresponding extension feature value has not been acquired; In addition, perform the following steps for each texture extension line: Based on the texture extension line, the number of pixels and the extension angle are obtained; the number of pixels is the total number of pixels in the texture extension line; the extension angle is the acute angle formed by the extension direction of the texture extension line and the center line of the seamless steel pipe image. Based on the number of pixels and the included angle of extension, obtain the extension feature value corresponding to the texture extension line; Furthermore, after obtaining the extension feature values ​​corresponding to all texture extension lines, the first correction coefficient is obtained based on each extension feature value.

6. The seamless steel pipe production defect detection system based on machine vision according to claim 4, characterized in that, The acquisition device is further configured to, if the first defect probability is greater than or equal to a second preset value and less than the first preset value, re-capture and acquire a second detection image; the second detection image has a second segmented region, and the portion of the second segmented region located in the seamless steel pipe is the same as the portion of the first segmented region located in the seamless steel pipe; The processing device is further configured to acquire the second segmented region based on the second detected image; Furthermore, based on the second segmented region, a second defect probability is obtained; the second defect probability is used at least to characterize the probability of having a defect in the second segmented region; Furthermore, if the second defect probability is greater than or equal to the first preset value, the first segmented region is replaced with the second segmented region.

7. The seamless steel pipe production defect detection system based on machine vision according to claim 6, characterized in that, It also includes an early warning device, which issues an alarm if the second defect probability is greater than or equal to a second preset value and less than the first preset value.