Seamless steel pipe surface defect positioning and detection method and system based on deep learning

By using deep learning methods to detect surface defects in seamless steel pipes, multi-scale feature extraction and topological correlation network optimization are employed to generate defect candidate regions and construct composite feature vectors. This solves the problem of insufficient detection accuracy in existing technologies and achieves high-precision and high-reliability defect detection.

CN121120628BActive Publication Date: 2026-02-13CHANGZHOU SHENGTAK SEAMLESS STEEL TUBE
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202511648590.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-12
Publication Date
2026-02-13
Estimated Expiration
2045-11-12

AI Technical Summary

Technical Problem

Existing methods for detecting surface defects in seamless steel pipes lack flexibility in handling defects of different sizes and shapes, making it difficult to simultaneously ensure the detection accuracy of various types of defects. Furthermore, the lack of an effective information exchange mechanism leads to a high rate of missed detections and low reliability of the detection system.

Method used

A deep learning-based approach is adopted to generate candidate defect regions and their boundaries through multi-scale feature extraction and adaptive receptive field adjustment mechanism. A topological correlation network is established for collaborative optimization, and a composite feature vector containing the defect's own features and the surrounding background features is constructed. A contrastive learning mechanism is used for defect classification.

Benefits of technology

It improves the accuracy of defect detection and classification, especially for small-sized, low-contrast, and complex-shaped defects, enhances the identification capability, solves the problem of inaccurate positioning of adjacent defect boundaries, and improves the applicability and reliability of the detection system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121120628B_ABST
    Figure CN121120628B_ABST
Patent Text Reader

Abstract

The application provides a seamless steel pipe surface defect positioning and detection method and system based on deep learning, relates to the technical field of image processing, and comprises the following steps: acquiring seamless steel pipe surface image data; performing multi-scale feature extraction to obtain multi-level feature representation; adopting an adaptive receptive field adjustment mechanism to generate a defect candidate region; establishing a topological correlation network to perform boundary collaborative optimization; extracting defect local features and context background features to construct a composite feature vector, and determining a defect type through comparative learning. The application can accurately position defects of different morphologies, improve detection accuracy, and is suitable for intelligent monitoring of the surface quality of seamless steel pipes.
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 particularly relates to a seamless steel pipe surface defect positioning and detection method and system based on deep learning. BACKGROUND

[0002] As an important industrial product, seamless steel pipes are widely used in the fields of petroleum, chemical industry, electric power, aviation, etc. In the production process of seamless steel pipes, various defects such as scratches, cracks, bubbles and indentations often appear on the surface, which not only affect the appearance quality of the product, but also seriously weaken the mechanical properties and service life of the steel pipe. Therefore, accurate detection and positioning of the surface defects of the seamless steel pipe have important practical significance.

[0003] The existing method lacks flexibility in processing defects of different scales and morphologies. For defects of different morphologies such as long strip-shaped cracks and locally concentrated bubbles, a unified feature extraction method is often used, which is difficult to balance the detection accuracy of various defects at the same time, resulting in a high missing detection rate of certain specific types of defects. The existing defect detection method usually processes defect positioning and classification as two independent tasks, lacks an effective information interaction mechanism, and cannot fully utilize the contrast relationship between the defect area and the surrounding normal area. Especially when the defect and the background texture are similar, the detection accuracy significantly decreases. For multiple defects that are adjacent or partially overlapped, the existing method often fails to accurately distinguish their boundaries, which easily misidentifies multiple independent defects as a single large defect, or incorrectly divides a single complex defect into multiple small defects, affecting the subsequent defect classification and severity evaluation, and reducing the reliability and practicability of the detection system. SUMMARY

[0004] The embodiments of the present application provide a seamless steel pipe surface defect positioning and detection method and system based on deep learning, which can solve the problems in the prior art.

[0005] In a first aspect, the embodiments of the present application provide a seamless steel pipe surface defect positioning and detection method based on deep learning, comprising:

[0006] obtaining image data of the surface of the seamless steel pipe;

[0007] performing multi-scale feature extraction on the image data to obtain a multi-level feature representation containing spatial position information and texture feature information;

[0008] based on the multi-level feature representation, using an adaptive receptive field adjustment mechanism to differentially process different morphological regions of the surface of the seamless steel pipe, and generating multiple defect candidate regions and their corresponding spatial boundaries;

[0009] establishing a topological correlation network among the plurality of defect candidate regions, and cooperatively optimizing the spatial boundaries of adjacent defect candidate regions based on the topological correlation network to obtain positioning of a final defect region and boundary coordinates thereof;

[0010] extracting local feature representation of the final defect region and context background features of the final defect region in the image data, constructing a composite feature vector containing contrast features between the defect and the surrounding normal region, and determining a defect type through a contrast learning mechanism based on difference response strength of defect features and background features in the composite feature vector to obtain a defect classification result, and associating the defect classification result with the boundary coordinates to generate a detection result.

[0011] performing multi-scale feature extraction on the image data to obtain multi-level feature representation containing spatial position information and texture feature information, including:

[0012] performing multi-level down-sampling processing on the image data in a rate increasing relationship, after each level of down-sampling, performing convolution operation on the image data of the current resolution through a convolution kernel group containing a plurality of different size convolution kernels to obtain an initial feature map of the corresponding scale;

[0013] extracting pixel-level local response distribution from the initial feature map through convolution operation that maintains spatial dimension, determining spatial coordinates by locating positions where the response value exceeds the average response value of the neighborhood based on the response value and peak position in the local response distribution, and determining direction information by calculating the main direction of the feature gradient vector at the peak position to obtain the spatial position information;

[0014] extracting texture pattern response of the initial feature map through convolution operation that expands the receptive field and performing frequency domain decomposition to obtain frequency spectrum feature distribution representing texture periodicity and directionality, extracting dominant frequency and dominant direction of the texture based on energy concentration area in the frequency spectrum feature distribution to obtain the texture feature information;

[0015] restoring the texture feature information to the dimension of the spatial position information through up-sampling operation, and channel splicing the restored texture feature information and the spatial position information to obtain the multi-level feature representation.

[0016] based on the multi-level feature representation, using an adaptive receptive field adjustment mechanism to differentially process different morphological regions on the surface of the seamless steel pipe to generate a plurality of defect candidate regions and their corresponding spatial boundaries, including:

[0017] performing local feature statistical analysis on each spatial position in the multi-level feature representation to obtain feature response intensity and feature distribution dispersion of each spatial position, and dividing the seamless steel tube surface into a plurality of morphology regions according to the feature response intensity and the feature distribution dispersion;

[0018] dynamically determining a receptive field size of each morphology region according to the feature response intensity and the feature distribution dispersion of the morphology region, the receptive field size being inversely proportional to the feature response intensity and proportional to the feature distribution dispersion, to obtain an adaptive receptive field parameter corresponding to the morphology region;

[0019] extracting, based on the adaptive receptive field parameter of each morphology region, a region in which a feature response exceeds a background response as an initial candidate region in the morphology region; and performing boundary search in each initial candidate region along a direction in which a feature gradient decreases most rapidly in the multi-level feature representation, starting from a center coordinate, determining a boundary point position when the feature response intensity decreases to a background response level, and connecting all boundary point positions to form a closed contour to obtain a plurality of defect candidate regions and corresponding spatial boundaries.

