Injection mold surface defect detection method based on visual detection

By acquiring process data and adjusting acquisition parameters, combining multispectral images and structured light 3D point clouds, and using thermal deformation and vibration interference compensation algorithms, a process-aware CNN model is constructed to quantify and predict defects. This solves the accuracy and stability problems of surface defect identification and repair in injection molds, and achieves efficient defect detection and prediction.

CN121049290BActive Publication Date: 2026-02-03SUZHOU XINGKAISHENG INTELLIGENT TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511588727.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-03
Publication Date
2026-02-03
Estimated Expiration
2045-11-03

AI Technical Summary

Technical Problem

Existing technologies cannot effectively adapt to the surface characteristics of injection molds in different processes, resulting in low defect identification accuracy, inability to quantify defect parameters, and inability to predict defect propagation trends, which affects mold repair accuracy and production stability.

Method used

By associating the mold ID with the MES system to acquire process data, adjusting the acquisition parameters, and combining multispectral images and structured light 3D point clouds, a process-aware CNN model is constructed using a thermal deformation finite element model and a vibration disturbance compensation algorithm. This model is then used to separate and quantify defects, and an LSTM model is combined to predict defect propagation and generate a defect evolution report.

Benefits of technology

It enables high-precision defect identification and quantification on the surface of molds with different processes, reduces the debugging cost of cross-process inspection, stabilizes the inspection results, predicts the defect expansion trend, and improves the accuracy of mold repair and production stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121049290B_ABST
    Figure CN121049290B_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of injection mold detection, and discloses an injection mold surface defect detection method based on visual detection. Step S1: according to the mold process parameters, the collection parameters are self-adaptively adjusted to ensure that the surface defect features of different processes are clearly collected. Step S2: the deformation matrix is output through the finite element model of mold thermal deformation, and the image registration is guided in combination with the deformation field to correct the position deviation of the thermal mold defect. Based on the vibration sensor data, a "vibration-fuzzy kernel" mapping model is constructed, and the improved Richardson-Lucy algorithm is used to restore the blurred image. Step S3: a process-specific texture primitive library is constructed to avoid positioning deviation of the unified threshold. Step S4: through the process perception attention CNN model, the process parameters are converted into feature extraction weights to accurately capture the defect core features under different processes. The design makes the detection method adapt to the surface of multi-process molds without replacing the model, greatly reducing the debugging cost of cross-process detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of injection mold inspection technology, specifically a method for detecting surface defects in injection molds based on visual inspection. Background Technology

[0002] Injection molds are core molding equipment in the automotive, electronics, and medical industries. Their surface quality directly determines the dimensional accuracy, appearance integrity, and sealing performance of plastic products. Defects such as microcracks and pinholes can easily lead to flash, leakage, and even batch scrapping. Currently, the mainstream inspection methods in the industry are manual visual inspection and traditional machine vision inspection. However, both methods have significant limitations under complex processes and dynamic conditions, making it difficult to meet the demands of high-precision production. Surface defects in injection molds directly determine the quality of plastic products, and existing inspection technologies face the following technical problems:

[0003] The mold surface includes multiple processes such as polishing, etching, and nitriding. Existing technologies use a unified feature model (such as fixed HOG and SIFT features), which cannot match the surface characteristics of different processes. Polished surfaces are easily confused with scratches and reflections, and etched surfaces are difficult to distinguish between texture abnormalities and real defects, resulting in a significantly low defect identification accuracy and extremely poor adaptability.

[0004] Dynamic interferences in the production line, such as mold thermal deformation, mechanical vibration, and surface deposits (melt, release agent), lack specific compensation solutions in existing technologies: thermal deformation causes significant displacement of defect locations, vibration blurring leads to severe loss of microcrack edge features, and false detection of deposits and defects is prominent, seriously affecting the stability of detection.

[0005] Existing technologies can only qualitatively determine whether there are defects, but cannot achieve three-dimensional quantification (depth, volume) and have no evolution prediction capabilities. They cannot provide key parameters such as grinding amount for repair, such as the grinding amount required for a depth of 0.05-0.1mm, nor can they predict the defect expansion trend based on the injection molding cycle, resulting in insufficient mold repair accuracy and frequent losses due to sudden failures and downtime. Summary of the Invention

[0006] The purpose of this invention is to provide a visual inspection-based method for detecting surface defects in injection molds, in order to solve the problems mentioned in the background art.

[0007] To achieve the above objectives, the present invention provides the following technical solution: a method for detecting surface defects in injection molds based on visual inspection, the specific steps of which are as follows:

[0008] Step S1: Obtain process data by associating the mold ID with the MES system, adjust the acquisition parameters according to different surface process characteristics, and acquire 2D multispectral images and structured light 3D point clouds;

[0009] Step S2: The image is registered using the finite element model of mold thermal deformation to obtain the corrected image. The blurred image is restored using the vibration-fuzzy kernel mapping model. The channel difference segmentation algorithm is used to separate the defect from the attached material.

[0010] Step S3: Construct a texture primitive library for the corresponding process, calculate the Bartlett distance between the window and the texture primitive of the corresponding process using a sliding window, mark windows with similarity < 0.6 as suspected regions, perform morphological dilation processing, and output the initial defect localization mask;

[0011] Step S4: Based on the initial defect localization mask, construct a process-aware attention CNN model, output 256-dimensional semantic features, extract geometric features from the structured light 3D point cloud, and form a fusion feature including defect semantic features, 3D geometric features and process features after Min-Max normalization.

[0012] Step S5: Obtain the Mini-ViT model through feature extraction and classification knowledge distillation. For new mold materials or defect types, only an incremental adapter with less than 500K parameters needs to be added before the classification head. The classification results are then corrected by combining the defect association matrix.

[0013] Step S6: Combine the corrected image from step S2 with the 3D point cloud from step S1 to calculate the actual size of the defect. Use the gray-scale-depth mapping model to obtain the defect depth and volume, quantify the defect parameters, and input the detection data into the LSTM time series prediction to predict the defect expansion.

[0014] Step S7: Based on the defect parameters and predicted defect expansion amount from Step S6, generate a defect evolution report; push defect warnings to the MES system, output defect evolution reports to the operation and maintenance end, feed back the detection data of the repaired mold to Step S1 to optimize the acquisition parameters, and input the missed samples into the incremental adapter of Step S5.

[0015] Preferably, the specific steps of step S1 are as follows:

[0016] S11. Process Data Acquisition and Acquisition Parameter Adaptation: By associating the mold ID with the MES system, core process data such as polishing roughness Ra value (0.01-0.05μm), etching texture parameters (spacing 0.1-0.5mm, depth 5-10μm), and nitride layer thickness (5-15μm) are accurately acquired. The acquisition parameters are adaptively adjusted according to different surface process characteristics: blue light (450nm) + 0° polarization is used for polished surfaces (Ra < 0.02μm), green light (532nm) + 90° polarization is used for etched surfaces (spacing 0.2-0.5mm), and red light (650nm) + 45° polarization is used for the nitride layer. The exposure time (10-15ms for polished surfaces, 20-25ms for etched surfaces) and gain (0-5dB) are adjusted synchronously.

