Image-based steel pipe quality detection method and device, terminal equipment and storage medium

By selecting a matching defect recognition model in the seamless steel pipe production line, performing image interference removal processing and enhanced replication, the problem of high false detection and missed detection rates in the detection of small cracks in seamless steel pipes was solved, achieving higher detection accuracy and lower false detection rate.

CN121329918AInactive Publication Date: 2026-01-13JIANGXI HONGRUIMA STEEL PIPE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511477891.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-16
Publication Date
2026-01-13
Estimated Expiration
Not applicable · inactive patent

Smart Images

  • Figure CN121329918A_ABST
    Figure CN121329918A_ABST
Patent Text Reader

Abstract

The invention is suitable for the technical field of image processing, and provides an image-based steel pipe quality detection method and device, terminal equipment and a storage medium. And selecting a target defect identification model matched with the current steel pipe production line from an identification model library. Determining the defect area of the suspected crack image according to the pixel information of the target steel pipe image, copying the suspected crack in the suspected crack image according to the crack track parameter and the crack geometric parameter when the defect area is smaller than or equal to a preset area to obtain a copied defect image, and inputting the copied defect image into a model to obtain a target steel pipe image; an initial defect identification result is obtained, a final defect identification result is determined according to the initial defect identification result and the imitation parameters, the sizes of the cracks are screened according to the area of a defect region, and the smaller cracks are subjected to enhanced imitation to improve the image quality of the small cracks, so that the detection accuracy of the small cracks is improved, and the detection efficiency is improved. And the omission ratio is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, and in particular to a steel pipe quality detection method and device based on images, a terminal device and a storage medium. BACKGROUND

[0002] As the "blood vessels" of modern industry, seamless steel pipes play a core material role in more than 10 key fields such as oil drilling and production, chemical transportation, and power infrastructure. According to relevant data, the annual output of seamless steel pipes in China has broken through 30 million tons, of which 65% is used in scenarios with extremely high requirements for material safety performance.

[0003] In complex production processes such as high-pressure perforation and cold rolling finishing, the surface of the steel pipe is prone to form cracks due to factors such as impurities in raw materials, wear of rolling dies, and environmental dust. Such defects not only reduce the fatigue strength and corrosion resistance of the pipe, but also may cause stress concentration under high pressure and high temperature conditions, leading to pipe bursting and other safety accidents. Currently, machine vision technology is commonly used for quality detection of seamless steel pipes, but this detection method has a high miss rate and false detection rate for small cracks. Therefore, how to improve the accuracy of small crack defect detection has become a technical problem to be solved. SUMMARY

[0004] The embodiments of the present application provide a steel pipe quality detection method and device based on images, a terminal device and a storage medium, which can solve the technical problem of high miss rate and false detection rate of small cracks in the prior art.

[0005] In a first aspect, the embodiments of the present application provide a steel pipe quality detection method based on images, comprising: obtaining current production parameters of a current steel pipe production line and a steel pipe image of a steel pipe to be detected; selecting a target defect recognition model matched with the current steel pipe production line from a recognition model library according to the current production parameters; performing interference removal processing on the steel pipe image to obtain a target steel pipe image; obtaining a suspected crack image in the target steel pipe image, and determining a defect area of the suspected crack image according to pixel information of the suspected crack image; in a case where the defect area is less than or equal to a preset area, extracting crack trajectory parameters and crack geometric parameters of a suspected crack from the suspected crack image; enhancing and copying the suspected crack according to the crack trajectory parameters and the crack geometric parameters to obtain a copied defect image; inputting the copied defect image into the target defect recognition model to obtain an initial defect recognition result; According to the initial defect identification result and a simulation parameter simulating the suspected crack, a final defect identification result is determined.

[0006] Further, before the current steel pipe production line current production parameters and the steel pipe image to be detected are acquired, the method further comprises: Acquiring a plurality of historical production parameters of the current steel pipe production line; According to each historical production parameter, a matching is performed in a historical defect picture database to obtain a historical defect picture dataset corresponding to each historical production parameter, wherein the historical defect picture database stores seamless steel pipe images produced under different production parameters and having defects; According to the defect quantity and the definition of each historical defect picture in the historical defect picture dataset, a picture quality score of each historical defect picture is determined; According to the picture quality score of each historical defect picture, a plurality of target historical defect pictures are selected from the historical defect picture dataset to construct a training sample set; Each training sample set is used to train an initial convolutional neural network respectively to obtain a defect identification model corresponding to each historical production parameter, wherein the defect identification models corresponding to each historical production parameter constitute a model identification library.

[0007] Further, the steel pipe image is subjected to a disturbance removal process to obtain a target steel pipe image, comprising: Acquiring a steel pipe model of the steel pipe produced by the current steel pipe production line, and determining parameter information of a common interference image according to the steel pipe model; According to the parameter information, a target window used for image extraction is determined; Through the target window, a plurality of target images are extracted from the steel pipe image; The plurality of target images are subjected to a gray scale processing to obtain a plurality of target gray scale images; For each target gray scale image, a gray scale level of each pixel point in the target gray scale image is acquired; According to the gray scale level of each pixel point, an interference degree value of the corresponding target gray scale image is determined; According to the interference degree value corresponding to each target gray scale image, interference images in each target gray scale image are removed to obtain a target steel pipe image.

[0008] Further, the interference degree value of the corresponding target gray scale image is determined according to the gray scale level of each pixel point, comprising: According to the historical defect picture dataset corresponding to the current production parameter, a historical gray scale level is determined; The pixel points with a gray scale level greater than the historical gray scale level are determined as target pixel points; The qualified grayscale ratio of the corresponding target grayscale image is determined based on the number of target pixels and the total number of pixels in the corresponding target grayscale image. Based on the grayscale ratio range to which the qualified grayscale ratio belongs, a dynamic index coefficient is determined. The dynamic index coefficient is used to make the interference degree value exhibit different growth characteristics in different grayscale ratio ranges. Perform connected component analysis on the target pixels and calculate the target area of ​​each connected component; The interference level value of the corresponding target grayscale image is determined based on the qualified grayscale ratio, the dynamic index coefficient, and the target area of ​​each connected region.

