A method and device for visually detecting surface defects of pipes

By integrating grayscale and texture features, combined with the Canny edge detection algorithm, and adaptively adjusting the threshold, the problem of low accuracy in pipe defect detection in the existing technology is solved, and efficient and reliable pipe quality control is achieved.

CN118429333BActive Publication Date: 2024-09-10SHAANXI BAOYIDA NEW MATERIAL CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410874954.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-02
Publication Date
2024-09-10
Estimated Expiration
2044-07-02

AI Technical Summary

Technical Problem

Existing pipe defect detection methods cannot effectively distinguish between the shedding area and the interference area, resulting in low detection accuracy.

Method used

A pipe surface defect visual detection method is used to obtain the comprehensive probability of the grayscale image and texture image, calculate the correction factor, and combine it with the Canny edge detection algorithm to adaptively adjust the threshold to identify and locate the defective area.

Benefits of technology

It improves the accuracy and robustness of detection, reduces false detections, enhances the flexibility of detection results, and achieves efficient and reliable automated pipe quality control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118429333B
    Figure CN118429333B
Patent Text Reader

Abstract

The present invention relates to the field of pipe inspection, and more specifically, to a method and device for visual inspection of pipe surface defects. The method comprises: obtaining a grayscale image of the pipe surface, calculating a first probability of a target pixel; obtaining a texture image of the pipe surface, calculating a second probability of a target pixel; determining a correction factor of the target pixel; and using the product of the correction factor and a preset threshold as a correction threshold of an edge detection algorithm to perform pipe defect detection. Through the technical solution of the present invention, the accuracy of pipe defect detection can be improved, the risk of pipeline damage can be reduced, and a guarantee can be provided for pipeline safety work.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of pipe inspection, and more specifically, to a method and device for visually inspecting surface defects of pipes. Background Art

[0002] As the basic material in industrial production, pipes are widely used in many fields such as construction, petroleum, chemical industry, and medical treatment. The quality of pipes is directly related to the safety and reliability of the final product. Among them, PSP steel-plastic composite pressure pipe is a pipe made of welded steel pipe as the middle layer, polypropylene material as the inner and outer layers, and compounded by special hot melt adhesive and extrusion molding method. Its unique structural design makes it have excellent pressure resistance and corrosion resistance, and is suitable for various pressure pipeline systems. However, due to improper control of temperature, pressure and other parameters during the production process, the outer layer of PSP steel-plastic composite pressure pipe will delaminate. If the delamination defect is not discovered and handled in time, it will seriously affect the performance and service life of the pipe, making its safety and reliability low.

[0003] The existing Chinese patent application document with publication number CN117030744A discloses a local defect detection system for oil and gas pipe anti-corrosion layers based on multi-sensor fusion. By obtaining the data features corresponding to each sensor data, it is determined whether the oil and gas pipe anti-corrosion layer has fallen off, and the falling off area of ​​the oil and gas pipe anti-corrosion layer is determined based on the abnormal information. The falling off area is marked on the preset oil and gas pipe image to achieve the effect of locating the falling off area.

[0004] However, the above method does not consider the interference area in the pipeline except the falling-off area, and performs the same inspection on the interference area and the falling-off area to obtain the final inspection result, resulting in low accuracy of pipe defect detection. Summary of the invention

[0005] In order to solve the problem of low accuracy in pipe defect detection, the present invention provides a method and device for visually detecting surface defects of pipes.

[0006] In a first aspect, the present invention discloses a method for visually detecting surface defects of a pipe, comprising the following steps: obtaining a grayscale image of the pipe surface, taking any pixel point as a target pixel point, and taking the difference between the grayscale value of the target pixel point and the average grayscale value of all pixels in the grayscale image of the pipe surface as a first probability; obtaining a texture image of the pipe surface, constructing a window with the target pixel point as the center, calculating the average difference between the texture eigenvalues ​​of each pixel point in the window and the mode of the texture eigenvalues ​​of the pipe surface texture image, taking the pixel points in the window whose texture eigenvalues ​​are not equal to the mode of the texture eigenvalues ​​as general points, and taking the product of the ratio of the number of general points to the window size and the average difference as the second probability of the target pixel point; and taking the product of the first probability and the second probability as the comprehensive probability of the target pixel point.