[0017] The differences in optical reflection characteristics of different surface processes are the core basis for parameter adaptation: polished surfaces have extremely low surface roughness (Ra 0.01-0.05μm), which easily produces specular reflection. Using blue light (short wavelength) + 0° polarization can reduce reflected light interference and highlight linear defects such as scratches; etched surfaces have periodic texture structures (spacing 0.1-0.5mm). The green light wavelength has a high matching degree with the texture spacing. Combined with 90° polarization, it can enhance the grayscale contrast between texture and defects; the nitride layer is a dense compound layer (thickness 5-15μm). The red light penetration is suitable for this thickness range. 45° polarization can reduce interlayer reflection stray light and ensure clear imaging of crack defects;

[0018] S12. Multimodal data acquisition and subsequent connection: Simultaneously acquire 2D multispectral images (3 spectra × 3 polarizations) and structured light 3D point clouds (resolution 0.01mm / point) to form a multimodal dataset covering the visual features and spatial morphology of defects; this dataset can effectively avoid the problem of insufficient information from a single image and provide high-quality data support for step S2.

[0019] The collaborative logic for acquiring 2D multispectral images and 3D point clouds is as follows: First, the planar grayscale features of defects (such as grayscale anomalies in cracks) are captured using 2D multispectral images. Then, the spatial morphological information of defects (such as the depth distribution of depressions) is supplemented by structured light 3D point clouds. During acquisition, the coordinates of the defect area in the 2D image are used as a reference to guide the 3D point cloud to perform localized encrypted scanning in the corresponding area, ensuring that the 3D data accuracy of the defect area is higher than that of the non-defect area, thus providing more accurate spatial data support for subsequent 3D quantization.

[0020] Preferably, the specific steps of step S2 are as follows:

[0021] S21. Thermal Deformation and Vibration Interference Compensation: Based on the multimodal data obtained in step S1, the core interference is processed by integrating physical models and image algorithms: the deformation matrix is ​​output through the finite element model of mold thermal deformation (input temperature 200-280℃, material thermal expansion coefficient), and the hot image is aligned with the cold reference image by "deformation field guided image registration"; the "vibration-fuzzy kernel" mapping model (σ=0.5-2) is constructed by combining the real-time amplitude (0.01-0.05mm) of the vibration sensor of the production line, and the vibration fuzzy image is restored by introducing the improved Richardson-Lucy algorithm with defect edge prior (grayscale gradient > background 5 times);

[0022] Formula for deformation amount in thermal distortion image registration:

[0023]

[0024] In the formula: This represents the pixel position offset of defects in a hot mold image, in pixels, and corrects for defect position deviations caused by thermal deformation.

[0025] The coefficient of linear expansion of the mold material, expressed in degrees Celsius.

[0026] This indicates the temperature difference between the hot and cold states of the mold, expressed in degrees Celsius.

[0027] ,in The temperature of the mold after injection molding. Room temperature;

[0028] This represents the initial pixel position coordinates of the defect in the cold mold image. The modulus of ) is in pixels, i.e. ;

[0029] This indicates the actual thickness of the mold area where the defect is located, in millimeters, and is obtained through mold design drawings or 3D point cloud measurements.

[0030] This indicates the standard thickness of the mold, in millimeters, and is obtained from the mold process data associated with the MES system. It is used to correct for the impact of thickness differences in different areas on thermal deformation.

[0031] 's' represents the pixel size, measured in mm / pixel, obtained through camera calibration.

[0032] The coupling logic between the thermal deformation finite element model and image registration: The model first calculates the physical deformation (in mm) of each region of the mold based on the thermal expansion coefficient of the mold material (such as P20 steel, H13 steel) and the real-time temperature difference. Then, it converts the physical deformation into image pixel offset (ΔP) through the pixel size (s, mm / pixel) to ensure that the offset of each pixel corresponds to the real physical deformation during registration. During the registration process, the mold edge feature points of the cold reference image are used as anchor points, and the hot image is corrected point by point according to the deformation matrix to avoid local deviations caused by overall registration.

[0033] S22. Separation and Positioning of Attachments: To address interference from attachments such as molten plastic and release agent on the mold surface, based on the multispectral grayscale difference characteristics, the molten plastic has a 20%-30% higher grayscale in the blue channel and the release agent has a 15%-20% lower grayscale in the red channel. The channel difference segmentation algorithm (threshold based on the 3σ criterion) is used to achieve pixel-level separation of defects and attachments, eliminating dynamic interference and providing a clean, interference-free image for step S3, ensuring positioning accuracy.

[0034] The selection criteria for the channel difference segmentation algorithm are as follows: The plastic melt contains high molecular polymers, which have a significantly higher reflectivity to blue light than the mold substrate, resulting in an abnormally high grayscale value in the blue light channel; the release agent is mostly an oily substance, which has a higher absorption rate to red light than the mold substrate, resulting in an abnormally low grayscale value in the red light channel; by utilizing the unique spectral response differences of this material, the channel difference algorithm can accurately distinguish between defects (without specific spectral response deviations) and attachments (with clear channel grayscale anomalies), avoiding the problem of 'misjudgment of defects and attachments' in traditional grayscale threshold segmentation.

[0035] Preferably, the specific steps of step S3 are as follows:

[0036] S31. Construction of the Process Texture Primitive Library: For the clean image after compensation in step S2, a texture primitive library is constructed according to the mold surface process classification: the polished surface corresponds to Gaussian texture primitives with σ < 0.8 (matching its uniform and smooth characteristics), the etched surface corresponds to periodic texture primitives with a period equal to the etch interval (fitting its regular texture structure), and the nitrided layer corresponds to uniform texture primitives with a grayscale variance < 5 (adapting to its dense surface characteristics). The construction of the primitive library ensures that the positioning standard and process characteristics are deeply matched, avoiding deviations in general positioning;

[0037] The design of the process texture primitives is strongly correlated with the process fabrication: the polished surface forms a uniform surface through mechanical polishing, and its texture conforms to the Gaussian distribution characteristics. Therefore, Gaussian texture primitives with σ < 0.8 are selected to match its smoothness. The etched surface forms periodic grooves through chemical etching or laser etching. The texture spacing is directly related to the etching process parameters (such as etching time and etching solution concentration). Therefore, periodic texture primitives with a period equal to the etching spacing are selected to match its regular structure. The nitrided layer forms a dense surface layer through gas nitriding. The surface grayscale distribution is uniform. Therefore, uniform texture primitives with grayscale variance < 5 are selected to match its dense characteristics.

[0038] S32. Suspected area screening and mask output: A 5×5 pixel sliding window is used to traverse the image, and the Barcol distance between each window and the corresponding process texture primitive is calculated. Windows with similarity <0.6 are marked as suspected defect areas. Then, morphological dilation of 3×3 structuring elements is used to eliminate the discontinuous markings of microcracks and output a continuous and complete initial defect localization mask. This mask is used to accurately define the target area for multi-dimensional feature extraction in step S4 and avoids the mixing of irrelevant background information during feature extraction.