[0009] Further, when the area of ​​the defect region is less than or equal to a preset area, extracting the crack trajectory parameters and crack geometric parameters of the suspected crack from the suspected crack image includes: If the area of ​​the defect region is less than or equal to a preset area, the suspected crack image is processed into a grayscale image and a binarized image, and the grayscale image is divided into multiple image sub-blocks; The stability classification of each image sub-block is determined based on the pixel grayscale value of each sub-block. For each image sub-block, the image sub-block is processed according to the processing method matched with the corresponding stability classification to obtain the target grayscale image; Based on the grayscale values ​​of each pixel in the target grayscale image, determine the valley pixels in the grayscale image; Construct a valley pixel chain based on the grayscale value of each valley pixel; Step-by-step tracking is performed using the two endpoint pixels in the valley chain as initial points to obtain the pixel coordinates and orientation angle of each step; Based on the pixel coordinates and orientation angle of each step, determine the trajectory point sequence and trajectory breakpoint; The crack trajectory parameters are determined based on the trajectory point sequence, the orientation angle, and the trajectory break point. Based on the trajectory point sequence, the suspected cracks in the binarized image are segmented to obtain multiple suspected crack segments; The geometric parameters of the crack are determined based on the orientation angles corresponding to the trajectory points in each suspected crack segment and the arc length of each suspected crack segment.

[0010] Further, the step of enhancing and replicating the suspected crack based on the crack trajectory parameters and the crack geometric parameters to obtain a replicated defect image includes: A baseline path for replicating the crack is generated in the target coordinate system based on the crack trajectory parameters. The location of the suspected fracture point is found based on the crack trajectory parameters. Obtain the adjacent trajectory points of the break point location, and complete the break point in the reference path according to the direction angle of the adjacent trajectory points to obtain the initial path; Based on the initial path, the geometric dimensions of the simulated crack are restored according to the crack geometry parameters to obtain the restored path; The local calibration ratio is determined based on the crack geometry parameters, and the restoration path is calibrated based on the local calibration ratio to obtain the calibration path; The calibration path is enhanced with grayscale to obtain a simulated defect image.

[0011] Furthermore, after acquiring the suspected crack image in the target steel pipe image and determining the defect area of ​​the suspected crack image based on the pixel information of the suspected crack image, the method further includes: If the area of ​​the defect region is larger than a preset area, the image of the target steel pipe is input into the target defect recognition model to obtain the defect recognition result.

[0012] Secondly, embodiments of this application provide an image-based steel pipe quality inspection device, comprising: The acquisition unit is used to acquire the current production parameters of the current steel pipe production line and the image of the steel pipe surface to be inspected; The matching unit is used to select a target defect identification model that matches the current steel pipe production line from the identification model library based on the current production parameters. The processing unit is used to perform interference removal processing on the steel pipe image to obtain the target steel pipe image; The first determining unit is used to acquire a suspected crack image in the target steel pipe image and determine the defect area of ​​the suspected crack image based on the pixel information of the suspected crack image. The extraction unit is used to extract the crack trajectory parameters and crack geometric parameters of the suspected crack from the suspected crack image when the area of ​​the defect region is less than or equal to a preset area.

[0013] The replication unit is used to enhance the replication of the suspected crack based on the crack trajectory parameters and the crack geometric parameters to obtain a replicated defect image. The input unit is used to input the simulated defect image into the target defect recognition model to obtain an initial defect recognition result. The second determining unit is used to determine the final defect identification result based on the initial defect identification result and the replication parameters for replicating the suspected crack.

[0014] Thirdly, embodiments of this application provide a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect above.

[0015] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in the first aspect above.

[0016] It is understood that the beneficial effects of the second to fourth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here.

[0017] The beneficial effects of this application embodiment compared with the prior art are as follows: This application improves the adaptability of the model to the production line by selecting a target defect recognition model that matches the current steel pipe production line from the recognition model library, thereby improving the accuracy of defect recognition. The defect area of ​​the suspected crack image is determined based on the pixel information of the target steel pipe image. When the defect area is less than or equal to a preset area, the suspected crack in the suspected crack image is replicated according to the crack trajectory parameters and crack geometric parameters to obtain a replicated defect image. The replicated defect image is input into the target defect recognition model to obtain an initial defect recognition result. Then, the final defect recognition result is determined based on the initial defect recognition result and the replication parameters. The size of the crack is filtered by the defect area, and smaller cracks are enhanced and replicated to improve the image quality of small cracks. Finally, the final defect recognition result is determined based on the defect recognition result of the replicated defect image, thereby improving the accuracy of small crack detection while reducing the false negative rate. Attached Figure Description

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

[0019] Figure 1 This is a flowchart illustrating the implementation of a first embodiment of an image-based steel pipe quality inspection method provided in this application. Figure 2 This is a flowchart illustrating the implementation of a second embodiment of an image-based steel pipe quality inspection method provided in this application. Figure 3 This is a structural block diagram of an image-based steel pipe quality inspection device provided in an embodiment of this application; Figure 4This is a structural block diagram of an image-based steel pipe quality inspection device provided in an embodiment of this application. Detailed Implementation

[0020] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0021] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0022] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0023] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."

[0024] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0025] References to "one embodiment" or "some embodiments" in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0026] Please see Figure 1 , Figure 1 This document illustrates a flowchart of the first embodiment of an image-based steel pipe quality inspection method provided in this application, including: Step S10: Obtain the current production parameters of the current steel pipe production line and the image of the steel pipe surface to be inspected.

[0027] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, or an electronic device capable of performing the above functions, such as an image-based steel pipe quality inspection device, a computer, or a tablet computer. The following uses an image-based steel pipe quality inspection device (hereinafter referred to as the inspection device) as an example to illustrate this embodiment and the subsequent embodiments.

[0028] It is understandable that the current steel pipe production line can be a production line used to produce seamless steel pipes. Current production parameters can refer to specific quantitative indicators set for the process conditions and equipment operating status at each stage of production to ensure the quality, performance, and production efficiency of the steel pipes. Current production parameters include piercing temperature, wall thickness tolerance, cold forming deformation, and return temperature and time. The steel pipe to be inspected can be a seamless steel pipe that requires crack defect detection. The steel pipe image can be an image of the seamless steel pipe produced on the steel pipe production line, captured by an image acquisition camera.

[0029] Step S20: Based on the current production parameters, select a target defect identification model from the identification model library that matches the current steel pipe production line.

[0030] It should be understood that the identification model library can be a database composed of multiple defect identification models, and the production parameters and defect identification models are stored in the identification model library in a mapping relationship.