[0007] Calculate the correction factor of the target pixel ,in Indicates The correction factor for each pixel is Indicates The comprehensive probability of pixels, Indicates the The pixel point is the center of The comprehensive probability of the neighboring pixels is Represents the number of neighborhood pixels, represents the normalization function. In the correction factor formula, The pixel point is the target pixel point. The product of the correction factor and the preset threshold is used as the correction threshold of the edge detection algorithm to perform pipe defect detection.

[0008] The present invention improves the accuracy and robustness of detection and reduces false detection by integrating grayscale and texture features. On the contrary, if grayscale is considered alone, the accuracy of the detection result will be affected by the shadow part; if texture features are considered alone, the wrinkled area on the pipe surface will be affected. By adaptively adjusting the threshold of the edge detection algorithm, the flexibility of the calculation result is enhanced, thereby effectively improving the efficiency of pipe quality detection and the reliability of detection.

[0009] Preferably, the obtaining of the pipe surface texture map includes: using a texture feature extraction algorithm to calculate the texture feature value of each pixel in the pipe surface grayscale image, and constructing the pipe surface texture map.

[0010] Preferably, the second probability further comprises: taking the average difference between the texture feature value of each pixel point in the window and the mode of the texture feature value of the pipe surface texture map as the second probability.

[0011] By comparing the average difference between the texture feature values ​​and the mode, the consistency or abnormality of the texture in the pipe surface texture map can be quantified more accurately.

[0012] Preferably, the neighborhood pixel points are pixel points in a preset neighborhood of the target pixel point.

[0013] Preferably, the method of using the product of the correction factor and the preset threshold as the correction threshold of the edge detection algorithm for pipe defect detection includes: the edge detection algorithm is Canny edge detection; using the product of the correction factor and the preset threshold as the correction threshold of the edge detection algorithm, wherein the preset threshold is the upper threshold in Canny edge detection, the correction threshold is the corrected upper threshold, using the product of the correction threshold and the preset hyperparameter as the lower threshold, obtaining the edge detection result through Canny edge detection based on the upper threshold and the lower threshold, and performing connected domain analysis on the edge detection result; performing convex hull detection on the edge, and taking the convex hull detection result as the delamination area to complete the pipe defect detection.

[0014] By combining the correction factor with the preset upper threshold in the Canny edge detection algorithm and adjusting the lower threshold accordingly, the present invention can accurately identify and locate defective areas on the surface of the pipe, especially delamination defects. The accuracy and efficiency of detection are further improved through connected domain analysis and convex hull detection, thereby realizing efficient and reliable automated pipe quality control.

[0015] Preferably, the convex hull detection of the edge includes: taking the edge containing the largest number of pixels as the definite edge, and the remaining edges as suspected edges; calculating the mean of the Euclidean distances between the pixels in the suspected edge and each pixel in the definite edge, recording it as the average distance, traversing to obtain the average distance of each pixel in the suspected edge, taking the mean of all normalized average distances as the edge spacing of the suspected edge, performing negative correlation mapping on the edge spacing, and counting the mode of all edge spacings; multiplying the ratio of the number of pixels of the suspected edge to the number of pixels of the definite edge, the mode of the edge spacing, and the negative correlation mapping value of the edge spacing as the delamination area probability of the suspected edge, retaining the edges whose delamination area probability is greater than the preset delamination area threshold, and performing convex hull detection on all retained edges.

[0016] The calculation conditions for setting the convex hull include distance, number of included pixels and mode of edge spacing. The distance is to prevent the edges of the delamination area that are too far away from being detected by the convex hull, thereby reducing the area of ​​the actual delamination area; the number of included pixels is to prevent the noise edges with lengths similar to those belonging to the delamination area from being included in the delamination area, thereby expanding the area of ​​the actual delamination area; the mode of the edge spacing is to divide the two edges belonging to the normal area into the delamination area.