[0039] Bach distance formula for defect texture similarity:

[0040]

[0041] In the formula: This represents the Bach distance, with a value range of [0, 1], used to measure the similarity between the texture of the window to be detected and the primitive of the process texture;

[0042] This indicates the number of gray levels, with a value of 256, representing all possible values ​​for the image's gray levels.

[0043] This represents the probability of grayscale distribution of the texture of the window to be detected, that is, the grayscale value in the window to be detected. The proportion of pixels in the window to the total number of pixels is obtained by counting the sliding window.

[0044] This represents the grayscale distribution probability of the process texture primitives, i.e., the constructed process texture primitive library.

[0045] The logic for determining the Barcol distance similarity threshold of 0.6 is as follows: Through texture analysis of multiple sets of defect-free process surface samples (≥200 samples for each process), the Barcol distance between normal texture windows and corresponding process primitives is calculated to be ≤0.4 (i.e., similarity ≥0.6); while for texture windows containing defects (such as microcracks and pinholes), due to the deviation of grayscale distribution from the normal pattern, the Barcol distance is >0.4 (i.e., similarity <0.6); this threshold can ensure coverage of the vast majority of real defects, while excluding mislabeling caused by normal texture fluctuations.

[0046] Preferably, the specific steps of step S4 are as follows:

[0047] S41. Deep Feature Extraction of Process-Aware CNN: Based on the initial defect localization mask in step 3, a process-aware attention CNN model based on the MobileNetV3 architecture is constructed (parameter count < 8M, balancing accuracy and real-time performance): the mold process parameters (Ra value, etching spacing) are transformed into attention weight adjustment factors. The edge feature channel weights are increased for the polished surface (0.7-0.8), and the texture difference channel weights are increased for the etched surface (0.6-0.7). This accurately focuses on the core features of defects under different processes and finally outputs 256-dimensional deep semantic features that reflect the gray-scale distribution and edge curvature of defects.

[0048] The logic of the relationship between process parameters and attention weights: The core defects of polished surfaces are scratches and dents. The edge features of these defects are key to identification. Therefore, the smaller the Ra value of the polished surface (the smoother the surface), the higher the weight of the edge feature channel to enhance the capture of subtle edges. The core defects of etched surfaces are texture gaps and misalignments. The texture difference features of these defects are key to identification. Therefore, the larger the texture spacing of the etched surface, the higher the weight of the texture difference channel to highlight the discontinuous areas of texture. By dynamically adjusting the weights through process parameters, the model can focus on the core defect features under each process and avoid interference from irrelevant features.

[0049] S42. Multi-dimensional feature fusion and support: The structured light 3D point cloud collected in step S1 is processed simultaneously to extract 18-dimensional 3D geometric features such as "depth gradient, surface roughness, and volume density". At the same time, the normalized process parameters (Ra value, etching spacing, and nitride layer thickness) are used as 8-dimensional process features. The deep semantic features, 3D geometric features and process features are concatenated and normalized by Min-Max to form a 282-dimensional fused feature vector. Then, the feature expression is optimized through adversarial training (constructing a defect / non-defect feature discriminator) to provide comprehensive and accurate core data support for step S5.

[0050] Feature fusion Min-Max normalization formula:

[0051]

[0052] In the formula: This represents the normalized feature value, which takes the range [0, 1] and is used to eliminate the influence of differences in the dimensions of features of different dimensions on the classification model.

[0053] Represents the original feature values ​​to be normalized, with units varying depending on the feature type:

[0054] If it is a deep semantic feature These are the floating-point feature values ​​output by the CNN;

[0055] If it is a three-dimensional geometric feature The unit is mm / mm;

[0056] If it is a technological feature The unit is micrometer;

[0057] This represents the minimum value under this feature dimension, in units of 1 and 2. Consistent, derived from statistical analysis of the characteristics of 1000 sets of mold defect samples;

[0058] This represents the maximum value within this feature dimension, in units of 1 and 2. Consistent, same statistical source This ensures that all possible defect feature values ​​are covered.

[0059] The complementary logic of multi-dimensional feature fusion: deep semantic features (256 dimensions) mainly reflect the planar visual details of defects (such as grayscale distribution and edge curvature), three-dimensional geometric features (18 dimensions) mainly reflect the spatial morphology of defects (such as depth gradient and volume density), and process features (8 dimensions) mainly reflect the process background of defect generation (such as Ra value and nitriding layer thickness). After the three are combined, comprehensive feature coverage of 'visual details-spatial morphology-process background' can be achieved, avoiding the problem that single-dimensional features cannot distinguish 'similar appearance but different types of defects' (such as scratches on polished surfaces and missing corners in etched surfaces).

[0060] Preferably, the specific steps of step S5 are as follows:

[0061] S51. Lightweight Transformer Model Construction: Based on the 282-dimensional fused feature vector in step S4, a lightweight model is designed using "knowledge distillation + simplified architecture": The high-precision ViT-Base model (86M parameters) is used as the teacher model, and its feature extraction and classification knowledge are distilled into the self-designed "Mini-ViT" model (<12M parameters). The inference time for a single image is compressed to <80ms, which meets the production line cycle time requirements.

[0062] Lightweight model design and adaptation logic for production line scenarios: The production line has real-time requirements for detection speed (it needs to match the injection molding cycle time). Therefore, the core classification knowledge of the ViT-Base model is transferred to Mini-ViT through knowledge distillation, which compresses the number of parameters while retaining high accuracy. When simplifying the architecture, according to the complexity of mold defect features (6 types of defects, 282 feature dimensions), the number of encoder layers and attention heads is reduced to ensure that the inference time of a single image meets the continuous detection requirements of the production line and avoids detection delays caused by model redundancy.

[0063] S52, Incremental Adaptation and Classification Correction: For new mold materials (such as 718H steel) or defect types (such as nitrided layer cracks), there is no need to retrain the Mini-ViT main network. Only a "process / defect adapter" with less than 500K parameters is added before the classification head. It can be quickly adapted by training with 50-100 new samples (time < 1 hour). At the same time, a defect correlation matrix (such as the co-occurrence probability of microcracks and dents > 30%) is introduced to correct the classification results, so as to clarify the accurate target object for step S6.

[0064] The design logic of the incremental adapter is as follows: When adding a new mold material or defect type, the core difference lies in the mapping relationship between 'process-feature' (such as the different feature responses of nitrided layer cracks in 718H steel and nitrided layer cracks in P20 steel), rather than the overall feature extraction logic. Therefore, the new 'process-feature' mapping is learned only through a small adapter, without the need to retrain the main network. This reduces the time cost of model iteration and avoids the forgetting of original knowledge caused by full retraining, ensuring that the model retains its detection capability for the original scene while adapting to the new scene.

[0065] Preferably, the specific steps of step S6 are as follows:

[0066] S61. 3D Defect Quantization Analysis: Combining the corrected image from step S2 with the 3D point cloud from step 1, full-dimensional defect quantization is achieved: The actual defect size is calculated by "sub-pixel edge detection (accuracy 0.1 pixel) + 3D point cloud registration" combined with camera calibration parameters (0.02 mm / pixel); Based on the multispectral gray-depth mapping model, such as the red light gray level and nitrided layer crack depth R² > 0.95, the defect depth (accuracy 0.005 mm) and volume (accuracy 0.001 mm³) are obtained by combining 3D point cloud data, filling the gap in the traditional 2D detection dimension.

[0067] Multispectral gray-depth mapping formula:

[0068]

[0069] In the formula: This indicates the actual depth of defects on the surface of the injection mold, measured in millimeters, specifically referring to the vertical depth of defects such as cracks and depressions in the nitride layer.

[0070] This represents the material correction coefficient, which needs to be calibrated using standard defect samples. It is used to compensate for the influence of different mold materials on the multispectral grayscale and depth mapping relationship; the relationship between the k-value and the material's thermal conductivity and surface reflectivity, such as... , Wavelength;

[0071] This represents the average gray value of the defect area in the red light channel, with a value range of 0-255, which is calculated from the pixel gray values ​​of the defect mask area in the multispectral image acquired in step S1.

[0072] This represents the average gray value of the defect-free region in the red light channel (650nm), with a value range of 0-255. It is obtained by statistical analysis of the gray values ​​of defect-free primitives in the process texture primitive library constructed in step S3, ensuring consistency with the gray value acquisition conditions of the defective region.

[0073] The physical basis of the gray-scale-depth mapping model is that different depths of defects on the mold surface result in different degrees of reflection and absorption of multispectral light, and this degree is strongly correlated with the mold material properties (such as thermal conductivity and surface reflectivity). For example, the greater the depth of the nitrided layer crack, the less red light is reflected in the crack area, and the lower the gray value of the red light channel. By establishing a mapping relationship between gray value and depth, and introducing a material correction coefficient k to compensate for the differences in spectral response of different materials, the accurate conversion from gray-scale information to depth information can be achieved, filling the gap in traditional 2D detection that cannot quantify depth.

[0074] S62. Defect Evolution Prediction and Repair Parameter Output: Construct a "defect-injection cycle" related database, record the defect parameters (size, depth, location) and injection cycle number for each detection, input the historical 10 detection data into the LSTM time series prediction model, and output the defect expansion amount after the next 50 injection cycles; based on the quantitative results of defect depth, volume, and actual size and the characteristics of mold material, automatically generate repair parameters, such as the need to grind 0.1-0.15mm for depressions with a depth of 0.05-0.1mm and the corresponding grinding path;

[0075] LSTM defect propagation prediction formula:

[0076]

[0077] In the formula: Indicates the future Predicted expansion of defects after one injection cycle, in millimeters;

[0078] Physical meaning: The difference between the predicted future defect size and the current defect size, such as the future length of a microcrack minus the current length. If mm, a repair warning will be triggered;

[0079] This represents the defect size sequence from the last 10 historical inspections, in millimeters, and constitutes the defect size input feature of the LSTM.

[0080] Subscript meaning: Represents the current detection time. This represents the 9th test before the current moment;

[0081] This represents the sequence of historical injection molding cycle counts corresponding to the aforementioned defect size. It is dimensionless and constitutes the temporal correlation input feature of the LSTM.

