Method and system for online defect detection of metal workpieces based on impedance spectroscopy analysis

By combining multi-mode excitation sequences and adaptive frequency sweeping strategies with deep learning models, the lack of automation and intelligence in the existing technology for defect detection of metal processing parts is solved, realizing rapid and accurate online defect identification and classification, and improving detection efficiency and quality reliability.

CN122238440APending Publication Date: 2026-06-19JIANGSU HAORAN NEW MATERIAL CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
JIANGSU HAORAN NEW MATERIAL CO LTD
Filing Date
2026-04-16
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Existing methods for detecting defects in metal parts are difficult to achieve high-speed, continuous online monitoring, and have low levels of automation and intelligence, making it difficult to achieve rapid and accurate defect identification and classification.

Method used

By employing a multi-mode excitation sequence and an adaptive frequency sweeping strategy, multiple impedance spectrum data most relevant to defects are acquired within an extremely short online detection time window. A deep learning model is then applied to intelligently analyze the impedance spectrum data and output defect identification results.

Benefits of technology

It enables rapid and accurate defect detection of metal parts, improves detection efficiency and automation and intelligence levels, and ensures the quality and reliability of metal parts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122238440A_ABST
    Figure CN122238440A_ABST
Patent Text Reader

Abstract

This invention discloses an online defect detection method and system for metal parts based on impedance spectroscopy analysis, relating to the field of metal parts inspection technology. The method, based on an adaptive frequency sweep strategy, sequentially performs real-time broadband linear scanning, multi-frequency high-density clustering scanning, and instantaneous pulse excitation and response acquisition on the metal parts on the production line to acquire workpiece impedance spectroscopy data. The pre-processed workpiece impedance spectroscopy data is input into a pre-trained defect detection model. Wavelet frequency-enhanced attention and prototype-guided attention are employed, and dynamic queries for mask prediction are generated by combining frequency and spatial domain information. Physical constraints are added to the loss function. Based on this physically-enhanced data-driven process, the model outputs defect classification and location prediction results for the metal parts. This method solves the problems of existing defect detection methods relying on manual feature extraction and empirical model building, resulting in low levels of automation and intelligence, and improves the efficiency and accuracy of metal parts defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of metal processing inspection technology, and in particular to an online defect detection method and system for metal processing based on impedance spectroscopy analysis. Background Technology

[0002] In the metal processing and manufacturing industry, the quality of the internal and surface of workpieces is the core factor determining product performance, safety, and reliability. Defects introduced during processing, including cracks, porosity, inclusions, and uneven structure, are the main causes of early workpiece failure. Therefore, efficient, accurate, and reliable online defect detection technology is a key link in ensuring the quality of metal processed parts, realizing closed-loop process control, and improving production efficiency, so as to achieve predictive early failure prediction and health management and reduce production costs.

[0003] Existing methods for detecting defects in metal parts include ultrasonic testing, radiographic testing, eddy current testing, and penetrant testing. These methods utilize physical, chemical, and optical principles to detect defects by analyzing acoustic wave characteristics, optical imaging, and chemical reaction results. However, these methods require high surface finish on the workpiece, have relatively slow testing speeds, are susceptible to interference from various factors, and are difficult to achieve high-speed, continuous online monitoring on production lines. Furthermore, existing testing methods have difficulty detecting workpieces with complex shapes, and the accuracy of the test results depends on the operator's experience.

[0004] Electrically based detection methods have attracted widespread attention due to their non-contact, rapid, and sensitive characteristics to the electromagnetic properties of metallic materials. Their core lies in measuring various electrical parameters of metal parts, which are directly related to the microstructure of the metallic materials. Impedance spectroscopy analysis classifies and identifies defects based on the characteristic impedance changes in different frequency bands caused by different defects. However, impedance spectroscopy data is high-dimensional and complex. Traditional methods rely on manual feature extraction and the establishment of empirical models, resulting in low levels of automation and intelligence, making it difficult to achieve rapid and accurate defect identification and classification. Summary of the Invention

[0005] To address the technical problems of the prior art, this application provides an online defect detection method and system for metal parts based on impedance spectroscopy analysis. By using a multi-mode excitation sequence and an adaptive frequency sweep strategy, the method maximizes the acquisition of multiple impedance spectral data most relevant to defects within an extremely short online detection time window. Furthermore, it applies a deep learning model to intelligently analyze the impedance spectral data and outputs defect identification results, thereby improving defect detection efficiency.

[0006] This application provides an online defect detection method for metal parts based on impedance spectroscopy analysis, including:

[0007] (1) After the metal workpiece is transported to the inspection station and positioned, a preliminary broadband scan is performed on the workpiece to obtain the first impedance spectrum data of the workpiece. The data is then compared with the basic response template to generate an adaptive frequency sweep strategy. (2) Based on the generated frequency sweeping strategy, perform broadband linear scanning, multi-frequency high-density focusing scanning, and instantaneous pulse excitation and response acquisition on the current metal workpiece in sequence to obtain the second impedance spectrum data of the workpiece and mark it with a unified timestamp and spatial location label; (3) Input the pre-processed second impedance spectrum data into the pre-trained defect detection model, use wavelet frequency-enhanced attention and prototype-guided attention, combine frequency domain and spatial domain information to generate dynamic query for mask prediction, and add physical constraints to the loss function. Based on the data-driven process of physical enhancement, the model outputs the defect classification and location prediction results of metal processing parts.

[0008] Furthermore, the essence of impedance spectroscopy analysis is to study the polarization and conduction behavior of metal parts under the action of alternating electric fields. Defects in metals, including cracks, pores, inclusions and uneven structure, will change the local or overall conductivity and dielectric properties of the workpiece, and exhibit specific defect characteristics in the macroscopic impedance response. Apply an angular frequency of to the tested metal workpiece. sinusoidal voltage Measure the current it generates Calculate the complex impedance of a machined metal part. :

[0009] in, and These represent the amplitudes of the voltage and current signals, respectively. and These represent the initial phases of the voltage and current signals, respectively. For complex units, Indicates a time index. This represents the magnitude of the complex impedance. This represents the phase difference between the voltage and current signals; The real part of a complex impedance corresponds to the resistive component of a machined metal part. Cracks and defects impede current, leading to... Increase; This represents the imaginary part of the complex impedance, corresponding to the capacitive component of the machined metal part. Non-conductive inclusions can cause interface polarization, leading to... An arc-shaped feature appears; Based on this, the impedance spectrum of a metal workpiece can be described by an equivalent circuit model, expressed as resistance. With capacitor Parallel connection:

[0010] in, Simulate the ease of carrier conduction in metallic materials. The ability of metallic materials to store charge is simulated and represented as the capacitance effect formed at the interface between defects in metal parts and the matrix. In the Nyquist plot, a single A parallel circuit is represented by a semicircle. and These represent the frequency and angular frequency corresponding to the vertex of the semicircle, respectively. Below, the polarization process of metallic materials is most active, and the imaginary part... Reaching its maximum value; defects in machined metal parts can alter the relaxation process within the metal material, changing... This is the key basis for identifying defects through impedance spectroscopy.

[0011] Furthermore, a preliminary broadband scan is performed on the workpiece. An excitation signal is output through a programmable signal generator, and the metal workpiece is swept across a series of discrete frequency points. Distributed on a logarithmic coordinate system, it can be expressed by the formula:

[0012] in, Indicates the index of the scan frequency point. and These represent the start and end frequencies, respectively. This indicates the total number of frequency points in a wideband scan. Indicates the frequency sweep interval; in Time of the first At each frequency point, the analog excitation signal generated by the signal generator Represented as:

[0013] in, Represents the signal waveform. For preset amplitude, It is the initial phase of the signal source; this signal is applied to the input of the transimpedance amplifier and converted into current excitation and voltage excitation applied to the metal workpiece; Based on the acquired current and voltage signals, the first impedance spectrum data of the workpiece at each discrete frequency point is calculated, forming an impedance spectrum vector. , The complex impedance of the machined metal part is represented by the impedance spectrum vector obtained from the initial scan, which is then compared with the standard spectrum. In comparison, the standard spectrum was obtained by performing a broadband frequency sweep on the target metal workpiece under defect-free conditions in a laboratory environment; the correlation coefficient was used. and normalized root mean square error As a measure of difference, comparison and :

[0014]

[0015] in, Represents the covariance function. and They represent and standard deviation The complex impedance representing a standard, defect-free machined metal part; and These represent the functions for finding the maximum and minimum values, respectively. The degree of defect in the current workpiece is determined by setting the thresholds for correlation coefficient and normalized root mean square error. The adaptive frequency sweeping strategy is divided into four categories: standard fast scanning, global fine scanning, sensitive frequency band focused scanning, and comprehensive depth scanning. The strategy is selected based on the comparison results. Different proportions of resource allocation weights are set for wideband linear scanning, multi-frequency point high-density focused scanning, and instantaneous pulse excitation. Different detection times are set for multi-mode frequency sweeping.