[0031] Understandably, the process involves extracting features from the current production parameters to obtain parameter feature vectors; calculating the cosine similarity between the parameter feature vectors of the current steel pipe production line and the feature vectors of the applicable production parameter ranges labeled by each defect identification model in the identification model library to obtain a similarity score; identifying defect identification models with similarity scores greater than a similarity threshold as candidate defect identification models and adding them to the candidate model set; if there are multiple models in the candidate model set, then ranking them comprehensively based on the matching degree between the defect types that the models in the candidate model set are good at identifying and the common defect types of the current steel pipe production line, as well as the model performance indicators, and selecting the model ranked first as the target defect identification model.

[0032] In one example, during the production of seamless steel pipes, features are extracted from production parameters in stages such as raw materials, piercing, rolling, heat treatment, and finishing. For instance, steel types are encoded as specific values ​​(e.g., 1 for 304 stainless steel, 2 for 45# steel), numerical parameters such as piercing temperature and capillary tube dimensions are normalized to a range of 0-1, while percentage parameters such as impurity content retain their original data format. In this way, production parameters are transformed into computer-processable feature vectors. Various defect recognition models are collected, such as surface defect recognition models based on convolutional neural networks (CNNs) and internal defect recognition models based on support vector machines (SVMs), forming a recognition model library. Each model is meticulously annotated, including the applicable production parameter range (e.g., a certain CNN model is suitable for piercing temperatures of 1100-1200℃ and wall thickness tolerances within ±8%), the types of defects it excels at recognizing (e.g., cracks, holes), and model performance metrics (accuracy, recall, F1 score), establishing a structured model information database. A similarity-based matching algorithm, such as the cosine similarity algorithm, is employed. The cosine similarity is calculated between the feature vectors of the production parameters of the current steel pipe production line and the feature vectors of the applicable production parameter ranges labeled for each model in the identification model library, yielding a similarity score. A similarity threshold, such as 0.8, is set; when a model's similarity score exceeds this threshold, it is included in the candidate model set. If there are multiple models in the candidate set, they are further ranked based on factors such as the matching degree between the defect types the model excels at identifying and common defect types on the current production line, and model performance indicators. The model with the highest ranking is selected as the target defect identification model.

[0033] It should be noted that by extracting and encoding detailed features of production parameters, combined with matching algorithms, a defect identification model that is well-suited to the current production line parameters can be accurately selected. Compared to random or experience-based model selection, this method effectively avoids identification errors caused by mismatch between the model and the actual production scenario, significantly improving the efficiency and accuracy of defect identification and reducing missed and false detections.

[0034] Step S30: Perform interference removal processing on the steel pipe image to obtain the target steel pipe image.

[0035] It is understandable that interference removal processing can be an image processing method that removes interfering images from a steel pipe image. Interference removal processing methods include, but are not limited to, noise reduction, filtering, and histogram equalization.

[0036] Step S40: Obtain a suspected crack image from the target steel pipe image, and determine the defect area of ​​the suspected crack image based on the pixel information of the suspected crack image.

[0037] It should be understood that a suspected crack image can be an image of the target steel pipe that may contain cracks, obtained after preliminary identification of the target steel pipe image. The defect area can be the area of ​​the region in the suspected crack image that may contain cracks. The number of pixels within the region that may contain cracks can be used as the defect area.

[0038] Understandably, the process begins by using edge detection algorithms (such as Canny and Sobel) to extract image edges and highlight potential crack outlines. Then, morphological operations (erosion and dilation) are used to refine and connect the edges, improving the shape of the suspected crack. Next, a threshold is set based on typical crack characteristics (such as elongated shape and grayscale differences) to filter out regions that meet the criteria. Finally, regions meeting the criteria are extracted using a window of a preset size to obtain the suspected crack image. The suspected crack image undergoes grayscale transformation to obtain a grayscale image. The grayscale value of each pixel in the grayscale image is obtained and compared with a preset grayscale value. Pixels with grayscale values ​​greater than the preset grayscale value are identified as target pixels. The total number of target pixels is counted and used as the defect area of ​​the suspected crack image. The preset grayscale value can be the average grayscale value of all pixels in historical crack images.

[0039] Step S50: If the area of ​​the defect region is less than or equal to a preset area, extract the crack trajectory parameters and crack geometry parameters of the suspected crack from the suspected crack image.

[0040] It is understood that if the area of ​​the defective region is less than or equal to a preset area, the crack can be determined to be a small crack. Crack trajectory parameters can be indicators used to describe the geometric characteristics of the crack's propagation path. Crack geometric parameters can be indicators used to describe geometric characteristics such as the crack's width and length.

[0041] Step S60: Enhance the replication of the suspected crack based on the crack trajectory parameters and the crack geometry parameters to obtain a replicated defect image.

[0042] Understandably, enhanced replication can be a processing method that replicates a suspected crack and then enhances it to improve image quality. A replicated defect image can be an image obtained by replicating and enhancing a suspected crack in a suspected crack image.

[0043] In one example, a simulated crack trajectory is generated in the target coordinate system based on the crack trajectory parameters. The simulated crack trajectory is then filled based on the crack geometry parameters to obtain an initial simulated crack. Finally, the initial simulated crack is enhanced to obtain a simulated defect image.

[0044] Step S70: Input the simulated defect image into the target defect recognition model to obtain the initial defect recognition result.

[0045] It is understandable that the initial defect identification result can be a preliminary identification result of crack defects obtained from the replicated defect image.

[0046] Step S80: Determine the final defect identification result based on the initial defect identification result and the replication parameters for replicating the suspected crack.

[0047] It is understandable that the replication parameters include the magnification factor. For example, if the replication parameter is 2x magnification, the corresponding crack level will be increased by 3 levels. Assuming the initial defect identification result is a crack defect level of 6, the final defect identification result will be level 3.

[0048] In some optional implementations, before step S10, the following steps are also included: obtaining multiple historical production parameters of the current steel pipe production line; matching each historical production parameter with a historical defect image database to obtain a historical defect image dataset corresponding to each historical production parameter, wherein the historical defect image database stores images of seamless steel pipes with defects produced under different production parameters; determining the image quality score of each historical defect image based on the number and clarity of defects in each historical defect image in the historical defect image dataset; selecting multiple target historical defect images from the historical defect image dataset to construct a training sample set based on the image quality scores of each historical defect image; training an initial convolutional neural network using each training sample set to obtain a defect recognition model corresponding to each historical production parameter, wherein the defect recognition models corresponding to each historical production parameter constitute a model recognition library.

[0049] Understandably, historical production parameters can be parameters of seamless steel pipes previously produced by the current steel pipe production line. A historical defect image database can be a database storing images of seamless steel pipes with cracks or defects previously produced by the current production line. A historical defect image dataset can be a collection of images corresponding to each historical production parameter. Image quality scores can be scores used to evaluate the quality of images. The training sample set can be a set of images with high image quality scores used for model training.

[0050] It should be understood that the first score is found in the first mapping table based on the number of defects, and the second score is found in the second mapping table based on the clarity. The image quality score is obtained by adding the product of the first score and the first weight to the product of the second score and the second weight.

[0051] In some optional implementations, step S30 can be achieved through the following steps: obtaining the steel pipe model of the steel pipe produced by the current steel pipe production line, and determining the parameter information of common interference images based on the steel pipe model; determining a target window for image extraction based on the parameter information; extracting multiple target images from the steel pipe image through the target window; performing grayscale processing on the multiple target images to obtain multiple target grayscale images; obtaining the grayscale level of each pixel in each target grayscale image; determining the interference level value of the corresponding target grayscale image based on the grayscale level of each pixel; removing the interference images in each target grayscale image based on the interference level value corresponding to each target grayscale image to obtain the target steel pipe image.

[0052] It is understandable that common interference images can be images in which interference occurs more frequently than a preset frequency within a preset time period for producing this type of steel pipe. Parameter information includes, but is not limited to, pixel information, size information, and sharpness information. The target window can be a window used for image extraction. The interference level value can be a value used to measure the magnitude of interference with the defect identification results.

[0053] It should be understood that, based on the pixel information of common interference images, the minimum bounding rectangle of each interference image is determined; the average length and average width of each minimum bounding rectangle are calculated, and the average length is used as the window length and the average width is used as the window width to obtain the target window.

[0054] It should be noted that this embodiment determines the target window by using parameter information from historical common interference images. This avoids the problem of incomplete image extraction due to an excessively small window size, and also avoids the problem of extracting too many images other than the interference images due to an excessively large window size, thus improving the accuracy of image extraction. The number of pixels in the target grayscale image with a grayscale level greater than a preset grayscale level is determined by the grayscale level. Based on this number of pixels, the interference level is determined, which removes interference images other than the cracks in the image, improving the accuracy of the interference removal process.

[0055] In some optional implementations, determining the interference level of the corresponding target grayscale image based on the grayscale level of each pixel includes: determining historical grayscale levels based on a historical defect image dataset corresponding to the current production parameters; identifying pixels with grayscale levels greater than the historical grayscale levels as target pixels; determining the qualified grayscale percentage of the corresponding target grayscale image based on the number of target pixels and the total number of pixels in the corresponding target grayscale image; determining a dynamic exponential coefficient based on the grayscale percentage range to which the qualified grayscale percentage belongs, wherein the dynamic exponential coefficient is used to make the interference level exhibit different growth characteristics in different grayscale percentage ranges; performing connected component analysis on the target pixels and calculating the target area of ​​each connected component; and determining the interference level of the corresponding target grayscale image based on the qualified grayscale percentage, the dynamic exponential coefficient, and the target area of ​​each connected component.

[0056] Understandably, historical grayscale levels can be obtained by averaging the grayscale levels of historical crack images and interfering images. The percentage of acceptable grayscale levels is obtained by dividing the number of acceptable pixels by the total number of pixels.

[0057] In one example, the dynamic index coefficient is determined by the first formula (1) based on the grayscale ratio range to which the qualified grayscale ratio belongs; the size weight is calculated by the second formula (2) based on the target area of ​​each connected component; and the interference level value of the target image is calculated by the third formula (3) based on the qualified grayscale ratio, the dynamic index coefficient, and the size weight. The first formula, the second formula, and the third formula are respectively: (1) (2) (3) In the formula, The acceptable grayscale percentage; For dynamic exponential coefficients; Size weight; For the first The target area of ​​each connected region; This represents the level of interference. This is the preset scaling factor.

[0058] It should be noted that since the crack in the image occupies a smaller proportion in the target window compared to other interfering images, the corresponding qualified grayscale proportion is also smaller. In this embodiment, the interference level value is calculated by using a dynamic index and size weight. When the crack is in the target grayscale image, the corresponding interference level value can be reduced, thereby avoiding filtering out the crack image as an interfering image.

[0059] When the target grayscale image contains interfering images, the interference value increases more steeply to amplify the corresponding interference level, thereby reducing the probability of missing interfering images and making the detection more accurate. In some optional implementations, after step S40, the method further includes: if the area of ​​the defect region is greater than a preset area, inputting the target steel pipe image into the target defect recognition model to obtain the defect recognition result.

[0060] The method provided in this embodiment improves the compatibility between the model and the production line by selecting a target defect recognition model that matches the current steel pipe production line from the recognition model library, thereby improving the accuracy of defect recognition. The defect area of ​​the suspected crack image is determined based on the pixel information of the target steel pipe image. When the defect area is less than or equal to a preset area, the suspected crack in the suspected crack image is replicated to obtain a replicated defect image. The replicated defect image is input into the target defect recognition model to obtain an initial defect recognition result. The final defect recognition result is then determined based on the initial defect recognition result and replication parameters. The size of the crack is filtered by the defect area, and smaller cracks are enhanced through replication to improve the image quality of small cracks. Finally, the final defect recognition result is determined based on the defect recognition result of the replicated defect image, thereby improving the accuracy of small crack detection while reducing the false negative rate.

[0061] In optional implementations of various embodiments of this application, step S50 may include the following steps: steps S501 to S510. Wherein, Figure 2 This is a flowchart illustrating the implementation of a second embodiment of the image-based steel pipe quality inspection method provided in this application.

[0062] Step S501: If the area of ​​the defect region is less than or equal to a preset area, the suspected crack image is processed into a grayscale image and a binarized image, and the grayscale image is divided into multiple image sub-blocks.

[0063] Understandably, each image sub-block does not overlap, and the sub-blocks are of equal size. For example, a grayscale image is divided into 10*10 pixel non-overlapping sub-blocks. Pixels with grayscale values ​​greater than a preset grayscale value are processed as black, and pixels with grayscale values ​​less than or equal to the preset grayscale value are processed as white, resulting in a binarized image.

[0064] Step S502: Determine the stability grade of each image sub-block based on the pixel grayscale value of each image sub-block.

[0065] Understandably, stability grading includes stable level, moderate fluctuation level, and severe fluctuation level. For each image sub-block, the gray value variance of that sub-block is calculated based on the pixel gray values ​​of each pixel. When the gray value variance is less than or equal to a first threshold, the stability grade of the corresponding image sub-block is determined to be stable. When the gray value variance is greater than the first threshold but less than or equal to a second threshold, the stability grade of the corresponding image sub-block is determined to be moderate fluctuation level; when the gray value variance is greater than the second threshold, the stability grade of the corresponding image sub-block is determined to be severe fluctuation level.

[0066] Step S503: For each image sub-block, process the image sub-block according to the processing method matching the corresponding stability level to obtain the target grayscale image.

[0067] Understandably, when the stability level of an image sub-block is stable, the original grayscale of the sub-block is retained, and the grayscale value of isolated pixels in the sub-block is replaced with the mean of its eight neighbors. An isolated pixel is a pixel whose grayscale difference with its eight neighboring pixels is greater than a preset value. When the stability level of an image sub-block is general fluctuation, the grayscale value of the pixels in the center region of the sub-block is multiplied by a first weight, and the remaining pixels are multiplied by a second weight, where the first weight is greater than 1 and greater than the second weight. The calculated mean grayscale value of the sub-block is then calculated, and the grayscale value of the sub-block is replaced with a weighted mean grayscale value. For example, the first weight is 1.5, the second weight is 0.9, and the pixels in the center region of the sub-block are 3*3 pixels centered on the center. When the stability of an image sub-block is classified as severe fluctuation, the mean gray value and standard deviation of the gray value of the image sub-block are obtained. The standard deviation of the gray value is multiplied by the adjustment coefficient and then added to the mean gray value to obtain the standard value. Pixels with gray values ​​greater than the standard value are identified as reflective points. The gray gradient value of the pixel column where the reflective point is located is calculated and the gray value of the reflective point is replaced with the gray gradient value.

[0068] It should be noted that the above-mentioned graded processing method has the following advantages: (1) Targeted processing, taking into account both noise reduction and detail preservation: Different sub-blocks are affected by noise and reflection to different degrees (stable level has less noise, violent fluctuation level has strong reflection), and graded processing can adopt an adaptation strategy for each type of region. For example, in the stable region, only isolated points are corrected to avoid over-processing and blurring crack details; in the violent fluctuation region, the focus is on correcting the reflection points, while using the gradient of adjacent regions to fill, which suppresses noise without destroying the grayscale features of the crack. If a uniform processing (such as global filtering) is used, it will lead to the loss of details in the stable region or incomplete noise reduction in the violent fluctuation region. (2) Preserving local grayscale features and maintaining crack recognizability: The core feature of the crack is the "grayscale valley". Graded processing ensures that the grayscale distribution trend (dark center, gradual edge) of the crack region is not destroyed by differential weights (such as priority weighting of the center pixel in the fluctuation region) and gradient filling. For example, the reflection point correction in the violent fluctuation region is based on the grayscale gradient of the stable region in the same column, rather than directly replacing it with the mean, which can preserve the grayscale difference between the crack and the background and provide an accurate grayscale basis for subsequent valley point detection. (3) Adapting to complex scenarios on the surface of steel pipes: Seamless steel pipes often have interference such as uneven reflection and local scratches, and the distribution of these interferences is irregular. The hierarchical processing quantifies the complexity of the region by using the "grayscale fluctuation value", automatically matches the processing intensity to strengthen the noise reduction of areas with strong interference, and reduces the intervention of clean areas. It can adapt to the surface conditions of different steel pipe images without manual adjustment of parameters, thus improving the robustness of preprocessing.

[0069] Step S504: Determine the valley pixel in the grayscale image based on the grayscale value of each pixel in the target grayscale image.

[0070] It is understandable that pixels that meet the following conditions are identified as valley pixels: (1) The gray value of a pixel is less than the gray value of its four adjacent pixels; (2) The gray value of a pixel is less than the average gray value of the pixels in its 3*3 neighborhood.

[0071] Step S505: Construct a valley pixel chain based on the grayscale values ​​of each valley pixel.

[0072] Understandably, the valley pixels are sorted from lowest to highest grayscale value. Starting with the valley pixel with the lowest grayscale value, the search continues for other valley pixels within their 8-neighborhood. For a 3x3 pixel, the outer 8 pixels form the 8-neighborhood of the center pixel. If the distance between two points is less than 5 pixels and the grayscale difference is less than 10, the pixels are connected. This process is repeated to obtain a valley pixel chain. The region containing the valley pixel chain is set to 1, and other regions are set to 0, resulting in a binarized image.

[0073] It should be noted that the advantages of constructing the estimated pixel chain through the above technical solution are as follows: The advantages of the suspected crack location technology based on the "gray-level valley value chain" are as follows: (1) Taking the gray-level valley value chain as the core, it is different from the traditional threshold segmentation which is either one or the other. By tracking the continuous gray-level valley value for location, it fits the actual feature that the crack has a continuously lower gray level in the image, accurately anchors the crack area, and reduces misjudgment. (2) The initial screening of valley value points is based on the dual constraints of its own gray level and neighborhood relationship (4 neighborhoods are the peak value and the neighborhood mean difference condition). Combined with the gray level difference and the neighborhood mean difference setting, it effectively filters out non-crack interference points and purifies the quality of valley value points.

[0074] Step S506: Using the two endpoint pixels in the valley chain as initial points, perform step-by-step tracking to obtain the pixel coordinates and orientation angle of each step.

[0075] Understandably, an endpoint pixel can be a pixel with only one adjacent valley pixel within its 8-neighborhood. Step-by-step tracking can be a process of starting from each of the two endpoint pixels, moving forward one pixel at a time, and searching for the next valley pixel within a preset angle in the current direction. For example, searching for the next pixel within a range of ±30°. When the distance of the step-by-step tracking is less than 3 pixels, tracking stops, and the two trajectories are merged to obtain the complete crack trajectory.

[0076] Step S507: Determine the trajectory point sequence and trajectory breakpoint based on the pixel coordinates and orientation angles of each step.

[0077] Understandably, a trajectory sequence can be a sequence of pixels at each step in the step-by-step tracking process. The orientation angle can be the angle with the X-axis. The rate of change of orientation is the rate of change of orientation angle between adjacent steps, used to reflect the curvature of the trajectory. A trajectory breakpoint can be a point at a certain step where there are no candidate pixels within a preset angle in the current orientation.

[0078] Step S508: Determine the crack trajectory parameters based on the trajectory point sequence, the orientation angle, and the trajectory break point.

[0079] Understandably, the sequence of trajectory points, the orientation angle corresponding to each point in the sequence, and the trajectory break point can be used as crack trajectory parameters.

[0080] It should be noted that the advantages of the above-mentioned technical solution for determining crack trajectory parameters are as follows: (1) It simulates the thinking of manually tracking cracks, extending from both ends in a two-way trial and error. Unlike traditional fitting algorithms, which are prone to smoothing errors, it can accurately record the trajectory direction deflection and position change, fit the actual meandering shape of the crack, and retain details. (2) It clearly defines the endpoint as "8 neighborhoods with only 1 adjacent crack pixel", accurately locates the starting point and ending point of the tracking, and lays an accurate foundation for subsequent two-way tracking. (3) The initial direction is determined based on adjacent pixels, and the search is limited to ±30° within the current direction. This not only conforms to the characteristics of cracks being mostly smooth and curved, avoiding sudden turning and misjudgment, but also allows for orderly expansion of the trajectory, fitting the actual direction of the crack.

[0081] Step S509: The suspected cracks in the binarized image are segmented according to the trajectory point sequence to obtain multiple suspected crack segments.

[0082] Understandably, segmentation can be achieved by dividing the binarized image containing a predetermined number of pixels from the trajectory point sequence into a small segment. For example, dividing a sequence of 5 consecutive pixels into a small segment would divide the binarized image containing these 5 pixels into a single image segment.

[0083] Step S510: Determine the crack geometric parameters based on the orientation angles corresponding to the trajectory points in each suspected crack segment and the arc length of each suspected crack segment.

[0084] Understandably, the mean of the orientation angles is calculated based on the orientation angles corresponding to the trajectory points in each suspected crack segment. Perpendicular to the direction of this mean orientation angle (normal), a search is performed from the midpoint of the trajectory outwards until a non-crack pixel (0 in the binarized image) is encountered. The sum of the distances to both sides represents the local width of that suspected crack segment. The local width and arc length of each suspected crack are then defined as the crack's geometric parameters.

[0085] In some optional implementations, step S60 above can be achieved through the following steps: generating a reference path for the simulated crack in the target coordinate system based on the crack trajectory parameters; finding the location of the suspected crack break point based on the crack trajectory parameters; obtaining adjacent trajectory points of the break point location, and completing the break point in the reference path based on the direction angle of the adjacent trajectory points to obtain an initial path; restoring the geometric dimensions of the simulated crack based on the initial path and the crack geometric parameters to obtain a restored path; determining a local calibration ratio based on the crack geometric parameters, and calibrating the restored path based on the local calibration ratio to obtain a calibrated path; and enhancing the grayscale of the calibrated path to obtain a simulated defect image.

[0086] Understandably, a baseline path can be generated in the target coordinate system based on the sequence of trajectory points and corresponding orientation angles in the crack trajectory parameters. The location of the fracture point can then be found based on the trajectory fracture point.

[0087] It should be understood that adjacent trajectory points include the first adjacent trajectory point and the second adjacent trajectory point, corresponding to the first direction angle and the second direction angle, respectively. When the absolute value of the angle difference between the first and second direction angles is less than a preset value, the break point is determined to be a small-angle turn; the radius of the arc is calculated using the radius formula, and an arc is generated based on this radius to complete the break point, ensuring a smooth directional transition. If the absolute value of the angle difference is greater than or equal to the preset value, the break point is determined to be a large-angle turn, and the break point is completed using a three-segment broken line. The width of the completed line can be set as the average width of that segment.

[0088] Understandably, the local calibration ratio can be obtained by dividing the local width by the arc length of that segment. The actual ratio is calculated based on the actual width and length of each segment in the original path, and compared with the local calibration ratio. If the actual ratio is greater than the local calibration ratio, the actual width is reduced; otherwise, the actual width is increased.

[0089] It should be noted that in this embodiment, the trajectory is divided into small segments and measured point by point. When filling the crack, the local consistency of direction and width is considered, rather than overall fitting, which is more in line with the non-uniform characteristics of real cracks.

[0090] In some optional implementations, when the area of ​​the defect region is less than or equal to a preset area, the suspected crack image is standardized to obtain a standard image; based on the pixel information of the suspected crack in the standard image, the minimum bounding rectangle, crack start coordinates, and crack end coordinates of the suspected crack are determined; based on the pixel information of the minimum bounding rectangle, the coordinates of the replication region are determined; based on the crack parameters in each historical standard image in the historical standard image set, replication parameters for defect replication are determined; based on the replication region coordinates, the crack start coordinates, the crack end coordinates, and the replication parameters, a replicated defect image is generated.

[0091] Understandably, standardization processes include grayscale normalization, size normalization, and illumination normalization. The coordinates of the copied region include the coordinates of the first, second, third, and fourth copied regions. The pixel coordinates of the four vertices of the minimum bounding rectangle in the standard image are determined based on the pixel information of the minimum bounding rectangle, and these coordinates are used as the coordinates of the copied region. Crack parameters include crack length, crack width, and direction angle. Crack parameters are determined by statistically analyzing crack parameters from a large number of historical standard images, combined with the characteristics of small cracks that are difficult to identify in actual detection. For example, if historical standard image statistics show that crack parameters are: small crack lengths are mainly concentrated between 1-5 mm (corresponding to image pixel length), widths are between 1-3 pixels, and direction angles show no obvious concentration trend, then when setting the range of copied parameters, the crack length is set to 1-5 mm, the width to 1-3 pixels, and the direction angle range to 0-360 degrees. The range of the crack generation area in the target coordinate system is determined based on the coordinates of the imitation area. The generation start point and generation end point are determined based on the coordinates of the crack start point and the crack end point. The geometric shape of the crack is constructed using a graphics drawing algorithm. For straight cracks, the Bresenham algorithm is used to generate the crack pixel coordinates. For curved cracks, the fractal Brownian motion (FBM) algorithm can be used to generate the curve trajectory, which is then converted into pixel coordinates to obtain the imitation defect image.

[0092] In some optional implementations, the above steps of generating a simulated defect image based on the simulated region coordinates, the crack start coordinates, the crack end coordinates, and the simulated parameters can be achieved through the following steps: determining the simulated crack's location in the target coordinate system based on the simulated region coordinates; determining the simulated start and end points of the defect based on the crack start and end coordinates; generating an initial simulated crack in the target coordinate system based on the region location, the simulated start, the simulated end, and the simulated parameters; optimizing the initial simulated crack based on the crack's geometric morphology parameters in the standard image to obtain a target simulated crack image; obtaining the target defect recognition model's recognition accuracy for multiple labeled images, and using the labeled image with the highest recognition accuracy as the target labeled image; enhancing the target simulated crack image based on the image parameters of the target labeled image to obtain a simulated defect image.

[0093] Understandably, geometric parameters can be parameters used to describe the shape, size, and spatial location of cracks.

[0094] This embodiment first generates an initial simulated crack in the target coordinate system, then optimizes it based on geometric morphology parameters to obtain a target simulated crack image. This makes the simulated crack more similar in shape to the crack in the original image, allowing it to more closely resemble the actual defect characteristics and improving detection accuracy. Finally, the target simulated crack image is enhanced using the parameters of the target labeled image with the highest recognition accuracy, resulting in a simulated defect image. By enhancing the target simulated crack image with the parameters of the image with high recognition accuracy, image quality is improved, making the enhanced image easier for the model to recognize and further improving the defect recognition accuracy of the simulated defect image.

[0095] Please see Figure 3 , Figure 3 This is a structural block diagram of an image-based steel pipe quality inspection device 400 provided in an embodiment of this application. In this embodiment, the image-based steel pipe quality inspection device includes units used for performing... Figures 1-2 The steps in the corresponding embodiments. Please refer to the details. Figures 1-2 as well as Figures 1-2 The relevant descriptions in the corresponding embodiments are shown below. For ease of explanation, only the parts relevant to this embodiment are shown. See also... Figure 3 The image-based steel pipe quality inspection device 400 includes: The acquisition unit 401 is used to acquire the current production parameters of the current steel pipe production line and the image of the steel pipe surface to be inspected; The matching unit 402 is used to select a target defect identification model that matches the current steel pipe production line from the identification model library according to the current production parameters. Processing unit 403 is used to perform interference removal processing on the steel pipe image to obtain the target steel pipe image; The first determining unit 404 is used to acquire a suspected crack image in the target steel pipe image and determine the defect area of ​​the suspected crack image based on the pixel information of the suspected crack image. Extraction unit 405 is used to extract crack trajectory parameters and crack geometric parameters of the suspected crack from the suspected crack image when the area of ​​the defect region is less than or equal to a preset area.

[0096] The replication unit 406 is used to enhance the replication of the suspected crack based on the crack trajectory parameters and the crack geometric parameters to obtain a replicated defect image. Input unit 407 is used to input the simulated defect image into the target defect recognition model to obtain an initial defect recognition result; The second determining unit 408 is used to determine the final defect identification result based on the initial defect identification result and the replication parameters for replicating the suspected crack.

[0097] The device provided in this embodiment improves the compatibility between the model and the production line by selecting a target defect recognition model that matches the current steel pipe production line from the recognition model library, thereby improving the accuracy of defect recognition. Based on the pixel information of the target steel pipe image, the defect area of ​​the suspected crack image is determined. When the defect area is less than or equal to a preset area, the suspected crack in the suspected crack image is replicated according to crack trajectory parameters and crack geometric parameters to obtain a replicated defect image. The replicated defect image is input into the target defect recognition model to obtain an initial defect recognition result. Then, the final defect recognition result is determined based on the initial defect recognition result and the replication parameters. The size of the crack is filtered by the defect area, and smaller cracks are enhanced through replication to improve the image quality of small cracks. Finally, the final defect recognition result is determined based on the defect recognition result of the replicated defect image, thereby improving the accuracy of small crack detection while reducing the false negative rate.

[0098] It should be understood that, Figure 3 The structural block diagram of the image-based steel pipe quality inspection device shown illustrates how each unit performs [the necessary functions]. Figures 1-2 The steps in the corresponding embodiments, and for Figures 1-2 The steps in the corresponding embodiments have been explained in detail in the above embodiments. Please refer to them for details. Figures 1-2 as well as Figures 1-2 The relevant descriptions in the corresponding embodiments will not be repeated here.

[0099] Figure 4 This is a structural block diagram of a terminal device provided in another embodiment of this application. For example... Figure 4 As shown, the terminal device 500 of this embodiment includes: a processor 501, a memory 502, and a computer program 503 stored in the memory 502 and executable on the processor 501, such as a program for an image-based steel pipe quality inspection method. When the processor 501 executes the computer program 503, it implements the steps in the various embodiments of the image-based steel pipe quality inspection method described above, for example... Figure 1 Steps 101 to 105 are shown. Alternatively, the processor 501 may execute the above-described steps when executing computer program 503. Figure 3 For details on the functions of each unit in the corresponding embodiments, please refer to [link / reference]. Figure 3 The relevant descriptions in the corresponding embodiments are not repeated here.

[0100] For example, computer program 503 may be divided into one or more units, one or more of which are stored in memory 502 and executed by processor 501 to complete this application. The one or more units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of computer program 503 in terminal device 500.

[0101] The terminal device may include, but is not limited to, a processor 501 and a memory 502. Those skilled in the art will understand that... Figure 4 This is merely an example of terminal device 500 and does not constitute a limitation on terminal device 500. It may include more or fewer components than shown, or combine certain components, or different components. For example, a turntable terminal device may also include input / output terminal devices, network access terminal devices, buses, etc.

[0102] The processor 501 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0103] The memory 502 can be an internal storage unit of the terminal device 500, such as a hard disk or RAM of the terminal device 500. The memory 502 can also be an external storage terminal device of the terminal device 500, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the terminal device 500. Furthermore, the memory 502 can include both internal storage units and external storage terminal devices of the terminal device 500. The memory 502 is used to store computer programs and other programs and data required by the turntable terminal device. The memory 502 can also be used to temporarily store data that has been output or will be output.