[0082] definition: For the current detection time ( The corresponding cumulative number of injection cycles for the mold. This represents the cumulative number of cycles since the previous test.

[0083] Indicates the current detection time ( The actual size of the defect, in millimeters, is the defect size obtained by multimodal quantization in step S6 (e.g., the current microcrack length is 0.08 mm).

[0084] Calculation logic: The future defect size output by the LSTM directly reflects the physical meaning of the expansion.

[0085] The logic for adapting LSTM time-series prediction to defect evolution patterns: The expansion of injection mold defects is temporally related to the number of injection cycles (e.g., microcracks will slowly expand under the influence of temperature and pressure after each injection cycle), and this expansion process has short-term continuity; therefore, the LSTM model (which is good at capturing long-term dependencies in time-series data) is selected, and the data from the last 10 detection cycles are input (which can cover short-term expansion patterns) to predict the amount of defect expansion in the next 50 injection cycles, providing a time-series decision basis for preventive maintenance and avoiding misjudgments of maintenance timing based solely on the current defect status.

[0086] Preferably, the specific steps of step S7 are as follows:

[0087] S71. Closed-loop system multi-terminal result output: Based on the quantitative results and repair parameters in step S6, construct an industrial-grade multi-terminal output closed loop: push defect warnings (trigger shutdown when defect size exceeds threshold) and repair parameters (automatically generate grinding paths by connecting to the CAM system) to the production-end MES system to avoid continuous production of defective molds; output a defect evolution report containing the risk level of the next 100 injection cycles to the operation and maintenance end to support mold preventive maintenance decisions and reduce losses from sudden failure downtime;

[0088] The collaborative logic of multi-terminal output closed loop: The production end needs to control the mold usage status in real time, so it pushes defect warnings and repair parameters to ensure that defective molds are stopped and repaired in time to avoid the production of batches of unqualified products; the operation and maintenance end needs to formulate long-term maintenance plans, so it outputs defect evolution reports to ensure that maintenance is arranged in advance based on defect expansion trends to avoid production line shutdowns caused by sudden failures; through multi-terminal output, the linkage of 'real-time production control - long-term maintenance planning' is realized, covering the mold's full life cycle management needs;

[0089] S72. Data Feedback and Full-Process Optimization: Establish a data feedback mechanism: Feedback the inspection data of the repaired mold (such as defect residue > 0.01mm) to step S1 to optimize image acquisition parameters, such as increasing the weight of the blue light channel; After labeling the missed / false detection samples, input them into the incremental adapter in step S5 to achieve automatic model iteration once a month; At the same time, based on the defect type and frequency, output process optimization suggestions to the mold processing stage, such as adjusting the etching current ±5% when etching corner defects occur frequently, and finally achieve full-process optimization of "inspection-repair-model-process".

[0090] The beneficial effects of this invention are as follows:

[0091] 1. This invention achieves full process coverage through multi-stage technological innovation: Step S1 adaptively adjusts the acquisition parameters according to the mold process parameters to ensure clear acquisition of surface defect features of different processes; Step S3 constructs a process-specific texture primitive library to avoid positioning deviation under a uniform threshold; Step S4 uses a process-aware attention CNN to transform process parameters into feature extraction weights, accurately capturing the core features of defects under different processes; This design enables the detection method to adapt to the surface of molds with multiple processes without changing the model, greatly reducing the debugging cost of cross-process detection and meeting diverse mold detection needs.

[0092] 2. This invention integrates physical models and image algorithms to form an interference compensation system: Step S2 outputs the deformation matrix through the finite element model of mold thermal deformation, and combines the deformation field to guide image registration to correct the position deviation of hot mold defects; a "vibration-fuzzy kernel" mapping model is constructed based on vibration sensor data, and the blurred image is restored using the improved Richardson-Lucy algorithm, preserving the details of microcrack edges; using the multispectral grayscale difference characteristics, pixel-level separation of defects and attachments is achieved through channel difference segmentation; this scheme effectively resists dynamic interference on the production line, ensuring stable defect identification under complex working conditions and reducing detection interruptions or misjudgments caused by interference.

[0093] 3. This invention constructs a full-chain quantification and prediction system: Step S6 combines the corrected image with the 3D point cloud, and obtains 3D parameters such as defect size, depth, and volume through sub-pixel edge detection and grayscale-depth mapping model, providing a precise basis for grinding amount for repair; constructs a "defect-injection cycle" related database, inputs historical data into the LSTM model, and predicts future defect expansion trends; Step S7 pushes repair parameters to the production end and outputs risk reports to the operation and maintenance end, realizing "detection-repair-maintenance" linkage; this effect fills the gap in defect quantification dimensions, avoids blind repair, and at the same time avoids sudden mold failures in advance through trend prediction, reducing production losses. Attached Figure Description

[0094] Figure 1This is a flowchart of the visual inspection-based surface defect detection method for injection molds according to the present invention. Detailed Implementation

[0095] 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 skilled in the art without creative effort are within the scope of protection of the present invention.

[0096] like Figure 1 As shown in the figure, this invention provides a method for detecting surface defects in injection molds based on visual inspection. The specific steps of this method are as follows:

[0097] Step S1: Obtain process data by associating the mold ID with the MES system, adjust the acquisition parameters according to different surface process characteristics, and acquire 2D multispectral images and structured light 3D point clouds;

[0098] Step S2: The image is registered using the finite element model of mold thermal deformation to obtain the corrected image. The blurred image is restored using the vibration-fuzzy kernel mapping model. The channel difference segmentation algorithm is used to separate the defect from the attached material.

[0099] Step S3: Construct a texture primitive library for the corresponding process, calculate the Bartlett distance between the window and the texture primitive of the corresponding process using a sliding window, mark windows with similarity < 0.6 as suspected regions, perform morphological dilation processing, and output the initial defect localization mask;

[0100] Step S4: Based on the initial defect localization mask, construct a process-aware attention CNN model, output 256-dimensional semantic features, extract geometric features from the structured light 3D point cloud, and form a fusion feature including defect semantic features, 3D geometric features and process features after Min-Max normalization.

[0101] Step S5: Obtain the Mini-ViT model through feature extraction and classification knowledge distillation. For new mold materials or defect types, only an incremental adapter with less than 500K parameters needs to be added before the classification head. The classification results are then corrected by combining the defect association matrix.

[0102] Step S6: Combine the corrected image from step S2 with the 3D point cloud from step S1 to calculate the actual size of the defect. Use the gray-scale-depth mapping model to obtain the defect depth and volume, quantify the defect parameters, and input the detection data into the LSTM time series prediction to predict the defect expansion.

[0103] Step S7: Based on the defect parameters and predicted defect expansion amount from Step S6, generate a defect evolution report; push defect warnings to the MES system, output defect evolution reports to the operation and maintenance end, feed back the detection data of the repaired mold to Step S1 to optimize the acquisition parameters, and input the missed samples into the incremental adapter of Step S5.

[0104] The specific steps of step S1 are as follows:

[0105] S11. Process Data Acquisition and Acquisition Parameter Adaptation: By associating the mold ID with the MES system, core process data such as polishing roughness Ra value (0.01-0.05μm), etching texture parameters (spacing 0.1-0.5mm, depth 5-10μm), and nitride layer thickness (5-15μm) are accurately acquired. The acquisition parameters are adaptively adjusted according to different surface process characteristics: blue light (450nm) + 0° polarization is used for polished surfaces (Ra < 0.02μm), green light (532nm) + 90° polarization is used for etched surfaces (spacing 0.2-0.5mm), and red light (650nm) + 45° polarization is used for the nitride layer. The exposure time (10-15ms for polished surfaces, 20-25ms for etched surfaces) and gain (0-5dB) are adjusted synchronously.

[0106] Synchronous adjustment of exposure time and gain: For polished surfaces (Ra < 0.02 μm), the exposure time is set to 10-12 ms and the gain to 0-2 dB; for polished surfaces (Ra ≥ 0.02 μm and ≤ 0.05 μm), the exposure time is set to 13-15 ms and the gain to 3-5 dB; for etched surfaces (pitch 0.2-0.3 mm), the exposure time is set to 20-22 ms and the gain to 1-3 dB; for etched surfaces (pitch 0.3-0.5 mm), the exposure time is set to 23-25 ​​ms and the gain to 3-5 dB; for nitride layers (thickness 5-10 μm), the exposure time is set to 18-20 ms and the gain to 2-4 dB; for nitride layers (thickness 10-15 μm), the exposure time is set to 21-23 ms and the gain to 4-5 dB.

[0107] S12. Multimodal data acquisition and subsequent connection: Simultaneously acquire 2D multispectral images (3 spectra × 3 polarizations) and structured light 3D point clouds (resolution 0.01mm / point) to form a multimodal dataset covering the visual features and spatial morphology of defects; this dataset can effectively avoid the problem of insufficient information from a single image and provide high-quality data support for step S2.

[0108] Multimodal data timestamp alignment: When acquiring 2D multispectral images and structured light 3D point clouds, synchronization is triggered by device hardware (the trigger signal is a 5V level signal, triggered on the rising edge), and the timestamp error between each 2D image and the corresponding 3D point cloud is controlled within ±10ms; during data storage.

[0109] The specific steps of step S2 are as follows:

[0110] S21. Thermal Deformation and Vibration Interference Compensation: Based on the multimodal data obtained in step S1, the core interference is processed by integrating physical models and image algorithms: the deformation matrix is ​​output through the finite element model of mold thermal deformation (input temperature 200-280℃, material thermal expansion coefficient), and the hot image is aligned with the cold reference image by "deformation field guided image registration"; the "vibration-fuzzy kernel" mapping model (σ=0.5-2) is constructed by combining the real-time amplitude (0.01-0.05mm) of the vibration sensor of the production line, and the vibration fuzzy image is restored by introducing the improved Richardson-Lucy algorithm with defect edge prior (grayscale gradient > background 5 times);

[0111] The correspondence between σ value and amplitude in the vibration-fuzzy kernel mapping model is as follows: σ = 0.5-0.8 when amplitude is 0.01-0.02 mm, σ = 0.8-1.2 when amplitude is 0.02-0.03 mm, σ = 1.2-1.6 when amplitude is 0.03-0.04 mm, and σ = 1.6-2.0 when amplitude is 0.04-0.05 mm. The improved Richardson-Lucy algorithm has 20 iterations, a step size of 0.05 per iteration, and an edge prior weight coefficient of 0.7.

[0112] An improved approach to introducing defect edge priors in the Richardson-Lucy algorithm is proposed: suspected edge regions are extracted using Canny edge detection (threshold 100-200), generating an edge mask matrix (pixel values ​​of 1 for edge regions and 0 for non-edge regions); the edge mask matrix is ​​multiplied by the restored image of each iteration, with the weight of edge regions set to 0.7 and the weight of non-edge regions set to 0.3, enhancing the restoration effect of edge details and avoiding edge blurring during the restoration process;

[0113] S22, Separation and Positioning of Attachments: To address interference from attachments such as molten plastic and release agent on the mold surface, based on the multispectral grayscale difference characteristics, the molten plastic has a 20%-30% higher grayscale in the blue channel and the release agent has a 15%-20% lower grayscale in the red channel. The channel difference segmentation algorithm (threshold based on the 3σ criterion) is used to achieve pixel-level separation of defects and attachments, eliminating dynamic interference and providing a clean image without interference for step S3, ensuring positioning accuracy;

[0114] The 3σ criterion calculation method for the channel difference segmentation algorithm is as follows: ① Collect multispectral grayscale values ​​of 100 defect-free areas (100 data points each for blue, green, and red channels); ② Calculate the mean μ and standard deviation σ of the grayscale value of each channel; ③ Set segmentation thresholds: the defect judgment threshold for the blue channel is μ-3σ to μ+3σ, and the defect judgment threshold for the red channel is μ-2.5σ to μ+2.5σ. Pixels exceeding the threshold range are marked as suspected defects to exclude interference from attached materials (grayscale value of blue channel in plastic melt > μ+3σ, grayscale value of red channel in release agent < μ-2.5σ).

[0115] The specific steps of step S3 are as follows:

[0116] S31. Construction of Process Texture Primitive Library: For the clean image after compensation in step S2, a texture primitive library is constructed according to the process classification of the mold surface: the polished surface corresponds to Gaussian texture primitives with σ < 0.8 (matching its uniform and smooth characteristics), the etched surface corresponds to periodic texture primitives with a period equal to the etch interval (fitting its regular texture structure), and the nitrided layer corresponds to uniform texture primitives with grayscale variance < 5 (adapting to its dense surface characteristics). The construction of the primitive library ensures that the positioning standard and process characteristics are deeply matched, avoiding deviations in general positioning;

[0117] In the process texture primitive library, the primitive size is uniformly set to 32×32 pixels. The sample size of the primitive library for each process type is ≥500: the polishing surface primitive is collected from 5 32×32 pixel areas from the surface of each of 100 defect-free polishing molds, the etching surface primitive is collected from 6-7 32×32 pixel areas from the surface of each of 80 defect-free etching molds, and the nitriding layer primitive is collected from 4-5 32×32 pixel areas from the surface of each of 120 defect-free nitriding layer molds. All primitives are stored after grayscale normalization (0-255).

[0118] S32. Suspected area screening and mask output: A 5×5 pixel sliding window is used to traverse the image, and the Barcol distance between each window and the corresponding process texture primitive is calculated. Windows with similarity <0.6 are marked as suspected defect areas. Then, morphological dilation of 3×3 structuring elements is used to eliminate the discontinuous markings of microcracks and output a continuous and complete initial defect localization mask. This mask is used to accurately define the target area for multi-dimensional feature extraction in step S4 and avoids the mixing of irrelevant background information during feature extraction.

[0119] When calculating the Bach distance, the number of gray levels n=256, and the probability of gray level distribution of the detection window (5×5 pixels) is... This is determined by counting the pixel grayscale values ​​within the sliding window (for example, if there are 3 pixels with a grayscale value of 100 within the window, then...). =3 / 25); Morphological dilation processing uses 3×3 square structuring elements, with the structuring element matrix being [[1,1,1], [1,1,1], [1,1,1]], and the dilation iteration is performed once to ensure that the discontinuous markers of microcracks are connected as continuous regions.

[0120] The specific steps of step S4 are as follows:

[0121] S41. Deep Feature Extraction of Process-Aware CNN: Based on the initial defect localization mask in step 3, a process-aware attention CNN model based on the MobileNetV3 architecture is constructed (parameter count < 8M, balancing accuracy and real-time performance): the mold process parameters (Ra value, etching spacing) are transformed into attention weight adjustment factors. The edge feature channel weights are increased for the polished surface (0.7-0.8), and the texture difference channel weights are increased for the etched surface (0.6-0.7). This accurately focuses on the core features of defects under different processes and finally outputs 256-dimensional deep semantic features that reflect the gray-scale distribution and edge curvature of defects.

[0122] The specific formula for converting process parameters into attention weight adjustment factors is: w = 0.4 × (Ra / 0.05) + 0.6 × (etching pitch / 0.5), where Ra is in μm (value 0.01-0.05μm), the etching pitch is in mm (value 0.2-0.5mm), and w ranges from 0 to 1; the weight of the polished surface edge feature channel = base weight 0.2 + w × 0.6, the weight of the etched surface texture difference channel = base weight 0.3 + w × 0.4, and the weights are normalized to the 0-1 range after calculation by Softmax;

[0123] S42. Multi-dimensional feature fusion and support: The structured light 3D point cloud collected in step S1 is processed simultaneously to extract 18-dimensional 3D geometric features such as "depth gradient, surface roughness, and volume density". At the same time, the normalized process parameters (Ra value, etching spacing, and nitride layer thickness) are used as 8-dimensional process features. The deep semantic features, 3D geometric features and process features are concatenated and normalized by Min-Max to form a 282-dimensional fused feature vector. Then, the feature expression is optimized through adversarial training (constructing a defect / non-defect feature discriminator) to provide comprehensive and accurate core data support for step S5.

[0124] 3D geometric feature extraction is implemented using the PCL (Point Cloud Library): the depth gradient is obtained by calculating the mean Z-axis difference of the neighborhood (10 neighboring points) of the point cloud; the surface roughness is calculated by the standard deviation of the distance from all points in the point cloud region (5×5mm) to the fitting plane; and the volume density is calculated by the ratio of the number of points in the point cloud region to the region volume. The adversarial training iterations are 200 times. In each iteration, the CNN feature extractor and discriminator are updated alternately. The iteration stops when the discriminator's accuracy in recognizing defective and non-defective features stabilizes at 50%±3%.

[0125] Specific calculations for normalizing process parameters:

[0126] Taking Ra values ​​(0.01-0.05 μm) as an example, the normalization formula is:

[0127] ;

[0128] The normalized formula for the etching pitch (0.2-0.5mm) is:

[0129]

[0130] The normalized formula for nitride layer thickness (5-15μm) is:

[0131]

[0132]

[0133] The remaining five process parameters (such as injection temperature and pressure) were all processed to the range of 0-1 using this linear normalization method.

[0134] The specific steps of step S5 are as follows:

[0135] S51. Lightweight Transformer Model Construction: Based on the 282-dimensional fused feature vector in step S4, a lightweight model is designed using "knowledge distillation + simplified architecture": The high-precision ViT-Base model (86M parameters) is used as the teacher model, and its feature extraction and classification knowledge are distilled into the self-designed "Mini-ViT" model (<12M parameters). The inference time for a single image is compressed to <80ms, which meets the production line cycle time requirements.

[0136] During knowledge distillation, the temperature parameter T=10 for both the teacher model (ViT-Base) and the student model (Mini-ViT). The distillation loss function is the weighted sum of KL divergence loss (weight 0.7) and cross-entropy loss (weight 0.3). The Mini-ViT model architecture has 6 encoder layers, 4 attention heads per layer, 256 hidden layer dimensions, and 512 feedforward network dimensions. The number of model parameters is controlled to 10-12M through redundant channel pruning. The inference time for a single image is accelerated to 70-80ms using TensorRT.

[0137] S52, Incremental Adaptation and Classification Correction: For new mold materials (such as 718H steel) or defect types (such as nitrided layer cracks), there is no need to retrain the Mini-ViT main network. Only a "process / defect adapter" with <500K parameters is added before the classification head. It can be quickly adapted by training with 50-100 new samples (time <1 hour). At the same time, a defect correlation matrix (such as the co-occurrence probability of microcracks and dents >30%) is introduced to correct the classification results, so as to clarify the accurate target object for step S6.

[0138] The incremental adapter adopts a two-layer fully connected network structure: the input layer has 282-dimensional features, the first layer has 32 neurons (ReLU activation function), the second layer has 16 neurons (ReLU activation function), and the output layer dimension is consistent with the number of defect categories (e.g., if there are 6 defect categories, the output is 6-dimensional). The number of parameters is controlled between 400K and 500K. The defect association matrix is ​​a 6×6 matrix (rows / columns correspond to microcracks, dents, pinholes, etched corner defects, nitride layer peeling, and scratches, respectively). The matrix element values ​​are the co-occurrence probabilities of two types of defects (e.g., the element value for microcrack-dent is 0.32, and the element value for microcrack-pinhole is 0.15). During classification, if the predicted probability of a certain defect is >0.6, and the predicted probability of the corresponding high-probability (>0.3) defect in the association matrix is ​​also >0.3, then both types of defects are labeled simultaneously.

[0139] The specific steps of step S6 are as follows:

[0140] S61. 3D Defect Quantization Analysis: Combining the corrected image from step S2 with the 3D point cloud from step 1, full-dimensional defect quantization is achieved: The actual defect size is calculated by "sub-pixel edge detection (accuracy 0.1 pixel) + 3D point cloud registration" combined with camera calibration parameters (0.02 mm / pixel); Based on the multispectral gray-depth mapping model, such as the red light gray level and nitrided layer crack depth R² > 0.95, the defect depth (accuracy 0.005 mm) and volume (accuracy 0.001 mm³) are obtained by combining 3D point cloud data, filling the gap in the traditional 2D detection dimension.

[0141] Subpixel edge detection employs the Zernike moment algorithm, achieving an edge localization accuracy of 0.1 pixels. The specific steps are: ① Gaussian filtering (σ=1.0) is applied to the corrected image; ② The image grayscale gradient is calculated using the Sobel operator; ③ Edge pixel coordinates are extracted; ④ The edge curve is fitted using Zernike moments to obtain subpixel-level edge coordinates. Camera calibration parameters are obtained using a checkerboard calibration method. The calibration board size is 10×10cm, the checkerboard corner spacing is 1cm, and the calibrated pixel size is s=0.02mm / pixel. The actual defect size = subpixel edge distance × s.

[0142] S62. Defect Evolution Prediction and Repair Parameter Output: Construct a "defect-injection cycle" related database, record the defect parameters (size, depth, location) and injection cycle number for each detection, input the historical 10 detection data into the LSTM time series prediction model, and output the defect expansion amount after the next 50 injection cycles; based on the quantitative results of defect depth, volume, and actual size and the characteristics of mold material, automatically generate repair parameters, such as the need to grind 0.1-0.15mm for depressions with a depth of 0.05-0.1mm and the corresponding grinding path;

[0143] Training data for the LSTM time series prediction model: Defect detection data were collected from 200 different molds (covering P20, H13, and 718H steel). For each mold, the defect size and number of injection cycles were recorded for 100 injection cycles, resulting in a total of 20,000 sets of time series data. During model training, the dropout rate of the input layer was 0.2, the Tanh activation function was used for the hidden layer, and the Linear activation function was used for the output layer. The training iterations were 500 times, with an initial learning rate of 0.001. Every 100 iterations, the learning rate was reduced to 0.8 times the previous value. Training was stopped when the validation set loss (MSE) did not decrease for 20 consecutive iterations.

[0144] The specific steps of step S7 are as follows:

[0145] S71. Closed-loop system multi-terminal result output: Based on the quantitative results and repair parameters in step S6, construct an industrial-grade multi-terminal output closed loop: push defect warnings (trigger shutdown when defect size exceeds threshold) and repair parameters (automatically generate grinding paths by connecting to the CAM system) to the production-end MES system to avoid continuous production of defective molds; output a defect evolution report containing the risk level of the next 100 injection cycles to the operation and maintenance end to support mold preventive maintenance decisions and reduce losses from sudden failure downtime;

[0146] Defect warning threshold settings: Based on mold material and application scenario, three threshold levels are defined. For P20 steel molds (injection molding of automotive parts): a level 1 warning (immediate shutdown) is triggered when microcrack length > 0.1mm and dent depth > 0.08mm; a level 2 warning (re-inspection after 10 injection cycles) is triggered when microcrack length 0.05-0.1mm and dent depth 0.04-0.08mm; and a level 3 warning (re-inspection after 50 injection cycles) is triggered when microcrack length < 0.05mm and dent depth < 0.04mm. Warning information is pushed to the MES system via the MQTT protocol, including defect location, type, current size, and threshold information.

[0147] S72. Data Feedback and Full-Process Optimization: Establish a data feedback mechanism: Feedback the inspection data of the repaired mold (such as defect residue > 0.01mm) to step S1 to optimize image acquisition parameters, such as increasing the weight of the blue light channel; After labeling the missed / false detection samples, input them into the incremental adapter in step S5 to achieve automatic model iteration once a month; At the same time, based on the defect type and frequency, output process optimization suggestions to the mold processing stage, such as adjusting the etching current ±5% when etching corner defects occur frequently, and finally achieve full-process optimization of "inspection-repair-model-process";

[0148] The criteria for optimizing the acquisition parameters are as follows: When the residual defect amount in the mold inspection data after repair is >0.01mm (such as 0.012mm of scratch residue on the polished surface), and the gray-scale contrast of the residual defect in the blue channel is <30 under the original acquisition parameters, the weight of the blue channel is increased (adjustment step size 5%). After optimization, the image is re-acquired and detected. If the gray-scale contrast of the residual defect is ≥30 and the detection accuracy is >98%, the new acquisition parameters are determined. Otherwise, the adjustment continues, with a maximum of 3 adjustments. After each adjustment, the parameters and detection results are recorded in the acquisition parameter optimization log.

[0149] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0150] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for detecting surface defects in injection molds based on vision inspection, characterized in that: The specific steps of this method are as follows: Step S1: Obtain process data by associating the mold ID with the MES system, adjust the acquisition parameters according to different surface process characteristics, and acquire 2D multispectral images and structured light 3D point clouds; Step S2: The image is registered using the finite element model of mold thermal deformation to obtain the corrected image. The blurred image is restored using the vibration-fuzzy kernel mapping model. The channel difference segmentation algorithm is used to separate the defect from the attached material. Step S3: Construct a texture primitive library for the corresponding process, calculate the Bartlett distance between the window and the texture primitive of the corresponding process using a sliding window, mark windows with similarity < 0.6 as suspected regions, perform morphological dilation processing, and output the initial defect localization mask; Step S4: Based on the initial defect localization mask, construct a process-aware attention CNN model, output 256-dimensional semantic features, extract geometric features from the structured light 3D point cloud, and form a fusion feature including defect semantic features, 3D geometric features and process features after Min-Max normalization. Step S5: Obtain the Mini-ViT model through feature extraction and classification knowledge distillation. For new mold materials or defect types, only an incremental adapter with less than 500K parameters needs to be added before the classification head. The classification results are then corrected by combining the defect association matrix. Step S6: Combine the corrected image from step S2 with the 3D point cloud from step S1 to calculate the actual size of the defect. Use the gray-scale-depth mapping model to obtain the defect depth and volume, quantify the defect parameters, and input the detection data into the LSTM time series prediction to predict the defect expansion. Step S7: Based on the defect parameters from step S6 and the predicted defect expansion amount, generate a defect evolution report; Push defect warnings to the MES system, output defect evolution reports to the operation and maintenance end, feed back the detection data of the repaired mold to step S1 to optimize the acquisition parameters, and input the missed samples into the incremental adapter in step S5.