[0017] Preferably, the edge detection algorithm further includes Sobel edge detection; and the product of the correction factor and a preset threshold is used as the correction threshold of the edge detection algorithm.

[0018] Sobel edge detection is relatively simple, easy to implement, and computationally efficient.

[0019] In a second aspect, the present invention discloses a device for visually inspecting surface defects of a pipe, comprising: a processor; and a memory, wherein the memory stores computer instructions, and when the computer instructions are executed by the processor, the device executes the above-mentioned method for visually inspecting surface defects of a pipe.

[0020] The present invention has the following technical effects:

[0021] By calculating the first probability of the pixel from the grayscale aspect, and the second probability of the pixel from the texture feature aspect, and then combining the first probability and the second probability to obtain the comprehensive probability, the probability that the pixel belongs to the delamination area is fully considered. The correction factor of the pixel is calculated based on the difference between the comprehensive probability of the pixel itself and the comprehensive probability of the neighboring pixels, and then the correction threshold of the pixel is calculated. The delamination area is obtained by using the edge detection algorithm through the correction threshold, which improves the accuracy of the detection result. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:

[0023] Figure 1 It is a flow chart of a method for visually detecting surface defects of a pipe according to an embodiment of the present invention.

[0024] Figure 2 It is a grayscale image of the surface of a pipe in a method for visually detecting surface defects of a pipe according to an embodiment of the present invention.

[0025] Figure 3 It is a pipe surface texture diagram of a method for visually detecting surface defects of a pipe according to an embodiment of the present invention.

[0026] Figure 4 It is a schematic diagram of the system structure of a device for visually inspecting surface defects of a pipe according to an embodiment of the present invention. DETAILED DESCRIPTION

[0027] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions 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. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0028] It should be understood that when the terms "first", "second", etc. are used in the claims, descriptions, and drawings of the present invention, they are only used to distinguish different objects, rather than to describe a specific order. The terms "include" and "comprise" used in the description and claims of the present invention 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 their collections.

[0029] The present invention provides a method for visually detecting surface defects of a pipe. Figure 1 As shown, a method for visually inspecting surface defects of a pipe includes steps S1 to S4, which are described in detail below.

[0030] S1, obtain the grayscale image of the pipe surface and calculate the first probability of the target pixel point.

[0031] In one embodiment, an industrial camera is used to collect RGB (Red Green Blue) images of the surface of the PSP steel-plastic composite pressure pipe, and the collected surface images of the PSP steel-plastic composite pressure pipe are grayed to obtain a grayscale image of the pipe surface, such as Figure 2 The figure below shows the grayscale image of the pipe surface. Converting the RGB image to a grayscale image can save storage space, and it is more convenient to analyze the internal area features of the image through the grayscale value features.

[0032] Taking the pixel point in the upper left corner of the grayscale image of the pipe surface as the coordinate origin, the horizontal right direction as the positive direction of the x-axis, the index increases successively along the positive direction of the x-axis, and the vertical downward direction as the positive direction of the y-axis, the index increases successively along the positive direction of the y-axis. The priority of increasing the index along the positive direction of the x-axis is higher than the priority of increasing the index along the positive direction of the y-axis. The pixel points in the grayscale image of the pipe surface can be arranged, and any pixel point can be used as the target pixel point.

[0033] It should be noted that the grayscale value of the delamination area affected by its own metal color is lower than that of the normal area, and the grayscale value of the part affected by surface reflection is higher than that of the normal area. In the surface image of the pipe with delamination defects, the area of ​​the defective area accounts for a smaller proportion of the total image area, and the grayscale mean of the pipe surface image is closer to the grayscale value of the normal area. Therefore, the higher the degree of deviation of the grayscale value of the pixel from the grayscale mean of the pipe surface image, the more likely it is that the pixel is located in the delamination area.

[0034] The difference between the gray value of the target pixel and the mean gray value of all pixels in the gray image of the pipe surface is taken as the first probability, and the first probability satisfies the relationship:

[0035] ,in Indicates The first probability of pixels, No. The gray value of a pixel, Represents the total number of pixels in the grayscale image of the pipe surface. represents the normalization function. In the first probability relation, The pixel point is the target pixel point.

[0036] The first probability is the probability that the pixel point belongs to the delamination area obtained from the direction of the gray value.

[0037] S2, obtaining a surface texture map of the pipe and calculating a second probability of the target pixel.

[0038] It should be noted that since the metal texture in the delaminated area is quite different from the uniform plastic texture in the normal area, and the uniform plastic texture in the normal area accounts for a high area in the pipe surface texture map, the mode of the texture eigenvalues ​​of the pixels in the pipe surface texture map is the texture eigenvalue of the pixels belonging to the normal area.

[0039] In one embodiment, a texture feature extraction algorithm is used to calculate the texture feature value of each pixel in the grayscale image of the pipe surface to construct a texture image of the pipe surface, such as Figure 3 The figure shows the pipe surface texture map. Exemplarily, the texture feature extraction algorithm includes: gray level co-occurrence matrix (GLCM), local binary pattern (LBP), wavelet transform and scale invariant feature transform (SIFT), etc. The mode of texture feature values ​​of pixel points in the pipe surface texture map is counted.

[0040] A window is constructed with the target pixel point as the center. For example, the size of the window can be set by a person skilled in the art. In the present invention, the size of the window is set to 3×3. The average difference between the texture feature value of each pixel point in the window and the mode of the texture feature value of the pipe surface texture map is calculated. The pixel points whose texture feature value in the window is not equal to the mode of the texture feature value are regarded as general points. The product of the ratio of the number of general points to the window size and the average difference is regarded as the second probability of the target pixel point. The second probability satisfies the relationship:

[0041] ,in Indicates The second probability of pixels, Indicates the The number of general points in the window centered at the pixel point, Indicates the window size, Indicates the The first pixel in the window centered at The texture feature value of each pixel, represents the mode of texture eigenvalues, represents the normalization function. In the second probability relation, The pixel point is the target pixel point.

[0042] The average difference between the texture eigenvalues ​​of all pixels in the window and the texture eigenvalues ​​of the normal area can represent the consistency between the pixels in the window and the pixels in the normal area. The smaller the average difference, the closer the texture eigenvalues ​​of the pixels in the window are to the texture eigenvalues ​​of the pixels in the normal area. The number of general points is used to constrain the number of general points. The fewer the number of general points, the closer the pixels in the window are to the pixels in the normal area. The ratio of the number of general points to the window size can also play a denoising role, because even if the texture eigenvalues ​​are similar, the texture areas where the pixels are located may have different complexities or details.

[0043] In another embodiment, the average difference between the texture feature value of each pixel in the window and the mode of the texture feature value of the pipe surface texture map is used as the second probability, and the second probability satisfies the relationship:

[0044] ,in Indicates The second probability of pixels, Indicates the window size, Indicates the The first pixel in the window centered at The texture feature value of each pixel, represents the mode of texture eigenvalues, represents the normalization function. In the second probability relation, The pixel point is the target pixel point.

[0045] The second probability is the probability that the pixel point obtained from the direction of the texture feature value belongs to the delamination area.

[0046] S3, calculating the comprehensive probability of the target pixel point, and calculating the correction factor of the target pixel point through the comprehensive probability.

[0047] It should be noted that due to the influence of illumination, some normal areas on the surface of the pipe have shadows, and the first probability of the shadow area is also very high, which is difficult to distinguish from the actual delamination area by the first probability, while the second probability of the shadow part is low and can be distinguished by the second probability. Due to the influence of wrinkles, the second probability of the wrinkle area on the surface of some pipes is also very high, which is difficult to distinguish by the second probability, while the first probability of the wrinkle area is low and can be distinguished by the first probability. Therefore, in order to fully consider all situations, both the first probability and the second probability need to be considered at the same time.

[0048] In one embodiment, the product of the first probability and the second probability is used as the comprehensive probability of the target pixel.

