Defect detection method and system for large mold production based on machine vision

CN121724935BActive Publication Date: 2026-08-11QINGDAO AIJINGZE TRANSPORTATION EQUIPMENT CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-11
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0004]本发明的目的在于提供一种基于机器视觉的大型模具生产用探伤方法及系统,以解决上述背景技术中提出的现有检测技术在HIFU球面声学聚焦透镜模具这类复杂曲面精密部件上,难以同时实现表面缺陷与三维几何异常的高精度、自动化、定量化协同检测的问题

Benefits of technology

1、本发明涉及的基于机器视觉的大型模具生产用探伤方法及系统中,通过建立统一的三维坐标参考框架,将高分辨率图像数据与高精度结构光/激光扫描生成的点云数据在空间上进行精确配准,实现了光学纹理信息与三维几何形貌信息的深度融合。在球面声学聚焦透镜模具这类具有复杂曲率特征的大型模具检测中,单一视觉模态易受光照变化、表面反光或局部形变干扰,导致误检或漏检。而本方法结合CNN模型对表面纹理、边缘和曲率等底层特征的提取能力,并引入坐标感知机制的多尺度卷积核,使网络能够根据像素空间位置自适应调整采样策略,增强对曲面结构的几何感知能力;同时,通过点云数据的曲面拟合、法向偏差分析和局部几何特征计算,识别出潜在的几何异常区域。最终通过图像缺陷与几何异常的空间映射与交叉验证,有效区分真实缺陷与伪影,大幅提升了在复杂工业场景下对裂纹、气孔、划痕等微小缺陷的识别准确率和判别鲁棒性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121724935B_ABST
    Figure CN121724935B_ABST
Patent Text Reader

Abstract

This invention relates to the field of machine vision inspection technology, specifically to a flaw detection method and system for large mold production based on machine vision. It includes the following steps: locating the surface and key curvature regions of a spherical acoustic focusing lens mold, establishing a three-dimensional coordinate reference frame for the mold; acquiring images of the entire spherical area of ​​the mold and preprocessing the images, while simultaneously acquiring point cloud data of the mold surface; identifying surface defects of the mold using a convolutional neural network model based on the preprocessed images, and detecting areas with geometric anomalies by combining the point cloud data. This invention establishes a unified three-dimensional coordinate reference frame, enabling precise spatial registration of high-resolution image data with point cloud data generated by high-precision structured light / laser scanning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of machine vision inspection technology, and more specifically, to a flaw detection method and system for large mold production based on machine vision. Background Technology

[0002] In high-intensity focused ultrasound (HIFU) therapy systems, the spherical acoustic focusing lens mold is a core component. Its surface quality and geometric accuracy directly determine the focusing performance and energy distribution of ultrasound waves, thus affecting the safety and effectiveness of the treatment. Any minute surface defects (such as cracks, pores, scratches) or local geometric deviations (such as uneven curvature, surface undulations) can lead to sound field distortion, focus shift, or energy attenuation, and in severe cases, even cause off-target tissue damage, threatening patient safety. Therefore, high-precision and high-reliability flaw detection of the HIFU spherical acoustic focusing lens mold is crucial.

[0003] However, traditional inspection methods are insufficient to meet the quality control requirements of such complex and precision molds. Manual visual inspection is highly subjective, inefficient, easily affected by operator experience and visual fatigue, and cannot quantify the three-dimensional morphology of defects. While conventional two-dimensional machine vision technology can identify surface texture anomalies, it lacks depth information acquisition capabilities and cannot assess key geometric parameters affecting acoustic performance. Contact measurement or single three-dimensional scanning methods suffer from slow inspection speeds, surface damage, and difficulty in comprehensively integrating surface condition and geometric morphology information. Especially when dealing with large-sized, high-curvature spherical structures, traditional methods are susceptible to lens distortion, uneven lighting, and shadow interference, leading to unstable feature extraction and decreased defect identification accuracy. Furthermore, existing technologies generally lack the ability to accurately locate defects in three dimensions and quantitatively characterize them in multiple dimensions (such as length, area, maximum depth, average depth, and spatial distribution density), making it difficult to support quality grading and process closed-loop optimization in HIFU equipment manufacturing. As HIFU equipment develops towards higher precision, higher reliability, and intelligent production, traditional inspection methods are no longer adequate for online, non-contact, and fully automated quality inspection needs, becoming a technological bottleneck restricting product quality improvement. Therefore, a flaw detection method and system based on machine vision for the production of large molds is provided. Summary of the Invention

[0004] The purpose of this invention is to provide a flaw detection method and system for large mold production based on machine vision, so as to solve the problem mentioned in the background art that the existing detection technology is difficult to achieve high-precision, automated, and quantitative collaborative detection of surface defects and three-dimensional geometric anomalies on complex curved precision parts such as HIFU spherical acoustic focusing lens molds.

[0005] To achieve the above objectives, the present invention provides a flaw detection method for large mold production based on machine vision, comprising: S1. Locate the surface and key curvature areas of the spherical acoustic focusing lens mold and establish a three-dimensional coordinate reference frame for the spherical acoustic focusing lens mold; S2. Acquire images of the entire spherical area of ​​the spherical acoustic focusing lens mold and preprocess the images. At the same time, acquire point cloud data of the surface of the spherical acoustic focusing lens mold. S3. Based on the preprocessed image, a convolutional neural network model is used to identify surface defects of the spherical acoustic focusing lens mold. Combined with point cloud data, regions with geometric anomalies are detected. In the process of identifying surface defects, a multi-scale convolutional kernel with a coordinate-aware mechanism is introduced to perform convolution operations on the input preprocessed image to extract the low-level features of the spherical acoustic focusing lens mold surface. S4. The identified surface defects are spatially located on the three-dimensional coordinate reference frame of the spherical acoustic focusing lens mold, and the size, depth and distribution of the defects are calculated to obtain quantitative indicators of the defects.