2. The method for detecting surface defects in injection molds based on vision inspection according to claim 1, characterized in that: The specific steps of step S1 are as follows: S11. Process data acquisition and parameter adaptation: By associating the mold ID with the MES system, process data including polishing roughness Ra value, etching texture parameters and nitride layer thickness are acquired. The polishing surface uses blue light + 0° polarization, the etching surface uses green light + 90° polarization, and the nitride layer uses red light + 45° polarization. The exposure time and gain are adjusted synchronously. S12. Multimodal data acquisition and subsequent integration: Simultaneously acquire 2D multispectral images and structured light 3D point clouds to form a multimodal dataset covering the visual features and spatial morphology of defects.

3. The method for detecting surface defects in injection molds based on vision inspection according to claim 2, characterized in that: The specific steps of step S2 are as follows: S21. Thermal Deformation and Vibration Interference Compensation: Based on the multimodal data in step S1, the deformation matrix is ​​output through the finite element model of mold thermal deformation. The hot image is aligned with the cold reference image by image registration guided by the deformation field. After registration, a corrected image is obtained to eliminate thermal deformation deviation. A vibration-fuzzy kernel mapping model is constructed by combining the real-time amplitude of the vibration sensor of the production line. The vibration fuzzy image is restored by introducing the improved Richardson-Lucy algorithm with defect edge prior. S22. Separation and localization of attachments: Based on the multispectral grayscale difference characteristics, a channel difference segmentation algorithm is used to achieve pixel-level separation of defects and attachments, eliminate dynamic interference, and provide an interference-free image for step S3.

