Pipeline weld radiographic testing AI identification system
Patent Information
- Application Number
- CN202611332470.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-31
- Publication Date
- 2026-10-16
AI Technical Summary
现有预处理算法以适配人眼视觉感受为优化目标,过度追求图像可视化清晰,会在增强图像对比度的同时放大噪声,降噪处理又会模糊微小缺陷边缘,彻底改变缺陷原始像素分布特征,导致深度学习模型无法有效区分微小缺陷信号与背景噪声,大幅降低微小缺陷的识别精度
[0027] It is understood that the beneficial effects of the second and third aspects mentioned above can be referred to the beneficial effects described in the first aspect, and will not be repeated here. This application integrates imaging physical prior, defect signal perception enhancement and adaptive feature sampling step by step, decomposes the results to drive enhancement processing, enhances the differences to drive network training, and uses probability prior and network features to jointly drive adaptive sampling. Information reuse in each link forms a collaborative closed loop, which improves the automation level and recognition consistency of pipeline weld radiographic inspection as a whole, and reduces the probability of missed detection and false detection.
Smart Images

Figure CN122928859A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of nondestructive testing technology, and more specifically, to an AI recognition system for radiographic inspection of pipe welds. Background Technology
[0002] Pipelines are core infrastructure for transporting media in industries such as oil, natural gas, chemicals, and power. The welding quality of pipeline welds is crucial to ensuring the safe and stable operation of the transport system. Radiographic testing (RT), as the mainstream non-destructive testing technology for pipeline welds, relies on X-ray radiography to obtain weld images. It can effectively identify various weld defects such as porosity, slag inclusions, incomplete penetration, and cracks, and is widely used in industrial weld quality verification. However, traditional radiographic testing heavily relies on manual image interpretation, which is not only inefficient but also highly subjective, as the interpretation results are greatly affected by the experience and subjective state of the personnel. At the same time, long-term, high-intensity manual image interpretation work can easily lead to visual fatigue, resulting in frequent missed or false detections, making it difficult to meet the needs of modern pipeline welding production inspection that requires large scale, high efficiency, and high precision.
[0003] Existing technologies based on deep learning for automatic weld defect identification using convolutional neural networks (CNNs) are gradually becoming a research hotspot in the industry. The process of this type of conventional technical solution is as follows: First, the weld ray image is visually enhanced and denoised using algorithms such as histogram equalization, gamma transform, bilateral filtering, and wavelet denoising to optimize the visual effect. Then, a deep learning model is used to classify and detect weld defects. This solution can effectively replace some manual work and improve the level of automation in testing; However, it has significant shortcomings in identifying minute defects such as micropores and microcracks. Existing preprocessing algorithms aim to adapt to human visual perception and excessively pursue image visualization clarity. This can amplify noise while enhancing image contrast, and noise reduction can blur the edges of tiny defects, completely changing the original pixel distribution characteristics of defects. As a result, deep learning models cannot effectively distinguish between tiny defect signals and background noise, significantly reducing the recognition accuracy of tiny defects. Summary of the Invention
[0004] This application provides an AI recognition system for radiographic inspection of pipeline welds. By constructing a signal decomposition model based on a physical imaging model, the original radiographic inspection image of the weld is decomposed into a defect signal probability map and a structure background map. Based on the defect signal probability map, the original radiographic inspection image of the weld is spatially asymmetrically enhanced to generate a defect focusing enhancement map and a structure preservation reference map. Combined with a dual-stream feature extraction network to maximize the learning of the difference between the defect focusing enhancement map and the structure preservation reference map, and adaptive sampling detection based on the defect signal probability map, the image enhancement is made to serve the model feature extraction rather than human visual perception, thereby improving the sensitivity of feature expression to weak signals such as micropores and microcracks.
[0005] To achieve the above objectives, this application adopts the following technical solution: Firstly, a radiographic inspection AI recognition system for pipe welds is provided, the system comprising: The imaging decomposition module acquires the original weld radiographic inspection image, constructs a signal decomposition model based on the physical imaging model, inputs the original weld radiographic inspection image into a neural network, and decomposes it into a defect signal probability map and a structure background map under constraints. The defect enhancement module performs spatial asymmetric enhancement on the original weld radiographic inspection image based on the defect signal probability map. Enhancement is performed in regions with probability values greater than a first threshold, and smoothing is performed in regions with probability values less than a second threshold. The enhancement and smoothing results are fused based on the defect signal probability map to generate a defect-focused enhancement map, and the smoothing result is saved as a structure-preserving reference map. The dual-stream training module constructs a dual-stream feature extraction network. The defect-focused enhancement map and the structure-preserving reference map are input into the two branches of this network to extract feature vectors. A difference maximization loss function is constructed and the network is trained to obtain a trained dual-stream feature extraction network. The adaptive sampling detection module inputs the original weld radiographic inspection image into the trained dual-stream feature extraction network to extract a global feature map. Candidate regions are generated based on the global feature map. The uncertainty of each candidate region is determined based on the defect signal probability map. The sampling grid density and sampling point positions are adjusted according to the uncertainty, and then the global feature map is sampled to extract the feature vectors of each candidate region.
[0006] In the recognition system provided in this application, the imaging decomposition module decomposes the original weld radiographic inspection image into a defect signal probability map and a structural background map based on a physical imaging model. The defect signal probability map quantifies the confidence level of the presence of a defect at each pixel location, providing a probabilistic prior for subsequent enhancement processing and sampling detection. The defect enhancement module performs spatial asymmetric enhancement on the original image based on the defect signal probability map, performing contrast enhancement in suspected defect areas and smoothing processing in identified background areas, so that image enhancement serves model feature extraction rather than human visual perception. The dual-stream training module learns to maximize the difference between the defect-focused enhancement map and the structural-preserving reference map through a dual-stream feature extraction network, improving the sensitivity of feature representation to weak signals such as micropores and microcracks. The adaptive sampling detection module adjusts the sampling grid density and sampling point positions based on uncertainty, tilting feature extraction resources towards uncertain regions and defect response regions, achieving a balance between detection accuracy and computational efficiency.
[0007] In one embodiment, the imaging decomposition module is specifically used to: acquire the original weld radiographic inspection image and its accompanying imaging physical parameters; convert the pixel grayscale values of the original weld radiographic inspection image into material equivalent thickness physical quantity values to form a physical quantity normalized image; perform sampling statistics on the physical quantity normalized image; estimate the noise distribution parameters of the physical quantity normalized image based on the noise distribution characteristics; and use the noise distribution parameters as the configuration input of the mixed signal decomposition model.
[0008] In this embodiment, pixel grayscale values are converted into physical quantities of material equivalent thickness, eliminating the influence of exposure condition differences on grayscale distribution and unifying image measurement standards under different exposure conditions. This makes images acquired under different tube voltages, tube currents, and exposure times comparable. Simultaneously, by estimating noise distribution parameters from the physical quantity-normalized image, adaptive constraint boundary conditions are provided for the subsequent mixed-signal decomposition model. This allows the decomposition model to automatically adjust its decomposition accuracy based on the actual noise level of each image, eliminating the need for manually setting fixed parameters.
[0009] In one implementation, the imaging decomposition module is further configured to: input a physical quantity normalized image into a mixed signal decomposition model, perform iterative decomposition using noise distribution parameters as constraint boundary conditions, alternately update the defect signal component and background component in each iteration and apply different types of constraints respectively, until the iteration converges and terminates, and output a defect signal probability map and a structure background map.
[0010] In this embodiment, the mixed-signal decomposition model performs iterative decomposition using an alternating update method. It imposes sparsity constraints on the defect signal component to suppress scattered and weak noise responses while preserving spatially clustered defect responses, and imposes smoothness constraints on the background component to prevent it from absorbing the defect signal. This alternating constraint iterative mechanism ensures that the defect signal component and the background component are strictly separated in a physical sense, resulting in a decomposition result with clear physical interpretability, unlike the output of an end-to-end black-box model.
[0011] In one implementation, the defect enhancement module is specifically used to: acquire a defect signal probability map; perform local statistical feature analysis on the defect signal probability map; divide the defect signal probability map into continuous regions and isolated point regions based on the analysis results; perform probability value reestimation on the isolated point regions to form a regularized defect signal probability map; acquire the regularized defect signal probability map; and use the probability value of each pixel in the defect signal probability map as a modulation factor to perform dual-mode parallel enhancement processing on the original weld radiographic inspection image: in the first mode, contrast enhancement is performed on regions with probability values greater than a first threshold; in the second mode, smoothing processing is performed on regions with probability values less than a second threshold, and the intermediate image after contrast enhancement and the intermediate image after smoothing are output.
[0012] In this embodiment, regularization processing divides the probability map into continuous regions and isolated point regions through local statistical feature analysis. Probability value reestimation is performed on the isolated point regions, effectively suppressing isolated noise responses caused by random fluctuations in quantum noise or detector defects, while not damaging the boundaries of continuous defect regions. Dual-mode parallel enhancement processing provides contrast stretching for suspected defect regions and smoothing for determined background regions. Furthermore, the enhancement intensity is modulated by probability values, preventing false contrast amplification at non-defect locations. For example, a tiny pore with a diameter of 0.5 mm typically has only a dozen or so grayscale contrast levels with the surrounding weld material; after enhancement using the first mode, the contrast can be increased to more than twice the original value.
[0013] In one implementation, the defect enhancement module is further configured to: acquire a regularized defect signal probability map, use the probability value of each pixel in the defect signal probability map as a fusion weight, perform pixel-by-pixel weighted fusion on the contrast-enhanced intermediate image and the smoothed intermediate image, output a defect focus enhancement map, and simultaneously save the smoothed intermediate image as a structure-preserving reference map.
[0014] In this embodiment, pixel-by-pixel weighted fusion ensures that the proportion of contrast-enhancing components is high at suspected defect locations, and the proportion of smoothing components is high at identified background locations. At locations with probability values in the transition zone, the two types of components transition continuously according to probability, and the entire defect-focused enhancement image has no processing abrupt boundaries. Simultaneously, the structure-preserving reference image and the defect-focused enhancement image originate from the same original image and are perfectly registered in spatial geometry. They respectively carry background structure information and defect enhancement information, forming paired training data for the dual-stream training module, ensuring data homogeneity in dual-stream contrastive learning.
[0015] In one implementation, the dual-stream training module is specifically used to: acquire a defect focusing enhancement map and a structure preservation reference map; perform grayscale distribution alignment and low-frequency component fusion on both; and output the aligned defect focusing enhancement map and the aligned structure preservation reference map; input the aligned defect focusing enhancement map and the aligned structure preservation reference map into two branches of the dual-stream feature extraction network respectively; extract feature map groups of each network layer and calculate channel-by-channel differences; arrange them according to network depth to form a multi-layer difference feature sequence; perform inter-layer difference accumulation analysis on the multi-layer difference feature sequence; mark the difference-sensitive layer and record the difference-dominant channel.
[0016] In this implementation, grayscale distribution alignment eliminates the global grayscale distribution difference between the two images caused by defect enhancement processing. This ensures that the difference learning objective of the two-stream network is precisely constrained to defect-related content, preventing the two branches from learning the grayscale distribution difference itself as a discrimination criterion. Inter-layer difference accumulation analysis identifies difference-sensitive layers and difference-dominant channels, providing a quantitative basis for constructing the subsequent difference-weighted loss function. This allows training resources to be tilted towards layers and channels that contribute significantly to defect discrimination.
[0017] In one implementation, the dual-stream training module is further used to: construct a differential weighted maximization loss function using the difference-sensitive layer and the difference-dominant channel as constraint anchors, assign different weight coefficients to the differences of different layers and different channels, and calculate the weighted difference of the feature vectors output by the two branches in the corresponding layers and corresponding channels according to the weight coefficients; dynamically combine the differential weighted maximization loss function with the basic classification loss function, adjust the weight ratio of the two in the total loss according to the relative change trend of the two during the training process, iteratively train the dual-stream feature extraction network according to the total loss after dynamic combination until convergence, and output the trained dual-stream feature extraction network.
[0018] In this implementation, the differential weighted maximization loss function prompts the network to output as many divergent feature representations as possible on the difference-sensitive layer and the difference-dominant channel, thereby continuously expanding the separation between defect enhancement content and background content in the feature space. The dynamic combination mechanism balances the two training objectives of feature difference amplification and discrimination accuracy improvement, avoiding the problem of one objective being suppressed by the other due to fixed weight combination. The adjustment range of the weight ratio is limited to 0.3 to 0.7 to avoid either objective being completely suppressed.
[0019] In one implementation, the adaptive sampling detection module is specifically used to: input the original weld radiographic inspection image into a trained dual-stream feature extraction network to extract a global feature map, record the total downsampling factor, perform equal-scale compression on the defect signal probability map according to the total downsampling factor, and establish an index relationship with the global feature map; generate candidate regions on the global feature map, use the index relationship to locate the probability distribution corresponding to each candidate region on the compressed defect signal probability map, calculate the statistical feature value of the probability distribution, and determine the confidence score and uncertainty measure of each candidate region based on the statistical feature value.
[0020] In this embodiment, the equal-scale compression adopts the method of taking the maximum value rather than the average value, so as to fully retain the strongest defect response evidence within the block and avoid the dilution of the average value by taking the average value when the small defects only occupy a few pixels in the original image. The uncertainty measure is determined by the distribution entropy through monotonic mapping. The candidate region with higher distribution entropy corresponds to the position with ambiguous probability response, which is the position where defect judgment is most prone to error and the position where sampling resources need to be tilted the most.
[0021] In one implementation, the adaptive sampling detection module is further configured to: obtain the confidence score and uncertainty metric of each candidate region, determine the total number of sampling points for each candidate region based on the uncertainty metric, and generate a sampling grid spatial density distribution map for each candidate region using the confidence score as a guide for the spatial distribution of sampling points.
[0022] In this embodiment, the total number of sampling points is allocated according to the proportion of the uncertainty metric value of each candidate region to the total. Regions with high uncertainty receive more sampling points, while regions with low uncertainty retain only a small number of sampling points. Regions with clear probability responses do not require dense sampling to obtain reliable feature representations, thus overcoming the defect of uniform grid sampling that ignores the uncertainty differences of candidate regions.
[0023] In one implementation, the adaptive sampling detection module is further configured to: obtain the initial position of each sampling point in the sampling grid spatial density distribution map, offset the initial position with the gradient information of the compressed defect signal probability map, extract the feature values at each sampling point position on the global feature map according to the offset sampling point position and the weight determined by the sampling grid spatial density distribution map, and perform aggregation, and output the aggregated feature vector of each candidate region.
[0024] In this embodiment, gradient offset fine-tunes the sampling points in the direction of the fastest probability increase, causing the sampling points to converge towards the peak region of the defect probability response, thereby improving the targeting of feature extraction; the aggregated feature vector integrates the weighted feature responses of multiple sampling positions within the region, highlighting the feature contribution of the peak position of the defect response while retaining the feature context of the region as a whole, serving as the direct data basis for determining pipeline weld defects.
[0025] Secondly, this application provides a computer device, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the functions of the pipeline weld radiographic inspection AI recognition system described in the first aspect and various embodiments of the first aspect.
[0026] Thirdly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the functions of the pipeline weld radiographic inspection AI recognition system in the first aspect and various embodiments thereof.
[0027] It is understood that the beneficial effects of the second and third aspects mentioned above can be referred to the beneficial effects described in the first aspect, and will not be repeated here. This application integrates imaging physical prior, defect signal perception enhancement and adaptive feature sampling step by step, decomposes the results to drive enhancement processing, enhances the differences to drive network training, and uses probability prior and network features to jointly drive adaptive sampling. Information reuse in each link forms a collaborative closed loop, which improves the automation level and recognition consistency of pipeline weld radiographic inspection as a whole, and reduces the probability of missed detection and false detection. Attached Figure Description
[0028] Figure 1 This is a schematic diagram of the overall system architecture of the present invention; Figure 2 This is a schematic diagram of the imaging decomposition module processing flow of the present invention; Figure 3 This is a schematic diagram of the defect enhancement module processing flow of the present invention; Figure 4 This is a schematic diagram of the overall data flow during the actual training phase of the present invention; Figure 5 This is a schematic diagram of the overall data flow during the detection phase of the present invention. Detailed Implementation
[0029] The technical solutions in this application will now be described in conjunction with the accompanying drawings. The detailed descriptions and drawings of the following embodiments are used to exemplarily illustrate the principles of this application, but should not be used to limit the scope of this application; that is, this application is not limited to the described embodiments.
[0030] It should be noted that, in this application, the terms "exemplary" or "for example" are used to indicate that something is being described as an example, illustration, or illustration. Any embodiment or design described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0031] In one possible implementation, deep learning-based automatic weld defect identification technology using convolutional neural networks has gradually become a research hotspot in the industry. The process of this solution is as follows: First, visual enhancement and noise reduction preprocessing of weld seam ray images are performed using algorithms such as histogram equalization, gamma transform, bilateral filtering, and wavelet denoising. Then, a deep learning model is used to complete defect classification and detection. However, existing preprocessing algorithms aim to adapt to human visual perception and excessively pursue clear image visualization. This can amplify noise while enhancing image contrast, and the noise reduction process can blur the edges of tiny defects, completely changing the original pixel distribution characteristics of the defects. As a result, the deep learning model cannot effectively distinguish between tiny defect signals and background noise, significantly reducing the recognition accuracy of tiny defects.
[0032] Furthermore, the traditional uniform grid feature sampling method extracts features from the entire feature map using equally spaced grids, ignoring the differences in the credibility of different candidate regions. High-credibility regions and low-credibility regions receive the same computing power allocation, resulting in both wasted computing power and insufficient feature representation in uncertain regions.
[0033] Based on the above issues, please refer to Figures 1 to 5 This application provides an AI recognition system for radiographic inspection of pipeline welds. By constructing a signal decomposition model based on a physical imaging model, the original radiographic inspection image of the weld is decomposed into a defect signal probability map and a structure background map. Based on the defect signal probability map, the original radiographic inspection image of the weld is spatially asymmetrically enhanced to generate a defect focusing enhancement map and a structure preservation reference map. Combined with a dual-stream feature extraction network to maximize the learning of the difference between the defect focusing enhancement map and the structure preservation reference map, and adaptive sampling detection based on the defect signal probability map, the image enhancement is made to serve the model feature extraction rather than human visual perception, thereby improving the sensitivity of feature expression to weak signals such as micropores and microcracks.
[0034] The system architecture on which this application is based will be introduced below. This application provides an overall architecture for an AI recognition system for radiographic inspection of pipe welds.
[0035] The entire system is deployed on a testing workstation, which is equipped with a graphics processing unit (GPU) and connected to the X-ray imaging equipment via an industrial bus.
[0036] The radiographic imaging equipment includes an X-ray flaw detector and a digital flat panel detector. The X-ray flaw detector emits radiographic rays into the weld area, and the digital flat panel detector receives the rays that have penetrated the weld and outputs a digital grayscale image.
[0037] Under normal operating conditions, the detector pixel size is 0.139 mm, the grayscale bit depth of the output image is 16 bits, and the number of horizontal pixels in a single image is approximately 3000 and the number of vertical pixels is approximately 1000. The inspection workstation also receives the imaging physical parameters recorded in the radiographic operation record. The imaging physical parameters include tube voltage, tube current, exposure time, distance from the X-ray source to the detector, and the material grade and wall thickness of the inspected pipe. The above parameters are automatically recorded by the flaw detector control unit and the inspection process document and archived together with the image.
[0038] The system's software architecture comprises four core modules: The system includes an imaging decomposition module, a defect enhancement module, a dual-stream training module, and an adaptive sampling detection module. The imaging decomposition module is used to acquire the original weld radiographic inspection image, construct a signal decomposition model based on the physical imaging model, and decompose the original weld radiographic inspection image into a defect signal probability map and a structural background map. The defect enhancement module performs spatial asymmetric enhancement on the original weld radiographic inspection image based on the defect signal probability map, generating a defect focusing enhancement map and a structure preservation reference map. The dual-stream training module is used to construct a dual-stream feature extraction network. During the training phase, the difference maximization learning is performed on the defect focusing enhancement map and the structure preservation reference map to obtain the trained dual-stream feature extraction network. The adaptive sampling detection module runs during the detection phase. It inputs the original weld radiographic inspection image into a trained dual-stream feature extraction network to extract a global feature map. Based on the global feature map and the defect signal probability map, it performs adaptive sampling detection and outputs the aggregated feature vector of each candidate region as the data basis for defect determination.
[0039] The following details the specific implementation methods of each module in the AI recognition system for radiographic inspection of pipe welds provided in this application: The imaging decomposition module is used to acquire the original weld radiographic inspection image, construct a signal decomposition model based on the physical imaging model, input the original weld radiographic inspection image into the neural network, and decompose it into a defect signal probability map and a structural background map under constraints.
[0040] The hardware input source for the imaging decomposition module is the radiographic imaging equipment at the pipeline weld radiographic inspection site; the original weld radiographic inspection image is transmitted to the inspection workstation via an industrial bus to complete data reception; the overall operation logic of the imaging decomposition module is divided into three progressive processes: The first part is the conversion operation from grayscale to physical quantity, which restores the pixel grayscale value to the physical quantity value of the material equivalent thickness, and eliminates the influence of exposure condition differences on grayscale distribution. The second part is the noise distribution parameter estimation calculation, which statistically analyzes the distribution characteristics of background noise from the normalized image of physical quantities; The third part is the mixed signal iterative decomposition operation, which decomposes the image into a defect signal probability map and a structural background map under the constraint of noise distribution parameters; All calculations in the imaging decomposition module are completed locally on the inspection workstation without needing to access an external database. In the processing results, the defect signal probability map is used to drive the defect enhancement module and the adaptive sampling detection module, and the structural background map is used for weld structure integrity verification.
[0041] In one embodiment, the processing procedure of the imaging decomposition module includes the following steps: Step 101: Obtain the original weld radiographic inspection image and its accompanying imaging physical parameters, convert the pixel grayscale values of the original weld radiographic inspection image into material equivalent thickness physical quantity values, and form a physical quantity normalized image.
[0042] There is a definite mapping relationship between the pixel grayscale value of the original weld radiographic inspection image and the intensity of the radiation received by the detector. The digital flat panel detector operates within a linear response range, and the pixel grayscale value increases linearly with the intensity of the received radiation. According to the physical law of radiation penetration attenuation, the intensity of radiation decreases exponentially after passing through the material. The degree of attenuation is determined by both the thickness of the penetrated material and the linear attenuation coefficient of the material for that radiation energy. The greater the wall thickness, the lower the intensity of the penetrating radiation and the smaller the corresponding pixel grayscale value. Geometric structures such as weld reinforcement, misalignment, and root formation, as well as defects such as porosity, slag inclusions, incomplete penetration, and cracks, will all appear as differences in grayscale on the image. The physical quantity of equivalent material thickness refers to the equivalent material thickness value calculated by converting the attenuation degree at different pixel positions based on the linear attenuation coefficient of the inspected pipe's base material. This physical quantity unifies the image measurement standard under different exposure conditions.
[0043] The conversion from grayscale to equivalent material thickness is accomplished using a pre-calibrated thickness calibration curve. The calibration process uses a stepped test block of the same material and wall thickness as the pipe under test. Grayscale responses of each step are collected under the same radiographic process, establishing a correspondence between grayscale values and known step thicknesses, and storing this as a calibration curve. The conversion operation iterates through all pixels of the image, querying the calibration curve one by one to obtain the physical quantity value of the equivalent material thickness for each pixel. Subsequently, normalization is performed on all physical quantity values. The normalization method involves subtracting the minimum value from the entire image and then dividing by the difference between the maximum and minimum values, ensuring the normalized result ranges from zero to one, thus forming a normalized physical quantity image.
[0044] Taking the inspection of circumferential welds in long-distance pipelines as an example, the equivalent thickness at the weld center reinforcement position is greater than that at the base material position. If there are porosity defects inside the weld, the actual material density at the porosity position decreases and the equivalent thickness changes. This is presented as a locally identifiable deviation on the normalized physical quantity image, and the magnitude of this deviation is related to the porosity size. For example, the relative change in equivalent thickness caused by a tiny porosity with a diameter of 0.5 mm under typical radiographic processes is about 1% to 3% of the wall thickness.
[0045] Step 102: Sample and statistically analyze the normalized image of physical quantities, estimate the noise distribution parameters of the normalized image of physical quantities based on the noise distribution characteristics, and use the noise distribution parameters as the configuration input of the mixed signal decomposition model.
[0046] Noise in X-ray inspection images mainly originates from two physical levels; One type is X-ray quantum noise. The number of photons transmitted through the irradiation has inherent random fluctuations. The random fluctuations in the number of photons received by the detector are manifested as random fluctuations in grayscale on the image. The intensity of this type of noise is related to the number of photons received; the more photons received, the weaker the quantum noise. The second is detector electronic noise, which is a Gaussian morphological random error introduced by the detector readout circuit and analog-to-digital conversion process. This type of noise is independent of exposure conditions.
[0047] Sampling statistics are performed in the background area of the normalized physical quantity image. The background area refers to the uniform base material area that does not contain weld contours and defect responses. The system uniformly extracts sample sub-blocks from the image at fixed row and column intervals. The side length of each sample sub-block is 16 pixels. Under general working conditions, the total number of sample sub-blocks extracted is not less than 500 to ensure the stability of the statistical results.
[0048] For each sample sub-block, the arithmetic mean and standard deviation of all physical quantities within the block are calculated. The standard deviation characterizes the degree of dispersion of the values within the block from the mean, reflecting the noise intensity level of the area. After completing the statistics of all sample sub-blocks, the median value of the standard deviation of all sub-blocks is defined as the global noise intensity estimate, and the overall dispersion of the mean of all sub-blocks is defined as the background drift amplitude. The two together constitute the noise distribution parameters.
[0049] Among them, the global noise intensity estimate is used to define the separability boundary between defect signals and noise, and the background drift amplitude is used to define the gradual range of structural components. The noise distribution parameters are generated synchronously with the physical quantity normalized image and used as the configuration input of the mixed signal decomposition model. When the radiographic process or pipe specifications change, the noise distribution parameters are automatically updated without manual intervention.
[0050] Step 103: Input the normalized image of physical quantities into the mixed signal decomposition model, and perform iterative decomposition with noise distribution parameters as constraint boundary conditions. In each iteration, the defect signal component and background component are updated alternately and different types of constraints are applied respectively until the iteration converges and terminates, outputting the defect signal probability map and the structure background map.
[0051] The mixed signal decomposition model is built on the physical imaging model. Its signal modeling logic is to regard each pixel value of the physical quantity normalized image as the superposition of background component and defect signal component.
[0052] The background component corresponds to the low-frequency components caused by the weld geometry and gradual changes in the base metal wall thickness, while the defect signal component corresponds to the local deviation components caused by defects such as porosity, inclusions, lack of fusion, and cracks.
[0053] The mixed signal decomposition model uses a neural network as the computational carrier. The network structure adopts the form of a convolutional neural network, which includes a feature encoding part and a component decoding part.
[0054] The feature encoding section consists of multiple convolutional operation units connected in series, and the component decoding section is set up with two sets of parallel outputs: background component output channel and defect signal component output channel.
[0055] The network takes a physical quantity normalized image as input and outputs pixel-wise estimates of the background and defect signal components.
[0056] The execution method using noise distribution parameters as constraint boundary conditions is as follows: The global noise intensity estimate defines the effective lower bound of the defect signal component's amplitude. Components in the defect signal component with amplitudes below this lower bound are identified as noise responses and suppressed. The background drift amplitude defines the allowable range of gradual change in the background component. The change in the background component during iterative updates is limited to this range to prevent the background component from absorbing the defect signal.
[0057] During the iterative decomposition process, alternating updates are performed in each iteration.
[0058] The first sub-step keeps the background component unchanged and updates the defect signal component. A sparsity constraint is applied to the defect signal component. The constraint logic is that the spatial duty cycle of the defect in the weld area is low, and the actual defect response occupies only a few pixel positions in the image plane. The update process suppresses the scattered and weak noise response and retains the spatially clustered defect response.
[0059] The second sub-step keeps the defect signal component unchanged and updates the background component. A smoothness constraint is applied to the background component. The constraint logic is that the weld structure and wall thickness change are continuously and gradually changed in space, and the numerical difference between adjacent positions of the background component is limited to the noise allowable range.
[0060] The convergence of the iteration is determined by the fact that the average absolute value of the pixel-by-pixel change of the defect signal component output in two adjacent iterations is less than the preset convergence threshold. Under normal working conditions, the convergence threshold is 0.001. At the same time, the maximum number of iterations is set to 200 as a forced termination condition to prevent individual images from failing to converge for a long time due to abnormal noise.
[0061] After the iteration terminates, a normalization mapping is performed on the defect signal components, linearly mapping the component amplitude to a probability value in the range of 0 to 1, forming a defect signal probability map. The probability value characterizes the confidence level of the presence of a defect at the corresponding pixel location; the closer the probability value is to 1, the higher the confidence level of the presence of a defect at that location. The background component is directly output as a structural background image, which fully preserves the weld reinforcement outline, bevel form, and gradual wall thickness change information, allowing inspection personnel to review the weld formation quality.
[0062] The defect enhancement module performs spatial asymmetric enhancement on the original weld radiographic inspection image based on the defect signal probability map. Enhancement is performed in regions where the probability value is greater than the first threshold, and smoothing is performed in regions where the probability value is less than the second threshold. The enhancement and smoothing results are fused based on the defect signal probability map to generate a defect focusing enhancement map, and the smoothing result is saved as a structure preservation reference map.
[0063] The defect enhancement module receives the probability map of the defect signal output by the imaging decomposition module and the original weld radiographic inspection image as dual inputs.
[0064] Unlike traditional contrast enhancement and noise reduction processes that serve human vision, the defect enhancement module optimizes by maximizing the separability of defect signals and background structures in the feature space. The enhancement process exhibits spatial asymmetry in the image space, and the suspected defect area and the confirmed background area are processed with completely opposite strategies.
[0065] The defect enhancement module's processing flow consists of three consecutive computational stages: The first stage is the regularization process for the probability map of defective signals, which removes isolated noise responses from the probability map and ensures the reliability of the probability map as a modulation factor and fusion weight. The second stage is a dual-mode parallel enhancement stage, which simultaneously performs two independent processing links for contrast enhancement and smoothing on the original image. The two links operate in parallel to compress processing time. The third stage is the probability-weighted fusion stage, which fuses the outputs of the two links pixel by pixel based on the probability values to generate a defect focusing enhancement map and a structure preservation reference map.
[0066] The defect-focused enhancement image serves as the training input for the defect branch of the dual-stream training module, while the structure-preserving reference image serves as the training input for the background branch of the dual-stream training module. Both images are derived from the same original image, ensuring the data homogeneity of the dual-stream contrastive learning.
[0067] In one embodiment, the processing procedure of the defect enhancement module includes the following steps: Step 201: Obtain the defect signal probability map, perform local statistical feature analysis on the defect signal probability map, divide the defect signal probability map into continuous regions and isolated point regions according to the analysis results, perform probability value re-estimation on the isolated point regions, and form a regularized defect signal probability map.
[0068] Local statistical feature analysis is performed using a sliding window approach, with a side length of 5 pixels. The window traverses the entire probability map in pixel-by-pixel increments.
[0069] For each center pixel of a window, calculate the average probability value of all pixels within the window and the deviation between the center pixel and the average value.
[0070] The distinction between continuous and isolated regions is based on the physical morphological characteristics of defects: real defects have definite spatial continuity in X-ray inspection images, pores appear as rounded clumps, inclusions appear as strips extending along the fusion line, and cracks appear as lines with a direction. These morphologies are represented on the probability map as a continuous response with several adjacent pixels having simultaneously high probability values. Isolated regions refer to scattered responses where only a few pixels have high probability values while their neighboring probability values are all low. Such responses are mostly caused by random fluctuations in quantum noise or detector defects.
[0071] The division method is as follows: if the number of pixels in the neighborhood of the center pixel of the window that have a probability value exceeding the preset response threshold of 0.5 is 3 or more, then the pixel is classified into the continuous region; if the number of pixels in the neighborhood that exceed the threshold is less than 3, but the center pixel itself exceeds the threshold, then the pixel is classified into the isolated point region.
[0072] The probability value is re-estimated for isolated point regions by replacing the original probability value with the median value of the probability values of all pixels in the 8-neighborhood of the pixel. The median value is not sensitive to individual extreme values, which can effectively suppress isolated noise response without damaging the boundary of continuous region.
[0073] After all pixels are segmented and re-estimated, a regularized probability map of the defect signal is output.
[0074] Step 202: Obtain the regularized defect signal probability map, and use the probability value of each pixel in the defect signal probability map as a modulation factor to perform dual-mode parallel enhancement processing on the original weld radiographic inspection image.
[0075] The first threshold and the second threshold are the system's preset probability judgment boundaries. The first threshold is 0.6 and the second threshold is 0.4. Pixels in the transition zone with probability values between the two thresholds participate in both processing links and the proportion of the two types of processing results is continuously adjusted by the probability value during the fusion process.
[0076] The first mode performs contrast enhancement, and the enhancement intensity is modulated by the probability value of the pixel. The modulation logic is that the higher the probability value of the pixel, the greater the contrast stretching intensity it receives.
[0077] The contrast enhancement process is as follows: For each pixel, a local window centered on that pixel with a side length of 9 pixels is extracted. The difference between the weighted average of the gray levels within the window and the gray level of that pixel is calculated. This difference is multiplied by an enhancement coefficient determined by a probability value and then added back to the original gray level. The enhancement coefficient increases continuously with the probability value from a first threshold to 1.
[0078] This processing is mathematically equivalent to amplifying the contrast between the grayscale within the suspected defect area and the local background, thereby enhancing the image contours of weak-contrast defects such as micropores and microcracks.
[0079] Taking a tiny pore with a diameter of 0.5 mm as an example, its original grayscale contrast with the surrounding weld material is usually only a dozen or so grayscale levels. After enhancement by the first mode, the contrast can be increased to more than twice the original value. At the same time, since the enhancement coefficient is modulated by the probability value, no false contrast amplification is generated at non-defect locations.
[0080] The second mode performs smoothing processing. The smoothing operation is performed on the background region where the probability value is less than the second threshold. The smoothing method is: Gaussian neighborhood weighted average centered on the pixel, with a neighborhood window side length of 7 pixels. The weight is determined by the distance between each pixel in the window and the center pixel, with the closer the distance, the greater the weight. The smoothing process suppresses quantum noise particles in the background region, making the grayscale distribution of the base material and weld body region more uniform, providing a clean background reference for dual-stream contrast learning. The two processing links are executed in parallel, outputting an intermediate image after contrast enhancement and an intermediate image after smoothing. The pixel coordinates of the two intermediate images correspond one-to-one with the original image.
[0081] Step 203: Obtain the regularized defect signal probability map. Using the probability value of each pixel in the defect signal probability map as the fusion weight, perform pixel-by-pixel weighted fusion on the intermediate image after contrast enhancement and the intermediate image after smoothing to output the defect focus enhancement map. At the same time, save the intermediate image after smoothing as the structure preservation reference map.
[0082] The operation rule for pixel-wise weighted fusion is as follows: For each pixel coordinate in the image plane, the probability value of that coordinate in the regularized defect signal probability map is read. This probability value is used as the fusion weight of the value of the intermediate image at that coordinate after contrast enhancement. The difference between 1 and the probability value is used as the fusion weight of the value of the intermediate image at that coordinate after smoothing. The values of the two intermediate images at that coordinate are multiplied by their corresponding weights and then summed. The sum is used as the value of the defect focus enhancement map at that coordinate.
[0083] The above fusion rules result in a high proportion of contrast-enhancing components being retained at suspected defect locations, a high proportion of smoothing components being retained at confirmed background locations, and a continuous transition between the two types of components at locations with probability values in the transition zone, so that there are no processing abrupt boundaries in the entire defect-focused enhancement image.
[0084] After the fusion operation traverses all pixels, a defect focus enhancement map is output. The contrast of the defect image in the defect focus enhancement map is enhanced while the background noise is suppressed. Moreover, this enhancement effect comes directly from the quantization guidance of probability prior, which is different from the traditional method of manually setting enhancement parameters.
[0085] Meanwhile, the smoothed intermediate image is completely saved as a structure-preserving reference image. The structure-preserving reference image and the defect-focusing enhancement image originate from the same original image. The two are fully registered in spatial geometry and carry background structure information and defect enhancement information respectively, forming paired training data for the dual-stream training module.
[0086] The dual-stream training module is used to construct a dual-stream feature extraction network. The defect focusing enhancement map and the structure preservation reference map are respectively input into the two branches of the network to extract feature vectors. The difference maximization loss function is constructed and the network is trained to obtain the trained dual-stream feature extraction network.
[0087] The dual-stream training module runs on a training server equipped with a graphics processor during the training phase. The training data comes from historically accumulated radiographic inspection images of pipe welds and their defect annotation records. Each training sample consists of an original radiographic inspection image of the weld and its corresponding defect mask annotation.
[0088] The defect mask markings are drawn by the inspectors based on the evaluation results, and the marking categories cover common weld defect types such as porosity, slag inclusion, incomplete penetration, lack of fusion, and cracks.
[0089] Each training sample image is processed sequentially by the imaging decomposition module and the defect enhancement module, resulting in a pair of images consisting of a defect focusing enhancement image and a structure preservation reference image. All pairs of images together form the training sample set of the two-stream feature extraction network.
[0090] The two-stream feature extraction network consists of two convolutional neural network branches with identical structures and independent parameters. The number of layers, kernel size, and channel configuration of the two branches are completely identical.
[0091] The defect-focused enhancement map is input into the first branch, and the structure-preserving reference map is input into the second branch. The two branches extract feature map groups layer by layer.
[0092] The shallow layers of the network extract low-level features such as edges and textures, while the deeper layers extract high-level semantic features. The overall training logic of the dual-stream training module is as follows: The feature differences between the two branches on paired images from the same source are used as the quantification carrier of defect separability. The difference maximization loss function drives the two branches to strengthen their respective discrimination capabilities in opposite directions. The first branch focuses on the feature representation after defect enhancement; The second branch focuses on the feature representation of the background structure; The more distinct the differences between the two, the better the separability of defects and background in the network feature space; after training, the trained dual-stream feature extraction network is used for global feature extraction of the adaptive sampling detection module.
[0093] In one embodiment, the processing procedure of the dual-stream training module includes the following steps: Step 301: Obtain the defect focusing enhancement map and the structure preservation reference map, perform grayscale distribution alignment and low-frequency component fusion on both, and output the aligned defect focusing enhancement map and the aligned structure preservation reference map.
[0094] The purpose of grayscale distribution alignment is to eliminate the global grayscale distribution difference between the two images caused by defect enhancement processing; contrast enhancement makes the overall grayscale dynamic range of the defect focus enhancement image relatively larger, and smoothing processing makes the overall grayscale distribution of the structure-preserving reference image relatively smaller; if not aligned, the two branches will learn to use the grayscale distribution difference itself as the basis for discrimination, weakening the extraction of the essential features of the defect.
[0095] The process of aligning grayscale distribution is as follows: The mean and standard deviation of the grayscale values of the two images are calculated separately. For each pixel value in the defect-focused enhancement image, the mean of its own image is subtracted, and then divided by the standard deviation of its own image to standardize the image. This is then multiplied by the standard deviation of the structure-preserving reference image and added to the mean of the structure-preserving reference image. This ensures that the mean and standard deviation of the grayscale values of the aligned defect-focused enhancement image are consistent with the structure-preserving reference image. Figure 1 To.
[0096] The two images are completely uniform in terms of overall brightness and contrast, and the differences in grayscale values only retain the differences in local content related to spatial location.
[0097] The low-frequency component fusion operation process is as follows: Low-pass filtering is performed on the two images to extract their respective low-frequency components. The low-pass filtering uses the mean of a neighborhood window with a side length of 31 pixels. The extracted low-frequency components characterize the overall brightness distribution and gradually varying structure of the image; Subsequently, the low-frequency components of the defect-focused enhancement map are replaced with the low-frequency components of the structure-preserving reference map, and then the replaced low-frequency components are recombined with the high-frequency detail components of the defect-focused enhancement map to form an aligned defect-focused enhancement map. The structure preservation reference image itself is output as the aligned structure preservation reference image.
[0098] After the above processing, the overall brightness layout of the paired images is completely consistent, the defect-focused enhancement map retains high-frequency enhancement differences only at the defect response location, and the difference learning objective of the two-stream network is precisely constrained to the defect-related content.
[0099] Step 302: Input the aligned defect focus enhancement map and the aligned structure preservation reference map into the two branches of the dual-stream feature extraction network respectively, extract the feature map group of each network layer and calculate the channel-by-channel difference, arrange them according to the network depth to form a multi-layer difference feature sequence, perform inter-layer difference accumulation analysis on the multi-layer difference feature sequence, mark the difference sensitive layer and record the difference dominant channel.
[0100] Both branches are composed of multiple network layers connected in series, with a total of 8 network layers in the general configuration.
[0101] The front layers of the network use larger convolutional kernels to extract low-level features, while the back layers use smaller convolutional kernels and more channels to extract high-level semantic features.
[0102] Each network layer outputs a feature map consisting of several channels. Under the general configuration, the number of channels in each layer from shallowest to deepest is 16, 32, 64, 128, 256, 256, 512, and 512.
[0103] After feeding the paired images into the two branches, for each network layer, the feature maps of each channel output by the first branch are paired one by one with the feature maps of the corresponding channels in the second branch, and the average difference value of the entire image for each pair of channel feature maps is calculated. The average difference value is calculated by subtracting the two feature maps pixel by pixel, taking the absolute value, and then averaging it over all pixels. This value quantifies the degree of divergence between the enhancement content of defects and the background content in the feature representation of the corresponding channel.
[0104] The channel-by-channel difference values of all network layers are arranged from shallow to deep according to network depth to form a multi-layer difference feature sequence. Each element in the sequence carries the network layer number and channel number information. The inter-layer difference accumulation analysis adds up the total difference of each layer in the multi-layer difference feature sequence layer by layer, and statistically analyzes the growth law of the total difference with network depth. At the same time, it calculates the proportion of the total difference of each layer to the total difference of all layers. The network layer whose proportion exceeds the preset sensitive layer threshold of 0.2 is marked as the difference sensitive layer. The difference sensitive layer refers to the feature extraction layer that responds most strongly to the divergence between defects and background. Under normal working conditions, the difference sensitive layers are concentrated in the middle and rear of the network.
[0105] For each difference-sensitive layer, the top few channels with the largest difference values within the layer are defined as difference-dominant channels, and the number of difference-dominant channels is one-quarter of the total number of channels in that layer. The record information of the difference-dominant channels includes a list of layer numbers and channel numbers, which serve as constraint anchors for constructing the difference-weighted loss function in the next step.
[0106] Step 303: Using the difference-sensitive layer and the difference-dominant channel as constraint anchors, construct a difference-weighted maximization loss function, assign different weight coefficients to the differences of different layers and different channels, and calculate the weighted difference of the feature vectors output by the two branches in the corresponding layers and corresponding channels according to the weight coefficients.
[0107] The design logic of the differentiated weighted maximization loss function is as follows: Network training resources should be tilted towards layers and channels that contribute significantly to defect discrimination; differences in difference-sensitive layers and differences in difference-dominant channels should have higher weights in the loss, prompting the network to further separate defect features from background features at these locations; while layers and channels that contribute little to defect discrimination should be given low weights to avoid wasting training computing power and overfitting.
[0108] The rules for configuring the weighting coefficients are as follows: The layer weight coefficient for difference-sensitive layers is 1.5, and the layer weight coefficient for non-sensitive layers is 1.0; the channel weight coefficient for difference-dominant channels is 2.0, and the channel weight coefficient for other channels is 1.0; the final weight of each channel difference is obtained by multiplying the layer weight coefficient and the channel weight coefficient.
[0109] The execution process for weighted difference calculation is as follows: For each channel of each network layer, read the feature map output by the two branches in that channel of that layer, calculate the average of the sum of squares of the pixel-by-pixel differences of the two feature maps as the original difference measure of that channel; multiply the original difference measure by the corresponding final weight to obtain the weighted difference value of that channel; sum the weighted difference values of all channels of all layers to form the main term of the differential weighted maximization loss function.
[0110] During training, the optimization direction of this loss function is to maximize the weighted difference value, that is, to drive the two branches to output as divergent feature expressions as possible on the difference-sensitive layer and the difference-dominant channel, so that the degree of separation between the defect enhancement content and the background content in the feature space continues to expand.
[0111] Step 304: Dynamically combine the differential weighted maximization loss function with the basic classification loss function. During the training process, adjust the weight ratio of the two functions in the total loss according to their relative changing trends. Iterate the training of the two-stream feature extraction network according to the total loss after dynamic combination until convergence, and output the trained two-stream feature extraction network.
[0112] The basic classification loss function is used to constrain the network's defect discrimination ability. Its operation is carried out by the classification discrimination operation at the end of the first branch of the network. The defect mask annotation of the training samples provides the supervision signal. The classification loss quantifies the network's discrimination bias between defect locations and non-defect locations.
[0113] The purpose of the dynamic combination mechanism is to balance the two training objectives of expanding feature differences and improving discrimination accuracy. The differential weighted maximization loss function drives feature separation, while the basic classification loss function drives discrimination accuracy. The convergence speed of the two differs at different stages of training. Fixed weight combination will cause one objective to be suppressed by the other.
[0114] The adjustment rules for dynamic combinations are as follows: After each training iteration, the rate of change of the two loss functions relative to the previous iteration is calculated. When the absolute value of the rate of change of the differential weighted maximization loss function is lower than the absolute value of the rate of change of the basic classification loss function, it is determined that the differential expansion process is slowing down, and the weight ratio of the differential weighted maximization loss function in the total loss is increased by a preset step size of 0.05; otherwise, the weight ratio of the basic classification loss function is increased by the same step size. The sum of the two weight ratios is constant at 1, and the adjustment range of the weight ratio is limited to the range of 0.3 to 0.7 to avoid either one being completely suppressed.
[0115] The total loss is calculated by multiplying the values of the two loss functions by their respective weights and then summing them. The training uses a gradient descent optimization algorithm to update parameters, with a batch size of 16. Each training round iterates through all training samples, and the number of training rounds is 100 under normal conditions. The convergence criterion is that the discrimination accuracy on the verification sample set no longer improves for 5 consecutive rounds and the total loss value tends to stabilize. After training is terminated, all network parameters of the two branches are fixed to obtain the trained dual-stream feature extraction network. The trained dual-stream feature extraction network, together with the recording information of the difference-sensitive layer and the difference-dominant channel, is delivered to the adaptive sampling detection module for use.
[0116] The adaptive sampling and detection module is used to input the original weld radiographic inspection image into a trained dual-stream feature extraction network to extract a global feature map. Based on the global feature map, candidate regions are generated. The uncertainty of each candidate region is determined according to the defect signal probability map. After adjusting the sampling grid density and sampling point positions based on the uncertainty, the global feature map is sampled to extract the feature vector of each candidate region. For details, please refer to [link to relevant documentation]. Figure 5 , Figure 5 This is a schematic diagram of the processing flow of an adaptive sampling and detection module provided in an embodiment of this application.
[0117] The adaptive sampling and detection module runs on the detection workstation during the detection phase, detecting newly acquired raw weld radiographic images from the field. The images are sequentially processed by the imaging decomposition module to obtain a defect signal probability map, and simultaneously input into the first branch of a pre-trained dual-stream feature extraction network to extract a global feature map.
[0118] The processing logic of the adaptive sampling and detection module differs from that of the traditional uniform grid feature sampling method; Traditional methods extract features from the entire feature map using equally spaced grids, ignoring the differences in the confidence levels of different candidate regions. High-confidence regions and low-confidence regions receive the same computing power allocation, resulting in both wasted computing power and insufficient feature representation in uncertain regions. The adaptive sampling detection module quantifies the uncertainty of each candidate region based on probabilistic priors, tilting sampling point resources towards regions with high uncertainty. At the same time, it guides sampling points to converge towards the defect response location using probability map gradients, achieving synergistic optimization of detection accuracy and computational efficiency.
[0119] The overall processing flow of the module is divided into four consecutive stages: The first section is the scaling registration process between the probability map and the feature map; The second section is the candidate region generation and uncertainty measurement step; The third stage is the sampling density planning stage; The fourth section is the gradient-guided sampling and feature aggregation stage; Finally, the aggregated feature vectors of each candidate region are output as the data basis for defect determination.
[0120] In one embodiment, the processing procedure of the adaptive sampling detection module includes the following steps: Step 401: Input the original weld radiographic inspection image into the trained dual-stream feature extraction network to extract the global feature map, record the total downsampling factor, and perform the defect signal probability map according to the total downsampling factor; After the original weld radiographic inspection image is input into the first branch of the trained dual-stream feature extraction network, the network performs convolution and downsampling operations layer by layer. Under the general configuration, the downsampling factor of each layer of the network is accumulated sequentially: shallow layers are downsampled by 2 times, middle layers by 8 times, and deep layers by 16 times. The spatial size of the global feature map output by the end of the network is one-sixteenth of the original image. Each spatial position on the feature map corresponds to an image block with a side length of 16 pixels on the original image. The feature map has 512 channels, and the value of each channel represents the response intensity of the corresponding image block in a specific semantic dimension.
[0121] The total downsampling factor is a fixed, known value after the network structure is determined, and the system records this value while extracting the global feature map; the equal-scale compression is performed as follows: The probability map of the defect signal is divided into non-overlapping image blocks according to the total downsampling factor, and each image block corresponds to a spatial location in the feature map. For each image block, the maximum value among all probability values in the block is taken as the probability value of the corresponding position after compression. The reason for taking the maximum value instead of the average value is that a small defect may only occupy a few pixels in the original image. Taking the average value will dilute the weak defect probability response, while taking the maximum value will completely preserve the strongest defect response evidence in the block.
[0122] After compression, the spatial dimensions of the compressed defect signal probability map and the global feature map are consistent and their coordinates correspond one-to-one. The index relationship records the conversion rules between the original image coordinates, the compressed probability map coordinates and the feature map coordinates. The coordinate range of any candidate region on the feature map can be directly located to the corresponding probability distribution area on the compressed probability map through the index relationship.
[0123] Step 402: Generate candidate regions on the global feature map, locate the probability distribution corresponding to each candidate region on the compressed defect signal probability map using the index relationship, calculate the statistical characteristic value of the probability distribution, and determine the confidence score and uncertainty measure of each candidate region based on the statistical characteristic value.
[0124] The candidate regions are generated as follows: Scanning is performed on the global feature map using a sliding window with a fixed side length, which is one-tenth the size of the feature map. The scanning step size is half the side length of the window. For each window position, the feature values of all channels within the window are aggregated in the spatial dimension to obtain the aggregated response intensity at that position. The aggregation method is to take the maximum value of all channel values at each position within the window. A candidate region is generated for window positions where the aggregated response intensity exceeds a preset response threshold. The response threshold is determined statistically based on the validation sample set and is set to the 90th quantile of the distribution of aggregated response intensities of all windows. This value ensures the defect recall rate while controlling the number of candidate regions within a reasonable range. Under normal operating conditions, the number of candidate regions generated for a single image is approximately several dozen.
[0125] After the candidate region is generated, the coordinate range of the candidate region on the feature map is mapped to the compressed defect signal probability map using the index relationship. All probability values of the corresponding region are extracted to form the probability distribution of the candidate region. The statistical feature values of the probability distribution include two types: distribution mean and distribution entropy.
[0126] The distribution mean is the arithmetic mean of all probability values within the region, representing the overall intensity level of the defect response in that region; the distribution entropy is calculated as follows: The range of probability values within the region, from 0 to 1, is divided into 10 equally wide sub-intervals. The number of values in each sub-interval is counted, and the proportion of each sub-interval to the total number of values in the region is calculated. Then, each proportion value is multiplied by the logarithm of that proportion, the negative value is taken, and the sum is applied to all sub-intervals. The value of distribution entropy increases with the degree of dispersion of the distribution. The more concentrated the distribution values are in a single sub-interval, the lower the entropy value. The more dispersed the values are across multiple sub-intervals, the higher the entropy value.
[0127] The confidence score is determined by a monotonic mapping of the distribution mean; the higher the distribution mean, the higher the confidence score of the candidate region. The uncertainty measure is determined by a monotonic mapping of the distribution entropy; the higher the distribution entropy, the higher the uncertainty measure of the candidate region. Regions with high uncertainty correspond to positions with ambiguous probability responses, which are the most error-prone locations for defect judgment and also the locations where sampling resources should be tilted the most.
[0128] Step 403: Obtain the confidence score and uncertainty metric of each candidate region, determine the total number of sampling points for each candidate region based on the uncertainty metric, and generate a spatial density distribution map of the sampling grid for each candidate region by using the confidence score as a guide for the spatial distribution of sampling points.
[0129] The rule for determining the total number of sampling points is as follows: The system presets a total sampling budget for a single image, which is 2000 sampling points under normal operating conditions. After summing the uncertainty measures of all candidate regions, each candidate region is allocated a sampling budget according to the proportion of its own uncertainty measure to the total, thus obtaining the total number of sampling points for that candidate region. Regions with high uncertainty receive more sampling points, while regions with low uncertainty retain only a small number of sampling points. Regions with clear probability responses can obtain reliable feature representations without dense sampling.
[0130] The guiding logic for the spatial distribution of sampling points is as follows: The confidence score characterizes the credibility of the defect response at each location within the region. Sampling points should cluster towards locations with high confidence while also taking into account the integrity of the region's coverage. The sampling grid spatial density distribution map is generated as follows: For each candidate region, a density field is constructed with the region center as the origin, based on the probability values of each location on the compressed probability map within the region. The density baseline value at each location in the density field is proportional to the probability value at that location. Based on this, the density baseline level is increased for high-confidence candidate regions and appropriately decreased for low-confidence candidate regions. Then, the total number of sampling points is allocated to various spatial locations within the region according to the numerical distribution ratio of the density field, with more sampling points allocated to locations with high density and fewer sampling points allocated to locations with low density. The total number of sampling points at all locations is consistent with the total number of sampling points, and the resulting spatial distribution record is the sampling grid spatial density distribution map of the candidate region. The distribution map determines the initial grid position of each sampling point and the sampling weight corresponding to that position, and the sampling weight is proportional to the density baseline value at that position.
[0131] Step 404: Obtain the initial position of each sampling point in the sampling grid spatial density distribution map, perform offset on the initial position using the gradient information of the compressed defect signal probability map, extract the feature value at each sampling point position on the global feature map according to the offset sampling point position and the weight determined by the sampling grid spatial density distribution map, and perform aggregation to output the aggregated feature vector of each candidate region.
[0132] The initial position of the sampling point is determined by the spatial density distribution map of the sampling grid, and the initial position is located on the regular grid node. The regular grid node may not fall exactly at the position where the defect response is strongest. The purpose of gradient offset is to fine-tune the sampling point in the direction of enhancing the probability response.
[0133] The gradient information is calculated as follows: For each position in the compressed defect signal probability map, the probability values are calculated along the horizontal and vertical axes. The horizontal difference is the probability value of the position to the right minus the probability value of the current position, and the vertical difference is the probability value of the position to the bottom minus the probability value of the current position. The horizontal and vertical differences together constitute the gradient direction information of the current position, and the gradient direction points to the direction of the fastest increase in probability.
[0134] The rules for offset execution are as follows: For each sampling point, the gradient direction of the probability map at its initial position is read, and the sampling point position is moved along the gradient direction by a fixed step size. Under normal working conditions, the step size is one feature map grid cell. If the offset position exceeds the candidate region boundary, it is kept inside the boundary. After performing the offset on all sampling points one by one, the set of offset sampling point positions is obtained. The offset operation makes the sampling points as a whole converge towards the peak region of the defect probability response, improving the targeting of feature extraction.
[0135] The feature extraction and aggregation are performed as follows: For each offset sampling point, the feature values of all 512 channels at that location are read from the global feature map. The set of values is multiplied by the sampling weight corresponding to the sampling point in the sampling grid spatial density distribution map. Then, for all sampling points in the candidate region, the weighted feature values are accumulated channel by channel. After the accumulation is completed, the values of each channel are normalized by dividing by the sum of the weights of all sampling points in the region to obtain a fixed-dimensional aggregated feature vector. The aggregated feature vector has the same dimensionality as the feature map channel number, which is 512. The value of each dimension in the vector integrates the weighted feature responses of multiple sampling locations within the region, which not only highlights the feature contribution of the peak position of the defect response, but also preserves the overall feature context of the region.
[0136] After feature extraction and aggregation of all candidate regions, the system outputs the aggregated feature vector for each candidate region. The aggregated feature vector carries the location and size information of the candidate region, serving as the direct data basis for determining pipeline weld defects, and is used in subsequent defect type judgment and grade assessment stages.
[0137] In this embodiment of the application, a computer device is also provided, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the functions of the AI recognition system for radiographic inspection of pipe welds in the above embodiments. The computer device can be a testing workstation or a training server, and the processor can be a GPU or a CPU.
[0138] In this embodiment of the application, a computer-readable storage medium is also provided, on which a computer program is stored. When the computer program is executed by a processor, it implements the functions of the AI recognition system for radiographic inspection of pipe welds in the above embodiments. The computer-readable storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, mobile hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0139] It should be understood that the term "embodiment" used throughout this specification means that a specific feature, structure, or characteristic related to an embodiment is included in at least one embodiment of this application. Therefore, various embodiments throughout this specification do not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments.
[0140] It should also be understood that in this application, "when," "if," "in the circumstances," and "if" all refer to a situation where a corresponding action will be taken under certain objective circumstances, and are not time-limited. They do not require the device to perform a judgment action, nor do they imply any other limitations. Furthermore, in this application, the descriptions of conditions such as "when," "if," "in the circumstances," and "if" can be understood as necessary conditions, without limiting whether the condition is a sufficient condition or a necessary and sufficient condition. For example, "in the case of A, execute B" can be understood as "if at least A is satisfied, execute B."
[0141] It should also be understood that the descriptions such as "first" and "second" used in the embodiments of this application are only used to distinguish different objects and do not constitute a limitation on the quantity or order. The values of parameters such as "first threshold" and "second threshold" described in this application are only exemplary illustrations, and those skilled in the art can adjust them according to actual working conditions. This application does not limit them in this regard.
[0142] It should also be understood that the specific parameter values mentioned in the embodiments of this application, such as detector pixel size of 0.139 mm, sliding window side length of 5 pixels, first threshold of 0.6, second threshold of 0.4, number of network layers of 8, number of channels in each layer of 16 to 512, convergence threshold of 0.001, maximum number of iterations of 200, batch size of 16, number of training rounds of 100, and total sampling budget of 2000 sampling points, are all exemplary values under general operating conditions. Those skilled in the art can adjust the above parameters according to actual factors such as the specifications of the inspected pipeline, the radiographic process conditions, and the quota of computational resources, and this application does not limit this.
[0143] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. An AI recognition system for radiographic inspection of pipe welds, characterized in that, include: The imaging decomposition module is used to acquire the original weld radiographic inspection image, construct a signal decomposition model based on the physical imaging model, input the original weld radiographic inspection image into the neural network, and decompose the original weld radiographic inspection image into a defect signal probability map and a structural background map under constraints. The defect enhancement module is used to perform spatial asymmetric enhancement on the original weld radiographic inspection image based on the defect signal probability map. Enhancement is performed in the region where the probability value in the defect signal probability map is greater than the first threshold, and smoothing is performed in the region where the probability value is less than the second threshold. The enhancement result and the smoothing result are fused based on the defect signal probability map to generate a defect focusing enhancement map, and the smoothing result is saved as a structure preservation reference map. The dual-stream training module is used to construct a dual-stream feature extraction network. The defect focusing enhancement map and the structure preservation reference map are respectively input into the two branches of the dual-stream feature extraction network to extract feature vectors. The difference maximization loss function is constructed and the dual-stream feature extraction network is trained to obtain the trained dual-stream feature extraction network. The adaptive sampling detection module is used to input the original weld radiographic inspection image into a trained dual-stream feature extraction network to extract a global feature map, generate candidate regions based on the global feature map, determine the uncertainty of each candidate region according to the defect signal probability map, and then sample the global feature map after adjusting the sampling grid density and sampling point position according to the uncertainty, and extract the feature vector of each candidate region.
2. The AI recognition system for radiographic inspection of pipe welds according to claim 1, characterized in that, The imaging decomposition module is specifically used for: Acquire the original radiographic images of the weld and their associated imaging physical parameters; The pixel grayscale values of the original weld radiographic inspection image are converted into the physical quantity value of the material equivalent thickness, forming a physical quantity normalized image; Sampling statistics are performed on the normalized image of physical quantities; The noise distribution parameters of the normalized image of physical quantities are estimated based on the noise distribution characteristics, and the noise distribution parameters are used as the configuration input of the mixed signal decomposition model.
3. The AI recognition system for radiographic inspection of pipe welds according to claim 2, characterized in that, The imaging decomposition module is also specifically used for: The normalized image of the physical quantity is input into the mixed signal decomposition model, and the noise distribution parameter is used as the constraint boundary condition to perform iterative decomposition. In each iteration, the defect signal component and the background component are updated alternately and different types of constraints are applied respectively until the iteration converges and terminates, outputting a defect signal probability map and a structure background map.
4. A pipeline weld radiographic inspection AI recognition system according to any one of claims 1 to 3, characterized in that, The defect enhancement module is specifically used for: Obtain the probability map of defect signals; Local statistical feature analysis is performed on the defect signal probability map. Based on the analysis results, the defect signal probability map is divided into continuous regions and isolated point regions. The probability value is re-estimated for the isolated point regions to form a regularized defect signal probability map. Using the probability value of each pixel in the regularized defect signal probability map as a modulation factor, dual-mode parallel enhancement processing is performed on the original weld radiographic inspection image; The first mode performs contrast enhancement on regions with a probability value greater than a first threshold, while the second mode performs smoothing on regions with a probability value less than a second threshold, outputting an intermediate image with contrast enhancement and an intermediate image with smoothing.
5. The AI recognition system for radiographic inspection of pipe welds according to claim 4, characterized in that, The defect enhancement module is also specifically used for: Using the probability value of each pixel in the regularized defect signal probability map as the fusion weight, pixel-wise weighted fusion is performed on the intermediate image after contrast enhancement and the intermediate image after smoothing to output a defect focus enhancement map; Simultaneously, the smoothed intermediate image is saved as a structure-preserving reference image.
6. The AI recognition system for radiographic inspection of pipe welds according to claim 5, characterized in that, The dual-stream training module is specifically used for: Obtain defect-focused enhancement maps and structure-preserving reference maps; Perform grayscale distribution alignment and low-frequency component fusion on the defect focus enhancement map and the structure preservation reference map, and output the aligned defect focus enhancement map and the aligned structure preservation reference map; The aligned defect-focused enhancement map and the aligned structure-preserving reference map are respectively input into the two branches of the dual-stream feature extraction network. Feature maps of each network layer are extracted and channel-by-channel differences are calculated. The feature maps are arranged according to network depth to form a multi-layer difference feature sequence. Inter-layer difference accumulation analysis is performed on the multi-layer difference feature sequence, the difference-sensitive layers are marked and the difference-dominant channels are recorded.
7. The AI recognition system for radiographic inspection of pipe welds according to claim 6, characterized in that, The dual-stream training module is also specifically used for: Using the difference-sensitive layer and the difference-dominant channel as constraint anchors, a difference-weighted maximization loss function is constructed. Among them, the differential weighted maximum loss function assigns different weight coefficients to the differences between different network layers and different channels, and calculates the weighted difference of the feature vectors output by the two branches in the corresponding channels of the corresponding network layers based on the weight coefficients; Dynamically combine the differential weighted maximization loss function with the basic classification loss function; During training, the weight ratio of the two loss functions in the total loss is adjusted according to the relative changing trend of the differential weighted maximization loss function and the basic classification loss function. The two-stream feature extraction network is iteratively trained according to the total loss after dynamic combination until convergence. Output the trained two-stream feature extraction network.
8. A pipeline weld radiographic inspection AI recognition system according to any one of claims 5 to 7, characterized in that, The adaptive sampling and detection module is specifically used for: The original weld radiographic inspection image is input into a trained dual-stream feature extraction network to extract the global feature map. The total downsampling factor of the trained dual-stream feature extraction network is recorded. The defect signal probability map is compressed at the same scale according to the total downsampling factor, and an index relationship is established between the compressed defect signal probability map and the global feature map. Candidate regions are generated on the global feature map. The probability distribution corresponding to each candidate region is located on the compressed defect signal probability map using the index relationship. The statistical characteristic value of the probability distribution is calculated. The confidence score and uncertainty measure of each candidate region are determined based on the statistical characteristic value.
9. The AI recognition system for radiographic inspection of pipe welds according to claim 8, characterized in that, The adaptive sampling and detection module is also specifically used for: The confidence score and uncertainty metric of each candidate region are obtained. The total number of sampling points for each candidate region is determined based on the uncertainty metric. The confidence score is used as a guide for the spatial distribution of sampling points to generate a spatial density distribution map of the sampling grid for each candidate region.
10. The AI recognition system for radiographic inspection of pipe welds according to claim 9, characterized in that, The adaptive sampling and detection module is also specifically used for: The initial positions of each sampling point in the sampling grid spatial density distribution map are obtained, and the initial positions are offset using the gradient information of the compressed defect signal probability map to obtain the offset sampling point positions. Based on the weights determined by the offset sampling point positions and the spatial density distribution map of the sampling grid, feature values at each sampling point position are extracted from the global feature map and aggregated to output the aggregated feature vector of each candidate region.