[0006] As a further improvement to this technical solution, in step S1, the establishment of a three-dimensional coordinate reference frame for the spherical acoustic focusing lens mold involves the following specific steps: selecting n geometric feature points on the edge of the spherical acoustic focusing lens mold as initial reference points, imaging and measuring the initial reference points to obtain the two-dimensional pixel coordinates of the spherical acoustic focusing lens mold, and combining the obtained two-dimensional pixel coordinates with camera calibration parameters and laser depth information to convert them into three-dimensional spatial coordinate data.

[0007] As a further improvement to this technical solution, in step S3, the surface defects of the spherical acoustic focusing lens mold are identified using a convolutional neural network model based on the preprocessed image, including the following steps: S3.1 Input the preprocessed image into the convolutional neural network model; S3.2. The input image is convolved by a multi-scale convolution kernel with a coordinate-aware mechanism, and the low-level features of the surface of the spherical acoustic focusing lens mold are extracted. The low-level features include at least local texture, edge contour and curvature change. S3.3. Perform dimensionality reduction and region invariance enhancement on the features in the pooling layer, and extract high-level semantic features related to the defects of the spherical acoustic focusing lens mold in the deep convolutional layer. S3.4. In the fully connected layer, classify and discriminate the extracted high-level semantic features, and output the discrimination results of different categories of defects; S3.5. Based on the discrimination results, locate and visualize the defect area in the original image, and output the defect location, defect category label and its confidence level.

[0008] As a further improvement to this technical solution, step S3.2, extracting the underlying features of the surface of the spherical acoustic focusing lens mold, includes the following steps: For each preprocessed image input to the convolutional neural network model, two coordinate graphs of the same size as the image are generated simultaneously. and ; For each local region covered by the current convolutional kernel, based on the coordinate graph and The two-dimensional coordinates of the center pixel of the local region are extracted as the center point coordinates. These center point coordinates and the scale information of the convolution kernel are input into a lightweight multilayer perceptron to predict the offset of all sampling points of the convolution kernel relative to the standard regular positions. ; Based on predicted offset At the offset position Sampling is performed on the upper surface, and the corresponding pixel value is obtained through bilinear interpolation; The sampled pixel values ​​are weighted and summed according to the convolution kernel weights to obtain the local convolution response, and the underlying features of the surface of the spherical acoustic focusing lens mold are formed based on the multi-scale convolution kernel.

[0009] As a further improvement to this technical solution, step S3, which involves detecting regions with geometric anomalies using point cloud data, includes the following steps: S3.6. Preprocess the point cloud data, calculate the preliminary curvature features of the local neighborhood of each point, and perform adaptive non-uniform voxel downsampling based on the preliminary curvature features of each point in the point cloud data. S3.7 Based on the preprocessed point cloud data, a continuous geometric model of the surface of the spherical acoustic focusing lens mold is obtained by using the spherical fitting surface reconstruction method. S3.8. Compare the continuous geometric model with the ideal mathematical spherical equation of the spherical acoustic focusing lens mold, and calculate the normal deviation and height residual of each point cloud sampling point; S3.9 Extract local geometric features of the surface of the spherical acoustic focusing lens mold based on point cloud data, including at least curvature value, surface gradient change and local plane fitting error; S3.10. Spatial mapping and cross-comparison are performed between the defect locations output by the convolutional neural network model and the point cloud anomaly regions.

[0010] As a further improvement to this technical solution, in step S3.6, adaptive non-uniform voxel downsampling is performed based on the preliminary curvature features of each point in the point cloud data, including the following steps: S3.61. Calculate the covariance matrix of the local neighborhood of each point in the point cloud data, perform eigenvalue decomposition on the covariance matrix, and calculate the local curvature eigenvalue of the point based on the eigenvalues. S3.62. Create a three-dimensional voxel lattice in the point cloud space, and within each voxel, calculate the average local curvature based on the point cloud sampling points contained within the voxel. Adaptive adjustment of voxel size.

[0011] As a further improvement to this technical solution, in step S4, the identified surface defects are spatially located on the three-dimensional coordinate reference frame of the spherical acoustic focusing lens mold, and the size, depth, and distribution of the defects are calculated, including the following steps: S4.1 Map the defect locations identified by the convolutional neural network in step S3 onto the point cloud under the three-dimensional coordinate reference frame to form a complete set of three-dimensional defect points; S4.2 Using a distance threshold-based clustering method, neighboring defect points are grouped into the same defect, a unique identifier ID is generated for each defect, and the number and distribution range of defect points are recorded. S4.3 Perform dimensional analysis on each defect area; S4.4 Fit the surface model and calculate the defect depth characteristics; S4.5 Spatial distribution characteristics of statistical defects across the entire surface of the spherical acoustic focusing lens mold; S4.6 Integrate the spatial location, size, depth, and distribution characteristics of each defect into structured data.

[0012] As a further improvement to this technical solution, in step S4.4, fitting the surface model and calculating the defect depth characteristics includes the following steps: S4.41. For each set of defect points, perform local surface fitting based on neighborhood points to obtain an initial surface model, and perform bidirectional projection residual calculation and fitting quality diagnosis. S4.42. Calculate the perpendicular distance from the defect point to the fitted surface in the local normal direction of the reference surface model to obtain the height deviation of the defect point. And perform depth compensation on the height deviation to generate the compensated height deviation. ; S4.43, Compensated height deviation in the defect point set Statistical analysis is conducted to record the maximum depth value, average depth value, and root mean square deviation, forming a multi-dimensional defect depth characterization index, namely, defect depth characteristics.

[0013] As a further improvement to this technical solution, step S4.41, which involves calculating the bidirectional projection residual and diagnosing the fitting quality, includes the following steps: From the initial surface model used for fitting Among the neighborhood points, using the classification results of the convolutional neural network in step S3, the classification results are divided into a set of normal surface points. With suspected defect set ; Set of suspected defects Projected onto the initial surface model Calculate its height deviation to obtain the positive residual distribution. ; Fit a local surface model representing the geometric features of the defect region. Normal surface point set Projecting points in the model onto the local surface Calculate its vertical distance to obtain the inverse residual distribution. ; Calculate the positive residual distribution and inverse residual distribution The distribution differences are analyzed, and a reference surface is reconstructed based on these differences.