[0104] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0105] If an integrated module is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. This computer-readable storage medium can be non-volatile or volatile. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable storage medium can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.

[0106] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. An image-based method for inspecting the quality of steel pipes, characterized in that, The method includes: Obtain the current production parameters of the current steel pipe production line and the image of the steel pipe surface to be inspected; Based on the current production parameters, select a target defect identification model from the identification model library that matches the current steel pipe production line; The steel pipe image is subjected to interference removal processing to obtain the target steel pipe image; Obtain a suspected crack image from the target steel pipe image, and determine the defect area of ​​the suspected crack image based on the pixel information of the suspected crack image; If the area of ​​the defect region is less than or equal to a preset area, extract the crack trajectory parameters and crack geometric parameters of the suspected crack from the suspected crack image. The suspected crack is enhanced and simulated based on the crack trajectory parameters and the crack geometry parameters to obtain a simulated defect image. The simulated defect image is input into the target defect recognition model to obtain the initial defect recognition result; Based on the initial defect identification results and the replication parameters used to replicate the suspected cracks, the final defect identification results are determined.

2. The method as described in claim 1, characterized in that, Before acquiring the current production parameters of the current steel pipe production line and the image of the steel pipe surface to be inspected, the process also includes: Obtain multiple historical production parameters of the current steel pipe production line; The historical defect image dataset is obtained by matching each historical production parameter with the historical defect image database. The historical defect image database stores images of seamless steel pipes with defects produced under different production parameters. Based on the number of defects and the clarity of each historical defect image in the historical defect image dataset, determine the image quality score of each historical defect image. Based on the image quality scores of each historical defect image, multiple target historical defect images are selected from the historical defect image dataset to construct a training sample set; The initial convolutional neural network is trained using each training sample set to obtain a defect identification model corresponding to each historical production parameter. The defect identification models corresponding to each historical production parameter constitute a model identification library.