4. The method for detecting surface defects in injection molds based on vision inspection according to claim 3, characterized in that: The specific steps of step S3 are as follows: S31. Construction of Process Texture Primitive Library: For the interference-free image in step S2, construct a texture primitive library according to the surface process of the mold: polished surface corresponds to Gaussian texture primitive with σ < 0.8, etched surface corresponds to periodic texture primitive with period equal to etch spacing, and nitrided layer corresponds to uniform texture primitive with gray scale variance < 5. S32. Suspected area screening and mask output: Use a 5×5 pixel sliding window to traverse the image, calculate the Bartlett distance between each window and the corresponding process texture primitive, and mark windows with similarity <0.6 as suspected defect areas; Subsequently, morphological dilation of 3×3 structural elements is used to eliminate the discontinuous markings of microcracks and output the initial defect localization mask.

5. The method for detecting surface defects in injection molds based on vision inspection according to claim 4, characterized in that: The specific steps of step S4 are as follows: S41. Deep Feature Extraction of Process-Aware CNN: Based on the initial defect localization mask in step S3, a process-aware attention CNN model based on the MobileNetV3 architecture is constructed: the mold process parameters are transformed into attention weight adjustment factors, the edge feature channel weights are increased for the polished surface, the texture difference channel weights are increased for the etched surface, and finally, deep semantic features are output. S42. Multi-dimensional feature fusion and support: Simultaneously process the structured light 3D point cloud from step S1 to extract 3D geometric features including depth gradient, surface roughness and volume density, and use the normalized process parameters as 8-dimensional process features. The semantic features of defects, three-dimensional geometric features, and process features are concatenated, and after Min-Max normalization, a 282-dimensional fused feature vector is formed. Then, the feature representation is optimized through adversarial training.