[0014] On the other hand, the present invention provides a machine vision-based flaw detection system for large mold production, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the machine vision-based flaw detection method for large mold production as described above.

[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. The flaw detection method and system for large mold production based on machine vision involved in this invention establishes a unified three-dimensional coordinate reference frame, accurately registering high-resolution image data with point cloud data generated by high-precision structured light / laser scanning in space, achieving deep fusion of optical texture information and three-dimensional geometric shape information. In the inspection of large molds with complex curvature features, such as spherical acoustic focusing lens molds, a single visual modality is easily affected by changes in illumination, surface reflection, or local deformation, leading to false detections or missed detections. This method combines the ability of CNN models to extract low-level features such as surface texture, edges, and curvature, and introduces multi-scale convolutional kernels with coordinate perception mechanisms, enabling the network to adaptively adjust the sampling strategy according to the spatial position of pixels, enhancing the geometric perception ability of curved surface structures; at the same time, through surface fitting, normal deviation analysis, and local geometric feature calculation of point cloud data, potential geometric anomaly regions are identified. Finally, through spatial mapping and cross-validation of image defects and geometric anomalies, real defects and artifacts are effectively distinguished, significantly improving the accuracy and robustness of identifying minute defects such as cracks, pores, and scratches in complex industrial scenarios.

[0016] 2. The flaw detection method and system for large mold production based on machine vision involved in this invention not only achieves automatic defect identification but also constructs a complete quantitative defect analysis process. By fusing camera calibration parameters with point cloud data, the two-dimensional defect locations identified by CNN are accurately mapped to a three-dimensional coordinate system. Clustering algorithms such as DBSCAN are used to segment and number the defect point cloud, achieving spatial clustering and unique identification of defects. Based on this, the system can perform multi-dimensional calculations on the length, width, area, boundary contour, depth (maximum depth, average depth, root mean square deviation), and spatial distribution characteristics (radial and circumferential distribution density) of each defect. A bidirectional projection residual diagnosis mechanism is introduced to dynamically correct the reference surface in the presence of defect interference, avoiding the "surface sinking" problem caused by defect points participating in the fitting, thereby ensuring the accuracy of depth measurement. Finally, structured defect description information is output, supporting visualization, quality grading, report generation, and process feedback, providing reliable technical support for intelligent manufacturing and quality closed-loop control of large molds. Attached Figure Description

[0017] Figure 1 This is a flowchart of the overall method of the present invention. Detailed Implementation

[0018] 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. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.

[0019] Example 1: Please refer to Figure 1 As shown, this embodiment provides a flaw detection method for large mold production based on machine vision, including the following steps: S1. Locate the surface and key curvature areas of the spherical acoustic focusing lens mold and establish a three-dimensional coordinate reference frame for the spherical acoustic focusing lens mold; In this embodiment, a three-dimensional coordinate reference frame for the spherical acoustic focusing lens mold is established. The specific steps involved are as follows: n geometric feature points are selected as initial reference points on the edge of the spherical acoustic focusing lens mold or in a preset reference area. An industrial camera is used in conjunction with a laser calibrator or a structured light device to image and measure the initial reference points, thereby obtaining the two-dimensional pixel coordinates of the spherical acoustic focusing lens mold. The camera's internal and external parameters are calibrated using a calibration board. The obtained two-dimensional pixel coordinates are combined with the camera calibration parameters and laser depth information to convert them into three-dimensional spatial coordinate data.

[0020] S2. Acquire images of the entire spherical area of ​​the spherical acoustic focusing lens mold and preprocess the images. At the same time, acquire point cloud data of the surface of the spherical acoustic focusing lens mold. In this embodiment, an industrial camera mounted on a multi-degree-of-freedom motion platform is controlled to capture images of the spherical acoustic focusing lens mold from multiple angles along a preset trajectory to ensure coverage of the entire spherical area. Simultaneously, a ring light source or stripe light source is triggered to enhance surface texture features. Subsequently, the acquired image sequence is preprocessed, including noise filtering, lens distortion correction, brightness equalization, and geometric alignment, to improve the stability of subsequent feature extraction. During image acquisition, a structured light projection or laser scanning device is simultaneously activated to obtain depth information of the mold surface, which is then fused with the preprocessed image to generate high-precision three-dimensional point cloud data, used to reflect the complete geometric shape of the spherical area of ​​the mold. S3. Based on the preprocessed image, the convolutional neural network (CNN) model is used to identify surface defects of the spherical acoustic focusing lens mold. Combined with point cloud data, the region with geometric anomalies is detected. In the process of identifying surface defects, a multi-scale convolutional kernel with a coordinate-aware mechanism is introduced to perform convolution operation on the input preprocessed image to extract the low-level features of the surface of the spherical acoustic focusing lens mold. In this embodiment, step S3 involves identifying surface defects of the spherical acoustic focusing lens mold based on the preprocessed image using a convolutional neural network (CNN) model, including the following steps: S3.1 The preprocessed image is input into a convolutional neural network model. The overall architecture of the convolutional neural network model includes: an input layer for receiving the preprocessed mold surface image; multiple convolutional layers and pooling layers are set sequentially after the input layer. The convolutional layers combine multi-scale convolutional kernels with a coordinate-aware mechanism to extract features from the image, and the pooling layers downsample the features to achieve dimensionality reduction and region invariance enhancement; during the step-by-step feature transfer, the shallow convolutional layers mainly extract low-level features such as texture, edge, and curvature, while the deep convolutional layers aggregate to form high-level semantic features related to the defect category; after the convolution and pooling operations, a fully connected layer is set to comprehensively express and classify the high-level features, and the output layer generates defect category labels and corresponding confidence scores based on the Softmax function, thereby realizing the identification and output of multiple types of surface defects such as cracks, pores, scratches, and inclusions. S3.2. The input image is convolved by a multi-scale convolution kernel with a coordinate-aware mechanism, and the low-level features of the surface of the spherical acoustic focusing lens mold are extracted. The local convolution response is generated by the multi-scale convolution kernel with a coordinate-aware mechanism, and a low-level feature map that can characterize the surface texture, edge and curvature changes of the spherical acoustic focusing lens mold is formed under multi-channel and multi-scale fusion. The low-level features include at least local texture, edge contour and curvature change. In particular, machine vision-based flaw detection systems for large-scale mold production face challenges in feature extraction due to the curved geometry of spherical acoustic focusing lens molds. Specifically, the standard convolutional kernels of traditional convolutional neural networks (CNNs) assume a planar image, making it difficult to adapt to the curvature variations of spherical molds. This leads to distortion or missed detections when extracting surface textures, edges, and geometric features, especially failing to accurately capture the subtle morphology of local defects (such as cracks and pores) on curved surfaces. Introducing a coordinate-aware multi-scale convolutional kernel aims to solve this surface adaptability problem. By explicitly incorporating the spatial location information of pixels, the convolution operation can dynamically adjust the distribution of sampling points, thereby improving the model's feature extraction accuracy in complex curvature regions. The coordinate-aware multi-scale convolutional kernel combines a normalized coordinate map with the convolutional kernel, enabling the model to not only utilize grayscale textures during feature extraction but also perceive the position of pixels within the spherical geometry, thus achieving adaptive adjustment of convolutional sampling. The advantage of this mechanism is that it enhances the model's robustness to surface deformation, enabling it to extract low-level features related to defects (such as curvature changes and edge contours) more accurately and reduce false detections caused by surface distortion. At the same time, multi-scale fusion ensures the comprehensiveness of feature representation, significantly improving the accuracy and generalization ability of identifying defects such as cracks and scratches, making the flaw detection system more reliable and efficient in large mold production. Extracting the underlying features of the surface of the spherical acoustic focusing lens mold includes the following steps: For each preprocessed image input to the convolutional neural network (CNN) model, two coordinate graphs of the same size as the image are generated simultaneously. and Each pixel value represents the normalized coordinates of that pixel (e.g., a value range of [-1, 1] or [0, 1]), coordinate graph and By providing normalized spatial location information (horizontal and vertical coordinates) for each pixel, the convolutional neural network can not only utilize pixel grayscale or texture information when performing convolution operations, but also explicitly perceive the position of the pixel in the overall geometric structure. The introduction of this positional encoding helps the convolutional kernel to adaptively adjust the distribution of sampling points according to the coordinates when extracting features, thereby enhancing the model's geometric perception ability of the surface features of the spherical mold and improving the accuracy and robustness of defect identification. During convolutional feature extraction, for each local region covered by the current convolutional kernel, based on the coordinate map... and The two-dimensional coordinates of the center pixel of the local region are extracted as the center point coordinates. These center point coordinates, along with the scale information of the convolution kernel (the size of the convolution kernel or the receptive field size of the convolutional neural network (CNN), are input into a lightweight multilayer perceptron (MLP) to predict the offset of all sampling points of the convolution kernel relative to the standard regular positions (i.e., the fixed sampling grid positions of the convolution kernel under conventional two-dimensional convolution operations). This enables adaptive adjustment of the convolution sampling position; Based on predicted offset At the offset position Sampling is performed on the upper part of the sample, and the corresponding pixel value is obtained through bilinear interpolation to ensure that a smooth and continuous feature response can still be obtained at irregular sampling points. Specifically, this is done at standard regular locations. Corrected to the offset position Since the offset position usually does not fall on integer pixel coordinates, the weighted average value of the continuous pixel corresponding to the offset point is obtained by using bilinear interpolation to obtain the value of the continuous pixel at that position. The sampled pixel values ​​are weighted and summed according to the convolution kernel weights to obtain local convolution responses (the convolution kernel slides across the entire image, outputting a local convolution response at each position; arranging these responses forms a complete feature map). Based on multi-scale convolution kernels, the low-level features of the spherical acoustic focusing lens mold surface are formed (based on the complete feature map, through the parallel action of different convolution kernels, multiple response modes can be extracted within the same image region; some convolution kernels are sensitive to surface texture details, highlighting minor non-uniformities on the mold surface, while others are sensitive to edge details). Sensitive to grayscale abrupt changes, it can characterize the contours and gaps on the mold surface, while the convolutional kernel with a larger receptive field can capture the overall geometric undulations and curvature changes of the spherical region. Furthermore, by fusing the feature maps generated by the multi-scale convolutional kernels, a low-level feature map that can comprehensively characterize the surface texture, edges, and curvature changes of the spherical acoustic focusing lens mold can be formed. Through this coordinate-aware convolutional method, the network can more accurately extract low-level features such as surface texture, edges, and geometric changes in complex curvature regions of the spherical surface, providing a more robust feature representation for subsequent defect identification and classification. S3.3. Dimensionality reduction and region invariance enhancement are performed on features in the pooling layer, and high-level semantic features related to defects in the spherical acoustic focusing lens mold are extracted in the deep convolutional layer. Specifically: In the feature extraction stage of the convolutional neural network, the pooling layer first downsamples the low-level feature map generated by multi-scale convolutional kernels. Representative response values ​​are selected in local regions through max pooling or average pooling, thereby achieving feature dimensionality reduction, reducing redundant information, and improving the computational efficiency of the model. Simultaneously, it enhances the region invariance of features in terms of translation, scale, and rotation. After multiple pooling operations, the deep convolutional layer performs further convolution operations on the downsampled features within a larger receptive field, gradually aggregating multi-level information formed by low-level features such as texture, edge, and curvature changes, and extracting high-level semantic features that can directly characterize surface defect patterns such as cracks, pores, scratches, and inclusions. S3.4. In the fully connected layer, the extracted high-level semantic features are classified and discriminated, outputting the discrimination results for different types of defects. For example, one region is discriminated as a porosity defect with a confidence level of 0.93; another region is identified as a crack defect with a confidence level of 0.87; scratch defects with a confidence level of 0.81, or inclusion defects with a confidence level of 0.89 are also output. Through this discrimination result, the category of each defect and the reliability of the identification can be clearly given, which is used to distinguish different types of surface defects such as cracks, pores, inclusions, and scratches. In the fully connected layer stage, the high-level semantic features from the deep convolutional layer are first flattened into... A one-dimensional vector is multiplied by a weight matrix through several fully connected neurons and a bias term is added to achieve linear combination and nonlinear mapping of features in high-dimensional space. Subsequently, these linear combination results are nonlinearly transformed by an activation function (ReLU) to enhance the discriminative ability of the features. After multiple layers of fully connected mapping, the final feature vector is input to the output layer, and the Softmax function is used to transform it into the probability distribution of each defect category (such as cracks, pores, scratches, and inclusions). The output results include category labels and their corresponding confidence scores, and category vectors are generated for multi-class discrimination, thereby completing the automatic classification and identification of surface defects of the mold. S3.5. Based on the discrimination results, the defect region is located and visualized in the original image, and the defect location, defect category label and its confidence score are output. Specifically, after the defect classification is completed, the category label and confidence score output by the convolutional neural network are mapped to the corresponding feature map response region, and the identified defect region is restored on the original image by combining the camera calibration parameters and the pixel coordinate information of the original image. Then, a visual annotation box is drawn at the defect location using bounding boxes or polygonal contours, and the defect category label and corresponding confidence score value are added next to the annotation box to intuitively display the spatial location of the defect and the discrimination result. At the same time, structured defect description information is generated to ensure that the recognition result has both intuitive visualization effect and can be directly used for subsequent geometric anomaly detection and quality assessment.

[0021] Furthermore, by combining point cloud data to detect regions with geometric anomalies, the following steps are included: S3.6 Preprocess the point cloud data, including outlier removal and noise filtering, to reduce redundant data and improve point cloud quality. Then, use the three-dimensional coordinate reference frame established in S1 using the spherical acoustic focusing lens mold to register and align the point cloud, ensuring that the point cloud and the preprocessed image data can be jointly analyzed under the same spatial reference. Calculate the preliminary curvature features (or approximate curvature features) of the local neighborhood for each point, and perform adaptive non-uniform voxel downsampling based on the preliminary curvature features of each point in the point cloud data (a single three-dimensional sampling point in the point cloud data). The adaptive non-uniform voxel downsampling addresses the specific problems of large point cloud data volume and uneven density distribution in spherical molds, as well as the oversimplification of smooth regions and loss of key geometric details in high curvature or potentially defective regions by traditional uniform downsampling methods. Defects in spherical molds (such as tiny pits and cracks) are often accompanied by abrupt changes in local curvature. Uniform downsampling, with its one-size-fits-all simplification strategy, smooths out these subtle but crucial anomalous features, leading to missed detections in subsequent geometric anomaly detection. The core advantage of this adaptive non-uniform voxel downsampling lies in its "adaptive non-uniformity": it dynamically adjusts the voxel size based on the initial curvature characteristics of each point, using smaller voxels in high curvature regions to retain more details and larger voxels in low-curvature, gently curvature regions for efficient compression. This intelligent sampling strategy is highly effective, significantly reducing the amount of point cloud data and improving subsequent processing speed while maximizing the retention of key geometric information related to potential defects. This achieves an optimal balance between computational efficiency and detection accuracy, ensuring the reliability of geometric anomaly detection. Adaptive non-uniform voxel downsampling is performed based on the preliminary curvature features of each point in the point cloud data, including the following steps: S3.61. For the preprocessed but not yet downsampled original dense point cloud, calculate the covariance matrix of the local neighborhood (e.g., based on k-nearest neighbors) for each point in the point cloud data, and perform eigenvalue decomposition on the covariance matrix. Calculate the local curvature eigenvalue of the point based on the eigenvalue. The curvature eigenvalue reflects the degree of geometric curvature of the local region where the point is located. The higher the curvature, the more obvious the geometric change in the region. The covariance matrix is: ; The local curvature characteristic value is: ; In the formula, For point The local covariance matrix (3×3 matrix) reflects the geometric structure of the neighborhood point distribution. For point neighborhood point set The number of points (neighborhood size). For belongs to point Points in the neighborhood, For point The mean coordinates of the neighboring points, i.e., the centroid of the neighboring points. For point The local curvature eigenvalues ​​are between [0,1]. This indicates the transpose operation. Local covariance matrix The minimum eigenvalue reflects the degree of dispersion of the point's neighborhood in the normal direction; the smaller the value, the closer the point cloud is to a plane in that direction. The intermediate eigenvalues ​​of the local covariance matrix reflect the intensity of change in the neighborhood along a certain tangential direction. The largest eigenvalue of the local covariance matrix reflects the intensity of change in the neighborhood along another principal tangential direction, which usually corresponds to the principal extension direction of the local point cloud; S3.62. Create a 3D voxel grid in the point cloud space (point cloud space refers to a 3D coordinate space composed of point cloud data) for downsampling, and within each voxel, based on the average local curvature of the point cloud sampling points contained within the voxel. Adaptive adjustment of voxel size: (In the formula, Based on the basic voxel size, This is the adjustment coefficient (which controls the effect of curvature on voxel size). (For the adaptively adjusted voxel size), within each voxel, the point closest to the voxel center is retained as the representative point, thus forming a point cloud that balances efficiency and local detail; S3.7. Based on the preprocessed point cloud data, a spherical fitting surface reconstruction method is used to obtain a continuous geometric model of the surface of the spherical acoustic focusing lens mold, providing a reference for geometric feature calculation. Specifically, the preprocessed and downsampled point cloud data is first subjected to preliminary denoising and normal estimation. Then, based on the overall geometric distribution of the point cloud, initial fitting parameters, including the center position and radius, are selected. The least squares method is used to iteratively adjust the center coordinates and radius to minimize the vertical distance error from all points to the normal direction of the sphere. Through this iterative process, a continuous spherical model is obtained. This model smoothly connects the discrete sampling points in the point cloud and fully reflects the overall geometric shape of the surface of the spherical acoustic focusing lens mold, providing a reference surface for subsequent local curvature calculation and geometric anomaly detection. S3.8. Compare the continuous geometric model with the design CAD data or ideal mathematical spherical equation of the spherical acoustic focusing lens mold, and calculate the normal deviation and height residual of each point cloud sampling point (i.e., a single 3D point in the point cloud data) to identify the difference between the actual mold surface and the theoretical model. Specifically, the preprocessed point cloud is registered and aligned with the design CAD model of the mold or the fitted spherical surface; then, for each sampling point in the point cloud, least squares plane fitting is performed based on its local neighborhood points (such as k-nearest neighbors) to estimate the normal direction, and the angle between the normal vector at the corresponding position of the theoretical surface is compared to obtain the normal deviation; at the same time, the vertical distance between the coordinate projection of the sampling point in the normal direction and the corresponding point of the theoretical surface is calculated as the height residual; by repeating the above process for all sampling points, the deviation distribution of the entire mold surface from the ideal surface can be obtained, which is used for subsequent geometric anomaly detection and defect area identification. S3.9 Extract local geometric features from the surface of the spherical acoustic focusing lens mold based on point cloud data, including at least curvature value (or radius of curvature), surface gradient change (obtained by calculating the rate of change of the angle between the normal vectors of neighboring points to reflect the smoothness or abruptness of the local surface), and local plane fitting error (perform local plane fitting (such as least squares fitting) on ​​the set of neighboring points, calculate the vertical residual from each point to the fitting plane and statistically calculate the mean square error to obtain the local plane fitting error), used to characterize surface details and overall curvature changes; S3.10. Spatial mapping and cross-comparison are performed between the defect locations output by the convolutional neural network (CNN) model and the point cloud anomaly regions (i.e., the aggregation result of the defect point set determined by the CNN classification and geometric feature screening in three-dimensional space). If a region exhibits surface cracks, pits, or texture anomalies in the image features, and also has a normal abrupt change or height deviation in the point cloud geometry, then the region is confirmed as a true geometric anomaly. If a region only exhibits anomalies in a single modality, then a confidence assessment is used to determine whether to retain it as a potential defect.

[0022] S4. Spatially locate the identified surface defects on the three-dimensional coordinate reference frame of the spherical acoustic focusing lens mold, and calculate the size, depth and distribution of the defects to obtain quantitative indicators of the defects. In this embodiment, the identified surface defects are spatially located on the three-dimensional coordinate reference frame of the spherical acoustic focusing lens mold, and the size, depth, and distribution of the defects are calculated, including the following steps: S4.1 Map the defect locations identified by the convolutional neural network (CNN) in step S3 onto the point cloud under the three-dimensional coordinate reference frame. Use camera calibration parameters and depth information to convert the two-dimensional pixel coordinates into three-dimensional spatial coordinates and align them with the downsampled point cloud or fitted surface model to form a complete set of three-dimensional defect points. S4.2. Using a distance threshold-based clustering method (such as DBSCAN), neighboring defect points are grouped into the same defect. A unique identifier ID is generated for each defect, and the number and distribution range of defect points are recorded. Specifically: First, an index is created in the point cloud space for all defect points judged as abnormal. Based on the DBSCAN algorithm, a distance threshold c and a minimum number of points MinPts are set. Then, taking any point as the core point, the point set within its c-neighborhood is searched. If the number of neighboring points is greater than or equal to MinPts, the point is determined to be the core point, and its neighboring points are expanded into the same cluster. This iterative expansion forms defect clusters. If a point cannot be assigned to any cluster, it is marked as a noise point. Finally, each clustering result is regarded as an independent defect region, a unique defect ID is assigned to it, and the number of defect points and the three-dimensional coordinate distribution range within the cluster are counted to obtain the overall scale and spatial location description of the defect. S4.3 Perform size analysis on each defect region. Size analysis includes at least length and width analysis (extract the principal direction of the defect point set through principal component analysis (PCA) and calculate the maximum extended length and width), area analysis (project the defect points onto the fitted surface and calculate the coverage area based on convex hull or mesh method), and boundary contour analysis (extract the boundary of the defect points and generate the geometric contour line of the defect region for subsequent visualization and comparison). S4.4 Fit the surface model and calculate the defect depth characteristics; The fitting of the surface model and calculation of the defect depth features include the following steps: S4.41. For each set of defect points, perform local surface fitting (such as quadratic surface or B-spline surface) based on neighborhood points to obtain an initial surface model that is consistent with the ideal shape of the mold, and perform bidirectional projection residual calculation and fitting quality diagnosis. Furthermore, the bidirectional projection residual calculation and fitting quality diagnosis addresses the specific problem of establishing an accurate reference surface benchmark when calculating the defect depth of a spherical mold. Traditional methods directly use local point clouds containing defect points for surface fitting. This can lead to the fitted reference surface being "pulled down" by the defect area (such as a pit), resulting in a downward deviation and severely underestimating the true depth of the defect. This affects the accuracy of the detection results and the judgment of the defect severity. The bidirectional projection active diagnosis of fitting quality intelligently determines whether the initial fitted surface is contaminated by defects by comparing the projection residual distribution (fitting distortion) of the normal point set and the defect point set in two directions. Its core function is to effectively identify and eliminate the interference of defect points on the reference surface model. When the distortion exceeds the limit, it can automatically reconstruct an accurate reference surface using a clean normal point set, thereby ensuring the reliability of the defect depth calculation benchmark and ultimately obtaining more accurate and robust depth measurement results, providing a reliable basis for quantitative defect assessment. Performing bidirectional projection residual calculation and fitting quality diagnosis includes the following steps: From the initial surface model used for fitting Among the neighborhood points, using the classification results of the convolutional neural network (CNN) in step S3, the classification results are divided into a set of normal surface points with high confidence. With suspected defect set The specific partitioning process is as follows: First, a convolutional neural network (CNN) is used to perform forward inference on the input point cloud neighborhood data or its projection image, outputting the probability distribution of each point belonging to the normal surface or defect category, and generating the corresponding confidence score; then, a confidence threshold q is set. If the probability of a point in the normal surface category is greater than q, it is partitioned into the high-confidence normal point set. Otherwise, if its probability in the defect category exceeds q, it is classified into the suspected defect point set. Points with confidence levels below the threshold can be marked as undetermined points or re-evaluated through post-processing, thereby achieving reliable partitioning of the point set. Set of suspected defects Projected onto the initial surface model Calculate its height deviation (vertical distance) to obtain the positive residual distribution. ; Fit a local surface model that represents only the geometric features of the defect area. Normal surface point set Projecting points in the model onto the local surface Calculate its vertical distance to obtain the inverse residual distribution. ; Calculate the positive residual distribution and inverse residual distribution The distribution differences (such as calculating the difference between the two means or KL divergence) are used to reconstruct the reference surface based on the distribution differences; The distribution difference is the fitting distortion. ; The process of reconstructing the reference surface is as follows: when the fitting distortion... When the value is less than the preset threshold b, the initial surface model is used directly. As the final reference surface model When the fitting distortion When the threshold b is exceeded, only the normal surface point set is used. Refit the local surface to obtain a pure reference surface model. The initial surface model is calculated at the center point of the defect region. With pure reference surface model The height difference is used to obtain the compensation depth. It is used to correct the calculation results of defect depth, thereby avoiding surface sinking error caused by defect point interference, and ensuring the accuracy and robustness of depth feature representation. S4.42, in the local normal direction of the reference surface model (here, the reference surface model is the final reference surface model). ), calculate the vertical distance from the defect point to the fitted surface, and obtain the height deviation of the defect point. And perform depth compensation on the height deviation to generate the compensated height deviation. : ; S4.43, Compensated height deviation in the defect point set Statistical analysis is conducted to record the maximum depth value, average depth value, and root mean square deviation, forming a multi-dimensional defect depth characterization index, namely, defect depth characteristics. S4.5 Statistical analysis of the spatial distribution characteristics of defects on the entire surface of the spherical acoustic focusing lens mold: First, each defect region identified by clustering is mapped back to the 3D point cloud model of the spherical acoustic focusing lens mold, and the geometric center coordinates, boundary range, and occupied surface area of ​​the defect region are extracted; then, in the global spherical coordinate system, the defect position is converted into polar angle or standardized spherical parameters, and the radial distribution, circumferential distribution, and local density of defects on the mold surface are calculated; at the same time, the spatial proximity relationship and overall distribution pattern between different defects are statistically analyzed, such as whether they are concentrated, uniformly dispersed, or clustered along a certain structural direction; finally, the global distribution characteristics of defects on the mold surface are formed. S4.6 Integrate the spatial location, size, depth, and distribution characteristics of each defect into structured data, which can be directly used for defect visualization, classification, report generation, and subsequent process optimization analysis.