[0020] establishing a topological association network among the plurality of defect candidate regions, and performing cooperative optimization on the spatial boundaries of adjacent defect candidate regions based on the topological association network to obtain positioning of a final defect region and boundary coordinates thereof, including:

[0021] calculating spatial adjacency relationships and feature similarity relationships between any two defect candidate regions, constructing a spatial adjacency matrix based on the spatial adjacency relationships, constructing a feature similarity matrix based on the feature similarity relationships, fusing the spatial adjacency matrix and the feature similarity matrix, and establishing the topological association network;

[0022] in the topological association network, calculating an association strength of each defect candidate region with adjacent defect candidate regions, and determining a cooperative optimization weight distribution of the defect candidate region according to the association strength;

[0023] for each defect candidate region, obtaining a set of boundary points on the spatial boundary of the defect candidate region, for each boundary point, obtaining a reference boundary point corresponding to the spatial position of the boundary point in adjacent defect candidate regions according to the cooperative optimization weight distribution, calculating a positional deviation between the boundary point and the reference boundary point, and iteratively adjusting coordinates of the boundary point based on the positional deviation to obtain an optimized spatial boundary;

[0024] forming a complete closed contour from the optimized spatial boundary, determining a region surrounded by the complete closed contour as the final defect region, and extracting coordinates of all boundary points on the complete closed contour as the boundary coordinates of the seamless steel tube surface defect.

[0025] extracting a local feature representation of the final defect region and a context background feature of the final defect region in the image data, to construct a composite feature vector containing contrast features of the defect itself and surrounding normal region includes:

[0026] According to the boundary coordinates, a feature sub-region corresponding to the spatial range of the final defect region is cropped in the multi-level feature representation, and an intra-regional feature aggregation process is performed on the feature sub-region to generate a local feature representation representing the morphology and texture attributes of the defect itself;

[0027] With the boundary coordinates of the final defect region as a reference, a preset background range is expanded outward to determine the surrounding background region of the final defect region, and image pixels corresponding to the surrounding background region are extracted in the image data; normal region pixels are selected by calculating the texture uniformity and response stability of the image pixels, and the context background feature is generated based on the corresponding features of the normal region pixels in the multi-level feature representation to represent the normal surface attributes;

[0028] Calculate the feature difference measure between the local feature representation and the context background feature, and generate contrast features representing the difference degree of the defect region relative to the normal region based on the feature difference measure;

[0029] The local feature representation, the context background feature and the contrast feature are spliced according to the feature dimension to obtain the composite feature vector.

[0030] and based on the difference response intensity of the defect feature and the background feature in the composite feature vector, the defect type is determined through a contrast learning mechanism to obtain a defect classification result, and the defect classification result is associated with the boundary coordinates to generate a detection result, including:

[0031] Separate the local feature representation from the composite feature vector as a defect feature component, and separate the context background feature as a background feature component, calculate the response value difference of the defect feature component and the background feature component in each feature dimension, and construct a difference response vector;

[0032] The difference response vector is taken as a query sample, and a similarity measure between the query sample and a reference sample feature vector is calculated, and a contrast learning sample pair set composed of the query sample and the reference sample is constructed based on the similarity measure;

[0033] The ratio of intra-class contrast to inter-class contrast of the contrast learning sample pair set is calculated through a contrast learning mechanism to determine the defect type confidence and select the type corresponding to the highest confidence as the defect classification result.

[0034] extracting a start point coordinate and a terminal point coordinate in a boundary coordinate of the final defect area, mapping the defect classification result with the start point coordinate and the terminal point coordinate, forming a result association record containing a defect type identifier and spatial position information, and extracting the detection result of the surface defect of the seamless steel pipe from the result association record.

[0035] determining a defect type confidence and selecting a type corresponding to the highest confidence as the defect classification result by calculating a ratio of the intra-class contrast and the inter-class contrast of the set of the contrast learning sample pairs through a contrast learning mechanism includes:

[0036] filtering out reference samples with the same defect type label as the query sample from the set of the contrast learning sample pairs as same-class reference samples, calculating a feature space distance between the difference response vector of the query sample and the feature vector of the same-class reference sample and performing aggregated statistics to obtain the intra-class contrast;

[0037] filtering out reference samples with different defect type labels from the set of the contrast learning sample pairs as different-class reference samples, grouping the different-class reference samples according to defect types to obtain a plurality of different-class sample groups, calculating a group feature space distance between the difference response vector of the query sample and the feature vectors of all reference samples in the different-class sample groups and selecting the minimum value to obtain the inter-class contrast;

[0038] calculating a ratio of the intra-class contrast and the inter-class contrast to obtain a contrast ratio of the query sample, converting the contrast ratio into a confidence value of the defect type through a nonlinear mapping, comparing the confidence values of all defect types corresponding to the same-class reference samples, and selecting the defect type with the highest confidence value as the defect classification result of the surface defect of the seamless steel pipe.

[0039] In a second aspect of the embodiment of the present application, a seamless steel pipe surface defect positioning and detection system based on deep learning is provided, which includes:

[0040] A first unit is configured to acquire image data of a seamless steel pipe surface.

[0041] A second unit is configured to perform multi-scale feature extraction on the image data to obtain a multi-level feature representation containing spatial position information and texture feature information.

[0042] A third unit is configured to perform differential processing on different morphological regions of the seamless steel pipe surface based on the multi-level feature representation and using an adaptive receptive field adjustment mechanism to generate a plurality of defect candidate regions and their corresponding spatial boundaries.

[0043] A fourth unit is configured to establish a topological association network among the plurality of defect candidate regions, and cooperatively optimize the spatial boundaries of adjacent defect candidate regions based on the topological association network to obtain positioning of a final defect region and boundary coordinates thereof.

[0044] A fifth unit is configured to extract local feature representation of the final defect region and context background features of the final defect region in the image data, construct a composite feature vector containing contrast features between the defect and the surrounding normal region, and determine a defect type through a contrast learning mechanism based on difference response strength of defect features and background features in the composite feature vector to obtain a defect classification result.

[0045] A third aspect of the embodiment of the application,

[0046] An electronic device is provided, comprising:

[0047] A processor;

[0048] A memory for storing processor-executable instructions;

[0049] The processor is configured to invoke the instructions stored in the memory to perform the method described above.

[0050] A fourth aspect of the embodiment of the application,

[0051] A computer-readable storage medium is provided, which stores computer program instructions, and the computer program instructions are executed by a processor to implement the method described above.

[0052] The beneficial effects of the present application are as follows:

[0053] The seamless steel pipe surface defect positioning and detection method based on deep learning provided by the application can effectively process different morphological regions on the surface of a seamless steel pipe by introducing a multi-scale feature extraction and adaptive receptive field adjustment mechanism, improve the accuracy of defect detection, and has stronger recognition ability, especially for small-size, low-contrast and complex morphological defects.

[0054] By establishing a topological association network among defect candidate regions and cooperatively optimizing the network, the method overcomes the problem of inaccurate positioning of adjacent defect boundaries in traditional methods, effectively solves the problem of accurate positioning in the case of dense distribution of defects, and improves the applicability and reliability of the detection system in actual industrial production environments.