[0016] Furthermore, based on the generated adaptive frequency sweep strategy and according to the scan time set within the strategy, the relevant parameters of the signal generator are modified, and a wideband linear scan is performed again on the current metal workpiece to acquire voltage and current signals and calculate each discrete frequency point. Full-band impedance spectrum ; Secondly, considering that the impedance transformation caused by specific types of defects is most significant only within a narrow frequency band, wideband linear scanning has fewer sampling frequency points within this band, resulting in detailed features being overwhelmed by noise and insufficient sampling; therefore, based on the first impedance spectrum in step (1) Compared with standard spectrum Calculate frequency points Local deviation Identify sensitive frequency bands:

[0017] Find all that satisfy Sensitive frequency points ,in and Let these represent functions for calculating the mean and standard deviation, respectively. This is the sensitivity coefficient; the sampling frequency is greater than the sampling frequency in wideband linear scanning, focusing adjacent frequency points to form the sensitive frequency band to be finely scanned; A high-density, multi-frequency focused scan of the current metal workpiece is performed within the sensitive frequency band, and a high-resolution local impedance spectrum is calculated for each frequency point using a multiple averaging method. After averaging, measurement noise is suppressed, allowing subtle features of the impedance spectrum within this frequency band to be clearly captured. Finally, a transient pulse excitation, namely a rapid current step pulse, is applied to the current metal workpiece. , Indicates amplitude. It is a unit step function; the transient voltage decay curve across the workpiece is measured. This feature is highly sensitive to the detection of non-conductive inclusions and delamination defects. A fast Fourier transform is performed on the curve to convert it into impedance spectrum information. It fills the information gap in the frequency band below 0.01Hz during wideband scanning, adapting to the slow polarization process caused by defects; full-band impedance spectrum. High-resolution local impedance spectroscopy and transient response impedance spectrum Together they constitute the second impedance spectrum data.

[0018] Furthermore, the real and imaginary parts of each impedance feature in the second impedance spectrum data are concatenated to form a one-dimensional space tensor, which serves as the input feature for the defect detection model. This input feature is then fed into a visual backbone network based on a one-dimensional feature pyramid to extract multi-resolution features. , , and The feature sizes are 1 / 4, 1 / 8, 1 / 16, and 1 / 32 of the original input features, respectively. It generates learnable query vectors through Transformer for defect classification and localization; and incorporates features... , and The parameters of the query vector are updated by feeding them into a dual-domain decoder. In each decoder, wavelet frequency-enhanced cross-attention (WCA) and prototype-guided attention (PCA) aggregate important features in the frequency and spatial domains, respectively, to update the query; and a self-attention layer captures global relationships in the query vector to enrich the query representation.

[0019] Wavelet frequency-enhanced cross-attention first decomposes the features into different frequency components using wavelet transform, preserving the defect location information within the features to obtain high-frequency and low-frequency features. In the frequency domain, the high-frequency components contain rich boundary details, presenting detailed information in the horizontal, vertical, and diagonal directions, which is beneficial for detecting weak defects. Secondly, the global and local channel dependencies between different frequency components are utilized to modulate the high-frequency features. The high-frequency features and low-frequency features are added together and then fed into the multi-scale context module to generate channel weights. The high-frequency features are then weighted and balanced. The global channel weights suppress noise in the feature channels by learning global dependencies, while the local channel weights suppress noise in the feature space pixels by learning local dependencies. The modulated high-frequency features are combined with low-frequency features as key and value vectors in the attention mechanism, and the query vector is updated through a cross-attention layer.

[0020] At the spatial domain level, the perfect pairwise spatial similarity in the standard cross-attention mechanism leads to redundant information. Therefore, the prototype-guided attention mechanism in the dual-domain decoder reduces redundant spatial information in features from two dimensions: The input features are first fed into a depthwise separable convolutional layer for prototype learning, flattening the features into a sequence format. Prototype weights are generated through a linear layer, and after Softmax normalization, a global prototype vector is generated. Next, the prototype vector and the query vector are weighted and fused through a multi-scale context module. The multi-scale channel weights enable the query vector to focus on the global and local spatial relationships between the query vector and the prototype. Finally, after residual connections and layer normalization, a globally enhanced query vector is obtained. The query vector, after wavelet frequency-enhanced cross-attention and prototype-guided attention calibration, is summed element-wise, and then processed through spatial attention and residual connections to obtain the final query vector used for mask prediction. In the detection head, the query vector guides and decodes features. The mapping output mask features are used to predict the defect features and locations of metal parts. The prediction results from each detection head are weighted and averaged to calculate the binary cross-entropy loss and cross-union ratio loss, with physical constraints added to the loss function.