[0023] Example 2: This example provides a machine vision-based flaw detection system for large mold production, including a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor executes the computer program to implement the machine vision-based flaw detection method for large mold production described above.

[0024] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely preferred examples and are not intended to limit the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claimed invention.

Claims

1. A flaw detection method for large mold production based on machine vision, characterized in that, Includes the following steps: S1. Locate the surface and key curvature areas of the spherical acoustic focusing lens mold and establish a three-dimensional coordinate reference frame for the spherical acoustic focusing lens mold; S2. Acquire images of the entire spherical area of ​​the spherical acoustic focusing lens mold and preprocess the images. At the same time, acquire point cloud data of the surface of the spherical acoustic focusing lens mold. S3. Based on the preprocessed image, a convolutional neural network model is used to identify surface defects of the spherical acoustic focusing lens mold. Combined with point cloud data, regions with geometric anomalies are detected. In the process of identifying surface defects, a multi-scale convolutional kernel with a coordinate-aware mechanism is introduced to perform convolution operations on the input preprocessed image to extract the low-level features of the spherical acoustic focusing lens mold surface. The extraction of low-level features from the surface of the spherical acoustic focusing lens mold includes: for each preprocessed image input to the convolutional neural network model, simultaneously generating two coordinate maps, Xmap and Ymap, with the same size as the image; for each local region covered by the current convolutional kernel, based on the coordinate maps Xmap and Ymap, extracting the two-dimensional coordinates of the center pixel of the local region as the center point coordinates; inputting the center point coordinates and the scale information of the convolutional kernel into a lightweight multilayer perceptron to predict the offset ∆x of all sampling points of the convolutional kernel relative to the standard regular position. i ∆y i Based on the predicted offset ∆x i ∆y i At the offset position x i +∆x i y i +∆y i The sampling is performed on the surface, and the corresponding pixel value is obtained by bilinear interpolation; the sampled pixel values ​​are weighted and summed according to the convolution kernel weights to obtain the local convolution response, and the low-level features of the surface of the spherical acoustic focusing lens mold are formed based on the multi-scale convolution kernel. S4. Spatially locate the identified surface defects on the three-dimensional coordinate reference frame of the spherical acoustic focusing lens mold, and calculate the size, depth and distribution of the defects to obtain quantitative indicators of the defects. In step S3, the detection of regions with geometric anomalies based on point cloud data includes the following steps: The point cloud data is preprocessed to calculate the preliminary curvature features of the local neighborhood of each point, and adaptive non-uniform voxel downsampling is performed based on the preliminary curvature features of each point in the point cloud data. Based on the preprocessed point cloud data, a continuous geometric model of the surface of the spherical acoustic focusing lens mold is obtained by using the spherical fitting surface reconstruction method. The continuous geometric model is compared with the ideal mathematical spherical equation of the spherical acoustic focusing lens mold, and the normal deviation and height residual of each point cloud sampling point are calculated. Local geometric features of the surface of a spherical acoustic focusing lens mold are extracted based on point cloud data, including at least curvature values, surface gradient changes, and local plane fitting errors. The defect locations output by the convolutional neural network model are spatially mapped and cross-compared with the point cloud anomaly regions.