[0055] The application constructs a composite feature vector containing the defect self feature and the contrast feature of the surrounding normal area, and classifies the defects based on the contrast learning mechanism, fully utilizes the difference information between the defects and the background, significantly improves the classification accuracy, and the classification effect is more significant for different types of defects with high visual similarity, and provides more accurate technical support for quality control in the seamless steel pipe production process. BRIEF DESCRIPTION OF DRAWINGS

[0056] Figure 1 A flowchart of a seamless steel pipe surface defect positioning and detection method based on deep learning of an embodiment of the application is shown in

[0057] Figure 2 A multi-scale feature extraction flowchart is shown in DETAILED DESCRIPTION

[0058] To make the purpose, technical scheme and advantages of the embodiments of the application clearer, the technical scheme in the embodiments of the application will be described clearly and completely below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are only part of the embodiments of the application, not all. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of the application.

[0059] The technical scheme of the application will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in some embodiments.

[0060] Figure 1 A flowchart of a seamless steel pipe surface defect positioning and detection method based on deep learning of an embodiment of the application is shown in Figure 1 As shown in the figure, the method comprises:

[0061] Obtaining image data of the surface of the seamless steel pipe;

[0062] Performing multi-scale feature extraction on the image data to obtain a multi-level feature representation containing spatial position information and texture feature information;

[0063] Based on the multi-level feature representation, an adaptive receptive field adjustment mechanism is used to differentially process different morphological regions of the surface of the seamless steel pipe to generate a plurality of defect candidate regions and their corresponding spatial boundaries;

[0064] Establishing a topological association network between the plurality of defect candidate regions, and based on the topological association network, the spatial boundaries of adjacent defect candidate regions are cooperatively optimized to obtain the positioning of the final defect region and its boundary coordinates;

[0065] The local feature representation of the final defect region is extracted, and the context background features of the final defect region in the image data are constructed, a composite feature vector containing the contrast features of the defect itself and the surrounding normal region is constructed, and based on the difference response strength of the defect features and the background features in the composite feature vector, the defect type is determined through a comparison learning mechanism to obtain a defect classification result. The defect classification result is associated with the boundary coordinates to generate a detection result.

[0066] In an optional embodiment, the multi-scale feature extraction is performed on the image data to obtain a multi-level feature representation containing spatial position information and texture feature information, which includes:

[0067] The image data is subjected to multi-level downsampling processing in a rate increasing relationship, and after each level of downsampling, the image data of the current resolution is subjected to convolution operation through a convolution kernel group containing a plurality of different size convolution kernels to obtain an initial feature map of the corresponding scale;

[0068] The spatial position information is obtained by maintaining the spatial dimension of the convolution operation, extracting the pixel-level local response distribution from the initial feature map, determining the spatial coordinates by locating the position where the response value exceeds the average response value of the neighborhood based on the response value and the peak position in the local response distribution, and determining the direction information by calculating the main direction of the feature gradient vector at the peak position;

[0069] The texture pattern response of the initial feature map is extracted by expanding the receptive field of the convolution operation and performing frequency domain decomposition to obtain a frequency spectrum feature distribution representing the texture periodicity and directionality, and the dominant frequency and dominant direction of the texture are extracted based on the energy concentration area in the frequency spectrum feature distribution to obtain the texture feature information;

[0070] The texture feature information is restored to the dimension of the spatial position information through upsampling operation, and the restored texture feature information is spliced with the spatial position information in the channel to obtain the multi-level feature representation.

[0071] As shown in Figure 2 The method includes:

[0072] The image data is processed by multiple levels of downsampling, and the downsampling ratio is increased each time. For example, the resolution of the original image is 1024x1024 pixels, the resolution becomes 512x512 pixels after the first level of downsampling, the resolution becomes 256x256 pixels after the second level of downsampling, and the resolution becomes 128x128 pixels after the third level of downsampling. After each level of downsampling, a convolution kernel group containing multiple different size convolution kernels is used to perform convolution operation on the image data of the current resolution. The convolution kernel group includes 3x3, 5x5 and 7x7 convolution kernels, and the number of each size of convolution kernel is 32. These different size convolution kernels can capture features of different scales in the image, thereby obtaining initial feature maps of corresponding scales.

[0073] For the obtained initial feature maps, a pixel-level local response distribution is extracted by a convolution operation that maintains the spatial dimension. This step uses a 1x1 convolution operation to maintain the spatial dimension of the feature map unchanged while integrating the information of the channel dimension to generate a local response distribution map. From the local response distribution, the positions where the response value exceeds the average response value of the neighborhood are located as key points. For example, for each pixel point, the average response value in its 3x3 neighborhood is calculated, and if the response value of the pixel point exceeds 1.5 times the average value of the neighborhood, it is marked as a key point. The spatial coordinates of these key points are part of the spatial position information. At the same time, the principal direction of the feature gradient vector is calculated at these key points to determine the direction information. The feature gradient vector is obtained by calculating the gradient amplitude and direction in the 8-neighborhood of the key point, and the principal direction is determined by calculating the histogram of the gradient direction and selecting the direction corresponding to the highest peak. For example, 360 degrees is divided into 8 intervals, the sum of the gradient amplitudes in each interval is calculated, and the central angle of the interval with the maximum amplitude sum is selected as the principal direction.

[0074] In order to extract texture feature information, an expanded receptive field convolution operation is performed on the initial feature map. This step uses dilated convolution with a dilation rate of 2 and a convolution kernel size of 3x3, so that the effective receptive field reaches 5x5, which can capture a larger range of texture patterns. For the extracted texture pattern response, frequency domain decomposition is performed to obtain a frequency spectrum feature distribution representing the periodicity and directionality of the texture. Frequency domain decomposition can be achieved by applying discrete Fourier transform to the feature map. In the obtained frequency spectrum distribution, the region with concentrated energy is identified, and the dominant frequency and dominant direction of the texture are extracted. Specifically, by dividing the frequency spectrum into 8 directional sectors and 3 frequency ring bands, the energy values in each sector and ring band are calculated, and the sector with the highest energy corresponds to the dominant direction of the texture, and the ring band with the highest energy corresponds to the dominant frequency of the texture. For example, if the energy value in the 0-45 degree directional sector is the highest, the dominant direction of the texture is 22.5 degrees; if the energy value in the medium frequency ring band (corresponding to a wavelength of 8-16 pixels) is the highest, the dominant frequency of the texture corresponds to this frequency range.

[0075] After obtaining the texture feature information, the texture feature information is restored to the dimension of spatial position information through upsampling operation. The upsampling adopts the deconvolution method, the convolution kernel size is 2x2, and the step is 2, so that the resolution of the feature map is expanded to twice the original. If the texture feature information has undergone multi-level downsampling, the corresponding number of upsampling operations is required. For example, if the texture feature information is extracted after three-level downsampling of the original image, three upsampling operations are required, each time the resolution is expanded by one time, from 128x128 pixels to 1024x1024 pixels. The restored texture feature information is spliced with the spatial position information in the channel dimension, that is, the two kinds of information are combined in the channel dimension. Assuming that the spatial position information has 64 channels and the restored texture feature information has 32 channels, the spliced feature representation will have 96 channels. This splicing method preserves the integrity of the two kinds of information and enables them to complement each other in subsequent processing to form a more rich multi-level feature representation.