[0021] in, Represents the total loss function. Indicates the first Defect mask predicted by each detection head. This represents the true label corresponding to the training sample. and These are the weighting coefficients. This represents the sum of the binary cross-entropy loss and the IoU loss. For physical constraints, This is a forward model for finite element simulation, simulating the impedance response corresponding to the defect mask. The input features of the model are the actual measured second impedance spectrum data. The L2 norm is used to represent the L2 norm. The internal parameters of the model are updated by backpropagation based on the gradient of the loss function, and the parameters with the best performance are selected as the pre-trained defect detection model.

[0022] This application also provides an online defect detection system for machined metal parts based on impedance spectroscopy analysis, including: Adaptive frequency sweep strategy generation module: After the metal workpiece is transported to the inspection station and positioned, the module performs a preliminary broadband scan of the workpiece to obtain the first impedance spectrum data of the workpiece, compares it with the basic response template, and generates an adaptive frequency sweep strategy. Multi-mode impedance spectrum data acquisition module: It is used to perform broadband linear scanning, multi-frequency high-density focusing scanning, and instantaneous pulse excitation and response acquisition on the current metal workpiece according to the generated frequency sweeping strategy, to obtain the second impedance spectrum data of the workpiece, and to mark it with a unified timestamp and spatial location label; The online intelligent detection module for workpiece defects is used to input the pre-processed second impedance spectrum data into the pre-trained defect detection model. It uses wavelet frequency-enhanced attention and prototype-guided attention, combines frequency domain and spatial domain information to generate dynamic queries for mask prediction, and adds physical constraints to the loss function. Based on the data-driven process of physical enhancement, the model outputs the defect classification and location prediction results of metal processing parts.

[0023] This application discloses the following technical effects: This application proposes an online defect detection system for metal parts based on impedance spectroscopy analysis. Without requiring system downtime, an adaptive frequency sweep strategy is employed to apply excitation signals to the metal parts for multi-mode frequency sweeping, focusing on sensitive frequency bands and acquiring various impedance spectral data in real time. This enriches the diversity of workpiece impedance characteristics, preventing minute defect features from being buried in noise and providing comprehensive data support for subsequent defect detection. Furthermore, a deep learning-based defect detection model is applied, mapping impedance spectral features to the frequency and spatial domains. Wavelet frequency-enhanced cross-attention and prototype-guided self-attention are used to update the query vector, effectively capturing the global and local relationships of features, generating accurate mask predictions, identifying defect types in the metal parts, and locating defect positions. In addition, during model training, a loss function incorporating physical constraints is used to update model parameters, comprehensively considering the physical principles of metal part defect characterization, guiding the model to learn and predict accurate defect information, and achieving early fault prediction and health management of metal parts. The method proposed in this application improves the efficiency of online defect detection for metal parts, enhances the automation and intelligence of detection, and ensures the quality and reliability of metal parts. Attached Figure Description

[0024] Figure 1 This is a flowchart illustrating an online defect detection method for metal parts based on impedance spectroscopy analysis, provided in an embodiment of this application.

[0025] Figure 2 This is a schematic diagram of the defect detection model provided in an embodiment of this application.

[0026] Figure labels: FPN represents Feature Pyramid Network; SA represents Spatial Attention Mechanism.

[0027] Figure 3 This is a schematic diagram of an online defect detection system for metal parts based on impedance spectroscopy analysis, provided as an embodiment of this application. Detailed Implementation

[0028] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description of this application will be provided in conjunction with the accompanying drawings. The described embodiments should not be considered as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0029] Example 1: This application provides an online defect detection method for metal parts based on impedance spectroscopy analysis, such as... Figure 1 As shown, the method includes: Step S10: After the metal workpiece is transported to the inspection station and positioned, a preliminary broadband scan is performed on the workpiece to obtain the first impedance spectrum data of the workpiece. The data is then compared with the basic response template to generate an adaptive frequency sweep strategy.

[0030] In this embodiment, a preliminary broadband scan of the workpiece is performed. An excitation signal is output through a programmable signal generator, and the metal workpiece is swept across a series of discrete frequency points. Distributed on a logarithmic coordinate system, it can be expressed by the formula:

[0031] in, Indicates the index of the scan frequency point. and These represent the start and end frequencies, respectively. This indicates the total number of frequency points in a wideband scan. Indicates the frequency sweep interval; in Time of the first At each frequency point, the analog excitation signal generated by the signal generator Represented as:

[0032] in, Represents the signal waveform. For preset amplitude, It is the initial phase of the signal source; this signal is applied to the input of the transimpedance amplifier and converted into current excitation and voltage excitation applied to the metal workpiece; Based on the acquired current and voltage signals, the first impedance spectrum data of the workpiece at each discrete frequency point is calculated, forming an impedance spectrum vector. , The complex impedance of the machined metal part is represented by the impedance spectrum vector obtained from the initial scan, which is then compared with the standard spectrum. In comparison, the standard spectrum was obtained by performing a broadband frequency sweep on the target metal workpiece under defect-free conditions in a laboratory environment; the correlation coefficient was used. and normalized root mean square error As a measure of difference, comparison and :

[0033]

[0034] in, Represents the covariance function. and They represent and standard deviation The complex impedance representing a standard, defect-free machined metal part; and These represent the functions for finding the maximum and minimum values, respectively. The degree of defect in the current workpiece is determined by setting the thresholds for correlation coefficient and normalized root mean square error. The adaptive frequency sweeping strategy is divided into four categories: standard fast scanning, global fine scanning, sensitive frequency band focused scanning, and comprehensive depth scanning. The strategy is selected based on the comparison results. Different proportions of resource allocation weights are set for wideband linear scanning, multi-frequency point high-density focused scanning, and instantaneous pulse excitation. Different detection times are set for multi-mode frequency sweeping.

[0035] Step S20: According to the generated frequency sweeping strategy, perform broadband linear scanning, multi-frequency high-density focusing scanning, and instantaneous pulse excitation and response acquisition on the current metal workpiece in sequence to obtain the second impedance spectrum data of the workpiece and mark it with a unified timestamp and spatial location label.

[0036] In this embodiment, based on the generated adaptive frequency sweep strategy and according to the scan time set within the strategy, the relevant parameters of the signal generator are modified, and a wideband linear scan is performed again on the current metal workpiece to collect voltage data. and current The signal is calculated at each discrete frequency point. Full-band impedance spectrum :

[0037] in, and These represent the amplitudes of the voltage and current signals, respectively. and These represent the initial phases of the voltage and current signals, respectively. For complex units, Indicates a time index. This represents the magnitude of the complex impedance. This represents the phase difference between the voltage and current signals; The real part of a complex impedance corresponds to the resistive component of a machined metal part. Cracks and defects impede current, leading to... Increase; This represents the imaginary part of the complex impedance, corresponding to the capacitive component of the machined metal part. Non-conductive inclusions can cause interface polarization, leading to... An arc-shaped feature appears; Secondly, considering that the impedance transformation caused by certain types of defects is most significant only within a narrow frequency band, wideband linear scanning has few sampling frequency points within this band, resulting in detailed features being overwhelmed by noise and insufficient sampling; therefore, based on the first impedance spectrum data obtained in step S10... , and standard spectrum Calculate frequency points Local deviation Identify sensitive frequency bands:

[0038] Find all that satisfy Sensitive frequency points ,in and Let these represent functions for calculating the mean and standard deviation, respectively. This is the sensitivity coefficient; the sampling frequency is greater than the sampling frequency in wideband linear scanning, focusing adjacent frequency points to form the sensitive frequency band to be finely scanned; A high-density, multi-frequency focused scan of the current metal workpiece is performed within the sensitive frequency band, and a high-resolution local impedance spectrum is calculated for each frequency point using a multiple averaging method. After averaging, measurement noise is suppressed, allowing subtle features of the impedance spectrum within this frequency band to be clearly captured. Finally, a transient pulse excitation, namely a rapid current step pulse, is applied to the current metal workpiece. , Indicates amplitude. It is a unit step function; the transient voltage decay curve across the workpiece is measured. This feature is highly sensitive to the detection of non-conductive inclusions and delamination defects. A fast Fourier transform is performed on the curve to convert it into impedance spectrum information. It fills the information gap in the frequency band below 0.01Hz during wideband scanning, adapting to the slow polarization process caused by defects; full-band impedance spectrum. High-resolution local impedance spectroscopy and transient response impedance spectrum Together they constitute the second impedance spectrum data.