2. The flaw detection method for large mold production based on machine vision according to claim 1, characterized in that: In step S1, the three-dimensional coordinate reference frame of the spherical acoustic focusing lens mold is established. The specific steps involved are as follows: n geometric feature points are selected as initial reference points on the edge of the spherical acoustic focusing lens mold, the initial reference points are imaged and measured to obtain the two-dimensional pixel coordinates of the spherical acoustic focusing lens mold, and the obtained two-dimensional pixel coordinates are combined with camera calibration parameters and laser depth information to convert them into three-dimensional spatial coordinate data.

3. The flaw detection method for large mold production based on machine vision according to claim 1, characterized in that: In step S3, the surface defects of the spherical acoustic focusing lens mold are identified using a convolutional neural network model based on the preprocessed image, including the following steps: S3.1 Input the preprocessed image into the convolutional neural network model; S3.

2. The input image is convolved by a multi-scale convolution kernel with a coordinate-aware mechanism, and the low-level features of the surface of the spherical acoustic focusing lens mold are extracted. The low-level features include at least local texture, edge contour and curvature change. S3.

3. Perform dimensionality reduction and region invariance enhancement on the features in the pooling layer, and extract high-level semantic features related to the defects of the spherical acoustic focusing lens mold in the deep convolutional layer. S3.