[0076] Through the above steps, a multi-level feature representation containing spatial position information and texture feature information is generated. This feature representation captures key information of the image at different resolution scales, including accurate spatial position coordinates and direction information, as well as rich texture periodicity and directionality features. It can provide comprehensive and detailed image feature description for subsequent image analysis tasks. The multi-scale feature extraction strategy ensures that it can adapt to image targets of different sizes and complexities, improving the robustness and universality of the feature representation.

[0077] In an optional implementation, based on the multi-level feature representation, an adaptive receptive field adjustment mechanism is used to differentially process different morphological regions of the seamless steel pipe surface to generate a plurality of defect candidate regions and their corresponding spatial boundaries, including:

[0078] Local feature statistical analysis is performed on each spatial position in the multi-level feature representation to obtain the feature response intensity and feature distribution dispersion of each spatial position. According to the feature response intensity and the feature distribution dispersion, the seamless steel pipe surface is divided into a plurality of morphological regions.

[0079] The receptive field size of each morphological region is dynamically determined according to the feature response intensity and the feature distribution dispersion of the morphological region. The receptive field size is inversely proportional to the feature response intensity and proportional to the feature distribution dispersion, obtaining the adaptive receptive field parameters corresponding to the morphological region.

[0080] Based on the adaptive receptive field parameters of each morphology region, a region where the feature response exceeds the background response is extracted as an initial candidate region within the morphology region; in each initial candidate region, a boundary search is performed along the direction where the feature gradient decreases most rapidly, starting from the center coordinates, and a boundary point position is determined when the feature response intensity decreases to the background response level. All boundary point positions are connected to form a closed contour to obtain a plurality of defect candidate regions and their corresponding spatial boundaries.

[0081] For each spatial position in the multi-level feature representation, local feature statistical analysis is performed to evaluate the feature distribution of the position. Specifically, for position (i, j), the feature response intensity and feature distribution dispersion are calculated within its 5x5 neighborhood window. The feature response intensity is represented as the sum of the response values of all feature channels at this position, for example, the sum of the 64 feature channel values of a certain position is 125.8. The feature distribution dispersion is represented by calculating the standard deviation of the response of all feature channels at this position, for example, the standard deviation of the feature channel values of a certain position is 18.6, indicating that the feature distribution of this position is relatively discrete. Based on the calculated feature response intensity and feature distribution dispersion, the seamless steel pipe surface is divided into a plurality of morphology regions. In practical applications, when the feature response intensity is greater than 100 and the feature distribution dispersion is greater than 15, the region corresponds to a crack or fold defect region; when the feature response intensity is between 50 and 100 and the feature distribution dispersion is between 8 and 15, the region corresponds to a spot or slight corrosion region; and when the feature response intensity is less than 50 and the feature distribution dispersion is less than 8, the region is usually a normal surface region.

[0082] The receptive field size is inversely proportional to the feature response intensity and proportional to the feature distribution dispersion. In actual implementation, the receptive field size is determined according to the following rules: when the feature response intensity is greater than 100, the basic receptive field size is set to 3x3; when the feature response intensity is between 50 and 100, the basic receptive field size is set to 5x5; and when the feature response intensity is less than 50, the basic receptive field size is set to 7x7. At the same time, the basic receptive field size is adjusted according to the feature distribution dispersion: when the feature distribution dispersion is greater than 15, the receptive field size is increased by 2; when the feature distribution dispersion is between 8 and 15, the receptive field size is increased by 1; and when the feature distribution dispersion is less than 8, the receptive field size remains unchanged. In this way, for regions with high feature response intensity but concentrated distribution, such as clear cracks, a smaller receptive field is used, such as 3x3; and for regions with low feature response intensity but discrete distribution, such as fuzzy corrosion marks, a larger receptive field is used, such as 9x9.

[0083] In the morphological region, the region with feature response exceeding background response is extracted as an initial candidate region, and the average feature response value in the region is calculated as the background response threshold, which is usually 1.5 times of the average response value of the region. For example, if the average feature response value of a region is 30.5, the background response threshold is set to 45.75. When the feature response value of a position exceeds the threshold, the position is marked as part of the initial candidate region. In practical applications, for a seamless steel pipe surface image of 640x480 pixels, usually 5 to 20 initial candidate regions can be identified.

[0084] After determining each initial candidate region, the boundary search is performed in the direction with the fastest feature gradient descent from the center coordinates of the region in the multi-level feature representation. The feature gradient is calculated in eight directions: 0°, 45°, 90°, 135°, 180°, 225°, 270° and 315°, and the direction with the largest gradient is selected for search. During the search process, the feature response intensity of the position is calculated every time the selected direction is advanced by one pixel, and when the feature response intensity drops to the background response level, i.e. the background response threshold, the position is determined as a boundary point. For example, starting from the center point (150, 120), after searching for 6 pixels in the 45° direction, the feature response intensity drops from 98.3 to 43.2, which is lower than the background response threshold 45.75, so (156, 126) is determined as a boundary point. After completing the boundary search in all directions, all boundary point positions are connected to form a closed contour, and the complete defect candidate region and its corresponding spatial boundary are obtained.

[0085] Through the above adaptive receptive field adjustment mechanism, different morphological regions of the seamless steel pipe surface can be effectively processed, and various defects can be accurately located.

[0086] In an optional embodiment, a topological association network between a plurality of defect candidate regions is established, and the spatial boundaries of adjacent defect candidate regions are cooperatively optimized based on the topological association network to obtain the positioning of the final defect region and its boundary coordinates, including:

[0087] The spatial adjacency relationship and the feature similarity relationship between any two defect candidate regions are calculated, a spatial adjacency matrix is constructed based on the spatial adjacency relationship, a feature similarity matrix is constructed based on the feature similarity relationship, the spatial adjacency matrix and the feature similarity matrix are fused, and the topological association network is established;

[0088] In the topological association network, the association strength of each defect candidate region and adjacent defect candidate regions is calculated, and the cooperative optimization weight distribution of the defect candidate region is determined according to the association strength;

[0089] For each defect candidate region, a set of boundary points on the spatial boundary of the defect candidate region is obtained, for each boundary point, a reference boundary point corresponding to the spatial position of the boundary point in the adjacent defect candidate region is obtained according to the cooperative optimization weight distribution, a position deviation between the boundary point and the reference boundary point is calculated, the coordinate of the boundary point is iteratively adjusted based on the position deviation, and an optimized spatial boundary is obtained;

[0090] The optimized spatial boundary is formed into a complete closed contour, and a region surrounded by the complete closed contour is determined as the final defect region, and the coordinates of all boundary points on the complete closed contour are extracted as the boundary coordinates of the seamless steel pipe surface defect.

[0091] A distance threshold-based determination method is used to calculate the spatial adjacency relationship and feature similarity relationship between any two defect candidate regions. Assuming that there are N defect candidate regions, denoted as R1, R2,..., RN, the minimum distance d n between each pair of regions (R i , R j ) is calculated. ij When d ij is less than a preset threshold d_thresh, such as 10 pixels, it is considered that the two regions are adjacent in space, and the element a ij of the spatial adjacency matrix A is set to 1, otherwise it is set to 0. In actual application, d_thresh can be adjusted according to the image resolution, for example, in a 300 DPI image, d_thresh can be set to 15 pixels to adapt to different image acquisition conditions.