[0039] Step S30: Input the preprocessed second impedance spectrum data into the pre-trained defect detection model, use wavelet frequency-enhanced attention and prototype-guided attention, combine frequency domain and spatial domain information to generate dynamic queries for mask prediction, and add physical constraints to the loss function. Based on the data-driven process of physical enhancement, the model outputs the defect classification and location prediction results of the metal processing parts.

[0040] In this embodiment, the real and imaginary parts of each impedance feature in the second impedance spectrum data are concatenated to form a one-dimensional space tensor, which serves as the input feature of the defect detection model. The input feature is first fed into a visual backbone network based on a one-dimensional feature pyramid to extract multi-resolution features. , , and The feature sizes are 1 / 4, 1 / 8, 1 / 16, and 1 / 32 of the original input features, respectively. It generates learnable query vectors through Transformer for defect classification and localization; and incorporates features... , and The parameters of the query vector are updated by feeding them into a dual-domain decoder. In each decoder, wavelet frequency-enhanced cross-attention (WCA) and prototype-guided attention (PCA) are employed to aggregate important features in the frequency and spatial domains, respectively, to update the query. Wavelet frequency-enhanced cross-attention first decomposes the features into different frequency components using wavelet transform, preserving the defect location information within the features to obtain high-frequency and low-frequency features. In the frequency domain, the high-frequency components contain rich boundary details, presenting detailed information in the horizontal, vertical, and diagonal directions, which is beneficial for detecting weak defects. Secondly, the global and local channel dependencies between different frequency components are utilized to modulate the high-frequency features. The high-frequency features and low-frequency features are added together and then fed into the multi-scale context module to generate channel weights. The high-frequency features are then weighted and balanced. The global channel weights suppress noise in the feature channels by learning global dependencies, while the local channel weights suppress noise in the feature space pixels by learning local dependencies. The modulated high-frequency features are combined with low-frequency features as key and value vectors in the attention mechanism, and the query vector is updated through a cross-attention layer.

[0041] At the spatial domain level, the perfect pairwise spatial similarity in the standard cross-attention mechanism leads to redundant information. Therefore, the prototype-guided attention mechanism in the dual-domain decoder reduces redundant spatial information in features from two dimensions: The input features are first fed into a depthwise separable convolutional layer for prototype learning, flattening the features into a sequence format. Prototype weights are generated through a linear layer, and after Softmax normalization, a global prototype vector is generated. Next, the prototype vector and the query vector are weighted and fused through a multi-scale context module. The multi-scale channel weights enable the query vector to focus on the global and local spatial relationships between the query vector and the prototype. Finally, after residual connections and layer normalization, a globally enhanced query vector is obtained. The query vector, after wavelet frequency-enhanced cross-attention and prototype-guided attention calibration, is summed element-wise, and then processed through spatial attention and residual connections to obtain the final query vector used for mask prediction. In the detection head, the query vector guides and decodes features. The system outputs mask features after mapping to predict the defect features and locations of metal parts. The prediction results from each detection head are weighted and averaged to calculate the binary cross-entropy loss and cross-union ratio loss, with physical constraints added to the loss function.

[0042] in, Represents the total loss function. Indicates the first Defect mask predicted by each detection head. This represents the true label corresponding to the training sample. and These are the weighting coefficients. This represents the sum of the binary cross-entropy loss and the IoU loss. For physical constraints, This is a forward model for finite element simulation, simulating the impedance response corresponding to the defect mask. The input features of the model are the actual measured second impedance spectrum data. The L2 norm is used to represent the L2 norm. The internal parameters of the model are updated by backpropagation based on the gradient of the loss function, and the parameters with the best performance are selected as the pre-trained defect detection model.

[0043] Example 2: The online defect detection system for metal parts based on impedance spectroscopy analysis provided in this embodiment of the invention can execute the online defect detection method for metal parts based on impedance spectroscopy analysis provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method, such as... Figure 3 As shown, it includes the following modules: Adaptive frequency sweep strategy generation module: After the metal workpiece moves to the detection station and completes the positioning, it performs a broadband coarse frequency sweep on the workpiece to obtain the first impedance spectrum data of the workpiece, compares it with the corresponding basic template, and generates an adaptive frequency sweep strategy. Multi-mode impedance spectrum data acquisition module: It is used to perform broadband linear scanning, multi-frequency high-density focusing scanning, and instantaneous pulse excitation and response acquisition on the current metal workpiece according to the generated frequency sweeping strategy, to obtain the second impedance spectrum data of the workpiece, and to mark it with a unified timestamp and spatial location label; The online intelligent detection module for workpiece defects is used to input the pre-processed second impedance spectrum data into the pre-trained defect detection model. It adopts wavelet frequency-enhanced attention and prototype-guided attention, combines frequency domain and spatial domain information to generate dynamic queries for mask prediction, and adds physical constraints to the loss function to achieve physical enhancement data-driven processing. It outputs the defect classification and location results of the metal processing parts.