4. In the fully connected layer, classify and discriminate the extracted high-level semantic features, and output the discrimination results of different categories of defects; S3.

5. Based on the discrimination results, locate and visualize the defect area in the original image, and output the defect location, defect category label and its confidence level.

4. The flaw detection method for large mold production based on machine vision according to claim 1, characterized in that: Adaptive non-uniform voxel downsampling is performed based on the preliminary curvature features of each point in the point cloud data, including the following steps: For each point in the point cloud data, calculate the covariance matrix of its local neighborhood, perform eigenvalue decomposition on the covariance matrix, and calculate the local curvature eigenvalue of the point based on the eigenvalues. Create a 3D voxel lattice in the point cloud space, and within each voxel, calculate the average local curvature W of the point cloud sampling points contained within the voxel. avg Adaptive adjustment of voxel size.

5. The flaw detection method for large mold production based on machine vision according to claim 3, characterized in that: In step S4, the identified surface defects are spatially located on the three-dimensional coordinate reference frame of the spherical acoustic focusing lens mold, and the size, depth, and distribution of the defects are calculated, including the following steps: S4.1 Map the defect locations identified by the convolutional neural network in step S3 onto the point cloud under the three-dimensional coordinate reference frame to form a complete set of three-dimensional defect points; S4.2 Using a distance threshold-based clustering method, neighboring defect points are grouped into the same defect, a unique identifier ID is generated for each defect, and the number and distribution range of defect points are recorded. S4.3 Perform dimensional analysis on each defect area; S4.4 Fit the surface model and calculate the defect depth characteristics; S4.5 Spatial distribution characteristics of statistical defects across the entire surface of the spherical acoustic focusing lens mold; S4.6 Integrate the spatial location, size, depth, and distribution characteristics of each defect into structured data.