[0092] The feature similarity is calculated based on the visual features of the defect candidate regions, and the feature vector f i of each defect candidate region is extracted, including color, texture, shape and other multi-dimensional features. The color feature uses the HSV color space statistics of the pixels in the region, the texture feature uses the local binary pattern (LBP) histogram, and the shape feature includes the area, perimeter and circularity of the region. The feature similarity s i between two regions R j and R ij is obtained by calculating the cosine similarity between their feature vectors. When s ij is greater than a similarity threshold s_thresh, such as 0.75, the element s ij of the feature similarity matrix S is set to the similarity value, otherwise it is set to 0. In actual operation, for surface crack defects, s_thresh can be set to 0.7, and for spot defects, s_thresh can be adjusted to 0.8 to distinguish different types of defect features.

[0093] A topological association network is constructed by fusing the spatial adjacency matrix A and the feature similarity matrix S. The fusion adopts a weighted average method, and the elements t of the association matrix T are... ij = α·a ij + (1-α)·s ij α is a weighting parameter, ranging from 0 to 1. In practical applications, α can be set to 0.6, indicating that spatial adjacency is slightly more important than feature similarity. For the detection of continuous surface defects, the value of α can be increased to 0.7, while for the detection of discrete spot defects, the value of α can be reduced to 0.5.

[0094] Based on the constructed topological association network, the association strength between each defect candidate region and its neighboring regions is calculated, and the collaborative optimization weights are determined. For defect candidate regions R... i The set of association strengths between it and all its neighboring regions is {t}. i1 , t i2 , ..., t ik}, where k is the number of neighboring regions. After normalization, we obtain R. i Cooperative optimization weights w for adjacent regions ij = t ij / ∑t ik For example, for three adjacent regions with association strengths of 0.8, 0.6, and 0.4, the collaborative optimization weights would be 0.44, 0.33, and 0.22, respectively. In practical applications, when the association strength is below 0.3, the corresponding weight can be set to 0 to filter out the influence of weakly associated regions.

[0095] For each defect candidate region, boundary optimization is performed to obtain the boundary point set B = {b1, b2, ..., b}. m}, each boundary point b u It contains its coordinate information (x_u, y_u) for each boundary point b. u The corresponding reference boundary point is then found in the adjacent region. The search for the reference boundary point is based on the principle of spatial proximity, that is, within the adjacent region... Searching for b on the boundary u The nearest boundary point is used as the reference point. ju Considering reference points in all adjacent regions, calculate the positional deviation of the boundary points based on the collaborative optimization weights. The positional deviation is calculated as dx_u = ∑w ij (x_ref ju - x_u) and dy_u = ∑w ij (y_ref ju - y_u).

[0096] The gradient descent method is used to iteratively adjust the boundary points, and the new boundary point coordinates are x_u' = x_u + β·dx_u and y_u' = y_u + β·dy_u, where β is a step parameter, usually set to 0.3, and the iteration process continues until the position deviation is less than a threshold ε, such as 0.5 pixels, or a maximum number of iterations, such as 20 times, is reached. In the actual optimization process, for boundary points with high confidence, such as boundary points with large gradient values, the β value can be reduced to 0.2 to maintain the stability of the boundary.

[0097] The optimized boundary points are reordered and formed into a complete closed contour, the ordering is based on an angle-based method, with the region centroid as the reference point, and all boundary points are sorted according to the polar angle. To ensure the smoothness of the contour, B-spline interpolation is applied to generate a more natural boundary curve. The region enclosed by the closed contour is the final defect region, and the coordinate set {(x_1', y_1'), (x_2', y_2'),..., (x_m', y_m')} of all boundary points on the contour is output as the boundary coordinates of the seamless steel pipe surface defect.

[0098] In an alternative embodiment, extracting the local feature representation of the final defect region and the contextual background feature of the final defect region in the image data, and constructing a composite feature vector containing the contrast feature of the defect itself and the surrounding normal region include:

[0099] According to the boundary coordinates, a feature sub-region corresponding to the spatial range of the final defect region is cropped in the multi-level feature representation, and the feature sub-region is subjected to regional feature aggregation processing to generate a local feature representation representing the morphology and texture properties of the defect itself;

[0100] Based on the boundary coordinates of the final defect region, a predetermined background range is expanded outward to determine the surrounding background region of the final defect region, and the image pixels corresponding to the surrounding background region are extracted in the image data. Normal region pixels are selected by calculating the texture uniformity and response stability of the image pixels, and the contextual background feature is generated based on the corresponding features of the normal region pixels in the multi-level feature representation, representing the normal surface properties.

[0101] The feature difference measure between the local feature representation and the contextual background feature is calculated, and the contrast feature representing the difference degree of the defect region relative to the normal region is generated based on the feature difference measure.

[0102] The local feature representation, the contextual background feature, and the contrast feature are spliced according to the feature dimension to obtain the composite feature vector.

[0103] According to the boundary coordinates, a feature sub-region corresponding to the spatial range of the final defect region is cropped in the multi-level feature representation. Assuming that the boundary coordinates are (x1, y1, x2, y2), representing the coordinates of the upper left corner and the lower right corner of the defect region, the multi-level feature representation includes feature maps from different levels of the feature extraction network, such as feature maps with sizes of 32×32×256, 16×16×512, and 8×8×1024, respectively. For each feature map, the corresponding feature region position is calculated according to the boundary coordinates. Considering the down-sampling rate of the feature map relative to the original image, the original boundary coordinates can be divided by the corresponding down-sampling factor. For example, for the 32×32×256 feature map, the down-sampling factor is 8, and the feature sub-region coordinates are (x1 / 8, y1 / 8, x2 / 8, y2 / 8).

[0104] After obtaining the feature sub-region, a spatial pyramid pooling operation is used to aggregate the features within the region. The feature sub-region is divided into 1×1, 2×2, and 3×3 grids, and the maximum pooling operation is applied within each grid to extract significant features. For example, for a 2×2 grid, the maximum response values of 4 sub-regions are extracted, and for a 3×3 grid, the maximum response values of 9 sub-regions are extracted. All the pooling results are connected into a vector to form a local feature representation. In practical applications, if the defect region size is 64×48 pixels, the corresponding region in the 32×32×256 feature map after feature extraction is approximately 8×6 feature blocks, and after spatial pyramid pooling, a local feature vector of (1+4+9)×256=3584 dimensions is obtained.

[0105] Based on the boundary coordinates of the final defect region, a preset background range is expanded outward to determine the surrounding background region. The expansion range can be set to 1.5 times the size of the defect region. If the defect region is 64×48 pixels, it is expanded by 32 pixels and 24 pixels in each direction, resulting in a background region of (64+64)×(48+48)=(128×96) pixels. The original defect region is subtracted from this region to form an annular background region, and then the image pixels corresponding to this annular region are extracted from the image data.

[0106] The texture uniformity and response stability of the background region pixels are calculated to screen normal region pixels. The texture uniformity is measured by calculating the variance of the pixel gray value within a local region (such as a 5×5 window), and a region with a variance below a threshold of 20 is considered to have uniform texture. The response stability is evaluated by calculating the gradient magnitude, and a pixel with a gradient magnitude below a threshold of 30 is considered to have stable response. Pixels that satisfy both conditions are marked as normal region pixels. For example, for the 12,288 pixels (128×96) in the expanded background region, about 8,000 pixels are retained as normal region pixel samples after screening.