6. The method for detecting surface defects in injection molds based on vision inspection according to claim 5, characterized in that: The specific steps of step S5 are as follows: S51. Lightweight Transformer Model Construction: Based on the 282-dimensional fused feature vector in step S4, a lightweight model is designed using knowledge distillation and a simplified architecture: the ViT-Base model is used as the teacher model, and its feature extraction and classification knowledge are distilled into the Mini-ViT model, compressing the inference time of a single image to <80ms. S52, Incremental Adaptation and Classification Correction: For new mold materials or defect types, there is no need to retrain the Mini-ViT model's main network. Instead, an incremental adapter with fewer than 500K parameters is added before the classification head, and the adapter is trained using 50-100 new samples. At the same time, a defect association matrix is ​​introduced to correct the classification results.

7. The method for detecting surface defects in injection molds based on vision inspection according to claim 6, characterized in that: The specific steps of step S6 are as follows: S61. 3D Quantitative Analysis of Defects: Combining the corrected image from step S2 with the 3D point cloud from step S1, the actual size of the defect is calculated by subpixel edge detection + 3D point cloud registration, combined with camera calibration parameters; based on the multispectral gray-depth mapping model, the depth and volume of the defect are obtained by combining the 3D point cloud data. S62. Defect Evolution Prediction and Repair Parameter Output: Construct a defect-injection cycle association database, record the defect parameters and injection cycle number of each detection, input the historical 10 detection data into the LSTM time series prediction model, and output the defect expansion amount after the next 50 injection cycles; based on the quantitative results of defect depth, volume, actual size and mold material characteristics, automatically generate repair parameters.

8. The method for detecting surface defects in injection molds based on vision inspection according to claim 7, characterized in that: The specific steps of step S7 are as follows: S71. Closed-loop system multi-terminal result output: Based on the quantitative results and repair parameters of step S6, push defect warning and repair parameters to the production MES system, and output a defect evolution report containing the risk level of the next 100 injection molding cycles to the operation and maintenance end. S72. Data Feedback and Full-Process Optimization: Establish a data feedback mechanism: Feed back the inspection data of the repaired mold to step S1 to optimize the image acquisition parameters; After labeling the missed or falsely detected samples, input them into the incremental adapter in step S5, and the model will automatically iterate once a month; At the same time, based on the defect type and frequency, output process optimization suggestions to the mold processing stage.

Citation Information

Patent Citations

  • Rotor winding image qualification detection method

    CN108765365A

  • Defect detection method, device and equipment based on multi-cascade target detection model

    CN116977295A