Crack detection method and system based on x-ray phase-contrast imaging and adversarial learning
By integrating X-ray phase contrast imaging with adversarial learning, the problems of low accuracy and low automation in microcrack detection have been solved, achieving high-precision and highly automated microcrack detection, which is applicable to fields such as high-precision components, aerospace materials, and nuclear power equipment.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 广东德智矩阵科技有限公司
- Filing Date
- 2026-03-09
- Publication Date
- 2026-07-21
AI Technical Summary
Existing technologies for detecting microcracks suffer from low detection accuracy, low automation, and severe noise and artifact interference. In particular, traditional X-ray absorption imaging for microcracks in low atomic number materials cannot provide sufficient contrast, and deep learning models are unable to effectively extract microcrack features.
This method integrates X-ray phase contrast imaging technology with adversarial learning. It acquires sample features by selecting a phase contrast imaging method, extracts phase images using a phase retrieval algorithm, performs phase retrieval using an improved transfer function or Fourier integral method, and combines conditional generative adversarial networks to selectively enhance microcrack features. Finally, it detects microcracks through multi-scale feature extraction and quantitative characterization.
It achieves high-precision and highly automated micro-crack detection, effectively suppresses noise and artifacts, improves the visual performance and detection accuracy of micro-cracks, and meets the needs of modern industry for high-reliability non-destructive testing.
Smart Images