[0107] Based on the normal region pixels screened out, the feature values at the corresponding positions in the multi-level feature representation are found, the mean and standard deviation of these features are calculated, and the context background features representing the normal surface properties are generated. Specifically, statistical quantities are calculated for each feature dimension respectively. Assuming that the multi-level features contain 256-dimensional features, a 256-dimensional mean vector and a 256-dimensional standard deviation vector are generated, and are combined into a 512-dimensional background feature descriptor.

[0108] Subsequently, a feature difference measure between the local feature representation and the context background features is calculated, and the contrast features representing the difference degree of the defect region relative to the normal region are generated. The difference measure can be obtained by calculating the difference between each dimension in the local feature vector and the mean of the corresponding dimension in the background feature, and then dividing by the corresponding standard deviation to obtain a normalized deviation value. In addition, the cosine similarity and the Euclidean distance between the local feature and the background feature can also be calculated to form multi-dimensional contrast features. For example, 256-dimensional normalized deviation values are generated, plus 1-dimensional cosine similarity and 1-dimensional Euclidean distance, to obtain a 258-dimensional contrast feature vector.

[0109] Finally, the local feature representation (3584-dimensional), the context background features (512-dimensional) and the contrast features (258-dimensional) are spliced according to the feature dimensions to obtain a 4354-dimensional composite feature vector. This feature vector integrates the morphological features of the defect itself, the feature patterns of the surrounding normal region, and the contrast information between them, providing rich feature representation for subsequent defect classification and recognition.

[0110] In an optional implementation, based on the difference response strength of the defect features and the background features in the composite feature vector, the defect type is determined through a contrast learning mechanism to obtain a defect classification result, and the defect classification result is associated with the boundary coordinates to generate a detection result, including:

[0111] The local feature representation is separated from the composite feature vector as a defect feature component, and the context background features are separated as background feature components. The difference in response value between the defect feature component and the background feature component in each feature dimension is calculated to construct a difference response vector.

[0112] The difference response vector is taken as a query sample, and a similarity measure between the query sample and a reference sample is calculated. Based on the similarity measure, a contrast learning sample pair set composed of the query sample and the reference sample is constructed.

[0113] The ratio of intra-class contrast to inter-class contrast of the contrast learning sample pair set is calculated through a contrast learning mechanism to determine a defect type confidence and select the type corresponding to the highest confidence as the defect classification result.

[0114] Extracting the start point coordinate and the end point coordinate in the boundary coordinate of the final defect area, mapping the defect classification result with the start point coordinate and the end point coordinate, forming a result association record containing defect type identification and spatial position information, and extracting the detection result of the surface defect of the seamless steel pipe from the result association record.

[0115] Separate the local feature representation from the composite feature vector as a defect feature component, and separate the context background feature as a background feature component. For example, for a composite feature vector with a dimension of 512, the first 256 dimensions represent defect features, and the last 256 dimensions represent background features. The separation process is based on the structure design of the feature vector, ensuring the complete preservation of the two types of features.

[0116] Calculate the response value difference of the defect feature component and the background feature component in each feature dimension, subtract the corresponding position values of each feature dimension to obtain a new vector representing the difference degree. For example, if the defect feature value in a certain dimension is 0.85 and the background feature value in the corresponding dimension is 0.25, the difference response vector value in that dimension is 0.60. The larger this difference value, the higher the prominence of the defect feature in that dimension. Perform such difference calculation for all dimensions to form a complete difference response vector.

[0117] After the difference response vector is constructed, it is used as a query sample to perform similarity calculation with the pre-stored reference samples of each type of defect. The similarity calculation uses the cosine similarity method to calculate the cosine value between the query sample and each reference sample feature vector. For example, the cosine similarity between the difference response vector of a certain query sample and the "crack" type reference sample is 0.87, and the similarity with the "pit" type reference sample is 0.42. Based on the calculation results, a contrast learning sample pair set is constructed, each sample pair contains a query sample and a reference sample, and the similarity value is recorded.

[0118] Calculate the ratio of intra-class contrast and inter-class contrast of the contrast learning sample pair set through the contrast learning mechanism. The intra-class contrast refers to the average similarity of the query sample and the reference sample of the same type, and the inter-class contrast refers to the average similarity of the query sample and the reference sample of different types. For each defect type, a confidence value is calculated, which is equal to the intra-class contrast divided by the inter-class contrast. For example, for the "crack" type, the intra-class contrast is 0.85 and the inter-class contrast is 0.40, resulting in a confidence value of 2.125. Similarly, the confidence of other types is calculated, such as the "pit" type confidence of 1.375 and the "bubble" type confidence of 1.250. Select the type with the highest confidence as the defect classification result, which in this case is the "crack" type.

[0119] After determining the defect type, the boundary coordinate information of the final defect area is extracted, including the starting point coordinate and the ending point coordinate. For example, for the detected crack defect, the starting point of the boundary coordinate is (125, 347), and the ending point is (198, 412), indicating the location range of the defect in the image.

[0120] The defect classification result is mapped to these coordinates to form a result association record containing defect type identification and spatial location information. The format of the result association record is: defect ID, defect type, starting point coordinate, ending point coordinate, confidence. For example, a result association record is: Defect_001, crack, (125, 347), (198, 412), 2.125. Multiple defects are detected simultaneously, and each defect generates a similar record.

[0121] From the result association record, the final detection result of the surface defects of the seamless steel pipe is extracted, including the type and location information of each defect. These detection results can be used for subsequent quality control decisions, such as determining whether the steel pipe needs to be reworked or scrapped. For example, set the rule: if a crack defect longer than 20 pixels is detected, the steel pipe needs to be scrapped; if a depression with an area less than 100 square pixels is detected, the steel pipe can continue to be used but needs to be marked.

[0122] Through the above method, various defects on the surface of the seamless steel pipe can be accurately identified, and detailed defect type and location information can be provided, providing reliable technical support for steel pipe quality control.

[0123] In an optional implementation, the ratio of the intra-class contrast and the inter-class contrast of the set of contrast learning sample pairs is calculated by a contrast learning mechanism to determine the defect type confidence and select the type corresponding to the highest confidence as the defect classification result, including:

[0124] From the set of contrast learning sample pairs, reference samples with the same defect type label as the query sample are selected as same-class reference samples. The feature space distance between the difference response vector of the query sample and the feature vector of the same-class reference sample is calculated and aggregated to obtain the intra-class contrast.

[0125] From the set of contrast learning sample pairs, reference samples with different defect type labels from the query sample are selected as different-class reference samples. The different-class reference samples are grouped by defect type to obtain multiple different-class sample groups. The grouping feature space distance between the difference response vector of the query sample and the feature vectors of all reference samples in the different-class sample groups is calculated and the minimum value is selected to obtain the inter-class contrast.

[0126] The ratio of the intra-class contrast to the inter-class contrast is calculated to obtain a contrast ratio of the query sample, and the contrast ratio is converted into a confidence value of the defect type through a nonlinear mapping; the confidence values of all defect types corresponding to the same-class reference sample are compared, and the defect type with the highest confidence value is selected as the defect classification result of the seamless steel pipe surface defect.