[0044] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application. In some cases, the actions or steps described in this application can be performed in a different order than that shown in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

Claims

1. An online defect detection method for metal parts based on impedance spectroscopy analysis, characterized in that, The method includes: (1) After the metal workpiece is transported to the inspection station and positioned, a preliminary broadband scan is performed on the workpiece to obtain the first impedance spectrum data of the workpiece. The data is then compared with the basic response template to generate an adaptive frequency sweep strategy. (2) Based on the generated frequency sweeping strategy, perform broadband linear scanning, multi-frequency high-density focusing scanning, and instantaneous pulse excitation and response acquisition on the current metal workpiece in sequence to obtain the second impedance spectrum data of the workpiece and mark it with a unified timestamp and spatial location label; (3) Input the pre-processed second impedance spectrum data into the pre-trained defect detection model, use wavelet frequency-enhanced attention and prototype-guided attention, combine frequency domain and spatial domain information to generate dynamic query for mask prediction, and add physical constraints to the loss function. Based on the data-driven process of physical enhancement, the model outputs the defect classification and location prediction results of metal processing parts.

2. The online defect detection method for metal parts based on impedance spectroscopy analysis as described in claim 1, characterized in that, In step (1), a preliminary broadband scan is performed on the metal workpiece. An excitation signal is output through a programmable signal generator, and the metal workpiece is swept at a series of discrete frequency points. Distributed on a logarithmic coordinate system, it can be expressed by the formula: in, Indicates the index of the scan frequency point. and These represent the start and end frequencies, respectively. This indicates the total number of frequency points in a wideband scan. Indicates the frequency sweep interval; exist Time of the first At each frequency point, the analog excitation signal generated by the signal generator Represented as: in, Represents the signal waveform. For preset amplitude, It is the initial phase of the signal source; this signal is applied to the input of the transimpedance amplifier and converted into current excitation and voltage excitation applied to the metal workpiece.

3. The online defect detection method for metal parts based on impedance spectroscopy analysis as described in claim 2, characterized in that, Based on the current excitation and voltage excitation, the first impedance spectrum data of the workpiece at each discrete frequency point is calculated, forming an impedance spectrum vector. , and standard spectrum In comparison, the standard spectrum was obtained by broadband scanning of the target metal workpiece in a defect-free state under laboratory conditions. The correlation coefficient and normalized root mean square error were used as measures of difference to compare... and Set thresholds for correlation coefficient and normalized root mean square error to determine the degree of defect in the current workpiece; The adaptive frequency sweeping strategy is divided into four categories: standard fast scanning, global fine scanning, sensitive frequency band cluster scanning, and comprehensive depth scanning. The strategy is selected based on the comparison results. Different proportions of resource allocation weights are set for wideband linear scanning, multi-frequency point high-density cluster scanning, and instantaneous pulse excitation. Different detection times are set for multi-mode frequency sweeping.

4. The online defect detection method for metal parts based on impedance spectroscopy analysis as described in claim 1, characterized in that, In step (2), based on the generated adaptive frequency sweep strategy, the relevant parameters of the signal generator are modified according to the scan time set in the strategy, and a wideband linear scan is performed on the current metal workpiece again to collect voltage data. and current The signal is calculated at each discrete frequency point. Full-band impedance spectrum : in, and These represent the amplitudes of the voltage and current signals, respectively. and These represent the initial phases of the voltage and current signals, respectively. For complex units, Indicates a time index. This represents the magnitude of the complex impedance. This represents the phase difference between the voltage and current signals; The real part of a complex impedance. It represents the imaginary part of a complex impedance.

5. The online defect detection method for metal parts based on impedance spectroscopy analysis as described in claim 1, characterized in that, In step (2), the frequency points are calculated based on the first impedance spectrum data and the standard spectrum from step (1). Local deviation Identify sensitive frequency bands: Find all that satisfy Sensitive frequency points ,in and Let these represent the mean and standard deviation functions, respectively. This is the sensitivity coefficient. and The complex expressions for the first impedance spectrum and the standard spectrum are respectively used to focus adjacent frequency points and form a sensitive frequency band to be finely scanned; A high-density, multi-frequency focused scan of the current metal workpiece is performed within the sensitive frequency band, and the local impedance spectrum of each frequency point is calculated using a multiple averaging method. , Indicates the sensitive frequency points; Apply a transient pulse excitation, i.e., a rapid current step pulse, to the current workpiece. , Indicates amplitude. It is a unit step function; the transient voltage decay curve across the workpiece is measured. This feature is highly sensitive to the detection of non-conductive inclusions and delamination defects. A fast Fourier transform is performed on the curve to convert it into impedance spectrum information. It fills the information gap in the frequency band of wideband scanning at frequencies less than 0.01Hz and adapts to the slow polarization process caused by defects.