[0049] When performing threshold segmentation on pixels, since each pixel belongs to a different area, it is necessary to calculate the correction factor of each pixel based on the comprehensive probability.

[0050] Specifically, the correction factor of the target pixel is calculated based on the average difference between the comprehensive probability of the target pixel and the comprehensive probability of the neighboring pixels. The correction factor satisfies the relationship:

[0051] ,in Indicates The correction factor for each pixel is Indicates The comprehensive probability of pixels, Indicates the The pixel point is the center of The comprehensive probability of the neighboring pixels is Represents the number of neighborhood pixels, represents the normalization function. In the correction factor formula, The pixel point is the target pixel point.

[0052] The neighborhood pixel points are pixel points in a preset neighborhood of the target pixel point. Exemplarily, the preset neighborhood may be an 8-neighborhood, a 16-neighborhood, etc. The present invention adopts an 8-neighborhood.

[0053] S4, taking the product of the correction factor and the preset threshold as the correction threshold of the edge detection algorithm to perform pipe defect detection.

[0054] In one embodiment, the product of the correction factor and the preset threshold is used as the correction threshold of the edge detection algorithm, wherein the edge detection algorithm is Canny edge detection.

[0055] The modified threshold satisfies the relationship:

[0056] ,in Indicates The correction threshold of pixels is Indicates The correction factor for each pixel is Indicates the preset threshold.

[0057] It should be noted that there may still be some noise points in the edge detection results obtained by correcting the threshold, and the edges of the metal surface texture in the delamination area will be detected. Since the pipe surface image usually only contains a single delamination area, the convex hull detection result of the edge containing the largest number of pixels can be selected as the delamination area.

[0058] The product of the correction factor and the preset threshold is used as the correction threshold of the edge detection algorithm, where the preset threshold is the upper threshold in Canny edge detection, the correction threshold is the corrected upper threshold, and the product of the correction threshold and the preset hyperparameter is used as the lower threshold. Generally speaking, the lower threshold is 0.4 times the upper threshold. In this experiment, the preset hyperparameter is set to 0.3, and the specific value can be set by a person skilled in the art. Exemplarily, the preset threshold is set to 0.8, that is, the upper threshold in Canny edge detection is 0.8, and the lower threshold can be obtained as 0.24 through the multiple relationship.

[0059] Based on the upper threshold and the lower threshold, the edge detection result is obtained by Canny edge detection, and the connected domain analysis is performed on the edge detection result; the convex hull detection is performed on the edge, and the convex hull detection on the edge includes:

[0060] The edge with the largest number of pixels is taken as the confirmed edge, and the rest of the edges are taken as the suspected edges; the mean of the Euclidean distance between the pixels in the suspected edge and each pixel in the confirmed edge is calculated, recorded as the average distance, and the average distance of each pixel in the suspected edge is obtained by traversing, and the mean of all the normalized average distances is taken as the edge spacing of the suspected edge, and the edge spacing is negatively correlated. Generally, the edge spacing is negatively correlated using an exponential function to obtain a negative correlation mapping value, and the mode of all edge spacings is counted; the ratio of the number of pixels in the suspected edge to the number of pixels in the confirmed edge, the mode of the edge spacing, and the negative correlation mapping value of the edge spacing are multiplied as the probability of the delamination area of ​​the suspected edge, and the edges with a delamination area probability greater than a preset delamination area threshold are retained. For example, the preset delamination area threshold is set to 0.4. Convex hull detection is performed on all retained edges, and the convex hull detection results are taken as the delamination area.

[0061] In another implementation, the edge detection algorithm further includes Sobel edge detection, and the product of the correction factor and the preset threshold is used as the correction threshold of the edge detection algorithm. Exemplarily, the preset threshold is set to 0.8.

[0062] The present invention also discloses a device for visually inspecting surface defects of a pipe. Figure 4 , including a processor and a memory, the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a surface defect visual inspection method for a pipe according to the present invention is implemented.

[0063] The above system also includes other components well known to those skilled in the art, such as a communication bus and a communication interface, and their configuration and functions are known in the art, so they will not be described in detail here.