[0127] In the detection of seamless steel pipe surface defects, a contrast learning mechanism is used to calculate the ratio of the intra-class contrast to the inter-class contrast of a set of contrast learning sample pairs, so as to determine the defect type confidence and select the type corresponding to the highest confidence as the defect classification result.

[0128] The set of contrast learning sample pairs contains a query sample and multiple reference samples, each sample having a defect type label. From the set of contrast learning sample pairs, reference samples with the same defect type label as the query sample are selected as same-class reference samples. For example, if the query sample is labeled as "crack" type, all reference samples labeled as "crack" are selected from the set of sample pairs as same-class reference samples.

[0129] The feature space distance between the difference response vector of the query sample and the feature vector of the same-class reference sample is calculated and aggregated to obtain the intra-class contrast. The difference response vector of the query sample is a 512-dimensional vector, and the feature vector of the same-class reference sample is also a 512-dimensional vector. The feature space distance is calculated using the cosine distance, that is, the dot product of the two vectors after standardization. Assuming that the difference response vector of the query sample is [0.1, 0.2,..., 0.3] and the feature vector of a same-class reference sample is [0.2, 0.1,..., 0.4], their cosine distance calculation result is 0.85. For all same-class reference samples, the cosine distances with the query sample are calculated and aggregated by taking the average value. Assuming that there are 5 same-class reference samples with cosine distances of 0.85, 0.82, 0.88, 0.90, and 0.86, the intra-class contrast is 0.862.

[0130] From the set of contrast learning sample pairs, reference samples with different defect type labels from the query sample are selected as different-class reference samples. The different-class reference samples are grouped according to defect types to obtain multiple different-class sample groups. For example, if the query sample is of "crack" type, multiple different-class sample groups such as "folding", "spot", and "scratch" are obtained.

[0131] The inter-class contrast is obtained by calculating the group feature space distance between the difference response vector of the query sample and the feature vectors of all reference samples in the outlier sample group, and selecting the minimum value. For each outlier sample group, the cosine distance between the query sample and all reference samples in that group is calculated, and the average value of the group is taken as the group feature space distance. Assuming that the average cosine distance of the "folded" group is 0.65, the average cosine distance of the "spot" group is 0.58, and the average cosine distance of the "scratch" group is 0.70, the minimum value of 0.58 is selected as the inter-class contrast.

[0132] The ratio of intra-class contrast to inter-class contrast is calculated to obtain the contrast ratio of the query sample. Based on the example above, the contrast ratio is approximately 0.862 / 0.58 ≈ 1.486. The contrast ratio is then converted into a confidence score for the defect type using a non-linear mapping. This non-linear mapping employs the Sigmoid function, i.e., f(x) = 1 / (1+e^(-x / x)). -α(x-β) The function is defined as follows: α and β are hyperparameters, with empirical values ​​set to 2 and 1, respectively. Substituting the contrast ratio of 1.486 into the function yields a confidence level of approximately 0.732.

[0133] For each defect type to which the query sample belongs, repeat the above process to calculate the corresponding confidence score. Assuming the confidence scores for the four defect types "crack," "fold," "spot," and "scratch" are 0.732, 0.421, 0.368, and 0.513 respectively, compare these confidence scores and select the defect type "crack" (confidence score 0.732) with the highest confidence score as the defect classification result for the seamless steel pipe surface defect.

[0134] This invention relates to a deep learning-based system for locating and detecting surface defects in seamless steel pipes. The system includes:

[0135] The first unit is used to acquire image data of the surface of the seamless steel pipe;

[0136] The second unit is used to perform multi-scale feature extraction on the image data to obtain a multi-level feature representation containing spatial location information and texture feature information;

[0137] The third unit is used to differentiate different morphological regions on the surface of seamless steel pipe based on the multi-level feature representation and an adaptive receptive field adjustment mechanism to generate multiple defect candidate regions and their corresponding spatial boundaries.

[0138] The fourth unit is used to establish a topological association network among multiple defect candidate regions, and to perform collaborative optimization of the spatial boundaries of adjacent defect candidate regions based on the topological association network to obtain the final location of the defect region and its boundary coordinates.

[0139] A fifth unit is configured to extract a local feature representation of the final defect region and a context background feature of the final defect region in the image data, construct a composite feature vector containing contrast features between the defect and the surrounding normal region, and determine a defect type through a contrast learning mechanism based on a difference response strength of the defect feature and the background feature in the composite feature vector to obtain a defect classification result. The defect classification result is associated with the boundary coordinates to generate a detection result.

[0140] In a third aspect, an electronic device is provided, comprising:

[0141] a processor;

[0142] a memory for storing processor-executable instructions;

[0143] The processor is configured to invoke the instructions stored in the memory to execute the method described above.

[0144] In a fourth aspect, a computer-readable storage medium is provided, which stores computer program instructions. When the computer program instructions are executed by a processor, the method described above is implemented.

[0145] The present application can be a method, apparatus, system and / or computer program product. The computer program product can include a computer-readable storage medium having stored thereon computer-readable program instructions that, when executed by a computer, cause the computer to carry out various aspects of the present application.

[0146] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for locating and detecting surface defects in seamless steel pipes based on deep learning, characterized in that, include: Acquire image data of the surface of seamless steel pipe; Multi-scale feature extraction is performed on the image data to obtain a multi-level feature representation that includes spatial location information and texture feature information; Based on the aforementioned multi-level feature representation, an adaptive receptive field adjustment mechanism is employed to differentiate different morphological regions on the surface of the seamless steel pipe, generating multiple defect candidate regions and their corresponding spatial boundaries, including: Local feature statistical analysis is performed on each spatial location in the multi-level feature representation to obtain the feature response intensity and feature distribution dispersion of each spatial location. Based on the feature response intensity and feature distribution dispersion, the surface of the seamless steel pipe is divided into multiple morphological regions. The receptive field size of each morphological region is dynamically determined based on the feature response intensity and feature distribution dispersion of each morphological region. The receptive field size is inversely proportional to the feature response intensity and directly proportional to the feature distribution dispersion, thereby obtaining the adaptive receptive field parameters corresponding to the morphological region. Based on the adaptive receptive field parameters of each morphological region, regions whose feature responses exceed the background response are extracted within the morphological region as initial candidate regions. In each initial candidate region, a boundary search is performed along the direction of the fastest feature gradient descent in the multi-level feature representation, starting from the center coordinates. When the feature response intensity drops to the background response level, the boundary point position is determined. All boundary point positions are connected to form a closed contour, resulting in multiple defect candidate regions and their corresponding spatial boundaries. A topological association network is established among multiple defect candidate regions, and the spatial boundaries of adjacent defect candidate regions are collaboratively optimized based on the topological association network to obtain the final location of the defect region and its boundary coordinates. Local feature representations of the final defect region and contextual background features of the final defect region in the image data are extracted to construct a composite feature vector containing the defect's own features and the contrast features of the surrounding normal region. Based on the difference response intensity between the defect features and the background features in the composite feature vector, the defect type is determined through a contrastive learning mechanism to obtain the defect classification result. The defect classification result is then associated with the boundary coordinates to generate a detection result.

