A method and system for detecting cracks in a workpiece based on quantum measurements
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ANHUI HUASHENG TAILONG INTELLIGENT EQUIPMENT CO LTD
- Filing Date
- 2026-05-13
- Publication Date
- 2026-08-07
AI Technical Summary
[0005]本发明的目的就在于解决处理混合噪声,防止缺陷轮廓易断裂;且无法实现工件表面与内部裂缝的全维度、高精度探测的问题,而提出一种基于量子测量的加工工件裂缝探测方法及系统
本发明提出了一种基于量子测量的加工工件裂缝探测方法及系统,通过可见光图像,首先进行噪声类型判别和动态组合滤波处理,在有效保留细微缺陷边缘的前提下,利用形态学方法修复断裂的裂缝轮廓;接着,基于改进的ResNet18构建双通道表面裂缝模型,以提升表面裂缝的识别精度与定位能力。在此基础上,引入量子扫描与三维漏磁场反演技术,突破视觉检测的局限,准确获取内部裂缝的关键参数;最终将表面与内部裂缝的检测结果进行互补融合,实现对加工工件表面及内部裂缝的全方位、高精度探测,全面增强裂缝检测的完整性。
Smart Images

Figure CN122524938A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of nondestructive testing technology, specifically relating to a method and system for detecting cracks in machined workpieces based on quantum measurement. Background Technology
[0002] Currently, visible light visual inspection technology is mainly used for crack detection in processed workpieces. It is a core means of industrial non-destructive testing and is widely used for surface defect identification and screening of metal processed parts. It is a key technical link to ensure the processing accuracy, structural safety and reliability of workpieces.
[0003] Existing detection methods first acquire visible light images of the workpiece, use a single filter, then extract defect contours through edge detection, and finally use traditional machine vision technology to identify and locate surface cracks; thereby improving the ability to detect cracks on the surface of processed workpieces.
[0004] However, in practical applications, it cannot effectively handle mixed noise, and it is easy to have incomplete noise reduction or blurred defect edges, and the defect contour is easy to break; moreover, it can only detect surface cracks and cannot accurately detect internal defects, thus failing to achieve full-dimensional, high-precision detection of surface and internal cracks of workpieces. Summary of the Invention
[0005] The purpose of this invention is to solve the problems of handling mixed noise, preventing the defect contour from easily breaking, and the inability to achieve full-dimensional, high-precision detection of cracks on the surface and inside of the workpiece. Therefore, a method and system for detecting cracks in machined workpieces based on quantum measurement is proposed.
[0006] In a first aspect of this invention, a method for detecting cracks in machined workpieces based on quantum measurement is first proposed, the method comprising: Acquire a visible light image of the target workpiece, and preprocess the visible light image to obtain a grayscale image; Multi-scale Canny edge detection is performed on the grayscale image to obtain a contour feature map; morphological optimization is performed on the contour feature map to obtain an enhanced edge map; Substituting the grayscale image and enhanced edge map into the dual-channel surface crack model yields the surface crack results. After performing a quantum scan on the target workpiece, a magnetic field distribution map is obtained; the internal crack result is obtained by inversion based on the magnetic field distribution map. The results of internal crack detection are corrected based on the surface crack results to obtain the final crack detection results.
[0007] Optionally, the preprocessing of the visible light image to obtain a grayscale image includes: Local statistical feature analysis is performed on the visible light image to obtain the mean gray level, gray level variance, and gray level extreme value of each local window; a noise type distribution window is generated based on the mean gray level, gray level variance, and gray level extreme value of each local window; the local window is a 3×3 square neighborhood region centered on the current pixel; the noise type distribution window is divided into an impulse noise window and a Gaussian noise window; After performing improved median filtering on all impulse noise windows and Gaussian filtering on all Gaussian noise windows, the images are integrated to obtain a grayscale image. The improved median filter is calculated using the following formula: in, This represents the filtered output pixel value of the current pixel in the local window. This represents all pixels in a local window. The average grayscale value of a local window. () represents the grayscale value of the current pixel. ( ) represents the weighted median of all pixels within a local window.
[0008] Optionally, the morphological optimization of the contour feature map to obtain the enhanced edge map includes: The specific formula for the morphological optimization is as follows: in, This represents the current pixel after shape optimization; Represents the contour feature map; This represents the preset linear feature weights. This represents the preset disk-shaped feature weights; Represents the dilation operator, Represents the erosion operator; This represents the set of pixels representing a scratch-like defect area. A set of pixels representing a blocky defect region.
[0009] Optionally, the dual-channel surface crack model is obtained based on an improved ResNet18 network, specifically through the following improvements: The input feature map of the ResNet18 network is replaced with a grayscale image and an enhanced edge image; the grayscale image and the enhanced edge image are fused to obtain the first feature map; After processing the first 17 layers, the output features are processed into feature maps with feature sizes of 1 / 8, 1 / 16, and 1 / 32. The feature maps with feature sizes of 1 / 8, 1 / 16, and 1 / 32 are then substituted into the global average pooling module to obtain the second feature map. The first feature map is then substituted into the fully connected module to obtain the output feature map.
[0010] Optionally, the step of correcting the internal crack results based on the surface crack results to obtain the final crack detection results includes: The location of each surface crack is determined based on the surface crack results, and the location of each internal crack is determined based on the internal crack results. Calculate the positional similarity values of each surface crack location and each internal crack location in turn; If the location similarity value is greater than the similarity threshold, the new crack location is obtained by correcting the surface crack location and the internal crack location corresponding to the location similarity value. The surface crack result and the internal crack result corresponding to the new crack location are then fused to obtain a new crack detection result. This indicates that the surface crack location and the internal crack location corresponding to the currently calculated location similarity value coincide. If the location similarity value is less than the similarity threshold, the surface crack location corresponding to the location similarity value is taken as the new crack location, and the surface crack result corresponding to the new crack location is determined as the new crack detection result; this indicates that the surface crack location and the internal crack location corresponding to the currently calculated location similarity value do not coincide. The final crack detection result is obtained by integrating all the new crack detection results.
[0011] In a second aspect of this invention, a quantum measurement-based crack detection system for machined workpieces is proposed, the system comprising: Grayscale image module: Acquires the visible light image of the target workpiece and preprocesses the visible light image to obtain a grayscale image; Edge detection module: Performs multi-scale Canny edge detection on grayscale images to obtain contour feature maps; Morphology optimization module: Performs morphological optimization on the contour feature map to obtain an enhanced edge map; Surface crack module: Substitutes grayscale images and enhanced edge maps into a dual-channel surface crack model to obtain surface crack results; Internal Crack Module: After performing quantum scanning on the target workpiece, a magnetic field distribution map is obtained; the internal crack result is obtained by inversion based on the magnetic field distribution map; Correction module: Corrects the internal crack results based on the surface crack results to obtain the final crack detection results.
[0012] Optionally, the grayscale image module includes: a noise type distribution module and a dynamic filtering module. The noise type distribution module is used to perform local statistical feature analysis on the visible light image to obtain the gray-level mean, gray-level variance, and gray-level extreme value of each local window; and to generate a noise type distribution window based on the gray-level mean, gray-level variance, and gray-level extreme value of each local window; the local window is a 3×3 square neighborhood region centered on the current pixel; the noise type distribution window is divided into an impulse noise window and a Gaussian noise window; The dynamic filtering module is used to perform improved median filtering on all impulse noise windows, and Gaussian filtering on all Gaussian noise windows, and then integrate them to obtain a grayscale image. The improved median filter is calculated using the following formula: in, This represents the filtered output pixel value of the current pixel in the local window. This represents all pixels in a local window. The average grayscale value of a local window. () represents the grayscale value of the current pixel. ( ) represents the weighted median of all pixels within a local window.
[0013] Optionally, the morphology optimization module is further used for: The specific formula for the morphological optimization is as follows: in, This represents the current pixel after shape optimization; Represents the contour feature map; This represents the preset linear feature weights. This represents the preset disk-shaped feature weights; Represents the dilation operator, Represents the erosion operator; This represents the set of pixels representing a scratch-like defect area. A set of pixels representing a blocky defect region.
[0014] Optionally, the surface crack module is also used for: The dual-channel surface crack model is derived from an improved ResNet18 network. The specific improvements are as follows: The input feature map of the ResNet18 network is replaced with a grayscale image and an enhanced edge image; the grayscale image and the enhanced edge image are fused to obtain the first feature map; After processing the first 17 layers, the output features are processed into feature maps with feature sizes of 1 / 8, 1 / 16, and 1 / 32. The feature maps with feature sizes of 1 / 8, 1 / 16, and 1 / 32 are then substituted into the global average pooling module to obtain the second feature map. The first feature map is then substituted into the fully connected module to obtain the output feature map.
[0015] Optionally, the correction module includes: a crack location acquisition module, a location similarity module, a first judgment module, a second judgment module, and an integration module. The crack location acquisition module is used to determine the location of each surface crack based on the surface crack results, and to determine the location of each internal crack based on the internal crack results. The position similarity module is used to sequentially calculate the position similarity values of each surface crack location and each internal crack location; The first judgment module is used to correct the surface crack position and the internal crack position corresponding to the position similarity value to obtain a new crack position if the position similarity value is greater than the similarity threshold, and to fuse the surface crack result and the internal crack result corresponding to the new crack position to obtain a new crack detection result. The second judgment module is used to determine the surface crack location corresponding to the location similarity value as the new crack location if the location similarity value is less than the similarity threshold, and to determine the surface crack result corresponding to the new crack location as the new crack detection result. The integration module is used to integrate all the new crack detection results to obtain the final crack detection result.
[0016] The beneficial effects of this invention are: This invention proposes a quantum measurement-based method and system for detecting cracks in machined workpieces. First, using visible light images, noise type discrimination and dynamic combined filtering are performed. While effectively preserving the edges of subtle defects, morphological methods are used to repair the fractured crack contour. Next, a dual-channel surface crack model is constructed based on an improved ResNet18 to enhance the recognition accuracy and localization capability of surface cracks. Building upon this, quantum scanning and three-dimensional leakage magnetic field inversion techniques are introduced to overcome the limitations of visual inspection and accurately obtain key parameters of internal cracks. Finally, the detection results of surface and internal cracks are complementary and fused to achieve comprehensive, high-precision detection of both surface and internal cracks in machined workpieces, thus significantly enhancing the completeness of crack detection. Attached Figure Description
[0017] The invention will now be further described with reference to the accompanying drawings.
[0018] Figure 1 A flowchart illustrating a method for detecting cracks in machined workpieces based on quantum measurement, provided in an embodiment of the present invention; Figure 2 This is a framework diagram of a quantum measurement-based workpiece crack detection system provided in an embodiment of the present invention. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The term "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and B can represent: A alone, A and B simultaneously, and B alone. Furthermore, descriptions involving "first," "second," etc., in this invention are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, features defined with "first" or "second" can explicitly or implicitly include at least one of those features. Additionally, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by the present invention.
[0020] Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] Acquire a visible light image of the target workpiece, and preprocess the visible light image to obtain a grayscale image; Multi-scale Canny edge detection is performed on the grayscale image to obtain a contour feature map; morphological optimization is performed on the contour feature map to obtain an enhanced edge map; Substituting the grayscale image and enhanced edge map into the dual-channel surface crack model yields the surface crack results. After performing a quantum scan on the target workpiece, a magnetic field distribution map is obtained; the internal crack result is obtained by inversion based on the magnetic field distribution map. The results of internal crack detection are corrected based on the surface crack results to obtain the final crack detection results.
[0022] This invention provides a method for detecting cracks in machined workpieces based on quantum measurement. See also... Figure 1 , Figure 1 A flowchart illustrating a quantum measurement-based method for detecting cracks in machined workpieces, provided as an embodiment of the present invention. The method includes the following steps: This invention provides a quantum measurement-based method for detecting cracks in machined workpieces. It utilizes visible light images for noise type classification and dynamic combined filtering, while accurately preserving subtle defect edge information and optimizing the fracture defect contour using morphology. A dual-channel surface crack model is built using an improved ResNet18, significantly enhancing the accuracy of surface crack identification and location. Furthermore, quantum scanning and three-dimensional leakage magnetic field inversion techniques overcome visual detection blind spots, accurately acquiring key parameters of internal cracks. Finally, the surface and internal crack detection results are complementary and fused, achieving full-dimensional and high-precision detection of surface and internal cracks in machined workpieces, comprehensively improving the integrity of workpiece crack detection.
[0023] Specifically, quantum scanning of the target workpiece is performed using instruments based on diamond NV color centers (such as quantum diamond microscopes).
[0024] In one implementation, preprocessing a visible light image to obtain a grayscale image includes: Local statistical feature analysis is performed on the visible light image to obtain the mean gray level, gray level variance, and gray level extreme value of each local window; a noise type distribution window is generated based on the mean gray level, gray level variance, and gray level extreme value of each local window; the local window is a 3×3 square neighborhood region centered on the current pixel; the noise type distribution window is divided into impulse noise window and Gaussian noise window; After performing improved median filtering on all impulse noise windows and Gaussian filtering on all Gaussian noise windows, the images are integrated to obtain a grayscale image. The improved formula for median filtering is as follows: in, This represents the filtered output pixel value of the current pixel in the local window. This represents all pixels in a local window. The average grayscale value of a local window. () represents the grayscale value of the current pixel. ( ) represents the weighted median of all pixels within a local window.
[0025] In one implementation, an improved median filter with adaptive weights is used to remove high-intensity impulse noise while dynamically adjusting the weights based on the difference between the pixel and the local mean. This maximizes the protection of the edge information of minor defects such as scratches and cracks from being smoothed out, providing a high signal-to-noise ratio image foundation for subsequent edge detection. This solves the problem of denoising mixed noise (coexistence of salt-and-pepper noise and Gaussian noise) in metal surface images.
[0026] In a specific embodiment, an image of a metal workpiece with clear scratches is taken as an example. First, the image is traversed, and a 3×3 window is taken centered on each pixel. Next, an improved median filter is performed on this window: the grayscale mean of all pixels within the window is calculated to be 120, while the grayscale value of the noise point is 255. According to the formula, the weight of this point will approach 0 due to the large difference (|120-255|=135), making the filtered output value almost entirely determined by the weighted median of other normal pixels within the window, thus accurately removing the noise point. Conversely, for the "Gaussian noise window" in the background texture area, Gaussian filtering is used for micro-smoothing. Finally, a clean grayscale image that retains sharp edges is generated.
[0027] In one implementation, morphological optimization of the contour feature map to obtain an enhanced edge map includes: The specific formula for morphological optimization is: in, This represents the current pixel after shape optimization; Represents the contour feature map; This represents the preset linear feature weights. This represents the preset disk-shaped feature weights; Represents the dilation operator, Represents the erosion operator; This represents the set of pixels representing a scratch-like defect area. A set of pixels representing a blocky defect region.
[0028] In one implementation, the fractured linear contour is bridged by a closing operation (expansion followed by erosion), and the blocky contour is smoothed and burrs are eliminated by an opening operation (erosion followed by expansion), thereby obtaining a continuous and complete enhanced edge map, which improves the repair of defect contours and enhances the accuracy of subsequent deep learning models in determining defect type and size.
[0029] In a specific embodiment, a contour feature map containing both a discontinuous thin line and an irregular dark spot is obtained. After the morphology optimization module is activated, it first identifies connected components: the thin line region is identified as a scratch region, and the dark spot region is identified as a blocky defect region. For each pixel within the scratch region, a 1×3 pixel linear structuring element is first used for dilation, thickening the ends of the broken line segments and bringing them closer together. Then, the same structuring element is immediately used for erosion, thinning the thickened lines back to their original thickness. The result of the closing operation connects the broken parts. Simultaneously, for pixels within the blocky defect region, a disk-shaped structuring element with a radius of 2 pixels is first used for erosion, removing noise and burrs protruding from the edges of the dark spot. Then, dilation is performed to restore the main body, and the opening operation smooths and closes the originally broken contour. Finally, an enhanced edge map with accurate contours is generated.
[0030] In one implementation, the dual-channel surface crack model is derived from an improved ResNet18 network. The specific improvement is as follows: The input feature map of the ResNet18 network is replaced with a grayscale image and an enhanced edge image; the grayscale image and the enhanced edge image are fused to obtain the first feature map; After processing the first 17 layers, the output features are processed into feature maps with feature sizes of 1 / 8, 1 / 16, and 1 / 32. The feature maps with feature sizes of 1 / 8, 1 / 16, and 1 / 32 are then substituted into the global average pooling module to obtain the second feature map. The second feature map is then substituted into the fully connected module to obtain the output feature map.
[0031] In one implementation, feature fusion of grayscale images and enhanced edge images is performed, simultaneously learning the appearance and geometric features of defects. This significantly enhances the perception of subtle defects such as blurred cracks and shallow pits. Furthermore, by extracting feature maps at three scales (1 / 8, 1 / 16, and 1 / 32) and performing global average pooling, replacing the single-scale features at the tail of traditional ResNet, the model gains a multi-scale receptive field. This enables it to accurately identify various defects with significant size differences, ranging from thin scratches to large pits. Global average pooling also significantly reduces the number of parameters in the fully connected layers, effectively suppressing overfitting and improving the model's generalization ability and inference speed. This addresses the problem of insufficient ability to identify defects with weak contrast and complex shapes.
[0032] In a specific embodiment, after one convolution operation in the input layer, the grayscale feature map retains the intensity information of the slight darkening at the hairline, while the edge feature map highlights the linear ridges of the hairline and the disk-shaped boundaries of the patch. The model fuses the features of the two images in the shallow layer through a concatenation operation to generate the first feature map; this is then processed by the deeper network. When processing reaches layer 17, three branches are output: for the large-size feature map at a scale of 1 / 8, the fine positional information of the hairline is retained; for the small-size feature map at a scale of 1 / 32, the global contour information of the patch is highly abstracted. These three sets of feature maps are fed into a global average pooling layer, compressed into one-dimensional feature vectors, and concatenated to obtain a global multi-scale feature map, which is the second feature map. After comprehensive judgment, the model outputs a precise indication: a 12mm long level 1 hairline at position (15, 80) and a 6mm diameter level 5 patch defect at position (200, 350), achieving high-precision detection of complex workpiece surfaces.
[0033] In one implementation, the internal crack result is obtained by inversion based on the magnetic field distribution map, including: Step 1: Suppress noise in the magnetic field distribution map to obtain a noise-reduced three-dimensional magnetic field tensor map; Step 2: Calculate the magnetic field vectors of all scan points using Fourier transform on the three-dimensional magnetic field tensor map; Step 3: Invert the magnetic field intensity at all scanning points to obtain the internal crack result; Specifically, noise suppression employs adaptive wavelet threshold filtering to eliminate shot noise in quantum measurements. In the Fourier transform (wavenumber domain), a simple algebraic relationship is established between the three components of the magnetic field and different gradient components.
[0034] The specific process of inversion solution: The magnetic field vectors of all scanning points are integrated to obtain the magnetic charge density distribution; the three-dimensional spatial coordinates, burial depth, length, width, and orientation parameters of the internal crack are obtained by inversion based on the magnetic charge density distribution, which is the result of the internal crack.
[0035] In one implementation, quantum precision measurement technology is used to detect weak magnetic fields with high sensitivity. Cracks existing inside the workpiece are treated as magnetic charge sources. By solving the physical inverse problem of the magnetic field, not only can internal cracks be detected, but their key parameters such as three-dimensional spatial coordinates, burial depth, length, width, and orientation can also be accurately calculated. This fills the absolute blind spot of visual inspection and greatly improves the detection accuracy of critical components in the investigation of fatal internal defects such as cracks and interlaminar tears.
[0036] In one implementation, the internal crack results are corrected based on the surface crack results to obtain the final crack detection results, including: The location of each surface crack is determined based on the surface crack results, and the location of each internal crack is determined based on the internal crack results. Calculate the positional similarity values of each surface crack location and each internal crack location in turn; If the location similarity value is greater than the similarity threshold, the new crack location is obtained by correcting the surface crack location and the internal crack location corresponding to the location similarity value. The surface crack result and the internal crack result corresponding to the new crack location are then fused to obtain a new crack detection result. This indicates that the surface crack location and the internal crack location corresponding to the currently calculated location similarity value coincide. If the location similarity value is less than the similarity threshold, the surface crack location corresponding to the location similarity value is taken as the new crack location, and the surface crack result corresponding to the new crack location is determined as the new crack detection result; this indicates that the surface crack location and the internal crack location corresponding to the currently calculated location similarity value do not coincide. The final crack detection result is obtained by integrating all the new crack detection results.
[0037] In one implementation, surface and internal cracks with high positional similarity are fused and corrected. This integrates high-resolution surface observations and deep internal detection information, eliminating the positioning bias of single methods and thus obtaining more accurate new crack locations. For non-overlapping cracks, the more reliable surface crack results are prioritized as new detection results. This avoids misjudging internal anomalies as real cracks and reduces the risk of missed detections. This method achieves complementary advantages between surface and internal results: overlapping areas are enhanced through fusion, while surface information is preserved in non-overlapping areas, making the final crack results more consistent with the continuity of actual cracks in spatial distribution.
[0038] Based on the same inventive concept, this invention also provides a quantum measurement-based crack detection system for machined workpieces. See also Figure 2 , Figure 2 A framework diagram of a quantum measurement-based workpiece crack detection system provided for an embodiment of the present invention includes: Grayscale image module: Acquires the visible light image of the target workpiece and preprocesses the visible light image to obtain a grayscale image; Edge detection module: Performs multi-scale Canny edge detection on grayscale images to obtain contour feature maps; Morphology optimization module: Performs morphological optimization on the contour feature map to obtain an enhanced edge map; Surface crack module: Substitutes grayscale images and enhanced edge maps into a dual-channel surface crack model to obtain surface crack results; Internal Crack Module: After performing quantum scanning on the target workpiece, a magnetic field distribution map is obtained; the internal crack result is obtained by inversion based on the magnetic field distribution map; Correction module: Corrects the internal crack results based on the surface crack results to obtain the final crack detection results.
[0039] This invention provides a quantum measurement-based workpiece crack detection system. It utilizes visible light images for noise type classification and dynamic combined filtering, while accurately preserving subtle defect edge information and optimizing the fracture defect contour using morphology. A dual-channel surface crack model is built using an improved ResNet18, significantly enhancing the accuracy of surface crack identification and location. Furthermore, quantum scanning and three-dimensional leakage magnetic field inversion techniques overcome visual detection blind spots, accurately acquiring key parameters of internal cracks. Finally, the surface and internal crack detection results are complementary and fused, achieving full-dimensional and high-precision detection of both surface and internal cracks in the workpiece, comprehensively improving the integrity of workpiece crack detection.
[0040] The foregoing has described one embodiment of the present invention in detail, but this content is merely a preferred embodiment and should not be considered as limiting the scope of the present invention. All equivalent variations and modifications made within the scope of the claims of this invention should still fall within the scope of the claims of this invention.
Claims
1. A method for detecting cracks in machined workpieces based on quantum measurement, characterized in that, The method includes: Acquire a visible light image of the target workpiece, and preprocess the visible light image to obtain a grayscale image; Multi-scale Canny edge detection is performed on the grayscale image to obtain a contour feature map; morphological optimization is performed on the contour feature map to obtain an enhanced edge map; Substituting the grayscale image and enhanced edge map into the dual-channel surface crack model yields the surface crack results. After performing a quantum scan on the target workpiece, a magnetic field distribution map is obtained; the internal crack result is obtained by inversion based on the magnetic field distribution map. The results of internal crack detection are corrected based on the surface crack results to obtain the final crack detection results.
2. The method for detecting cracks in machined workpieces based on quantum measurement according to claim 1, characterized in that, The process of preprocessing the visible light image to obtain a grayscale image includes: Local statistical feature analysis is performed on the visible light image to obtain the mean gray level, gray level variance, and gray level extreme value of each local window; a noise type distribution window is generated based on the mean gray level, gray level variance, and gray level extreme value of each local window; the local window is a 3×3 square neighborhood region centered on the current pixel; the noise type distribution window is divided into an impulse noise window and a Gaussian noise window; After performing improved median filtering on all impulse noise windows and Gaussian filtering on all Gaussian noise windows, the images are integrated to obtain a grayscale image. The improved median filter is calculated using the following formula: in, This represents the filtered output pixel value of the current pixel in the local window. This represents all pixels in a local window. This represents the average grayscale value of a local window. () represents the grayscale value of the current pixel. ( ) represents the weighted median of all pixels within a local window.
3. The method for detecting cracks in machined workpieces based on quantum measurement according to claim 1, characterized in that, The morphological optimization of the contour feature map to obtain the enhanced edge map includes: The specific formula for the morphological optimization is as follows: in, This represents the current pixel after shape optimization; Represents the contour feature map; This represents the preset linear feature weights. This represents the preset disk-shaped feature weights; Represents the dilation operator, Represents the erosion operator; This represents the set of pixels representing a scratch-like defect area. A set of pixels representing a blocky defect region.
4. The method for detecting cracks in machined workpieces based on quantum measurement according to claim 1, characterized in that, The dual-channel surface crack model is derived from an improved ResNet18 network. The specific improvement steps are as follows: The input feature map of the ResNet18 network is replaced with a grayscale image and an enhanced edge image; the grayscale image and the enhanced edge image are fused to obtain the first feature map; After processing the first 17 layers, the output features are processed into feature maps with feature sizes of 1 / 8, 1 / 16, and 1 / 32, respectively. The feature maps with feature sizes of 1 / 8, 1 / 16, and 1 / 32 are substituted into the global average pooling module to obtain the second feature map; the first feature map is substituted into the fully connected module to obtain the output feature map.
5. The method for detecting cracks in machined workpieces based on quantum measurement according to claim 1, characterized in that, The step of correcting the internal crack results based on the surface crack results to obtain the final crack detection results includes: The location of each surface crack is determined based on the surface crack results, and the location of each internal crack is determined based on the internal crack results. Calculate the positional similarity values of each surface crack location and each internal crack location in turn; If the location similarity value is greater than the similarity threshold, the new crack location is obtained by correcting the surface crack location and the internal crack location corresponding to the location similarity value, and the surface crack result and the internal crack result corresponding to the new crack location are fused to obtain a new crack detection result. If the location similarity value is less than the similarity threshold, the surface crack location corresponding to the location similarity value is taken as the new crack location, and the surface crack result corresponding to the new crack location is determined as the new crack detection result. The final crack detection result is obtained by integrating all the new crack detection results.
6. A quantum measurement-based crack detection system for machined workpieces, characterized in that, The system includes: Grayscale image module: Acquires the visible light image of the target workpiece and preprocesses the visible light image to obtain a grayscale image; Edge detection module: Performs multi-scale Canny edge detection on grayscale images to obtain contour feature maps; Morphology optimization module: Performs morphological optimization on the contour feature map to obtain an enhanced edge map; Surface crack module: Substitutes grayscale images and enhanced edge maps into a dual-channel surface crack model to obtain surface crack results; Internal Crack Module: After performing quantum scanning on the target workpiece, a magnetic field distribution map is obtained; the internal crack result is obtained by inversion based on the magnetic field distribution map; Correction module: Corrects the internal crack results based on the surface crack results to obtain the final crack detection results.
7. The workpiece crack detection system based on quantum measurement according to claim 6, characterized in that, The grayscale image module includes: a noise type distribution module and a dynamic filtering module. The noise type distribution module is used to perform local statistical feature analysis on the visible light image to obtain the gray-level mean, gray-level variance, and gray-level extreme value of each local window; and to generate a noise type distribution window based on the gray-level mean, gray-level variance, and gray-level extreme value of each local window; the local window is a 3×3 square neighborhood region centered on the current pixel; the noise type distribution window is divided into an impulse noise window and a Gaussian noise window; The dynamic filtering module is used to perform improved median filtering on all impulse noise windows, and Gaussian filtering on all Gaussian noise windows, and then integrate them to obtain a grayscale image. The improved median filter is calculated using the following formula: in, This represents the filtered output pixel value of the current pixel in the local window. This represents all pixels in a local window. The average grayscale value of a local window. () represents the grayscale value of the current pixel. ( ) represents the weighted median of all pixels within a local window.
8. A quantum measurement-based workpiece crack detection system according to claim 6, characterized in that, The morphology optimization module is also used for: The specific formula for the morphological optimization is as follows: in, This represents the current pixel after shape optimization; Represents the contour feature map; This represents the preset linear feature weights. This represents the preset disk-shaped feature weights; Represents the dilation operator, Represents the erosion operator; This represents the set of pixels representing a scratch-like defect area. A set of pixels representing a blocky defect region.
9. A quantum measurement-based workpiece crack detection system according to claim 6, characterized in that, The surface crack module is also used for: The dual-channel surface crack model is derived from an improved ResNet18 network. The specific improvements are as follows: The input feature map of the ResNet18 network is replaced with a grayscale image and an enhanced edge image; the grayscale image and the enhanced edge image are fused to obtain the first feature map; After processing the first 17 layers, the output features are processed into feature maps with feature sizes of 1 / 8, 1 / 16, and 1 / 32, respectively. The feature maps with feature sizes of 1 / 8, 1 / 16, and 1 / 32 are substituted into the global average pooling module to obtain the second feature map; the first feature map is substituted into the fully connected module to obtain the output feature map.
10. A quantum measurement-based workpiece crack detection system according to claim 6, characterized in that, The correction module includes: a crack location acquisition module, a location similarity module, a first judgment module, a second judgment module, and an integration module. The crack location acquisition module is used to determine the location of each surface crack based on the surface crack results, and to determine the location of each internal crack based on the internal crack results. The position similarity module is used to sequentially calculate the position similarity values of each surface crack location and each internal crack location; The first judgment module is used to correct the surface crack position and the internal crack position corresponding to the position similarity value to obtain a new crack position if the position similarity value is greater than the similarity threshold, and to fuse the surface crack result and the internal crack result corresponding to the new crack position to obtain a new crack detection result. The second judgment module is used to determine the surface crack location corresponding to the location similarity value as the new crack location if the location similarity value is less than the similarity threshold, and to determine the surface crack result corresponding to the new crack location as the new crack detection result. The integration module is used to integrate all the new crack detection results to obtain the final crack detection result.