6. The online defect detection method for metal parts based on impedance spectroscopy analysis as described in claim 1, characterized in that, In step (3), the real and imaginary parts of each impedance feature of the second impedance spectrum data are concatenated to form a one-dimensional space tensor, which serves as the input feature of the defect detection model. The input feature is first fed into a visual backbone network based on a one-dimensional feature pyramid to extract multi-resolution features. , , and The feature sizes are 1 / 4, 1 / 8, 1 / 16, and 1 / 32 of the original input features, respectively. It generates learnable query vectors through Transformer for defect classification and localization; and incorporates features... , and The data are fed into a dual-domain decoder to update the parameters of the query vector.

7. The online defect detection method for metal parts based on impedance spectroscopy analysis as described in claim 6, characterized in that, The dual-domain decoder employs wavelet frequency-enhanced cross-attention (WCA) and prototype-guided attention (PCA) to aggregate important features in the frequency and spatial domains, respectively, to update the query vector. Wavelet frequency-enhanced cross-attention decomposes features into different frequency components using wavelet transform, while preserving defect location information within the features. The decomposed features are then fed into a multi-scale context module to generate channel weights, which are then used for weighted balancing of the features. Global channel weights suppress noise in feature channels by learning global dependencies, while local channel weights suppress noise in feature space pixels by learning local dependencies. The modulated features are used as key and value vectors in the attention mechanism, and the query vector is updated through a cross-attention layer. Prototype-guided attention reduces redundant spatial information in features from two dimensions. Features are first fed into a depthwise separable convolutional layer for prototype learning, flattening the features into a sequence format. Prototype weights are generated through a linear layer and then normalized by Softmax to generate a global prototype vector. Secondly, the prototype vector and the query vector are weighted and fused through a multi-scale context module. The multi-scale channel weights enable the query vector to focus on the global and local spatial relationships between the query vector and the prototype. Finally, after residual connection and layer normalization, a globally enhanced query vector is obtained.

8. The online defect detection method for metal parts based on impedance spectroscopy analysis as described in claim 1, characterized in that, In step (3), physical constraints are added to the loss function to train the defect detection model: in, Represents the total loss function. In the model, the first Defect mask predicted by each detection head. This represents the true label corresponding to the training sample. and These are the weighting coefficients. This represents the sum of the binary cross-entropy loss and the IoU loss. For physical constraints, This is a forward model for finite element simulation, simulating the impedance response corresponding to the defect mask. The input features of the model are the actual measured second impedance spectrum data. The L2 norm is used to represent the L2 norm. The internal parameters of the model are updated by backpropagation based on the gradient of the loss function, and the parameters with the best performance are selected as the pre-trained defect detection model.

9. An online defect detection system for machined metal parts based on impedance spectroscopy analysis, characterized in that, The system is used to implement the online defect detection method for metal parts based on impedance spectroscopy analysis as described in any one of claims 1-8, and the system comprises: Adaptive frequency sweep strategy generation module: After the metal workpiece is transported to the inspection station and positioned, the module performs a preliminary broadband scan of the workpiece to obtain the first impedance spectrum data of the workpiece, compares it with the basic response template, and generates an adaptive frequency sweep strategy. Multi-mode impedance spectrum data acquisition module: It is used to perform broadband linear scanning, multi-frequency high-density focusing scanning, and instantaneous pulse excitation and response acquisition on the current metal workpiece according to the generated frequency sweeping strategy, to obtain the second impedance spectrum data of the workpiece, and to mark it with a unified timestamp and spatial location label; The online intelligent detection module for workpiece defects is used to input the pre-processed second impedance spectrum data into the pre-trained defect detection model. It uses wavelet frequency-enhanced attention and prototype-guided attention, combines frequency domain and spatial domain information to generate dynamic queries for mask prediction, and adds physical constraints to the loss function. Based on the data-driven process of physical enhancement, the model outputs the defect classification and location prediction results of metal processing parts.