2. The method according to claim 1, characterized in that, Multi-scale feature extraction is performed on the image data to obtain a multi-level feature representation that includes spatial location information and texture feature information, including: The image data is subjected to multi-level downsampling with an increasing magnification. After each downsampling, the image data at the current resolution is convolved by a group of convolution kernels containing multiple kernels of different sizes to obtain an initial feature map of the corresponding scale. By performing a convolution operation that preserves the spatial dimension, pixel-level local response distributions are extracted from the initial feature map. Based on the response values ​​and peak positions in the local response distributions, spatial coordinates are determined by locating the positions where the response values ​​exceed the average response values ​​of the neighborhood. The direction information is determined by calculating the principal direction of the feature gradient vector at the peak position, thus obtaining the spatial position information. The texture pattern response of the initial feature map is extracted by convolution operation that expands the receptive field and then decomposed in the frequency domain to obtain the spectral feature distribution that characterizes the periodicity and directionality of the texture. Based on the energy concentration region in the spectral feature distribution, the dominant frequency and dominant direction of the texture are extracted to obtain the texture feature information. The texture feature information is restored to the dimension of the spatial location information by upsampling, and the restored texture feature information is concatenated with the spatial location information by channel concatenation to obtain the multi-level feature representation.

3. The method according to claim 1, characterized in that, A topological association network is established among multiple defect candidate regions, and the spatial boundaries of adjacent defect candidate regions are collaboratively optimized based on the topological association network to obtain the final location of the defect region and its boundary coordinates, including: Calculate the spatial adjacency relationship and feature similarity relationship between any two candidate defect regions, construct a spatial adjacency matrix based on the spatial adjacency relationship, construct a feature similarity matrix based on the feature similarity relationship, and fuse the spatial adjacency matrix and the feature similarity matrix to establish the topological association network; In the topological network, the association strength between each defect candidate region and its neighboring defect candidate regions is calculated, and the collaborative optimization weight allocation of the defect candidate region is determined based on the association strength. For each defect candidate region, a set of boundary points on the spatial boundary of the defect candidate region is obtained. For each boundary point, a reference boundary point corresponding to the spatial position of the boundary point in the adjacent defect candidate region is obtained according to the collaborative optimization weight allocation. The positional deviation between the boundary point and the reference boundary point is calculated. The coordinates of the boundary point are iteratively adjusted based on the positional deviation to obtain the optimized spatial boundary. The optimized spatial boundary is formed into a complete closed contour. The area enclosed by the complete closed contour is determined as the final defect area. The coordinates of all boundary points on the complete closed contour are extracted as the boundary coordinates of the surface defect of the seamless steel pipe.

4. The method according to claim 1, characterized in that, Extracting the local feature representation of the final defect region and the contextual background features of the final defect region in the image data, and constructing a composite feature vector containing the defect's own features and the contrast features of the surrounding normal region, includes: Based on the boundary coordinates, feature sub-regions corresponding to the spatial range of the final defect region are cropped from the multi-level feature representation. Intra-region feature aggregation processing is performed on the feature sub-regions to generate local feature representations that characterize the shape and texture attributes of the defect itself. Based on the boundary coordinates of the final defect area, a preset background range is extended outward to determine the surrounding background area of ​​the final defect area, and the image pixels corresponding to the surrounding background area are extracted from the image data; normal area pixels are selected by calculating the texture uniformity and response stability of the image pixels, and background feature statistics are performed based on the corresponding features of the normal area pixels in the multi-level feature representation to generate the context background features that characterize normal surface properties. Calculate the feature difference measure between the local feature representation and the context background features, and generate a contrast feature based on the feature difference measure to characterize the degree of difference between the defective region and the normal region; The local feature representation, the context background feature, and the contrast feature are concatenated according to the feature dimension to obtain the composite feature vector.

5. The method according to claim 1, characterized in that, Based on the difference in response intensity between defect features and background features in the composite feature vector, the defect type is determined through a contrastive learning mechanism to obtain a defect classification result. This defect classification result is then correlated with the boundary coordinates to generate a detection result, including: The local feature representation is separated from the composite feature vector as the defect feature component, and the context background feature is separated as the background feature component. The difference in response value between the defect feature component and the background feature component in each feature dimension is calculated, and a difference response vector is constructed. Using the difference response vector as a query sample, the similarity measure between the feature vectors of the query sample and the reference sample is calculated, and a set of contrast learning sample pairs consisting of the query sample and the reference sample is constructed based on the similarity measure. The ratio of intra-class contrast to inter-class contrast of the contrast learning sample pair set is calculated by the contrastive learning mechanism to determine the confidence of the defect type and select the type corresponding to the highest confidence as the defect classification result. Extract the starting point coordinates and ending point coordinates from the boundary coordinates of the final defect area, establish a mapping relationship between the defect classification result and the starting point coordinates and the ending point coordinates, form a result association record containing defect type identifier and spatial location information, and extract the detection result of the seamless steel pipe surface defect from the result association record.

6. The method according to claim 5, characterized in that, The comparison learning mechanism calculates the ratio of intra-class contrast to inter-class contrast of the comparison learning sample pairs, determines the confidence level of the defect type, and selects the type corresponding to the highest confidence level as the defect classification result, including: Reference samples with the same defect type label as the query sample are selected from the set of contrast learning sample pairs and used as reference samples of the same class. The feature space distance between the difference response vector of the query sample and the feature vector of the reference samples of the same class is calculated and aggregated to obtain the intra-class contrast. Reference samples with different defect type labels than the query sample are selected from the set of contrast learning sample pairs and used as outlier reference samples. The outlier reference samples are grouped according to defect type to obtain multiple outlier sample groups. The group feature space distance between the difference response vector of the query sample and the feature vectors of all reference samples in the outlier sample group is calculated and the minimum value is selected to obtain the inter-class contrast. The ratio of the intra-class contrast to the inter-class contrast is calculated to obtain the contrast ratio of the query sample. The contrast ratio is then converted into a confidence value of the defect type through a non-linear mapping. The confidence values ​​of all defect types corresponding to the same type of reference sample are compared, and the defect type with the highest confidence value is selected as the defect classification result of the seamless steel pipe surface defect.

7. A deep learning-based system for locating and detecting surface defects in seamless steel pipes, used to implement the method as described in any one of claims 1-6, characterized in that, include: The first unit is used to acquire image data of the surface of the seamless steel pipe; The second unit is used to perform multi-scale feature extraction on the image data to obtain a multi-level feature representation containing spatial location information and texture feature information; The third unit is used to differentiate different morphological regions on the surface of seamless steel pipe based on the multi-level feature representation and an adaptive receptive field adjustment mechanism to generate multiple defect candidate regions and their corresponding spatial boundaries. The fourth unit is used to establish a topological association network among multiple defect candidate regions, and to perform collaborative optimization of the spatial boundaries of adjacent defect candidate regions based on the topological association network to obtain the final location of the defect region and its boundary coordinates. The fifth unit is used to extract the local feature representation of the final defect region and the contextual background features of the final defect region in the image data, construct a composite feature vector containing the defect's own features and the contrast features of the surrounding normal region, and determine the defect type through a contrastive learning mechanism based on the difference response intensity between the defect features and the background features in the composite feature vector, obtain the defect classification result, associate the defect classification result with the boundary coordinates, and generate the detection result.

8. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to invoke instructions stored in the memory to execute the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the method described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Artificial board surface defect intelligent detection method and system based on machine vision

    CN120355688A