Artificial intelligence-based methods, devices, equipment, and media for identifying metal surface defects.
By acquiring signals and images using eddy current sensors and industrial cameras, gradient feature extraction and interference quantification are performed. Combined with a dual-branch neural network, the problem of cross-physical field interference is solved, enabling precise location and classification of defects on metal surfaces.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- JIANGSU SUPERVISION & INSPECTION INST FOR PROD QUALITY
- Filing Date
- 2025-08-08
- Publication Date
- 2026-05-26
AI Technical Summary
Existing fusion detection technologies cannot effectively separate interference across physical fields, resulting in a decrease in defect recognition rate, especially in complex working conditions where accurate positioning and classification are difficult to achieve.
By acquiring eddy current complex impedance signals and optical grayscale images based on eddy current sensors and industrial cameras, gradient feature extraction and coupling interference quantization are performed to generate interference region masks, physical field decoupling is performed, and multimodal feature fusion is carried out using a dual-branch neural network to generate defect detection results.
It achieves precise separation of interference across physical fields, eliminates signal cross-interference, preserves the true defect characteristics, and improves the accuracy and classification ability of defect identification, especially in effectively locating micro-defects under complex working conditions.
Smart Images

Figure CN120931622B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of metal surface defect detection technology, and specifically to a method, apparatus, equipment and medium for metal surface defect identification based on artificial intelligence. Background Technology
[0002] Metal surface defect identification is a crucial aspect of industrial non-destructive testing, particularly in high-precision manufacturing industries such as aerospace and rail transportation. Traditional surface defect detection primarily relies on single-physical field signal analysis. For example, eddy current testing utilizes electromagnetic induction to identify subsurface cracks in conductive materials, while machine vision uses optical imaging to capture surface scratches and pits. With the development of multimodal sensing technology, detection methods that integrate electromagnetic and optical signals are gradually becoming a new direction for improving identification accuracy. By collaboratively analyzing the characteristics of different physical fields, the limitations of single-modal perception can be overcome.
[0003] However, existing fusion detection technologies face a core bottleneck due to cross-physical field interference: the skin effect generated by electromagnetic eddy currents on metal surfaces distorts the grayscale distribution of optical imaging, while optical shadows caused by material surface deformation conversely interfere with the phase accuracy of electromagnetic signals. This physical field coupling effect leads to the mixing of defect features, making it difficult to separate the true defect signals. More importantly, current methods lack the ability to accurately locate interference regions and cannot achieve targeted decoupling in the spatial dimension, resulting in a significant decrease in defect recognition rate under complex working conditions. Furthermore, traditional feature fusion strategies ignore the physical correlation between electromagnetic and optical signals, and the simple splicing of multimodal features makes it difficult for artificial intelligence models to capture joint defect representations across physical fields, severely affecting the accuracy of locating and classifying micro-defects. Summary of the Invention
[0004] Based on this, the purpose of the present invention is to provide an artificial intelligence-based method, apparatus, device and medium for identifying metal surface defects that can accurately separate cross-physical field interference and achieve multi-modal feature collaborative optimization.
[0005] The objective of this invention is achieved through the following solution:
[0006] In a first aspect, the present invention provides a method for identifying metal surface defects based on artificial intelligence, comprising the following steps:
[0007] S1: Based on eddy current sensors and industrial cameras, acquire eddy current complex impedance signals and optical grayscale images of the metal under test, and extract gradient features from the eddy current complex impedance signals to generate electromagnetic gradient modes.
[0008] S2: Perform coupled interference quantization on electromagnetic gradient mode and optical grayscale image, calculate the cross-physical field interference intensity of shadow distortion and edge superposition, and generate interference region mask;
[0009] S3: Based on the interference region mask, perform physical field decoupling on the eddy current complex impedance signal and the optical grayscale image to generate physical field decoupling data containing the decoupled electromagnetic signal and the decoupled optical image;
[0010] S4: Perform multimodal feature fusion on the decoupled physical field data, call a dual-branch neural network to extract cross-modal correlation between electromagnetic impedance features and optical texture features, and generate a fused feature tensor;
[0011] S5: Perform defect decision-making on the fused feature tensor, analyze the defect probability heatmap distribution and locate the coordinates of abnormal areas, and generate defect detection results containing defect types and coordinate sets.
[0012] In one embodiment, S1 of the artificial intelligence-based metal surface defect identification method provided by the present invention specifically includes the following steps:
[0013] S11: Acquire eddy current complex impedance signal and optical grayscale image of the metal under test based on eddy current sensor and industrial camera;
[0014] S12: Perform real-part partial derivative calculation on the eddy current complex impedance signal, calculate the real-part gradient rate of change in the x-direction and the imaginary-part gradient rate of change in the y-direction, and generate real-part gradient components and imaginary gradient components.
[0015] S13: Perform modulus synthesis on the real and imaginary gradient components, take the Euclidean norm of the gradient vector of each pixel, and generate the electromagnetic gradient modulus. The electromagnetic gradient modulus is used to indicate the distribution characteristics of the electromagnetic field abrupt change in intensity on the metal surface.
[0016] In one embodiment, step S2 of the artificial intelligence-based metal surface defect identification method provided by the present invention specifically includes the following steps:
[0017] S21: Perform shadow simulation processing on the optical grayscale image, apply Gaussian kernel convolution to generate low-frequency shadow components, and generate an optical shadow simulation image;
[0018] S22: Perform edge detection processing on the optical grayscale image to generate an optical edge feature map, and perform spatial convolution processing in combination with the electromagnetic gradient mode to calculate the sum of the product of the gradient magnitude and the edge intensity in the 3×3 neighborhood to generate the edge superposition interference amount.
[0019] S23: Perform structural difference quantization processing on optical grayscale images and optical shadow simulation images, compare brightness, contrast and structural similarity within a multi-scale window, and generate shadow distortion variables;
[0020] S24: Perform weighted fusion processing on edge superposition interference and shadow distortion, synthesize cross-physical field interference intensity according to preset electromagnetic weight coefficient and optical weight coefficient, and generate interference region mask. The interference region mask is used to indicate the electromagnetic-optical coupling interference region that needs to be decoupled from the physical field.
[0021] In one embodiment, the calculation formula for the edge superposition interference amount of the metal surface defect identification method based on artificial intelligence provided by the present invention is as follows:
[0022]
[0023] Where Ioverlap(x,y) is the edge overlap interference at coordinates (x,y), and G Z (x+i, y+j) represents the electromagnetic gradient magnitude of the coordinates (x+i, y+j) in the neighborhood, E opt (x+i,y+j) is the optical edge feature map of the coordinates (x+i,y+j) in the neighborhood.
[0024] In one embodiment, step S3 of the artificial intelligence-based metal surface defect identification method provided by the present invention specifically includes the following steps:
[0025] S31: Perform depth reconstruction processing on the optical grayscale image, calculate pixel-level depth values based on the spatial geometric relationship between the angle between the surface normal vectors and the illumination direction, and generate surface depth information;
[0026] S32: Based on the interference region mask, the phase compensation processing of the eddy current complex impedance signal is performed. The imaginary part offset of the complex domain is dynamically adjusted in the mask marking area in combination with the surface depth value to generate a phase-corrected electromagnetic signal.
[0027] S33: Based on the interference region mask, the curvature analysis processing of the optical grayscale image is performed. The local absolute curvature distribution is extracted in the mask-marked area by the Laplacian operator to generate a grayscale distortion intensity map.
[0028] S34: Spatial integration processing is performed on the phase-corrected electromagnetic signal and the grayscale distortion intensity map. The compensated signal and the suppressed image are combined at the mask mark position to generate physical field decoupling data containing decoupled electromagnetic signals and decoupled optical images. The physical field decoupling data is used to indicate the electromagnetic-optical joint detection signal after eliminating cross-physical field interference.
[0029] In one embodiment, step S4 of the artificial intelligence-based metal surface defect identification method provided by the present invention specifically includes the following steps:
[0030] S41: The decoupled electromagnetic signal of the physical field decoupling data is processed by separating the real and imaginary parts, and the real and imaginary matrices are extracted as dual-channel inputs to generate electromagnetic impedance characteristics;
[0031] S42: Perform multi-scale feature extraction processing on the decoupled optical image of the physical field decoupled data, capture the texture patterns of different receptive fields through dilated convolution, and generate optical texture features;
[0032] S43: Perform cross-modal correlation processing on electromagnetic impedance features and optical texture features, calculate the cosine similarity matrix between feature maps, and generate modal interaction weights;
[0033] S44: Adaptive fusion processing is performed on the modal interaction weights. Electromagnetic impedance features and optical texture features are weighted and spliced according to a preset weight ratio to generate a fused feature tensor. The fused feature tensor is used to indicate the defect-sensitive feature expression of cross-physical field joint.
[0034] In one embodiment, step S5 of the artificial intelligence-based metal surface defect identification method provided by the present invention specifically includes the following steps:
[0035] S51: Perform heatmap generation processing on the fused feature tensor, restore the original resolution space of the feature map through transposed convolution, and generate a heatmap of the defect probability distribution.
[0036] S52: Perform region clustering on the defect probability distribution heatmap, and use connected component analysis to extract continuous regions with a probability higher than the preset threshold to generate candidate abnormal regions;
[0037] S53: Extract geometric features from candidate anomaly regions, calculate region area, aspect ratio and contour curvature, and generate morphological feature vectors;
[0038] S54: Perform defect classification processing on morphological feature vectors, and generate defect detection results containing defect types and coordinate sets by matching the geometric feature distribution of standard defects in the preset defect template library through a fully connected layer.
[0039] Secondly, the present invention provides an artificial intelligence-based metal surface defect identification device, which is configured with the following modules:
[0040] The gradient feature extraction module is used to acquire the eddy current complex impedance signal and optical grayscale image of the metal under test based on the eddy current sensor and industrial camera, and to extract the gradient features of the eddy current complex impedance signal to generate an electromagnetic gradient mode.
[0041] The coupling interference quantization module is used to perform coupling interference quantization on electromagnetic gradient modes and optical grayscale images, calculate the cross-physical field interference intensity of shadow distortion and edge superposition, and generate interference region masks.
[0042] The physical field decoupling module is used to physically decouple the eddy current complex impedance signal and the optical grayscale image based on the interference region mask, and generate physical field decoupling data containing the decoupled electromagnetic signal and the decoupled optical image.
[0043] The multimodal feature fusion module is used to perform multimodal feature fusion on physical field decoupled data. It calls a dual-branch neural network to perform cross-modal correlation extraction of electromagnetic impedance features and optical texture features, and generates a fused feature tensor.
[0044] The defect decision module is used to make defect decisions on the fused feature tensor, analyze the defect probability heatmap distribution and locate the coordinates of abnormal areas, and generate defect detection results containing defect types and coordinate sets.
[0045] Thirdly, this application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement any of the above-mentioned artificial intelligence-based metal surface defect identification methods.
[0046] Fourthly, this application provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements any of the above-mentioned artificial intelligence-based metal surface defect identification methods.
[0047] In summary, the artificial intelligence-based metal surface defect identification method provided in this application is based on the spatial interference quantification analysis of electromagnetic gradient modes and optical images. It can accurately locate cross-physical field coupling regions and generate targeted interference masks to achieve physical separation of electromagnetic skin effect and optical shadow distortion. Secondly, by performing phase compensation and shadow suppression operations in the mask marking region, signal cross-interference can be eliminated, and real defect features can be preserved, achieving physical field independence of electromagnetic signals and optical images after decoupling. Furthermore, by adopting a dual-branch neural network architecture, cross-modal correlation learning of electromagnetic impedance features and optical texture features can be achieved. Through dynamic fusion of cosine similarity weights, a defect-sensitive joint feature expression can be established. Finally, based on heatmap analysis and geometric feature matching of fused feature tensors, accurate defect localization and classification can be achieved, overcoming the problem of missed detection of micro-cracks in traditional methods.
[0048] To better understand and implement this invention, the following detailed description is provided in conjunction with the accompanying drawings. Attached Figure Description
[0049] Figure 1 A flowchart illustrating an artificial intelligence-based method for identifying metal surface defects, provided in an embodiment of this application;
[0050] Figure 2 This is a schematic diagram of the process for generating fused feature tensors provided in an embodiment of this application;
[0051] Figure 3 This is a schematic diagram of the structure of an artificial intelligence-based metal surface defect identification device provided in another embodiment of this application. Detailed Implementation
[0052] To facilitate understanding of the present invention, a more complete description will be given below with reference to the accompanying drawings. Preferred embodiments of the invention are shown in the drawings. However, the invention can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided to provide a thorough and complete understanding of the disclosure of the invention.
[0053] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0054] In one embodiment, such as Figure 1 As shown, an artificial intelligence-based method for identifying metal surface defects is provided. This embodiment illustrates the application of this method to a terminal. It is understood that this method can also be applied to a server, and further to a system including both a terminal and a server, and is implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0055] S1: Based on eddy current sensors and industrial cameras, acquire eddy current complex impedance signals and optical grayscale images of the metal under test, and extract gradient features from the eddy current complex impedance signals to generate electromagnetic gradient modes.
[0056] Specifically, the system acquires signals from the metal surface under test using an eddy current sensor, obtaining an eddy current complex impedance signal. This signal contains real and imaginary parts, corresponding to the resistive and reactive components, respectively. Simultaneously, the system performs optical imaging on the metal surface under test using an industrial camera, acquiring an optical grayscale image. This image contains optical features of surface texture and defects.
[0057] Specifically, when an eddy current sensor is energized, it generates an alternating magnetic field around its coil. When the sensor approaches the metal surface to be measured, the alternating magnetic field induces eddy currents in the metal. The distribution and intensity of these eddy currents are affected by factors such as the electrical conductivity, magnetic permeability, and surface defects of the metal material. The generation of eddy currents, in turn, affects the impedance of the sensor coil, causing its impedance value to change. The system accurately detects the change in coil impedance through a measurement circuit, including its amplitude and phase information, thereby obtaining the eddy current complex impedance signal. This signal reflects the electromagnetic properties of the metal surface and its vicinity, providing an electromagnetic data foundation for subsequent analysis. The lens of an industrial camera is aimed at the metal surface to be measured. Through the camera's internal optical system and photosensitive element, the optical information of the metal surface is converted into an electrical signal. The system controls the camera to take pictures according to the set parameters such as exposure time and aperture size. After the light signal received by the photosensitive element is converted from analog to digital, it forms digital image data, namely optical grayscale image. This image presents the light and dark distribution of the metal surface in the form of grayscale values. The level of grayscale value depends on the intensity of reflected light on the surface. The distribution of different grayscale values can reflect the morphological features of the metal surface, such as scratches, pits, etc.
[0058] For example, the system preprocesses the eddy current complex impedance signal by filtering out noise and retaining the signal components related to the defect. Simultaneously, the system calculates the spatial gradient of the eddy current complex impedance signal, solving for the gradients in the horizontal and vertical directions for the real and imaginary parts respectively. The electromagnetic gradient mode is obtained through gradient synthesis, which highlights the changes in the eddy current signal in the defect region.
[0059] S2: Perform coupled interference quantization on the electromagnetic gradient mode and optical grayscale image, calculate the cross-physical field interference intensity of shadow distortion and edge superposition, and generate interference region mask.
[0060] Specifically, the distorted grayscale distribution regions in optical grayscale images are due to the skin effect generated by electromagnetic eddy currents. The system identifies the affected regions by analyzing the differences between the grayscale value changes in these regions and the normal optical imaging patterns. In the eddy current complex impedance signal, the system identifies the electromagnetic signal phase noise caused by optical shadow back-interference by detecting abnormal phase change locations. The system establishes a mathematical model that comprehensively considers the influence of optical shadows on the phase of electromagnetic signals and the interference of electromagnetic eddy currents on the optical grayscale distribution, calculates the cross-physical field interference intensity, and generates an interference region mask based on the distribution of this interference intensity. This mask is presented in the form of a binary or grayscale image, identifying the location and severity of the regions affected by cross-physical field coupling interference.
[0061] S3: Based on the interference region mask, perform physical field decoupling on the eddy current complex impedance signal and the optical grayscale image to generate physical field decoupling data containing the decoupled electromagnetic signal and the decoupled optical image.
[0062] Specifically, for eddy current complex impedance signals, the system distinguishes between normal and interference regions based on a mask. Signals in normal regions remain in their original state, while signals in interference regions are adjusted using a compensation model built upon electromagnetic principles. This corrects phase deviations caused by optical shadow interference, eliminating the impact of cross-physical field interference on the electromagnetic signal. For optical grayscale images, the system similarly identifies interference regions using a mask. For these regions, multi-wavelength imaging analysis methods can be employed to separate the grayscale distortion components caused by the electromagnetic skin effect from the true surface optical features. By suppressing the distortion components, the true texture information of defects in the optical image is restored.
[0063] After the decoupling operation is completed, the system integrates the processed eddy current complex impedance signal and optical grayscale image to form physical field decoupling data. This data contains the decoupled electromagnetic signal and the decoupled optical image. The cross-physical field interference in the two signals is effectively separated, and their respective defect characteristics are preserved.
[0064] S4: Perform multimodal feature fusion on the decoupled physical field data, call a dual-branch neural network to extract cross-modal correlation between electromagnetic impedance features and optical texture features, and generate a fused feature tensor.
[0065] Specifically, the system uses a dual-branch neural network structure to process decoupled data. One branch receives the decoupled eddy current complex impedance signal, extracts the electromagnetic impedance distribution features in the signal through convolution operation, and generates an electromagnetic feature map after multi-layer processing. The other branch receives the decoupled optical grayscale image, extracts multi-level texture features in the image through a deep neural network, and generates an optical feature map after fusing feature information at different scales.
[0066] In the dual-branch feature extraction process, the system introduces a cross-modal correlation mechanism to calculate the spatial correlation weight between the electromagnetic and optical feature maps. Based on this weight, the two feature maps are interactively mapped to achieve mutual enhancement of electromagnetic and optical features. By weighted fusion of the correlated features, the system integrates the features output from both branches into a unified feature representation, generating a fused feature tensor. The fused feature tensor simultaneously contains defect features from both electromagnetic and optical physical fields, and the correlation between the two features is effectively preserved, providing comprehensive feature support for subsequent defect identification.
[0067] S5: Perform defect decision-making on the fused feature tensor, analyze the defect probability heatmap distribution and locate the coordinates of abnormal areas, and generate defect detection results containing defect types and coordinate sets.
[0068] Specifically, the system can use a trained deep learning classification model to process the fused feature tensor and parse out the probability heatmap distribution of defects on the metal surface. This probability heatmap is presented in the form of a two-dimensional image, where the value of each pixel represents the probability of a defect existing at that location, intuitively reflecting the distribution and severity of defects on the metal surface. Simultaneously, the system can utilize object detection algorithms or image segmentation techniques to locate the coordinates of abnormal regions on the probability heatmap, determining the specific location range of defects on the metal surface. Based on the defect probability heatmap and the coordinates of abnormal regions, the system, combined with preset defect type discrimination rules, generates defect detection results containing defect types and coordinate sets. The defect detection results include the type of each defect and its corresponding spatial coordinates, comprehensively presenting the defect information of the metal surface under test.
[0069] In summary, the artificial intelligence-based metal surface defect identification method provided in this application is based on the spatial interference quantification analysis of electromagnetic gradient modes and optical images. It can accurately locate cross-physical field coupling regions and generate targeted interference masks to achieve physical separation of electromagnetic skin effect and optical shadow distortion. Secondly, by performing phase compensation and shadow suppression operations in the mask marking region, signal cross-interference can be eliminated, and real defect features can be preserved, achieving physical field independence of electromagnetic signals and optical images after decoupling. Furthermore, by adopting a dual-branch neural network architecture, cross-modal correlation learning of electromagnetic impedance features and optical texture features can be achieved. Through dynamic fusion of cosine similarity weights, a defect-sensitive joint feature expression can be established. Finally, based on heatmap analysis and geometric feature matching of fused feature tensors, accurate defect localization and classification can be achieved, overcoming the problem of missed detection of micro-cracks in traditional methods.
[0070] This method can be widely applied to the non-destructive testing of high-value components such as aerospace engine blades and high-speed rail wheel axles. Without disassembly, it can achieve online high-precision defect identification of complex curved metal workpieces, providing reliable technical support for industrial quality control.
[0071] In one embodiment, S1 of the artificial intelligence-based metal surface defect identification method provided by the present invention specifically includes the following steps:
[0072] S11: Based on eddy current sensors and industrial cameras, acquire eddy current complex impedance signals and optical grayscale images of the metal under test.
[0073] Specifically, the system scans the metal surface under test using an eddy current sensor. The eddy current sensor maintains relative motion with the metal surface under test. During the motion, the eddy current sensor emits an alternating electromagnetic field, which acts on the metal surface under test to generate induced eddy currents. The eddy current sensor receives the eddy current complex impedance signal formed by the induced eddy currents. This signal contains a real part and an imaginary part. The real part reflects the change in the resistivity of the metal surface, and the imaginary part reflects the change in the reactance of the metal surface.
[0074] Simultaneously, the system uses an industrial camera to perform optical imaging of the metal surface under test. The lens axis of the industrial camera is maintained at a set angle with the metal surface. During imaging, a light source illuminates the metal surface, and the light is reflected by the metal surface before entering the industrial camera. The industrial camera converts the light signal into an electrical signal, generating an optical grayscale image. The grayscale value of each pixel in the optical grayscale image corresponds to the light reflection characteristics of that location on the metal surface. When acquiring the eddy current complex impedance signal and the optical grayscale image, the system records the spatial location information corresponding to both signals to ensure that the two signals correspond to each other in space.
[0075] S12: Perform real part partial derivative calculation on the eddy current complex impedance signal, calculate the real part gradient rate of change in the x direction and the imaginary part gradient rate of change in the y direction, and generate real part gradient components and imaginary part gradient components.
[0076] Specifically, the system performs real-part partial derivative calculations on the acquired eddy current complex impedance signal, extracting the real part of the signal. Partial derivatives are calculated on the real part in the x-direction, and the real gradient rate in the x-direction is obtained by calculating the ratio of the change in real part value to the change in position between adjacent positions; this is the component of the real gradient in the x-direction. The system also extracts the imaginary part of the eddy current complex impedance signal, performing partial derivative calculations on the imaginary part in the y-direction. The imaginary gradient rate in the y-direction is obtained by calculating the ratio of the change in imaginary part value to the change in position between adjacent positions; this is the component of the imaginary gradient in the y-direction. The real and imaginary gradient components reflect the changing trends of the eddy current complex impedance signal in the x and y directions, respectively. The magnitude of the real gradient component is related to the degree of change in the metal surface resistance characteristics in the x-direction, while the magnitude of the imaginary gradient component is related to the degree of change in the metal surface reactance characteristics in the y-direction.
[0077] S13: Perform modulus synthesis on the real and imaginary gradient components, take the Euclidean norm of the gradient vector of each pixel, and generate the electromagnetic gradient modulus. The electromagnetic gradient modulus is used to indicate the distribution characteristics of the electromagnetic field abrupt change in intensity on the metal surface.
[0078] Specifically, the system performs modulus synthesis on the generated real and imaginary gradient components, treating the real and imaginary gradient components as vector components on a two-dimensional plane. For each pixel, the system treats the real and imaginary gradient components of that point as two components of a vector and calculates the Euclidean norm of that vector. The calculation process involves taking the square root of the sum of the squares of the real and imaginary gradient components to obtain the gradient modulus value of each pixel.
[0079] The system combines the gradient modulus values of all pixels to form an electromagnetic gradient modulus. The value of each pixel in the electromagnetic gradient modulus corresponds to the gradient modulus value at that position. The distribution of the values can reflect the abrupt change in the electromagnetic field intensity at different positions on the metal surface. When there are defects on the metal surface, the electromagnetic field at the defect will change abruptly, and the value at the corresponding position in the electromagnetic gradient modulus will show a corresponding change, thus indicating the distribution characteristics of the abrupt change in the electromagnetic field intensity on the metal surface.
[0080] In one embodiment, step S2 of the artificial intelligence-based metal surface defect identification method provided by the present invention specifically includes the following steps:
[0081] S21: Perform shadow simulation processing on the optical grayscale image, apply Gaussian kernel convolution to generate low-frequency shadow components, and generate an optical shadow simulation image.
[0082] Specifically, the system retrieves a stored optical grayscale image, which exists as a two-dimensional array, where each element represents the grayscale value at a corresponding coordinate. When performing shadow simulation processing, the system first determines the size of the Gaussian kernel based on the resolution of the optical grayscale image. The size of the Gaussian kernel must cover the spatial distribution range of typical shadows in the image. The system constructs the Gaussian kernel, and its mathematical expression is:
[0083]
[0084] Where K(σ) is the Gaussian kernel, σ is the standard deviation of the Gaussian kernel, used to control the smoothness of the kernel, and x and y are the coordinate offsets of pixels within the kernel relative to the center pixel, with values corresponding to the size of the kernel. The system performs a convolution operation between the constructed Gaussian kernel and the optical grayscale image, and the convolution process follows the formula:
[0085] I shadow (x,y)=I opt (x,y)*K(σ)
[0086] Among them, I shadow (x,y) represents the pixel value of the optical shadow simulation map at coordinates (x,y), I opt(x, y) represents the pixel value at coordinates (x, y) in the optical grayscale image. * indicates a convolution operation, which involves a weighted summation of each pixel in the optical grayscale image using a sliding Gaussian kernel. This operation filters out high-frequency surface texture information from the optical grayscale image while preserving low-frequency brightness variations, creating an optical shadow simulation map. The system stores the generated optical shadow simulation map as a two-dimensional array in a designated storage area. This array has the same size as the optical grayscale image and is used for subsequent structural difference quantization processing between the original and optical grayscale images.
[0087] S22: Perform edge detection processing on the optical grayscale image to generate an optical edge feature map, and perform spatial convolution processing in combination with the electromagnetic gradient mode to calculate the sum of the product of the gradient magnitude and the edge intensity in the 3×3 neighborhood to generate the edge superposition interference.
[0088] Specifically, the system calls the optical grayscale image and calculates the grayscale gradient of each pixel in the image in the horizontal and vertical directions. The gradient calculation uses the Sobel operator. The horizontal and vertical operators are convolved with the optical grayscale image to obtain the horizontal gradient and the vertical gradient, respectively. Then, the gradient magnitude is obtained by taking the square root of the sum of the squares of the two gradients, which is the optical edge feature map E. opt (x,y),E opt (x,y) represents the edge intensity at coordinates (x,y). The larger the value, the more drastic the grayscale change at that location.
[0089] The system retrieves the electromagnetic gradient mode G from the storage area. Z (x, y), where the gradient modulus is also a two-dimensional array with the same size as the optical edge feature map. The system performs spatial convolution processing on the optical edge feature map and the electromagnetic gradient modulus. During processing, the system defines a 3×3 neighborhood centered on each pixel, covering the central pixel and its eight surrounding adjacent pixels. Preferably, the formula for calculating the edge superposition interference is:
[0090]
[0091] Where Ioverlap(x,y) is the edge overlap interference at coordinates (x,y), and G Z (x+i, y+j) represents the electromagnetic gradient magnitude of the coordinates (x+i, y+j) in the neighborhood, E opt (x+i, y+j) represents the optical edge feature map of the neighborhood coordinates (x+i, y+j). The system iterates through all pixels in the optical edge feature map, calculates the edge superposition interference for each pixel, generates a two-dimensional array of edge superposition interference, and stores it in a designated storage area for subsequent synthesis of cross-physical field interference intensity.
[0092] S23: Perform structural difference quantization processing on optical grayscale images and optical shadow simulation images, compare brightness, contrast and structural similarity within a multi-scale window, and generate shadow distortion variables.
[0093] Specifically, the system performs structural difference quantization on the optical grayscale image and the optical shadow simulation image, setting up multi-scale windows, gradually increasing the window size from 1×1 to one-tenth of the image diagonal length, with the window size at each scale being twice that of the previous scale. At each scale, the system synchronously slides the window across the optical grayscale image and the optical shadow simulation image, with each slide step being the same as the window size. At each window position, the system calculates the brightness difference D. L Contrast difference D C Structural similarity (SSIM):
[0094] D L =μ(I opt )-μ(I shadow )
[0095] D C =σ(I opt )-σ(I shadow )
[0096]
[0097] Where μ(·) represents the arithmetic mean of all pixel values within the window; σ(·) represents the standard deviation of all pixel values within the window; μ opt μ is the mean value within the optical grayscale image window. shadow σ is the mean value within the optical shadow simulation window. opt σ is the standard deviation within the optical grayscale image window. shadow σ represents the standard deviation within the optical shadow simulation window. opt,shadow Let C1 be the covariance of pixel values within the two image windows, where C1 = (k1L). 2 C2 = (k2L) 2 k1 and k2 are constants, and L is the dynamic range of grayscale values. The system performs a weighted summation of the brightness difference, contrast difference, and structural similarity of each window, with the weights determined according to the importance of different scales, to obtain the structural difference quantity corresponding to that window. Through calculations at all scales and all window positions, the system averages the structural difference quantity of each pixel when it is covered in different windows, generating a two-dimensional array of shadow distortion variables.
[0098] S24: Perform weighted fusion processing on edge superposition interference and shadow distortion, synthesize cross-physical field interference intensity according to preset electromagnetic weight coefficient and optical weight coefficient, and generate interference region mask. The interference region mask is used to indicate the electromagnetic-optical coupling interference region that needs to be decoupled from the physical field.
[0099] Specifically, the system performs a weighted fusion process on the edge superposition interference and shadow distortion, and the fusion process follows the formula below:
[0100] I cross (x,y)=α·I overlap (x,y)+(1-α)·D shadow (x,y)
[0101] Where α is the electromagnetic weighting coefficient, its value is determined according to the contribution of electromagnetic signals and optical signals in coupling interference, 1-α is the optical weighting coefficient, and the value of α ranges from 0 to 1. cross (x,y) represents the cross-physics interference intensity at coordinates (x,y), I overlap (x,y) represents the edge superposition interference at coordinates (x,y), D shadow (x,y) represents the shadow distortion at coordinates (x,y). The system calculates a two-dimensional array of cross-physical field interference intensity by traversing all pixels. The system performs thresholding on the cross-physical field interference intensity. The threshold τ is determined statistically by analyzing all pixel values of the cross-physical field interference intensity, taking the median of all pixel values as the initial value of τ, and then adjusting it according to the expected proportion of the interference region in the image. When I cross When (x,y)>τ, the system sets the mask value at that coordinate to 1, marking it as an interference region; when I cross When (x,y)≤τ, the mask value is set to 0, marking it as a non-interference region. Through this operation, the system generates an interference region mask, which is a two-dimensional binary array with the same size as the optical grayscale image. This mask is stored in a specified location to indicate the region that needs to be processed in the subsequent physical field decoupling process.
[0102] In one embodiment, step S3 of the artificial intelligence-based metal surface defect identification method provided by the present invention specifically includes the following steps:
[0103] S31: Perform depth reconstruction processing on the optical grayscale image, calculate pixel-level depth values based on the spatial geometric relationship between the angle between the surface normal vectors and the illumination direction, and generate surface depth information.
[0104] Specifically, the system performs depth reconstruction on the optical grayscale image. By analyzing the grayscale value distribution of pixels in the optical grayscale image, it inversely calculates the surface normal vector at each location on the metal surface. The calculation of the surface normal vector is based on the rate of change of grayscale values of adjacent pixels, and the spatial orientation of the normal vector is determined by the grayscale gradient direction. The system calls the illumination direction parameter, which includes the angle and azimuth information between the light source and the metal surface.
[0105] Preferably, the system utilizes the spatial geometric relationship between the surface normal vector and the illumination direction to establish a mapping relationship between grayscale values and depth, and calculates the depth value of each pixel through geometric derivation. The pixel-level depth value calculation process incorporates the cosine of the angle between the surface normal vector and the illumination direction, transforming the attenuation of the grayscale value into a distance metric along the normal vector direction. Ultimately, it generates surface depth information covering the entire area under test. This surface depth information reflects the three-dimensional morphological characteristics of the metal surface, providing a spatial dimension correction basis for subsequent eddy current signal phase compensation.
[0106] S32: Based on the interference region mask, the eddy current complex impedance signal is phase compensated. The imaginary part offset of the complex domain is dynamically adjusted in the mask marking area in combination with the surface depth value to generate a phase-corrected electromagnetic signal.
[0107] Specifically, the system performs curvature analysis on optical grayscale images based on interference region masks. By focusing on the areas marked by the interference region mask, the system applies the Laplacian operator to the optical grayscale image within those areas. The Laplacian operator, by calculating its second derivative, reflects the curvature changes of grayscale values in the image. The system uses this operator to extract the local curvature value of each pixel and takes its absolute value, forming a local curvature absolute value distribution. Local curvature changes on a metal surface can alter the direction of light reflection, leading to grayscale distortion in the optical grayscale image. The larger the local curvature absolute value, the more significant the grayscale distortion. The system transforms the local curvature absolute value distribution into a grayscale distortion intensity map. The value of each pixel in the grayscale distortion intensity map corresponds to the degree of grayscale distortion caused by surface curvature at that location, providing a quantitative basis for subsequent distortion suppression of the optical image.
[0108] S33: Based on the interference region mask, the curvature analysis processing of the optical grayscale image is performed. The local absolute curvature distribution is extracted in the mask-marked area by the Laplacian operator to generate a grayscale distortion intensity map.
[0109] Specifically, within the area marked by the interference region mask, the system performs a Laplacian operator operation on the optical grayscale image. The Laplacian operator, by calculating the sum of the second derivatives of the image, reflects the rate of change of grayscale values around each pixel, thereby extracting the absolute value of local curvature in that region. The distribution of the absolute value of local curvature is related to the curvature of the metal surface. Changes in surface curvature lead to changes in the light reflection angle during optical imaging, causing grayscale distortion. The system converts the distribution of the absolute value of local curvature into the corresponding degree of grayscale distortion, generating a grayscale distortion intensity map. The value of each pixel in the grayscale distortion intensity map corresponds to the intensity of optical grayscale distortion caused by local curvature.
[0110] S34: Spatial integration processing is performed on the phase-corrected electromagnetic signal and the grayscale distortion intensity map. The compensated signal and the suppressed image are combined at the mask mark position to generate physical field decoupling data containing decoupled electromagnetic signals and decoupled optical images. The physical field decoupling data is used to indicate the electromagnetic-optical joint detection signal after eliminating cross-physical field interference.
[0111] Specifically, the system spatially matches the phase-corrected electromagnetic signal with the grayscale distortion intensity map, ensuring the correspondence of the two data sets within the same coordinate system. At the masked locations in the interference region, the system combines the phase-compensated electromagnetic signal with the optical image after suppression processing based on the grayscale distortion intensity map. Suppression is achieved by weakening the grayscale signal in high-value regions of the grayscale distortion intensity map. For areas not marked by the mask, the system directly retains the effective features from both the phase-corrected electromagnetic signal and the original optical grayscale image. Through this spatial integration, the system generates physical field decoupling data, which includes the decoupled electromagnetic signal and the decoupled optical image. Cross-physical field coupling interference between the two signals in the interference region is eliminated, and their respective defect features are separated, indicating the electromagnetic-optical joint detection signal after eliminating cross-physical field interference.
[0112] In one embodiment, such as Figure 2 As shown, step S4 of the artificial intelligence-based metal surface defect identification method provided by the present invention specifically includes the following steps:
[0113] S41: The decoupled electromagnetic signal of the physical field decoupling data is processed by separating the real and imaginary parts, and the real and imaginary matrices are extracted as dual-channel inputs to generate electromagnetic impedance characteristics.
[0114] Specifically, the system separates the decoupled electromagnetic signal in the physical field decoupling data into real and imaginary parts, and reads the decoupled electromagnetic signal, which is stored in the form of a complex matrix. Each element in the matrix contains real and imaginary part information. The system splits the complex matrix into two independent matrices through data parsing. One matrix contains only the real part values of all elements in the original complex matrix, defined as the real part matrix, and the other matrix contains only the imaginary part values of all elements in the original complex matrix, defined as the imaginary part matrix. The real part matrix reflects the spatial distribution of the resistive component in the decoupled electromagnetic signal, and the imaginary part matrix reflects the spatial distribution of the reactive component in the decoupled electromagnetic signal.
[0115] The system adjusts the dimensions of the real and imaginary matrices to be consistent and transmits them as dual-channel inputs to the feature extraction module. The feature extraction module performs dimensionality expansion and standardization on the dual-channel inputs to generate electromagnetic impedance features. The dimensionality of the electromagnetic impedance features is represented as follows: Where C is the number of feature channels, H and W are the height and width of the feature map, respectively, and F ZEach element corresponds to the quantization value of the decoupled electromagnetic signal at a specific spatial location and characteristic channel.
[0116] S42: Perform multi-scale feature extraction processing on the decoupled optical image of the physical field decoupled data, capture texture patterns of different receptive fields through dilated convolution, and generate optical texture features.
[0117] Specifically, the system performs multi-scale feature extraction on the decoupled optical images from the physical field decoupling data. It invokes a pre-defined convolutional neural network structure containing multiple parallel dilated convolutional layers, each with a different dilation rate. The dilated convolutional layers expand the receptive field without increasing the number of parameters by setting intervals between kernel elements. The system inputs the decoupled optical image into this structure, and convolutional layers with different dilation rates perform convolution operations on the image, capturing texture patterns within different ranges. The relationship between the output feature map of the dilated convolution and the input image can be expressed as:
[0118]
[0119] Where O(i,j) is the value of the output feature map at coordinates (i,j), I is the decoupled optical image, r is the porosity, K is the convolution kernel, and m1,n1 are the kernel indices. The system performs channel concatenation on the output feature maps of each dilated convolutional layer to form a multi-scale feature set, generating optical texture features. The optical texture features integrate image texture information from different receptive fields, including surface texture features related to defects in the decoupled optical image.
[0120] S43: Perform cross-modal correlation processing on electromagnetic impedance features and optical texture features, calculate the cosine similarity matrix between feature maps, and generate modal interaction weights.
[0121] Specifically, the system performs cross-modal correlation on electromagnetic impedance features and optical texture features, converting them into sets of feature vectors, where each feature vector corresponds to a spatial location in the feature map. For vector 'a' in the electromagnetic impedance features and vector 'b' in the optical texture features, the system calculates their cosine similarity using the following formula:
[0122]
[0123] Where a·b is the dot product of vectors, and ||a|| and ||b|| are the L2 norms of the vectors, respectively. The system calculates the cosine similarity of feature vector pairs at all spatial locations, forming a cosine similarity matrix. The value of each element in this matrix reflects the degree of correlation between the two modal features at the corresponding spatial location, and the system uses this matrix as the modal interaction weight. The modal interaction weight quantifies the spatial correlation between electromagnetic impedance features and optical texture features, providing a basis for subsequent feature fusion.
[0124] S44: Adaptive fusion processing is performed on the modal interaction weights. Electromagnetic impedance features and optical texture features are weighted and spliced according to a preset weight ratio to generate a fused feature tensor. The fused feature tensor is used to indicate the defect-sensitive feature expression of cross-physical field joint.
[0125] Specifically, the system adaptively fuses the modal interaction weights, using them as fusion coefficients, and multiplies them element-wise with the electromagnetic impedance features and optical texture features. Let the electromagnetic impedance feature be F. Z The optical texture feature is F O If the modal interaction weight is W, then the weighted electromagnetic impedance characteristic is F. Z ′=F Z ⊙W, the weighted optical texture feature is F O ′=F O ⊙(1-W), where ⊙ represents element-wise multiplication.
[0126] The system concatenates the two weighted features along the channel dimension, and then unifies the dimensions of the concatenated features through a convolutional layer to generate a fused feature tensor. The fused feature tensor contains both electromagnetic impedance features and optical texture features adjusted by correlation weights, integrating the sensitive features related to defects in two physical fields. This allows for a more comprehensive reflection of the characteristics of metal surface defects and provides comprehensive feature support for subsequent defect decision-making.
[0127] In summary, the artificial intelligence-based metal surface defect recognition method provided in this application effectively solves the problem of missing cross-physical field correlation caused by the simple splicing of electromagnetic and optical features in traditional methods. It achieves in-depth mining of defect-sensitive features through multi-stage collaborative processing. First, the decoupled electromagnetic signal undergoes real-to-virtual part separation processing, which fully preserves the orthogonal characteristics of complex domain impedance information, enabling joint representation of electromagnetic field phase and amplitude. Second, dilated convolution is used to perform multi-scale feature extraction on the decoupled optical image, simultaneously capturing microscopic texture details and macroscopic contour morphology, overcoming the limitation of a single receptive field in perceiving multiple types of defects. Furthermore, based on cosine similarity, a cross-modal correlation matrix of electromagnetic impedance features and optical texture features is calculated, quantifying the spatial response consistency of different physical field features, and generating modal interaction weights reflecting defect sensitivity. Finally, by adaptively fusing dual-modal features through preset weight ratios, dynamic complementary enhancement of electromagnetic physical properties and optical morphology features is achieved, generating a joint cross-physical field defect-sensitive feature expression. This fusion mechanism significantly improves the response intensity of weak feature defects such as microcracks, while suppressing irrelevant background interference, providing a highly discriminative feature basis for subsequent accurate decision-making.
[0128] In one embodiment, step S5 of the artificial intelligence-based metal surface defect identification method provided by the present invention specifically includes the following steps:
[0129] S51: Perform heatmap generation processing on the fused feature tensor, and restore the original resolution space of the feature map through transposed convolution to generate a heatmap of the defect probability distribution.
[0130] Specifically, the system generates a heatmap of the fused feature tensor and calls a transposed convolutional layer. This layer upsamples the fused feature tensor using preset convolutional kernel parameters. The calculation process of the transposed convolution follows the matrix transpose principle, mapping the low-resolution feature map to the spatial resolution of the original detection region. The formula is:
[0131]
[0132] Where Q(i,j) is the value of the output heatmap at coordinates (i,j), I is the fused feature tensor, s is the upsampling factor, H is the transposed convolution kernel, and m2,n2 are the indices of the input feature map. Through the stacking operation of multiple transposed convolutions, the system gradually restores the spatial dimension of the feature map, making the resolution of the output feature map consistent with the original detection area of the metal surface under test. The system converts the final output feature map into a probability distribution through an activation function, generating a defect probability distribution heatmap. The value of each pixel in this heatmap represents the probability of a defect existing at the corresponding location, and the value range is mapped to the interval [0,1].
[0133] S52: Perform region clustering on the defect probability distribution heatmap, and use connected component analysis to extract continuous regions with a probability higher than a preset threshold to generate candidate abnormal regions.
[0134] Specifically, the system performs region clustering on the defect probability distribution heatmap and sets a preset probability threshold, which is determined based on statistical analysis of historical detection data. The system traverses all pixels in the defect probability distribution heatmap and marks pixels with values higher than the preset probability threshold as candidate points. Preferably, the system performs connected component analysis on the candidate points, using an 8-neighborhood search algorithm to determine the connectivity between candidate points and aggregating interconnected candidate points into continuous regions. The connected component analysis process is as follows: for each unmarked candidate point, it recursively searches for other candidate points within its 8 neighborhoods, assigning all connected candidate points to the same region number. The system calculates the minimum bounding rectangle for each continuous region to determine the boundary range of the region and generate candidate anomaly regions. The candidate anomaly regions contain all spatially continuous regions that meet the probability value conditions, initially screening out regions that may contain defects.
[0135] S53: Extract geometric features from candidate anomaly regions, calculate region area, aspect ratio, and contour curvature, and generate morphological feature vectors.
[0136] Specifically, the system extracts geometric features from candidate anomaly regions. For each candidate anomaly region, it counts the number of pixels within the region and calculates the region area by combining this with the spatial scale transformation relationship of the original detection region. The system calculates the aspect ratio using the ratio of the length to the width of the minimum bounding rectangle, with the formula R = L / W, where L is the length of the long side of the rectangle and W is the length of the short side. The system samples the contour of the candidate anomaly region, obtains the coordinates of each point on the contour, calculates the curvature value of each sampled point through curve fitting, and averages the absolute values to obtain the contour curvature. The system integrates the region area, aspect ratio, and contour curvature into a vector form to generate a morphological feature vector. The morphological feature vector quantifies the geometric attributes of the candidate anomaly region, reflecting the shape and size characteristics of the region, and providing a morphological basis for determining the defect type.
[0137] S54: Perform defect classification processing on morphological feature vectors, and generate defect detection results containing defect types and coordinate sets by matching the geometric feature distribution of standard defects in the preset defect template library through a fully connected layer.
[0138] Specifically, the system performs defect classification processing on morphological feature vectors. The morphological feature vectors are input into a fully connected layer, which maps them to a predefined feature space through matrix operations. A predefined defect template library stores morphological feature distribution models for various standard defects. Each model includes the area range, typical aspect ratio, and contour curvature interval for the corresponding defect type. The system calculates the distance metric between the input morphological feature vector and each model in the template library using the following formula:
[0139] D = ||VV k ||2
[0140] Where V is the input feature vector, V k Let be the feature model of the k-th standard defect, and ‖·‖2 be the L2 norm. The system determines the defect type corresponding to the model with the smallest distance as the defect type of the candidate anomaly region, and records the coordinates of the vertex of the smallest bounding rectangle of each candidate anomaly region, generating a coordinate set. The system integrates the defect type and the coordinate set to generate a defect detection result, which includes the specific type of all detected defects and their spatial location information on the metal surface to be tested.
[0141] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0142] Based on the same inventive concept, this application also provides an AI-based metal surface defect identification device for implementing the AI-based metal surface defect identification method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more AI-based metal surface defect identification device embodiments provided below can be found in the limitations of the AI-based metal surface defect identification method described above, and will not be repeated here.
[0143] Preferably, such as Figure 3 As shown, the present invention provides a metal surface defect identification device 600 based on artificial intelligence, which is configured with the following modules:
[0144] The gradient feature extraction module 610 is used to acquire the eddy current complex impedance signal and optical grayscale image of the metal under test based on the eddy current sensor and industrial camera, and to extract the gradient features of the eddy current complex impedance signal to generate an electromagnetic gradient mode.
[0145] The coupling interference quantization module 620 is used to perform coupling interference quantization on electromagnetic gradient mode and optical grayscale image, calculate the cross-physical field interference intensity of shadow distortion and edge superposition, and generate interference region mask.
[0146] The physical field decoupling module 630 is used to perform physical field decoupling on eddy current complex impedance signals and optical grayscale images based on interference region masks, and generate physical field decoupling data containing decoupled electromagnetic signals and decoupled optical images.
[0147] The multimodal feature fusion module 640 is used to perform multimodal feature fusion on physical field decoupled data. It calls a dual-branch neural network to perform cross-modal correlation extraction of electromagnetic impedance features and optical texture features, and generates a fused feature tensor.
[0148] The defect decision module 650 is used to make defect decisions on the fused feature tensor, analyze the defect probability heatmap distribution and locate the coordinates of abnormal areas, and generate defect detection results containing defect types and coordinate sets.
[0149] Preferably, the gradient feature extraction module 610 provided in this application is configured with the following units:
[0150] A multi-source signal acquisition unit is used to acquire eddy current complex impedance signals and optical grayscale images of the metal under test based on eddy current sensors and industrial cameras.
[0151] The impedance gradient component calculation unit is used to perform real part partial derivative calculation on the eddy current complex impedance signal, calculate the real part gradient rate of change in the x direction and the imaginary part gradient rate of change in the y direction, and generate real part gradient components and imaginary gradient components.
[0152] The electromagnetic gradient mode synthesis unit is used to perform mode synthesis processing on the real and imaginary gradient components. It takes the Euclidean norm of the gradient vector of each pixel to generate the electromagnetic gradient mode, which is used to indicate the characteristics of the sudden change in the intensity distribution of the electromagnetic field on the metal surface.
[0153] Preferably, the coupling interference quantization module 620 provided in this application is configured with the following units:
[0154] The optical shadow simulation unit is used to perform shadow simulation processing on optical grayscale images. It applies Gaussian kernel convolution to generate low-frequency shadow components and generates an optical shadow simulation map.
[0155] The edge superposition interference calculation unit is used to perform edge detection processing on the optical grayscale image, generate an optical edge feature map, and perform spatial convolution processing in combination with the electromagnetic gradient mode to calculate the sum of the product of the gradient magnitude and the edge intensity in the 3×3 neighborhood, thereby generating the edge superposition interference amount.
[0156] The shadow distortion quantization unit is used to perform structural difference quantization on optical grayscale images and optical shadow simulation images, compare brightness, contrast and structural similarity within a multi-scale window, and generate shadow distortion variables.
[0157] The interference intensity fusion unit is used to perform weighted fusion processing on the edge superimposed interference and shadow distortion, synthesize the cross-physical field interference intensity according to the preset electromagnetic weight coefficient and optical weight coefficient, and generate an interference region mask. The interference region mask is used to indicate the electromagnetic-optical coupling interference region that needs to be decoupled from the physical field.
[0158] Preferably, the physical field decoupling module 630 provided in this application is configured with the following units:
[0159] Optical Depth Reconstruction Unit: Used to perform depth reconstruction processing on optical grayscale images, calculate pixel-level depth values based on the spatial geometric relationship between the angle between surface normal vectors and the illumination direction, and generate surface depth information;
[0160] The electromagnetic signal phase compensation unit is used to perform phase compensation processing on the eddy current complex impedance signal based on the interference region mask. It dynamically adjusts the imaginary part offset of the complex domain in the mask marking area in combination with the surface depth value to generate a phase-corrected electromagnetic signal.
[0161] The optical image curvature analysis unit is used to perform curvature analysis processing on optical grayscale images based on interference region masks. It extracts the local absolute curvature distribution in the masked region using the Laplacian operator to generate a grayscale distortion intensity map.
[0162] The physical field data integration unit is used to spatially integrate the phase-corrected electromagnetic signal and the grayscale distortion intensity map. It combines the compensated signal and the suppressed image at the mask mark position to generate physical field decoupling data containing the decoupled electromagnetic signal and the decoupled optical image. The physical field decoupling data is used to indicate the electromagnetic-optical joint detection signal after eliminating cross-physical field interference.
[0163] Preferably, the multimodal feature fusion module 640 provided in this application is configured with the following units:
[0164] The electromagnetic impedance feature extraction unit is used to separate the real and imaginary parts of the decoupled electromagnetic signal of the physical field decoupling data, extract the real and imaginary matrix as dual-channel input, and generate electromagnetic impedance features.
[0165] The optical texture feature extraction unit is used to perform multi-scale feature extraction processing on the decoupled optical image of the physical field decoupled data. It captures texture patterns of different receptive fields through dilated convolution to generate optical texture features.
[0166] The cross-modal correlation calculation unit is used to perform cross-modal correlation processing on electromagnetic impedance features and optical texture features, calculate the cosine similarity matrix between feature maps, and generate modal interaction weights.
[0167] The cross-modal feature fusion unit is used to adaptively fuse modal interaction weights, and to weight and splice electromagnetic impedance features and optical texture features according to a preset weight ratio to generate a fused feature tensor. The fused feature tensor is used to indicate the defect-sensitive feature expression of cross-physical field joint.
[0168] Preferably, the defect decision module 650 provided in this application is configured with the following units:
[0169] The defect probability heatmap generation unit is used to perform heatmap generation processing on the fused feature tensor. It restores the original resolution space of the feature map through transposed convolution and generates a defect probability distribution heatmap.
[0170] The candidate anomaly region extraction unit is used to perform region clustering on the defect probability distribution heatmap, and apply connected component analysis to extract continuous regions with a probability higher than a preset threshold to generate candidate anomaly regions.
[0171] The regional morphological feature extraction unit is used to extract geometric features from candidate anomaly regions, calculate the region area, aspect ratio and contour curvature, and generate morphological feature vectors.
[0172] The defect classification and result generation unit is used to classify defects by morphological feature vectors. It matches the geometric feature distribution of standard defects in the preset defect template library through a fully connected layer to generate defect detection results containing defect types and coordinate sets.
[0173] In one embodiment, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described artificial intelligence-based metal surface defect identification method.
[0174] In one embodiment, this application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the above-described artificial intelligence-based metal surface defect identification method.
[0175] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of those different embodiments or examples.
[0176] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The components described as separate parts may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this disclosure according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0177] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various variations or substitutions within the technical scope disclosed in this application, and these should all 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. A method for identifying metal surface defects based on artificial intelligence, characterized in that, Includes the following steps: S1: Based on the eddy current sensor and industrial camera, acquire the eddy current complex impedance signal and optical grayscale image of the metal under test, and extract the gradient features of the eddy current complex impedance signal to generate an electromagnetic gradient mode. S2: Perform coupling interference quantization on the electromagnetic gradient mode and the optical grayscale image, calculate the cross-physical field interference intensity of shadow distortion and edge superposition, and generate interference region mask; S3: Based on the interference region mask, perform physical field decoupling on the eddy current complex impedance signal and the optical grayscale image to generate physical field decoupling data containing the decoupled electromagnetic signal and the decoupled optical image; S4: Perform multimodal feature fusion on the physical field decoupled data, call a dual-branch neural network to perform cross-modal correlation extraction of electromagnetic impedance features and optical texture features, and generate a fused feature tensor; S5: Perform defect decision-making on the fused feature tensor, analyze the defect probability heatmap distribution and locate the coordinates of abnormal areas, and generate defect detection results containing defect types and coordinate sets.
2. The method according to claim 1, characterized in that, S1 includes: S11: Acquire eddy current complex impedance signal and optical grayscale image of the metal under test based on eddy current sensor and industrial camera; S12: Perform real part partial derivative calculation on the eddy current complex impedance signal, calculate the real part gradient rate of change in the x direction and the imaginary part gradient rate of change in the y direction, and generate real part gradient components and imaginary gradient components. S13: Perform modulus synthesis processing on the real gradient component and the imaginary gradient component, take the Euclidean norm of the gradient vector of each pixel point, and generate an electromagnetic gradient modulus. The electromagnetic gradient modulus is used to indicate the distribution characteristics of the electromagnetic field abrupt intensity of the metal surface.
3. The method according to claim 1, characterized in that, S2 includes: S21: Perform shadow simulation processing on the optical grayscale image, apply Gaussian kernel convolution to generate low-frequency shadow components, and generate an optical shadow simulation image; S22: Perform edge detection processing on the optical grayscale image to generate an optical edge feature map, and perform spatial convolution processing in combination with the electromagnetic gradient mode to calculate the sum of the product of the gradient magnitude and the edge intensity in the 3×3 neighborhood to generate the edge superposition interference amount. S23: Perform structural difference quantization processing on the optical grayscale image and the optical shadow simulation image, compare brightness, contrast and structural similarity within a multi-scale window, and generate shadow distortion variables; S24: Perform weighted fusion processing on the edge superposition interference amount and the shadow distortion amount, synthesize the cross-physical field interference intensity according to the preset electromagnetic weight coefficient and optical weight coefficient, and generate an interference region mask. The interference region mask is used to indicate the electromagnetic-optical coupling interference region that needs to be decoupled from the physical field.
4. The method according to claim 3, characterized in that, The formula for calculating the edge superposition interference is: Where Ioverlap(x,y) is the edge overlap interference at coordinates (x,y), and G Z (x+i, y+j) represents the electromagnetic gradient magnitude of the coordinates (x+i, y+j) in the neighborhood, E opt (x+i,y+j) is the optical edge feature map of the coordinates (x+i,y+j) in the neighborhood.
5. The method according to claim 1, characterized in that, S3 includes: S31: Perform depth reconstruction processing on the optical grayscale image, calculate pixel-level depth values based on the spatial geometric relationship between the angle between the surface normal vectors and the illumination direction, and generate surface depth information; S32: Based on the interference region mask, perform phase compensation processing on the eddy current complex impedance signal, and dynamically adjust the imaginary part offset of the complex domain in the mask marking area in combination with the surface depth value to generate a phase-corrected electromagnetic signal. S33: Based on the interference region mask, perform curvature analysis processing on the optical grayscale image, and extract the local absolute curvature distribution in the mask-marked region using the Laplacian operator to generate a grayscale distortion intensity map. S34: Spatial integration processing is performed on the phase-corrected electromagnetic signal and the grayscale distortion intensity map. The compensated signal and the suppressed image are combined at the mask mark position to generate physical field decoupling data containing decoupled electromagnetic signals and decoupled optical images. The physical field decoupling data is used to indicate the electromagnetic-optical joint detection signal after eliminating cross-physical field interference.
6. The method according to claim 1, characterized in that, S4 includes: S41: Perform real and imaginary part separation processing on the decoupled electromagnetic signal of the physical field decoupling data, extract the real part matrix and imaginary part matrix as dual-channel input, and generate electromagnetic impedance characteristics; S42: Perform multi-scale feature extraction processing on the decoupled optical image of the physical field decoupling data, capture texture patterns of different receptive fields through dilated convolution, and generate optical texture features; S43: Perform cross-modal correlation processing on the electromagnetic impedance features and the optical texture features, calculate the cosine similarity matrix between feature maps, and generate modal interaction weights; S44: Adaptive fusion processing is performed on the modal interaction weights, and electromagnetic impedance features and optical texture features are weighted and spliced according to a preset weight ratio to generate a fused feature tensor. The fused feature tensor is used to indicate the defect-sensitive feature expression of cross-physical field joint.
7. The method according to any one of claims 1-6, characterized in that, S5 includes: S51: Perform heatmap generation processing on the fused feature tensor, and restore the original resolution space of the feature map by transpose convolution to generate a defect probability distribution heatmap. S52: Perform region clustering processing on the defect probability distribution heatmap, and use connected component analysis to extract continuous regions with a probability higher than a preset threshold to generate candidate abnormal regions; S53: Extract geometric features from the candidate abnormal regions, calculate the region area, aspect ratio and contour curvature, and generate morphological feature vectors; S54: Perform defect classification processing on the morphological feature vector, and generate a defect detection result containing defect type and coordinate set by matching the geometric feature distribution of standard defects in the preset defect template library through a fully connected layer.
8. A metal surface defect identification device based on artificial intelligence, characterized in that, The device includes: The gradient feature extraction module is used to acquire the eddy current complex impedance signal and optical grayscale image of the metal under test based on the eddy current sensor and industrial camera, and to extract the gradient features of the eddy current complex impedance signal to generate an electromagnetic gradient mode. The coupling interference quantization module is used to perform coupling interference quantization on the electromagnetic gradient mode and the optical grayscale image, calculate the cross-physical field interference intensity of shadow distortion and edge superposition, and generate an interference region mask. The physical field decoupling module is used to perform physical field decoupling on the eddy current complex impedance signal and the optical grayscale image based on the interference region mask, and generate physical field decoupling data containing the decoupled electromagnetic signal and the decoupled optical image. The multimodal feature fusion module is used to perform multimodal feature fusion on the physical field decoupled data, and calls a dual-branch neural network to perform cross-modal correlation extraction of electromagnetic impedance features and optical texture features to generate a fused feature tensor. The defect decision module is used to make defect decisions on the fused feature tensor, analyze the defect probability heatmap distribution and locate the coordinates of abnormal areas, and generate defect detection results containing defect types and coordinate sets.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 7.