6. The flaw detection method for large mold production based on machine vision according to claim 5, characterized in that: In step S4.4, fitting the surface model and calculating the defect depth features includes the following steps: S4.

41. For each set of defect points, perform local surface fitting based on neighborhood points to obtain an initial surface model, and perform bidirectional projection residual calculation and fitting quality diagnosis. S4.

42. Calculate the perpendicular distance from the defect point to the fitted surface in the local normal direction of the reference surface model to obtain the height deviation d of the defect point. base And perform depth compensation on the height deviation to generate the compensated height deviation d. final ; S4.43, Compensated height deviation d in the defect point set final Statistical analysis is conducted to record the maximum depth value, average depth value, and root mean square deviation, forming a multi-dimensional defect depth characterization index, namely, defect depth characteristics.

7. The flaw detection method for large mold production based on machine vision according to claim 6, characterized in that: In step S4.41, the calculation of bidirectional projection residuals and the diagnosis of fitting quality include the following steps: From the initial surface model M used for fitting initial Among the neighborhood points, using the classification results of the convolutional neural network in step S3, the classification results are divided into a normal surface point set P. normal With the suspected defect point set P defect ; The suspected defect point set P defect Projected onto the initial surface model M initial Calculate its height deviation to obtain the positive residual distribution R. forward ; Fit a local surface model M that represents the geometric features of the defect region. defect , the normal surface point set P normal Points in the model are projected onto the local surface model M. defect Calculate its vertical distance to obtain the inverse residual distribution R. reverse ; Calculate the positive residual distribution R forward and inverse residual distribution R reverse The distribution differences are analyzed, and a reference surface is reconstructed based on these differences.

8. A machine vision-based flaw detection system for large mold production, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: The processor executes a computer program to implement the machine vision-based flaw detection method for large mold production as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Large equipment surface defect positioning and measuring method based on image and point cloud combination

    CN117952904A

  • Local feature-based super-resolution reconstruction method for images of any scale

    CN119648523A

  • Machine vision dynamic defect detection method and device for precise structural part

    CN119887745A