3. The method as described in claim 1, characterized in that, The step of performing interference removal processing on the steel pipe image to obtain the target steel pipe image includes: Obtain the steel pipe model of the steel pipe produced by the current steel pipe production line, and determine the parameter information of common interference images based on the steel pipe model; Based on the parameter information, a target window for image extraction is determined; Multiple target images are extracted from the steel pipe image through the target window; The multiple target images are processed into grayscale to obtain multiple target grayscale images; For each target grayscale image, obtain the grayscale level of each pixel in the target grayscale image; Based on the gray level of each pixel, determine the interference level value of the corresponding target grayscale image; Based on the interference level value corresponding to each target grayscale image, the interfering images in each target grayscale image are removed to obtain the target steel pipe image.

4. The method as described in claim 3, characterized in that, The step of determining the interference level value of the corresponding target grayscale image based on the grayscale level of each pixel includes: Based on the historical defect image dataset corresponding to the current production parameters, determine the historical grayscale level; Pixels with a gray level greater than the historical gray level are identified as target pixels. The qualified grayscale ratio of the corresponding target grayscale image is determined based on the number of target pixels and the total number of pixels in the corresponding target grayscale image. Based on the grayscale ratio range to which the qualified grayscale ratio belongs, a dynamic index coefficient is determined. The dynamic index coefficient is used to make the interference degree value exhibit different growth characteristics in different grayscale ratio ranges. Perform connected component analysis on the target pixels and calculate the target area of ​​each connected component; The interference level value of the corresponding target grayscale image is determined based on the qualified grayscale ratio, the dynamic index coefficient, and the target area of ​​each connected region.