[0064] In the present invention, the aforementioned memory may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus or device. For example, a computer-readable storage medium may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc., or any other medium that can be used to store the required information and can be accessed by an application, a module or both. Any such computer storage medium may be part of a device or accessible or connectable to a device.

[0065] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.

[0066] The above are all preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Therefore, any equivalent changes made based on the structure, shape, and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for visually inspecting surface defects of a pipe, characterized in that: include: Obtain a grayscale image of the pipe surface, take any pixel as a target pixel, and normalize the difference between the grayscale value of the target pixel and the mean grayscale value of all pixels in the grayscale image of the pipe surface as the first probability; Obtain the surface texture map of the pipe, construct a window with the target pixel as the center, calculate the average difference between the texture feature value of each pixel in the window and the mode of the texture feature value of the surface texture map of the pipe, take the pixel points whose texture feature value in the window is not equal to the mode of the texture feature value as general points, and normalize the product of the ratio of the number of general points to the window size and the average difference as the second probability of the target pixel; The product of the first probability and the second probability is taken as the comprehensive probability of the target pixel; Calculate the correction factor of the target pixel ,in Indicates The correction factor for each pixel is Indicates The comprehensive probability of pixels, Indicates the The pixel point is the center of The comprehensive probability of the neighboring pixels is Represents the number of neighborhood pixels, represents the normalization function. In the correction factor formula, The pixel point is the target pixel point; The correction threshold of the edge detection algorithm is calculated based on the correction factor and the preset threshold to detect pipe defects. The correction threshold satisfies the relationship: ,in Indicates The correction threshold of pixels is Indicates The correction factor for each pixel is Indicates the preset threshold.

2. A method for visually inspecting surface defects of a pipe according to claim 1, characterized in that: The obtaining of the pipe surface texture map comprises: The texture feature extraction algorithm is used to calculate the texture feature value of each pixel in the grayscale image of the pipe surface and construct the pipe surface texture map.

3. The method for visually inspecting surface defects of a pipe according to claim 1, characterized in that: The neighborhood pixel points are pixel points in a preset neighborhood of the target pixel point.

4. The method for visually inspecting surface defects of a pipe according to claim 1, characterized in that: The edge detection algorithm is Canny edge detection; The preset threshold is the upper threshold in Canny edge detection, the modified threshold is the modified upper threshold, the product of the modified threshold and the preset hyperparameter is used as the lower threshold, the edge detection result is obtained by Canny edge detection based on the upper threshold and the lower threshold, and the connected domain analysis is performed on the edge detection result; The convex hull detection is performed on the edge, and the convex hull detection result is used as the delamination area to complete the pipe defect detection.

5. A method for visually inspecting surface defects of a pipe according to claim 4, characterized in that: The convex hull detection of the edge comprises: The edge with the largest number of pixels is regarded as the confirmed edge, and the remaining edges are regarded as suspected edges; Calculate the mean of the Euclidean distances between the pixel in the suspected edge and each pixel in the determined edge, record it as the average distance, traverse to obtain the average distance of each pixel in the suspected edge, take the mean of all normalized average distances as the edge spacing of the suspected edge, perform negative correlation mapping on the edge spacing, and count the mode of all edge spacings; The ratio of the number of pixels of the suspected edge to the number of pixels of the confirmed edge, the mode of the edge spacing and the negative correlation mapping value of the edge spacing are multiplied as the delamination area probability of the suspected edge, and the edges with the delamination area probability greater than the preset delamination area threshold are retained, and convex hull detection is performed on all retained edges.

6. The method for visually inspecting surface defects of a pipe according to claim 1, characterized in that: The edge detection algorithm is Sobel edge detection; The product of the correction factor and the preset threshold is used as the correction threshold of the edge detection algorithm.

7. A visual inspection device for surface defects of a pipe, characterized in that: include: Processor; and A memory storing computer instructions, wherein when the computer instructions are executed by a processor, the device executes a method for visually inspecting surface defects of a pipe according to any one of claims 1 to 6.