Figure CN122434818A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of defect detection and image processing technology, and in particular to a crack detection method and system based on X-ray phase contrast imaging and adversarial learning. Background Technology
[0002] Microcracks are a common type of critical defect in industrial products, especially in high-precision components, aerospace materials, nuclear power equipment, and electronic packaging. The presence of microcracks can lead to serious safety hazards and functional failures. Traditional methods for detecting microcracks mainly include ultrasonic testing, eddy current testing, and liquid penetrant testing, but these methods have significant limitations in terms of detection accuracy, non-destructive testing, and automation. As industrial manufacturing develops towards higher precision and higher reliability, higher demands are placed on the detection of microcracks, necessitating the development of more advanced detection technologies.
[0003] X-ray imaging technology, due to its non-destructive and high-penetration characteristics, is widely used in industrial defect detection. Traditional X-ray absorption imaging mainly relies on the difference in X-ray absorption by materials to form contrast. However, for microcracks, especially microcracks in materials with low atomic numbers, the X-ray absorption difference is extremely small, making it difficult for traditional absorption imaging to provide sufficient contrast, resulting in low detection sensitivity. In recent years, the development of X-ray phase contrast imaging technology has provided new possibilities for the detection of microcracks. Phase contrast imaging utilizes the phase change produced when X-rays pass through an object, rather than absorption differences, to form image contrast. It has higher sensitivity for minute structural changes, theoretically increasing detection sensitivity by more than 1000 times.
[0004] X-ray phase contrast imaging techniques mainly include propagation-based phase contrast imaging. Methods include phase-contrast imaging (PBI), diffraction-enhanced imaging (DEI), grating interferometry (GI), and edge illumination (EI). Among these, propagation phase-contrast imaging has attracted attention due to its simple experimental setup and lack of the need for additional optical components; grating interferometry has unique advantages because it can simultaneously acquire absorption, phase, and scattering information. However, these techniques still face many challenges in practical industrial applications: First, phase-contrast imaging has strict experimental requirements, requiring a highly coherent X-ray source, while conventional X-ray sources are usually available in industrial settings; second, the algorithms for extracting phase information are complex and computationally intensive, making it difficult to meet real-time detection needs; third, noise, artifacts, and other interference factors during the imaging process can significantly reduce the detection accuracy of microcracks; finally, the characteristics of microcracks in phase-contrast images are often not obvious, requiring interpretation by professionals, resulting in low automation.
[0005] In recent years, deep learning technology has made significant progress in image processing and defect detection. Models such as Convolutional Neural Networks (CNNs) and U-Net have demonstrated powerful performance in tasks such as medical image segmentation and industrial defect detection. However, directly applying deep learning to detect minute cracks in X-ray phase-contrast images still faces two key challenges: first, labeled data is scarce, and acquiring a large number of phase-contrast images with precise crack annotations is costly; second, minute cracks are not obvious in the image and are difficult to distinguish from background noise, making it difficult for conventional deep learning models to effectively extract these weak features.
[0006] Adversarial learning, as a cutting-edge branch of deep learning, has achieved functions such as image enhancement and domain adaptation through models like Generative Adversarial Networks (GANs), providing new ideas for solving the aforementioned challenges. Especially in fields such as medical image enhancement and low-dose CT reconstruction, adversarial learning has shown significant results. However, there is currently a lack of systematic methods specifically designed for the detection of microcracks that organically combine X-ray phase-contrast imaging with adversarial learning.
[0007] Therefore, the present invention aims to provide a microcrack detection method that integrates X-ray phase contrast imaging technology with adversarial learning, and has the advantages of high precision and high automation, so as to meet the urgent needs of modern industry for high-reliability non-destructive testing. Summary of the Invention
[0008] To overcome the problems existing in related technologies, the purpose of this invention is to provide a crack detection method and system based on X-ray phase contrast imaging and adversarial learning. The method integrates X-ray phase contrast imaging technology with adversarial learning, which has the advantages of high precision and high automation. It can detect tiny cracks in products, thereby meeting the urgent needs of modern industry for highly reliable non-destructive testing.
[0009] X-ray phase contrast imaging and adversarial learning-based crack detection methods include: Acquire sample characteristics and select a phase contrast imaging mode based on the sample characteristics; The original phase image is acquired using a phase contrast imaging method, and a phase retrieval algorithm is used to extract the phase image from the original phase image; the original phase image includes a sample intensity image and a phase differential image. The phase image is preprocessed to obtain a preprocessed phase image; A trained conditional generative adversarial network is used to selectively enhance the microcrack features in the preprocessed phase image to obtain an enhanced image; Multi-scale feature extraction is performed on the enhanced image to obtain multi-scale crack features; The multi-scale crack characteristics are quantitatively characterized to obtain crack parameters.
[0010] In a preferred embodiment of the present invention, the step of extracting the phase image from the original phase image using a phase retrieval algorithm includes: If the phase contrast imaging method is propagation phase contrast imaging, then an improved transfer function method is used for phase retrieval: ; ; in, The phase image represents the phase distribution, where x represents the abscissa and y represents the ordinate; I represents the sample intensity image, I0 represents the reference intensity image, z represents the propagation distance, and λ represents the wavelength. F represents the Laplace operator; F represents the Fourier transform, F -1 This represents the inverse Fourier transform, where i represents the imaginary unit, u represents the frequency coordinate in the x-direction, and v represents the frequency coordinate in the y-direction. This represents the regularization parameter.
[0011] In a preferred embodiment of the present invention, the step of extracting the phase image from the original phase image using a phase retrieval algorithm includes: If the phase contrast imaging method is grating interferometry imaging, then the phase image is calculated using the Fourier integral method: ; in, This represents the phase image, where x represents the sample's horizontal coordinate and y represents the sample's vertical coordinate; F represents the Fourier transform. -1 denoted as inverse Fourier transform, u represents the frequency coordinate in the x-direction, and i represents the imaginary unit; DP represents the differential phase image, and C(y) represents the integral constant that is only related to y. C(y) is estimated using zero-mean constraints or boundary conditions.
[0012] In a preferred embodiment of the present invention, before employing a trained conditional generative adversarial network to selectively enhance the microcrack features in the preprocessed phase image, the method further includes: Construct a generator network; Construct a discriminator network; The generator network and the discriminator network are combined to form a conditional generative adversarial network; Design a physical consistency loss function, and then perform a weighted summation of the physical consistency loss function, adversarial loss function, reconstruction loss function, and structural similarity loss function to obtain the total loss function; Based on the total loss function, a few-shot learning strategy is used to train the conditional generative adversarial network, resulting in a trained conditional generative adversarial network.
[0013] In a preferred embodiment of the present invention, the construction of the generator network includes: U-Net is used as the architecture for the generator network; Design an encoder, decoder, and skip connections for a generator network; the encoder includes multiple downsampling blocks, each of which includes a convolutional layer, a batch normalization layer, and a Leaky ReLU activation function; the decoder includes multiple upsampling blocks, each of which includes a transposed convolutional layer, a batch normalization layer, and a ReLU activation function; The generator network is obtained by introducing an attention gating mechanism into the skip connections using the following formula: ; ; Among them, A i This represents the attention weight of the i-th attention. This represents the feature map of the i-th layer of the encoder. This represents the feature map of the i-th layer of the decoder. This represents element-wise multiplication. W represents the output result of the i-th skip connection; a Let b represent the attention gain matrix. a This represents the attention bias matrix. This represents a non-linear activation function.
[0014] In a preferred embodiment of the present invention, the construction of the discriminator network includes: The input image and the target image are input into the concatenation module for channel concatenation to obtain the concatenated image. Nesting num convolutional blocks yields a convolution operation module; each convolutional block includes convolution, batch normalization, and LeakyReLU activation; The output of the cascaded module is connected to the input of the convolution operation module, and the output of the convolution operation module is connected to the input of the Sigmoid activation module to form a discriminator network.
[0015] In a preferred embodiment of the present invention, the design of the physical consistency loss function includes: The physical consistency loss function is constructed using the following formula: ; in, G( represents the physical consistency loss function) () indicates the enhanced image. Let P represent the transfer function constructed based on the enhanced image, and let P represent the Fresnel propagation operator. This indicates that Fresnel propagation is performed on the transfer function.
[0016] In a preferred embodiment of the present invention, the step of preprocessing the phase image to obtain a preprocessed phase image includes: Perform wavelet transform on the phase image to obtain the wavelet transform result; The wavelet transform result is input into a threshold function to obtain the mapped phase image; The mapped phase image is subjected to inverse wavelet transform based on a position-adaptive threshold to obtain a preprocessed phase image.
[0017] In a preferred embodiment of the present invention, the step of extracting multi-scale features from the enhanced image to obtain multi-scale crack features includes: Design a pyramid-shaped pooling module for hollow spaces; Multiple dilated convolutional branches of the dilated spatial pyramid pooling module are used to capture multi-scale contextual information; The multi-scale context information is upsampled to obtain upsampled crack information; The upsampled crack information and the low-level features are concatenated to obtain the concatenated crack information; The spliced crack information is convolved to obtain multi-scale crack features.
[0018] This invention also provides a crack detection system based on X-ray phase contrast imaging and adversarial learning, comprising: A phase contrast imaging mode selection module is used to acquire sample features and select a phase contrast imaging mode based on the sample characteristics. The phase image extraction module is used to acquire the original phase image based on phase contrast imaging and extract the phase image from the original phase image using a phase retrieval algorithm; the original phase image includes a sample intensity image and a phase differential image. A phase image preprocessing module is used to preprocess the phase image to obtain a preprocessed phase image; The feature selective enhancement module is used to selectively enhance the microcrack features in the preprocessed phase image using a trained conditional generative adversarial network to obtain the enhanced image. A multi-scale feature extraction module is used to extract multi-scale features from the enhanced image to obtain multi-scale crack features; The feature quantitative characterization module is used to quantitatively characterize the multi-scale crack features and obtain crack parameters.
[0019] The beneficial effects of this invention are as follows: This invention provides a crack detection method based on X-ray phase contrast imaging and adversarial learning, which includes acquiring sample features and selecting a phase contrast imaging method based on sample characteristics. The phase contrast imaging method includes propagating phase contrast or grating interferometry imaging. Propagating phase contrast imaging has attracted attention due to its simple experimental setup and lack of additional optical components; grating interferometry imaging has unique advantages because it can simultaneously acquire absorption, phase, and scattering information. The original phase image is acquired based on the phase contrast imaging method, and a phase retrieval algorithm is used to extract the phase image from the original phase image, improving the visual representation of microcracks. If the phase contrast imaging method is propagating phase contrast, an improved transfer function method is used for phase retrieval. If the phase contrast imaging method is grating interferometry imaging, phase retrieval is performed based on the differential phase image. The phase image is preprocessed to obtain a preprocessed phase image. Noise and artifacts during the phase retrieval process can severely affect the detection accuracy of microcracks. This invention designs a phase noise suppression method based on a physical model. This method combines the physical characteristics of X-ray imaging and a statistical noise model to achieve efficient noise suppression. A trained conditional generative adversarial network is used to selectively enhance the microcrack features in the preprocessed phase image, resulting in an enhanced image. The conditional generative adversarial network (GAN) consists of a generator network and a discriminator network. The generator network uses U-Net, and an attention gating mechanism is introduced into the skip connections of U-Net to better preserve the detailed features of microcracks. The discriminator network discriminates local regions of the image, which is beneficial for capturing local features of microcracks. Multi-scale feature extraction is performed on the enhanced image, and dilated convolution is used to capture multi-scale contextual information to obtain multi-scale crack features. The multi-scale crack features are quantitatively characterized to detect the location and morphology of microcracks, as well as their length, width, depth, and orientation. The method provided by this invention integrates X-ray phase contrast imaging technology with adversarial learning, and has the advantages of high precision and high automation. It can detect microcracks in products, meeting the urgent needs of modern industry for high-reliability non-destructive testing. Attached Figure Description
[0020] Figure 1 This is a flowchart of the crack detection method based on X-ray phase contrast imaging and adversarial learning of the present invention; Figure 2 This is a flowchart of the training conditional generative adversarial network of the present invention; Figure 3 This is the first result image of PCB crack defects detected by X-ray phase contrast imaging according to the present invention; Figure 4 This is the second result image of PCB crack defects detected by X-ray phase contrast imaging according to the present invention. Detailed Implementation
[0021] Preferred embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While preferred embodiments of the invention are shown in the drawings, it should be understood that the invention can be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to make the invention more thorough and complete, and to fully convey the scope of the invention to those skilled in the art.
[0022] Example 1 like Figure 1 As shown, this embodiment provides a crack detection method based on X-ray phase contrast imaging and adversarial learning, including: S1: Acquire sample characteristics and select a phase contrast imaging mode based on the sample characteristics; S2: Acquire the original phase image based on phase contrast imaging, and extract the phase image from the original phase image using a phase retrieval algorithm; the original phase image includes a sample intensity image and a phase differential image; S3: Preprocess the phase image to obtain a preprocessed phase image; S4: A trained conditional generative adversarial network is used to selectively enhance the microcrack features in the preprocessed phase image to obtain an enhanced image; S5: Perform multi-scale feature extraction on the enhanced image to obtain multi-scale crack features; S6: Quantitatively characterize the multi-scale crack features to obtain crack parameters.
[0023] The sample to be tested is fixed on a precision positioning platform to ensure stability during the imaging process. A suitable phase-contrast imaging method is selected based on the sample characteristics, choosing between propagation phase-contrast imaging and grating interferometry.
[0024] Propagation phase contrast imaging (PBI) has the advantage of simple operation. Its basic principle is to utilize the intensity modulation caused by phase change during the free propagation of X-rays through the sample, which creates an edge enhancement effect. The propagation phase contrast imaging system designed in this invention mainly includes three core components: a microfocus X-ray source, a sample rotation platform, and a high-resolution flat panel detector.
[0025] The focal size of a microfocus X-ray source has a decisive influence on the phase contrast effect. This invention uses a microfocus source with a focal size of less than 5 μm to provide sufficient spatial coherence. The operating parameters of the X-ray source are set as follows: (1) Where R1 represents the distance from the X-ray source to the sample, and R2 represents the distance from the sample to the detector. M represents the wavelength of the X-rays, and M represents the magnification factor. The dot (.) represents the pixel size of the detector, and the dot (.) represents a multiplication operation.
[0026] To achieve good phase contrast under conventional X-ray source conditions in industrial settings, this embodiment optimizes the geometric parameter setting strategy: (2) in, It represents the size of the smallest resolvable feature in the sample.
[0027] The edge enhancement effect in propagation phase contrast imaging can be described by the transfer function T(x,y): (3) Where T(x,y) represents the transfer function, exp represents the exponential function, i represents the imaginary unit, i corresponds to the vertical rotation in the complex plane, and i is used to convert the phase difference into a mathematical geometric operation. This indicates the phase change of X-rays after they pass through the sample. After propagating through free space, the X-ray intensity distribution received by the detector is as follows: (4) (5) Where I(x,y) represents the X-ray intensity distribution, and P represents the Fresnel propagation operator; F -1 Let f denote the inverse Fourier transform, F denote the Fourier transform, exp denote the exponential function, and i denote the imaginary unit. denoted by λ, z represents the wavelength of the X-rays, λ represents the propagation distance of the X-rays, u represents the abscissa of the frequency domain, and v represents the ordinate of the frequency domain.
[0028] For the detection of certain complex materials or higher precision requirements, this invention also designs an X-ray grating interferometric imaging system based on the Talbot-Lau effect. This system consists of a source grating G0, a phase grating G1, and an analysis grating G2, and can simultaneously acquire three complementary information types: absorption, phase, and scattering.
[0029] The key parameter settings for the grating interferometric imaging system are as follows: (6) Where, d TThe Talbot distance is a key parameter in optics describing the self-imaging phenomenon formed by diffraction of periodic structures such as gratings. It is defined as the propagation distance of a plane wave after passing through the grating and first reproducing the original structure. p1 represents the period of the phase grating G1. A phase grating is an optical element that achieves diffraction modulation by periodically modulating the phase of a light wave. Its core characteristic is that the amplitude of transmitted or reflected light remains constant, but the phase of the light changes periodically. The period of a phase grating is defined as the spacing between two adjacent identical structural units, such as scribe lines or phase modulation units, and is usually equivalent to the grating constant. The distance between the phase grating G1 and the analysis grating G2 satisfies: (7) Where, d 12 This represents the distance between the phase grating G1 and the analysis grating G2, where n represents the distance adjustment factor and is a non-negative integer.
[0030] To improve the system's stability and vibration resistance, this invention employs a phase-stepping method to obtain the interference pattern: (8) Where, x g p2 represents the displacement of the analysis grating G2, and p2 represents the period of the analysis grating G2. a represents the harmonic average amplitude of a point with x-axis and y-axis. n This represents the amplitude of the nth harmonic at a point with x as the horizontal coordinate and y as the vertical coordinate. This represents the phase of the nth harmonic at a point with x-coordinate and y-coordinate. This represents the interference pattern of points with x-coordinate and y-coordinate.
[0031] Fourier analysis can be used to extract the absorption image A(x,y), the differential phase image DP(x,y), and the scattering image V(x,y) from the phase-stepped data: (9) (10) (11) In formulas (9)-(11), x represents the horizontal axis coordinate of the image, y represents the vertical axis coordinate of the image, and a1 This represents the amplitude of the first harmonic at a point with x as the horizontal coordinate and y as the vertical coordinate.
[0032] To adapt to the detection needs of different materials and types of microcracks, this invention designs an adaptive optimization strategy for imaging parameters. Microcracks in this invention refer to cracks with a width of less than 10 micrometers. This strategy automatically selects the optimal imaging parameters based on the sample's material properties, expected crack characteristics, and system hardware conditions. (12) in, Represents the optimal parameter set. Indicates the feasible region of the parameter. Let P represent the image obtained under parameter P, and Q represent the image quality evaluation function.
[0033] Image quality evaluation functions comprehensively consider contrast, signal-to-noise ratio, and edge sharpness: (13) in, Image I P Contrast Image I P signal-to-noise ratio, Image I P Edge sharpness; Indicates the first evaluation weight. This indicates the second evaluation weight. This indicates the third evaluation weight.
[0034] The step of extracting the phase image from the original phase image using a phase retrieval algorithm includes: If the phase contrast imaging method is propagation phase contrast imaging, then an improved transfer function method is used for phase retrieval: (14) (15) in, The image represents the phase distribution, where x represents the sample's abscissa and y represents the sample's ordinate; I represents the sample intensity image, I0 represents the reference intensity image, and I0 is used to characterize the intensity distribution without a sample; z represents the propagation distance; and λ represents the wavelength. F represents the Laplace operator; F represents the Fourier transform, F -1 This represents the inverse Fourier transform, where i represents the imaginary unit, u represents the frequency coordinate in the x-direction, and v represents the frequency coordinate in the y-direction. The x- and y-directions are perpendicular to each other. This represents the regularization parameter.
[0035] Extracting phase information from X-ray phase contrast images is a key step in realizing the detection of microcracks. This invention designs corresponding phase retrieval algorithms based on different phase contrast imaging methods.
[0036] For propagation phase contrast imaging, this invention employs an improved transfer function method, namely formulas (14)-(15), for phase retrieval. A regularization parameter is introduced. This can suppress high-frequency noise, thereby improving the accuracy and stability of phase retrieval.
[0037] The step of extracting the phase image from the original phase image using a phase retrieval algorithm includes: If the phase contrast imaging method is grating interferometry imaging, then the phase image is calculated using the Fourier integral method: (16) in, Let F represent the phase image, and F represent the Fourier transform. -1 DP represents the inverse Fourier transform, u represents the frequency coordinate in the x-direction, and i represents the imaginary unit; DP represents the differential phase image. The value of the differential phase image at the x-axis and y-axis is represented; C(y) represents the integral constant that depends only on y, estimated using zero-mean constraints or boundary conditions. The purpose of zero-mean constraints is to determine the integral constant through constraints so that the solution satisfies specific statistical properties, such as a mean of 0. Boundary conditions are used to determine the integral constant so that the solution satisfies specific physical or mathematical constraints. Boundary conditions are divided into initial condition conditions (time-dependent) and boundary condition conditions (spatial-dependent).
[0038] For grating interferometric imaging, the phase retrieval of this invention is based on the differential phase image DP. In order to solve the problem of accumulated error in the integration process, this invention adopts the Fourier integration method and adds an integration constant after recovery to eliminate indeterminate constants.
[0039] This embodiment provides a crack detection method based on X-ray phase contrast imaging and adversarial learning, which includes acquiring sample features and selecting a phase contrast imaging method based on sample characteristics. The phase contrast imaging method includes propagating phase contrast or grating interferometry imaging. Propagating phase contrast imaging has attracted attention due to its simple experimental setup and lack of additional optical components; grating interferometry imaging has unique advantages because it can simultaneously acquire absorption, phase, and scattering information. The original phase image is acquired based on the phase contrast imaging method, and a phase retrieval algorithm is used to extract the phase image from the original phase image, improving the visual representation of microcracks. If the phase contrast imaging method is propagating phase contrast, an improved transfer function method is used for phase retrieval. If the phase contrast imaging method is grating interferometry imaging, phase retrieval is performed based on the differential phase image. The phase image is preprocessed to obtain a preprocessed phase image. Noise and artifacts during the phase retrieval process can severely affect the detection accuracy of microcracks. This invention designs a phase noise suppression method based on a physical model. This method combines the physical characteristics of X-ray imaging and a statistical noise model to achieve efficient noise suppression. A trained conditional generative adversarial network is used to selectively enhance the microcrack features in the preprocessed phase image, resulting in an enhanced image. The conditional generative adversarial network (GAN) consists of a generator network and a discriminator network. The generator network uses U-Net, and an attention gating mechanism is introduced into the skip connections of U-Net to better preserve the detailed features of microcracks. The discriminator network discriminates local regions of the image, which is beneficial for capturing local features of microcracks. Multi-scale feature extraction is performed on the enhanced image, and dilated convolution is used to capture multi-scale contextual information to obtain multi-scale crack features. The multi-scale crack features are quantitatively characterized to detect the location and morphology of microcracks, as well as their length, width, depth, and orientation. The method provided by this invention integrates X-ray phase contrast imaging technology with adversarial learning, and has the advantages of high precision and high automation. It can detect microcracks in products, meeting the urgent needs of modern industry for high-reliability non-destructive testing.
[0040] Example 2 like Figure 1 As shown, this embodiment provides a crack detection method based on X-ray phase contrast imaging and adversarial learning. This embodiment describes the differences from Embodiment 1, based on Embodiment 1. The method includes: S1: Acquire sample characteristics and select a phase contrast imaging mode based on the sample characteristics; S2: Acquire the original phase image based on phase contrast imaging, and extract the phase image from the original phase image using a phase retrieval algorithm; the original phase image includes a sample intensity image and a phase differential image; S3: Preprocess the phase image to obtain a preprocessed phase image; S4: A trained conditional generative adversarial network is used to selectively enhance the microcrack features in the preprocessed phase image to obtain an enhanced image; S5: Perform multi-scale feature extraction on the enhanced image to obtain multi-scale crack features; S6: Quantitatively characterize the multi-scale crack features to obtain crack parameters.
[0041] like Figure 2 As shown, before selectively enhancing the microcrack features in the preprocessed phase image using a trained conditional generative adversarial network, the method further includes: S31': Construct the generator network; S32': Construct the discriminator network; S33': Combine the generator network and the discriminator network into a conditional generative adversarial network; S34': Design a physical consistency loss function, and perform a weighted summation of the physical consistency loss function, adversarial loss function, reconstruction loss function, and structural similarity loss function to obtain the total loss function; S35': Based on the total loss function, a few-shot learning strategy is used to train the conditional generative adversarial network to obtain the trained conditional generative adversarial network.
[0042] The adversarial learning-based microcrack enhancement module selectively enhances microcrack features based on a conditional generative adversarial network (cGAN). The cGAN consists of a generator network G and a discriminator network D, and its objective function is: (17) Where min represents the minimum value operation, max represents the maximum value operation, G represents the generator, and D represents the discriminator; This represents the phase image, and target represents the ideal enhanced image of the microcrack. This represents the enhanced image generated by the generator. This represents the discriminator's judgment result on the input phase image and the generator's output enhanced image. `log` represents the logarithmic function with base constant 2. This represents the loss function of a conditional generative adversarial network. This represents the energy term associated with the phase image and the ideal microcrack enhancement image. This represents the energy term that is only related to the phase image.
[0043] The construction of the generator network includes: U-Net is used as the architecture for the generator network; Design an encoder, decoder, and skip connections for a generator network; the encoder includes multiple downsampling blocks, each of which includes a convolutional layer, a batch normalization layer, and a Leaky ReLU activation function; the decoder includes multiple upsampling blocks, each of which includes a transposed convolutional layer, a batch normalization layer, and a ReLU activation function; The generator network is obtained by introducing an attention gating mechanism into the skip connections using the following formula: (18) (19) Among them, A i This represents the attention weight of the i-th attention. This represents the feature map of the i-th layer of the encoder. This represents the feature map of the i-th layer of the decoder. This represents element-wise multiplication. W represents the output result of the i-th skip connection; a Let b represent the attention gain matrix. a This represents the attention bias matrix. This represents a non-linear activation function.
[0044] The generator network employs an improved U-Net architecture, comprising an encoder, a decoder, and skip connections. The encoder consists of multiple downsampling blocks, each containing a convolutional layer, a batch normalization layer, and a LeakyReLU activation function.
[0045] (20) in, represents the output of the downsampling block, LeakyReLU represents the rectified linear unit with leakage, BN represents the batch normalization operation, and Conv represents the convolution operation.
[0046] The decoder consists of multiple upsampling blocks, each containing a transposed convolutional layer, a batch normalization layer, and a ReLU activation function. For the decoder, the output of the transposed convolutional layer is connected to the input of the batch normalization layer, and the output of the batch normalization layer is connected to the input of the ReLU activation function.
[0047] The encoder, or downsampling part, is responsible for extracting features from the input image. It progressively compresses the spatial dimension of the image through multiple convolutional and pooling layers to extract high-level features. The decoder, or upsampling part, is used to restore the spatial dimension of the image through deconvolution and reconstruct the segmented image. Skip connections in the decoder pass low-level features from the encoder to the decoder, helping to recover finer segmentation boundaries. To better preserve the detailed features of tiny cracks, this invention introduces an attention gating mechanism in the skip connections of U-Net, which can remove redundant features and highlight key features. The output of the generator's final output layer is provided to the Tanh activation function to normalize the generator's output range to [-1, 1].
[0048] The construction of the discriminator network includes: S321': Input the input image and the target image into the concatenation module for channel concatenation to obtain the concatenated image; S322': Nest num convolutional blocks to obtain a convolution operation module; each convolutional block includes convolution, batch normalization, and LeakyReLU activation; S323': Connect the output of the cascaded module to the input of the convolution operation module, and connect the output of the convolution operation module to the input of the Sigmoid activation module to form a discriminator network.
[0049] The discriminator network uses a PatchGAN structure, which discriminates not the entire image, but local regions (patches) of the image. This is beneficial for capturing the local features of tiny cracks. ;(twenty one) in, The input image to the discriminator is represented by the phase image, and the target image is represented by the ideal enhanced image of the microcrack. This indicates channel concatenation of the input and target images for the discriminator, where C1 represents the first convolutional block, and C... n-1 Let C represent the (n-1)th convolutional block. n This represents the nth convolutional block. This represents the Sigmoid activation function. This represents the output of the discriminator.
[0050] To improve the discriminator's sensitivity to microcracks, this invention introduces a multi-scale discrimination strategy, performing discrimination simultaneously at different resolutions: ;(twenty two) Among them, D k This represents the discriminator at the k-th scale. kThis represents the input image of the discriminator at the k-th scale. Represents the target image at the k-th scale, weight k The weights of the discriminator at the k-th scale are represented by , where K represents the total number of scales. In this invention, represents a multiplication operation. This represents the output of the multi-scale discriminator.
[0051] In industrial settings, target images Since these data are often not directly obtainable, this embodiment employs weakly supervised or self-supervised alternative signals, such as edge priors, physical consistency terms, and synthetic data, for training. Phase retrieval and imaging geometric parameters can be optimized online using the image quality evaluation function Q in the adaptive optimization of imaging parameters to adapt to different material and equipment conditions.
[0052] The design physical consistency loss function includes: The physical consistency loss function is constructed using the following formula: ;(twenty three) in, G( represents the physical consistency loss function) () indicates the enhanced image. Let P represent the transfer function constructed based on the enhanced image, and let P represent the Fresnel propagation operator. This indicates that Fresnel propagation is performed on the transfer function.
[0053] To ensure that the enhancement process conforms to the physical laws of X-ray imaging and avoids introducing false features, this invention designs a physical consistency loss function. The total loss function consists of four parts: adversarial loss function, reconstruction loss function, structural similarity loss function, and physical consistency loss function.
[0054] The adversarial loss function is defined as: ;(twenty four) in, This represents the adversarial loss function.
[0055] The reconstruction loss employs the L1 norm to ensure that the generated enhanced image approximates the target image overall. (25) in, This represents the reconstruction loss function.
[0056] Structural similarity loss is used to ensure that the ideal image with small cracks retains the structural information of the original phase image. (26) SSIM stands for Structural Similarity Index. This represents the structural similarity loss.
[0057] In this embodiment, the physical consistency loss ensures that the enhancement process conforms to the physical laws of X-ray imaging. The physical consistency loss function is calculated using formula (23). The physical consistency loss function, adversarial loss function, reconstruction loss function, and structural similarity loss function are weighted and summed to obtain the total loss function. This embodiment provides two sets of weight parameters. The first set of weight parameters has a weight of 1 for each of the physical consistency loss function, adversarial loss function, reconstruction loss function, and structural similarity loss function, meaning that the four loss functions are weighted and summed proportionally. The second set of weight parameters has a weight of 1.2 for the physical consistency loss function, a weight of 0.8 for the adversarial loss function, a weight of 0.8 for the reconstruction loss function, and a weight of 1.2 for the structural similarity loss function. The first set of weight parameters is used by default. When it is necessary to highlight the true physical features in the imaging process, conform to the physical laws, and ensure structural similarity before and after X-ray imaging, the second set of weight parameters is used. Example 3 like Figure 1 As shown, this embodiment provides a crack detection method based on X-ray phase contrast imaging and adversarial learning. This embodiment describes the differences from Embodiment 1, based on Embodiment 1. The method includes: S1: Acquire sample characteristics and select a phase contrast imaging mode based on the sample characteristics; S2: Acquire the original phase image based on phase contrast imaging, and extract the phase image from the original phase image using a phase retrieval algorithm; the original phase image includes a sample intensity image and a phase differential image; S3: Preprocess the phase image to obtain a preprocessed phase image; S4: A trained conditional generative adversarial network is used to selectively enhance the microcrack features in the preprocessed phase image to obtain an enhanced image; S5: Perform multi-scale feature extraction on the enhanced image to obtain multi-scale crack features; S6: Quantitatively characterize the multi-scale crack features to obtain crack parameters.
[0058] The preprocessing of the phase image to obtain a preprocessed phase image includes: S31: Perform wavelet transform on the phase image to obtain the wavelet transform result; S32: Input the wavelet transform result into a threshold function to obtain the mapped phase image; S33: Perform wavelet inverse transform on the mapped phase image based on the position adaptive threshold to obtain the preprocessed phase image.
[0059] Noise and artifacts in the phase retrieval process can seriously affect the detection accuracy of microcracks. This invention designs a phase noise suppression method based on a physical model. This method combines the physical characteristics of X-ray imaging and a statistical noise model to achieve efficient noise suppression.
[0060] The noise model for X-ray phase imaging is established based on the following formula: (27) in, This represents the observed X-ray intensity distribution. Represents the true X-ray intensity distribution. The noise is represented by x, which is the horizontal axis of the true X-ray intensity, and y is the vertical axis of the true X-ray intensity. Both x and y are used to characterize the position of the sample. The sample of this invention is a PCB board.
[0061] noise Including multiple components such as photon statistical noise, detector readout noise, and system noise, this invention models the noise n(x,y) as: (28) in, This represents photon statistical noise. This indicates that the detector readout noise. This indicates system noise.
[0062] Based on the above noise model, this invention designs an adaptive wavelet threshold denoising algorithm: (29) (30) Where Wav represents wavelet transform, Wav -1 This represents the inverse wavelet transform. Represents the threshold function. Represents a phase image. This represents the denoised phase image. This represents the adaptive threshold at position (x,y). sd(x,y) represents the local noise standard deviation of the region centered at point (x,y), log represents the logarithm function with the natural constant as the base, row represents the number of rows in the image, col represents the number of columns in the image, and row.col represents the total number of pixels in the image.
[0063] To further improve the visual representation of microcracks, this invention designs a multi-scale decomposition and adaptive enhancement algorithm. The algorithm first performs multi-scale decomposition on the phase image, then adaptively enhances the components at different scales, and finally reconstructs the enhanced image.
[0064] Multiscale decomposition employs non-subsampled contourlet transform (NSCT): (31) Among them, C j Let J represent the component at the j-th scale of the phase image, where J represents the number of component layers in the phase image. NSCT stands for Non-Subsampled Prototype Transform. NSCT combines a non-subsampled pyramid and a non-subsampled directional filter bank, solving the translation sensitivity problem of traditional prototype transforms while preserving multi-scale, multi-directional, and anisotropic characteristics.
[0065] Preferably, the denoised phase image in formula (29) As the input to NSCT in formula (31), i.e., using Alternative First, the phase image is denoised. Then, the denoised phase image undergoes multi-scale decomposition and adaptive enhancement. This process suppresses noise and artifacts during phase retrieval while further improving the visual representation of micro-cracks. The following formula is used to adaptively enhance the components at each scale: (32) (33) in, G represents the enhanced component at the j-th scale of the phase image. j Let j represent the j-th enhancement function. Let the first enhancement coefficient be the j-th enhancement function. T is the second enhancement coefficient of the j-th enhancement function. j This represents the enhancement threshold, and sign represents the sign function. When C... j When greater than 0, Equals 1; when C j When equal to 0, Equals 0; when C j When less than 0, It equals -1.
[0066] Finally, the enhanced phase image is reconstructed using inverse transform: (34) in, Represents the adaptively enhanced phase image, NSCT -1 This represents the inverse transform of the non-subsampled contour wave transform.
[0067] The step of extracting multi-scale features from the enhanced image to obtain multi-scale crack features includes: S51: Design of a pyramid pooling module for hollow spaces; S52: Use multiple dilated convolutional branches of the dilated spatial pyramid pooling module to capture multi-scale contextual information; S53: Upsample the multi-scale context information to obtain upsampled crack information; S54: Perform feature concatenation between the upsampled crack information and the low-level features to obtain the concatenated crack information; S55: Convolve the spliced crack information to obtain multi-scale crack features.
[0068] Based on the enhanced images obtained through adversarial learning, this invention designs a multi-scale feature extraction network to capture crack features at different scales. This network employs a feature pyramid structure, combining depthwise separable convolutions and dilated convolutions to achieve efficient feature extraction.
[0069] The characteristic pyramid structure includes top-down paths and lateral connections: (35) Among them, P l P represents the feature of the l-th layer of the feature pyramid. l+1 C represents the feature of the (l+1)th layer of the feature pyramid. l Represents the backbone network features of layer l, Conv 1×1 represents a 1×1 convolution, and Upsample represents upsampling.
[0070] Depthwise separable convolution decomposes standard convolution into two steps: depthwise convolution and pointwise convolution. Depthwise convolution extracts spatial features independently using a convolutional kernel for each input channel, without cross-channel interaction. Pointwise convolution achieves inter-channel information fusion using a 1×1 convolutional kernel, adjusting the number of output channels. Dilated convolution expands the receptive field by introducing a dilation rate—that is, inserting holes in the convolution kernel—preventing information loss caused by downsampling, making it suitable for pixel-level tasks. The dilation rate controls the spacing between different elements of the convolution kernel. For example, when the dilation rate = 2, the effective coverage of a 3×3 convolution kernel is equivalent to that of a 5×5 kernel, but the number of parameters remains 3×3. This invention employs a semantic segmentation architecture based on DeepLabV3+ for crack segmentation. This architecture combines Spatial Pyramid Pooling with Diffusion (ASPP), an encoder, and a decoder, effectively handling cracks of different scales. The ASPP module captures multi-scale contextual information through multiple dilated convolutions with varying dilation rates. (36) Among them, F i F represents the output of the i-th spatial convolution branch. pool This represents the output of the global pooling branch, Concat represents the feature concatenation operation, and F ASPPThis indicates the output of the ASPP module.
[0071] The decoder recovers the fine boundaries of the crack through progressive upsampling and feature fusion: (37) Among them, F dec The features represent the output of the decoder, Conv represents the convolution operation, Upsample represents upsampling, and F represents the features of the decoder output. low This represents low-level features.
[0072] To address the class imbalance problem in crack segmentation, this invention employs a combination of weighted cross-entropy loss and Dice loss to train the semantic segmentation architecture. (38) Among them, L seg This represents the semantic segmentation loss function. L represents the semantic segmentation adjustment coefficient. CE L represents the weighted cross-entropy loss function. Dice This represents the Dice loss function.
[0073] The weighted cross-entropy loss function in this embodiment adjusts the contribution of different types of data or samples to the loss by introducing weighting factors, and is often used to handle scenarios with imbalanced data classes or differences in sample importance. The Dice loss function is suitable for handling imbalanced data classes; it optimizes the model by calculating the similarity between the predicted region and the true region.
[0074] Example 4 S1: Acquire sample characteristics and select a phase contrast imaging mode based on the sample characteristics; S2: Acquire the original phase image based on phase contrast imaging, and extract the phase image from the original phase image using a phase retrieval algorithm; the original phase image includes a sample intensity image and a phase differential image; S3: Preprocess the phase image to obtain a preprocessed phase image; S4: A trained conditional generative adversarial network is used to selectively enhance the microcrack features in the preprocessed phase image to obtain an enhanced image; S5: Perform multi-scale feature extraction on the enhanced image to obtain multi-scale crack features; S6: Quantitatively characterize the multi-scale crack features to obtain crack parameters.
[0075] This invention can not only detect the location and morphology of cracks, but also quantitatively characterize key crack parameters, including length, width, depth, and orientation. Crack length is calculated through skeleton extraction and path integration. (39) Where C represents the crack skeleton curve, ds represents the curve element, and Length represents the crack length.
[0076] Crack width was calculated through cross-sectional analysis perpendicular to the skeleton: (40) Where Width(s) represents the crack width at location s in the skeleton, r represents the normal direction, and dr represents a infinitesimal element of r. This represents the X-ray intensity distribution along the normal direction r at the skeleton position s.
[0077] Crack depth is estimated using the relationship between phase value and material properties: (41) This represents the phase of the phase image at point (x, y). Indicates the wavelength of X-rays. This represents the reduction in refractive index, and Depth(x,y) represents the crack depth at point (x,y).
[0078] Crack direction is determined by principal component analysis (PCA) or Hough transform: (42) u 20 U represents the (2,0)th order central moment of the crack region. 02 U represents the (0,2)th order central moment of the crack region. 11 Let denote the (1,1)th order central moment of the crack region, and arctan denote the arctangent function. Indicates the direction of the crack.
[0079] Based on the quantitative parameters and location information of cracks, this invention designs a crack severity assessment model, providing a basis for material performance evaluation and failure analysis: (43) Where eva represents the crack evaluation function, H represents the crack severity, and Pos represents the location of the crack.
[0080] Combining fracture mechanics theory and empirical models, a crack evaluation function is designed. For a typical type I crack, the stress intensity factor can be expressed as: (44) Where Y represents the geometric factor, Indicates far-field stress, This represents the stress intensity factor of a Type I crack. A Type I crack, also known as a type of open crack, is one of the three basic crack types in fracture mechanics. Its core characteristic is that the crack surface undergoes an opening displacement under a normal stress in the vertical direction. It is denoted by the standard symbol "Type I". Type I cracks have the lowest fracture toughness and the highest propagation rate, and are prone to inducing low-stress brittle fracture.
[0081] Crack severity is related to the ratio of stress intensity factor to critical stress intensity factor: (45) Where H represents the severity of the crack, Stress IC Indicates the fracture toughness of a material. This represents a weighting function based on the crack location, where Pos represents the crack location.
[0082] As shown in Table 1, numerous comparative experiments conducted on standard crack samples and actual industrial components demonstrate that the method of this invention has significant advantages in detecting microcracks. Experimental results show that for microcracks with widths ranging from 1 to 10 micrometers, the method provided by this invention significantly improves detection sensitivity compared to existing methods.
[0083] Table 1. Comparison of detection sensitivity for microcracks of different widths ; Especially for extremely small cracks with a width of less than 3 micrometers, the detection rate of the method of this invention reaches 78.5%, which is 63.2% higher than that of traditional X-ray absorption imaging and 35.8% higher than that of conventional phase contrast imaging. In the detection of small cracks in complex backgrounds, the F1 score of the method of this invention reaches 0.875, which is significantly better than the comparative methods. Figure 3 This is the first result image of PCB crack defects detected by X-ray phase contrast imaging according to the present invention. Figure 4 This is the second result image of PCB crack defects detected by X-ray phase contrast imaging according to the present invention.
[0084] As shown in Table 2, the adversarial learning microcrack enhancement module significantly improved the visual representation of microcracks, verifying the effectiveness of the adversarial learning strategy. Visualization analysis shows that the adversarial learning model of this invention can effectively enhance the contrast and clarity of microcracks while maintaining the physical consistency of the image and avoiding the introduction of false features. The signal-to-noise ratio before and after enhancement increased by 3.6 times, and the edge sharpness increased by 2.8 times.
[0085] Table 2 Detection results of different enhancement strategies ; Few-shot learning is a cutting-edge paradigm that enables machine learning models to quickly adapt to new tasks relying on only a very small number of labeled samples. Few-shot learning strategies include four categories: meta-learning, metric learning, transfer learning, and data augmentation. As shown in Table 3, the few-shot learning strategy of this invention significantly reduces the dependence on labeled data, achieving high-precision detection under limited sample conditions.
[0086] Table 3 Detection results with different training sample sizes ; Experimental results demonstrate that even with only 10 labeled samples, the method of this invention can still achieve a detection accuracy of 72.6%, which is 27.3% higher than the standard training method. This result verifies the effectiveness of this invention under conditions of scarce data and provides a feasibility guarantee for industrial field applications.
[0087] As shown in Table 4, the method of the present invention not only has high detection accuracy, but also good computational efficiency and real-time performance.
[0088] Table 4 Comparison of computational efficiency of different methods ; As shown in Table 5, the method provided by this invention has good application results in actual industrial applications such as aero-engine blades, key components of nuclear power equipment, and high-end electronic packaging.
[0089] Table 5. Detection results for different industrial application scenarios ; Adaptability tests of the method of the present invention under different materials, different types of cracks, and different imaging conditions demonstrate that the method has good generalization ability and robustness.
[0090] Table 6 Test results of different types of materials ; For different test materials, the performance fluctuation of the method provided by this invention does not exceed 6%, indicating its strong adaptability to different materials. In long-term stability testing, the system ran continuously for 3 months, and the detection accuracy decayed by no more than 2%, verifying the reliability and stability of the system. This embodiment also provides a crack detection system based on X-ray phase contrast imaging and adversarial learning, including: A phase contrast imaging mode selection module is used to acquire sample features and select a phase contrast imaging mode based on the sample characteristics. The phase image extraction module is used to acquire the original phase image based on phase contrast imaging and extract the phase image from the original phase image using a phase retrieval algorithm; the original phase image includes a sample intensity image and a phase differential image. A phase image preprocessing module is used to preprocess the phase image to obtain a preprocessed phase image; The feature selective enhancement module is used to selectively enhance the microcrack features in the preprocessed phase image using a trained conditional generative adversarial network to obtain the enhanced image. A multi-scale feature extraction module is used to extract multi-scale features from the enhanced image to obtain multi-scale crack features; The feature quantitative characterization module is used to quantitatively characterize the multi-scale crack features and obtain crack parameters.
[0091] The X-ray phase contrast imaging and adversarial learning-based crack detection system of this embodiment is used to implement the X-ray phase contrast imaging and adversarial learning-based crack detection method of any one of the embodiments 1-4.
[0092] This embodiment also provides a computer device, which may be a server. The computer device includes a processor, memory, a network interface, and a database connected via a system bus. The processor in this computer design provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communication with external terminals via a network connection.
[0093] This embodiment also provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements a crack detection method based on X-ray phase contrast imaging and adversarial learning. It is understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.
[0094] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, apparatus, article, or method. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, apparatus, article, or method that includes that element.
[0095] The above description is only a preferred embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural changes made based on the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A crack detection method based on X-ray phase contrast imaging and adversarial learning, characterized in that, include: Acquire sample characteristics and select a phase contrast imaging mode based on the sample characteristics; The original phase image is acquired using a phase contrast imaging method, and a phase retrieval algorithm is used to extract the phase image from the original phase image; the original phase image includes a sample intensity image and a phase differential image. The phase image is preprocessed to obtain a preprocessed phase image; A trained conditional generative adversarial network is used to selectively enhance the microcrack features in the preprocessed phase image to obtain an enhanced image; Multi-scale feature extraction is performed on the enhanced image to obtain multi-scale crack features; The multi-scale crack characteristics are quantitatively characterized to obtain crack parameters.
2. The crack detection method based on X-ray phase contrast imaging and adversarial learning according to claim 1, characterized in that, The step of extracting the phase image from the original phase image using a phase retrieval algorithm includes: If the phase contrast imaging method is propagation phase contrast imaging, then an improved transfer function method is used for phase retrieval: ; ; in, The phase image represents the phase distribution, where x represents the abscissa and y represents the ordinate; I represents the sample intensity image, I0 represents the reference intensity image, z represents the propagation distance, and λ represents the wavelength. F represents the Laplace operator; F represents the Fourier transform, F -1 This represents the inverse Fourier transform, where i represents the imaginary unit, u represents the frequency coordinate in the x-direction, and v represents the frequency coordinate in the y-direction. This represents the regularization parameter.
3. The crack detection method based on X-ray phase contrast imaging and adversarial learning according to claim 1, characterized in that, The step of extracting the phase image from the original phase image using a phase retrieval algorithm includes: If the phase contrast imaging method is grating interferometry imaging, then the phase image is calculated using the Fourier integral method: ; in, Let x represent the phase image, y represent the horizontal coordinate of the phase image, and F represent the vertical coordinate of the phase image; F represents the Fourier transform. -1 denoted as inverse Fourier transform, u represents the frequency coordinate in the x-direction, and i represents the imaginary unit; DP represents the differential phase image, and C(y) represents the integral constant that is only related to y. C(y) is estimated using zero-mean constraints or boundary conditions.
4. The crack detection method based on X-ray phase contrast imaging and adversarial learning according to claim 1, characterized in that, Before employing a trained conditional generative adversarial network to selectively enhance the microcrack features in the preprocessed phase image, the method further includes: Construct a generator network; Construct a discriminator network; The generator network and the discriminator network are combined to form a conditional generative adversarial network; Design a physical consistency loss function, and then perform a weighted summation of the physical consistency loss function, adversarial loss function, reconstruction loss function, and structural similarity loss function to obtain the total loss function; Based on the total loss function, a few-shot learning strategy is used to train the conditional generative adversarial network, resulting in a trained conditional generative adversarial network.
5. The crack detection method based on X-ray phase contrast imaging and adversarial learning according to claim 4, characterized in that, The construction of the generator network includes: U-Net is used as the architecture for the generator network; Design an encoder, decoder, and skip connections for a generator network; the encoder includes multiple downsampling blocks, each of which includes a convolutional layer, a batch normalization layer, and a Leaky ReLU activation function; the decoder includes multiple upsampling blocks, each of which includes a transposed convolutional layer, a batch normalization layer, and a ReLU activation function; The generator network is obtained by introducing an attention gating mechanism into the skip connections using the following formula: ; ; Among them, A i This represents the attention weight of the i-th attention. This represents the feature map of the i-th layer of the encoder. This represents the feature map of the i-th layer of the decoder. This represents element-wise multiplication. W represents the output result of the i-th skip connection; a Let b represent the attention gain matrix. a This represents the attention bias matrix. This represents a non-linear activation function.
6. The crack detection method based on X-ray phase contrast imaging and adversarial learning according to claim 4, characterized in that, The construction of the discriminator network includes: The input image and the target image are input into the concatenation module for channel concatenation to obtain the concatenated image. Nesting num convolutional blocks yields a convolution operation module; each convolutional block includes convolution, batch normalization, and LeakyReLU activation; The output of the cascaded module is connected to the input of the convolution operation module, and the output of the convolution operation module is connected to the input of the Sigmoid activation module to form a discriminator network.
7. The crack detection method based on X-ray phase contrast imaging and adversarial learning according to claim 4, characterized in that, The design physical consistency loss function includes: The physical consistency loss function is constructed using the following formula: ; in, G( represents the physical consistency loss function) () indicates the enhanced image. Let P represent the transfer function constructed based on the enhanced image, and let P represent the Fresnel propagation operator. This indicates that Fresnel propagation is performed on the transfer function.
8. The crack detection method based on X-ray phase contrast imaging and adversarial learning according to claim 1, characterized in that, The preprocessing of the phase image to obtain a preprocessed phase image includes: Perform wavelet transform on the phase image to obtain the wavelet transform result; The wavelet transform result is input into a threshold function to obtain the mapped phase image; The mapped phase image is subjected to inverse wavelet transform based on a position-adaptive threshold to obtain a preprocessed phase image.
9. The crack detection method based on X-ray phase contrast imaging and adversarial learning according to claim 1, characterized in that, The step of extracting multi-scale features from the enhanced image to obtain multi-scale crack features includes: Design a pyramid-shaped pooling module for hollow spaces; Multiple dilated convolutional branches of the dilated spatial pyramid pooling module are used to capture multi-scale contextual information; The multi-scale context information is upsampled to obtain upsampled crack information; The upsampled crack information and the low-level features are concatenated to obtain the concatenated crack information; The spliced crack information is convolved to obtain multi-scale crack features.
10. A crack detection system based on X-ray phase contrast imaging and adversarial learning, characterized in that, include: A phase contrast imaging mode selection module is used to acquire sample features and select a phase contrast imaging mode based on the sample characteristics. The phase image extraction module is used to acquire the original phase image based on phase contrast imaging and extract the phase image from the original phase image using a phase retrieval algorithm; the original phase image includes a sample intensity image and a phase differential image. A phase image preprocessing module is used to preprocess the phase image to obtain a preprocessed phase image; The feature selective enhancement module is used to selectively enhance the microcrack features in the preprocessed phase image using a trained conditional generative adversarial network to obtain the enhanced image. A multi-scale feature extraction module is used to extract multi-scale features from the enhanced image to obtain multi-scale crack features; The feature quantitative characterization module is used to quantitatively characterize the multi-scale crack features and obtain crack parameters.