5. The method according to any one of claims 1-4, characterized in that, When the area of ​​the defect region is less than or equal to a preset area, the step of extracting the crack trajectory parameters and crack geometric parameters of the suspected crack from the suspected crack image includes: If the area of ​​the defect region is less than or equal to a preset area, the suspected crack image is processed into a grayscale image and a binarized image, and the grayscale image is divided into multiple image sub-blocks; The stability classification of each image sub-block is determined based on the pixel grayscale value of each sub-block. For each image sub-block, the image sub-block is processed according to the processing method matched with the corresponding stability classification to obtain the target grayscale image; Based on the grayscale values ​​of each pixel in the target grayscale image, determine the valley pixels in the grayscale image; Construct a valley pixel chain based on the grayscale value of each valley pixel; Step-by-step tracking is performed using the two endpoint pixels in the valley chain as initial points to obtain the pixel coordinates and orientation angle of each step; Based on the pixel coordinates and orientation angle of each step, determine the trajectory point sequence and trajectory breakpoint; The crack trajectory parameters are determined based on the trajectory point sequence, the orientation angle, and the trajectory break point. Based on the trajectory point sequence, the suspected cracks in the binarized image are segmented to obtain multiple suspected crack segments; The geometric parameters of the crack are determined based on the orientation angles corresponding to the trajectory points in each suspected crack segment and the arc length of each suspected crack segment.

6. The method as described in claim 5, characterized in that, The step of enhancing and replicating the suspected crack based on the crack trajectory parameters and the crack geometric parameters to obtain a replicated defect image includes: A baseline path for replicating the crack is generated in the target coordinate system based on the crack trajectory parameters. The location of the suspected fracture point is found based on the crack trajectory parameters. Obtain the adjacent trajectory points of the break point location, and complete the break point in the reference path according to the direction angle of the adjacent trajectory points to obtain the initial path; Based on the initial path, the geometric dimensions of the simulated crack are restored according to the crack geometry parameters to obtain the restored path; The local calibration ratio is determined based on the crack geometry parameters, and the restoration path is calibrated based on the local calibration ratio to obtain the calibration path; The calibration path is enhanced with grayscale to obtain a simulated defect image.

7. The method according to any one of claims 1-4, characterized in that, After acquiring the suspected crack image in the target steel pipe image and determining the defect area of ​​the suspected crack image based on the pixel information of the suspected crack image, the method further includes: If the area of ​​the defect region is larger than a preset area, the image of the target steel pipe is input into the target defect recognition model to obtain the defect recognition result.

8. An image-based steel pipe quality inspection device, characterized in that, include: The acquisition unit is used to acquire the current production parameters of the current steel pipe production line and the image of the steel pipe surface to be inspected; The matching unit is used to select a target defect identification model that matches the current steel pipe production line from the identification model library based on the current production parameters. The processing unit is used to perform interference removal processing on the steel pipe image to obtain the target steel pipe image; The first determining unit is used to acquire a suspected crack image in the target steel pipe image and determine the defect area of ​​the suspected crack image based on the pixel information of the suspected crack image. The extraction unit is used to extract the crack trajectory parameters and crack geometric parameters of the suspected crack from the suspected crack image when the area of ​​the defect region is less than or equal to a preset area. The replication unit is used to enhance the replication of the suspected crack based on the crack trajectory parameters and the crack geometric parameters to obtain a replicated defect image. The input unit is used to input the simulated defect image into the target defect recognition model to obtain an initial defect recognition result. The second determining unit is used to determine the final defect identification result based on the initial defect identification result and the replication parameters for replicating the suspected crack.

9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 7.