Injection mold flaw detection method and system based on image generation

By using an image-based injection mold defect detection method, combined with the functional zoning information and demolding direction of the CAD design model, abnormal areas of the injection mold are analyzed. This solves the problem that the detection results in the existing technology cannot be accurately mapped to the engineering risk level, and realizes accurate evaluation of mold function and safety early warning.

CN121639583APending Publication Date: 2026-03-10DONGGUAN HONGWEN ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-05
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Existing image-based injection mold defect detection methods struggle to effectively distinguish between visually significant but minimally impactful textural anomalies and subtle visual changes that could trigger batch product quality incidents. This results in detection results that cannot be accurately mapped to engineering risk levels, leading to misallocation of maintenance resources and inappropriate production decisions.

Method used

By acquiring real-time images of the area to be inspected in the injection mold, generating reconstructed images using a pre-trained generative model, calculating pixel-level differences, and combining the functional zoning information of the CAD design model and the demolding movement direction, the spatial topological relationship of abnormal areas is analyzed, the clustering and spread trend and interference risk are assessed, the risk level is dynamically corrected, and alarm operations are executed.

Benefits of technology

This technology has made a leap from pixel difference analysis to engineering risk assessment, accurately identifying structural anomalies that may affect mold function, providing early warning of mechanical interference risks, improving the pertinence and effectiveness of detection results, and ensuring production safety and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121639583A_ABST
    Figure CN121639583A_ABST
Patent Text Reader

Abstract

The invention discloses an injection mold flaw detection method and system based on image generation, particularly relates to the technical field of industrial visual inspection, and is used for solving the problem that risk assessment is not accurate due to the fact that an existing anomaly detection method based on image generation only depends on pixel-level reconstruction errors and cannot distinguish texture anomaly and structural anomaly. The method comprises the following steps: acquiring a real-time image of a mold and generating a reconstructed image, and calculating a pixel-level difference to identify an initial abnormal region; combining a CAD design model to extract functional partitions and demolding motion direction information, and analyzing a spatial topological relation between the abnormal region and the functional partitions to evaluate an aggregation spreading trend; basic risk levels or interference risk assessment results are dynamically selected according to the trend, and the risk levels are corrected to trigger grading alarm, so that effective mapping from visual differences to engineering risks is realized, and the pertinence and reliability of detection decisions are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of industrial visual inspection, and in particular to a method and system for detecting defects of an injection mold based on image generation. BACKGROUND

[0002] In the field of industrial visual inspection, especially for the surface quality monitoring of high-value production equipment such as injection molds, the abnormality detection method based on image generation is an important technical direction. Generally, a normal sample is used to train a generated model to learn the visual feature distribution under the intact state of the mold. In actual detection, the system calculates the pixel-level difference between the to-be-detected image and the reconstructed image generated by the model to determine whether there is an abnormality. Compared with the traditional template matching, this method shows better adaptability in dealing with light fluctuations, slight position shifts, etc.

[0003] However, the detection decision of such a method is heavily dependent on the pixel-level reconstruction error obtained by unsupervised learning, which essentially measures the difference in visual appearance, which will cause the alarm logic of the detection system to be disconnected from the actual functional failure risk of the mold. Specifically, the system cannot effectively distinguish between those texture abnormalities (such as large-area water stains) that have a significant visual appearance but have little impact on product function, and those structural abnormalities (such as micro-cracks on the key sealing surface) that have subtle visual changes but can quickly cause batch product quality accidents, and cannot map the detection results to the risk level in the engineering sense, thereby possibly causing misallocation of maintenance resources and inappropriate production decisions, i.e., insufficient response to high-risk defects, but excessive alarm for low-risk interference. SUMMARY

[0004] The present application provides a method and system for detecting defects of an injection mold based on image generation to solve the technical problems in the prior art.

[0005] The technical solution of the present application to solve the above technical problems is as follows: The method for detecting defects of an injection mold based on image generation comprises: S1, obtaining a real-time image of a to-be-detected area of an injection mold and inputting it into a pre-trained generated model to obtain a corresponding generated reconstructed image; S2, calculating the pixel-level difference between the real-time image and the generated reconstructed image, and identifying all initial abnormal regions from the pixel-level difference based on a preset difference threshold; S3, obtaining a CAD design model of the injection mold and extracting functional partition information and demolding motion direction information corresponding to the to-be-detected area therefrom; S4, analyzing the spatial topological relationship between the initial abnormal region as a whole and the boundaries of different functional partitions based on the functional partition information to evaluate whether there is an aggregated spreading trend across the functional partitions; S5. If there is no clustering and spreading trend, determine the basic risk level based on the functional zoning information into which the initial abnormal area falls and execute the corresponding alarm operation; if there is a clustering and spreading trend, construct the motion trajectory point set of the initial abnormal area based on the demolding motion direction information, and calculate the Hausdorff distance statistical characteristics between it and the theoretical envelope surface to assess the interference risk. S6. Dynamically adjust the basic risk level based on the clustering and spread trend and the risk of intervention, and execute corresponding alarm operations.

[0006] Furthermore, S1 includes: Real-time images of the area to be inspected in the injection mold are acquired under standard lighting conditions; The real-time image is preprocessed, including size normalization and grayscale normalization. The preprocessed real-time image is input into a pre-trained variational autoencoder generative model; The preprocessed real-time image is encoded and decoded using a variational autoencoder generative model, and the corresponding generated and reconstructed image is output.

[0007] Furthermore, S2 includes: Calculate the difference in grayscale value between each pixel in the real-time image and the corresponding pixel in the generated reconstructed image to obtain a pixel-level difference map; Pixels whose grayscale value difference in the pixel-level difference map is greater than a preset difference threshold are marked as candidate abnormal pixels. Clustering based on spatial connectivity is performed on the marked candidate abnormal pixels, and the set of candidate abnormal pixels that are connected in spatial location is identified as an initial abnormal region; After traversing all candidate abnormal pixels, all initial abnormal regions are obtained.

[0008] Furthermore, S3 includes: Read the three-dimensional geometric data and annotation information related to the area to be inspected from the stored CAD design model file; Based on the surface type annotation in the three-dimensional geometric data, the area to be detected is divided into functional zones such as cavity surface, core surface, slider surface and venting groove, and functional zone information is obtained. Based on the ejection mechanism motion parameters defined in the CAD design model, the vector along the ejection direction is analyzed as the demolding motion direction information; Establish a spatial mapping relationship between functional partition information, demolding motion direction information, and the area to be detected in the real-time image.

[0009] Furthermore, S4 includes: Map all initial abnormal regions to the CAD design model space containing functional partition information to form a set of abnormal regions; Identify the functional partitions directly contacted by each initial abnormal region in the abnormal region set; Analyze whether there is at least one initial abnormal region in the set of abnormal regions that has a direct contact relationship with two or more different functional zones at the same time; If it exists, it is determined that there is a clustering and spreading trend that crosses functional zones; If not, further analysis is conducted to determine whether the set of abnormal regions exhibits a continuous or quasi-continuous path connecting at least two different functional zones in terms of spatial distribution, which can be used as a bridging pattern. If a bridging pattern is identified, it is determined that there is a clustering and spreading trend that crosses functional zones; If no bridging pattern is identified, it is determined that there is no clustering and spreading trend across functional zones.

[0010] Furthermore, the analysis examines whether the spatial distribution of the anomalous region set exhibits continuous or quasi-continuous paths connecting at least two different functional zones, including: Perform spatial clustering based on Euclidean distance on all initial abnormal regions in the abnormal region set, and merge the initial abnormal regions whose distance from each other is less than a preset clustering threshold into the same cluster. Determine whether there exists at least one cluster whose circumscribed convex hull or minimum bounding polygon intersects with two or more distinct functional partition regions; If it exists, then the clusters are determined to constitute a bridging pattern connecting different functional partitions.

[0011] Furthermore, S5 includes: When it is determined that there is no clustering and spread trend across functional zones, the basic risk level is determined by querying the preset risk level mapping table based on the specific functional zone type in which each initial abnormal area falls in the CAD design model space, and the first alarm operation corresponding to the basic risk level is triggered. When it is determined that there is a clustering and spreading trend across functional zones, the three-dimensional contour of each initial abnormal area is subjected to rigid body transformation based on the demolding motion direction information to generate a series of motion trajectory point sets discretely sampled along the demolding motion direction; Calculate the Hausdorff distance between the set of motion trajectory points and the theoretical safety envelope surface derived from the CAD design model; Extract the maximum and average Hausdorff distances as statistical features; The level of interference risk is determined by mapping the size range of statistical characteristics.

[0012] Furthermore, the Hausdorff distance between the set of motion trajectory points and the theoretical safety envelope surface derived from the CAD design model is calculated, including: Obtain the product's inner surface geometry model corresponding to the demolding motion direction from the CAD design model as the reference surface; The reference surface is offset inward along the normal direction of the demolding motion by a preset safety margin threshold to generate a theoretical safety envelope surface. Calculate the set of minimum distances from each point in the motion trajectory point set to the theoretical safe envelope surface; Extract the maximum value from the minimum distance set as the Hausdorff distance between the motion trajectory point set and the theoretical safe envelope.

[0013] Furthermore, S6 includes: When there is a trend of clustered spread, the basic risk level is adjusted upward by querying the predefined correction rule table according to the determined intervention risk level. When there is no trend of clustered spread, the basic risk level is directly used as the final risk level; The second alarm action is triggered according to the final risk level. The second alarm action includes different levels of visual and audible warnings.

[0014] On the other hand, the present invention provides an image-based injection mold defect detection system, comprising: The image generation module is used to acquire real-time images of the area to be detected in the injection mold and input them into the pre-trained generative model to obtain the corresponding generated reconstructed image; The anomaly detection module is used to calculate the pixel-level differences between the real-time image and the generated reconstructed image, and to identify all initial abnormal regions from the pixel-level differences based on a preset difference threshold. The information extraction module is used to acquire the CAD design model of the injection mold and extract the functional partition information and demolding movement direction information corresponding to the area to be detected. The spread assessment module is used to analyze the spatial topological relationship between the initial abnormal area as a whole and the boundaries of different functional zones based on functional zoning information, in order to assess whether there is a clustering and spread trend across functional zones. The classification analysis module is used to determine the basic risk level and execute the corresponding alarm operation based on the functional zoning information into which the initial abnormal area falls if there is no clustering and spreading trend; if there is a clustering and spreading trend, it constructs the motion trajectory point set of the initial abnormal area based on the demolding motion direction information, and calculates the Hausdorff distance statistical characteristics between it and the theoretical envelope surface to assess the interference risk. The alarm execution module is used to dynamically adjust the basic risk level based on the clustering and spread trend and the risk of interference, and to execute corresponding alarm operations.

[0015] The beneficial effects of this invention are: 1. By combining the functional zoning information in the CAD design model with the image detection results, a leap from simple pixel difference analysis to engineering risk assessment has been achieved. By analyzing the spatial relationship between abnormal areas and key functional zones such as cavity surfaces and core surfaces, structural anomalies that may affect mold function can be accurately identified. This effectively avoids the problem of oversensitivity to texture anomalies in traditional methods, making the detection results directly related to the actual performance of the mold and significantly improving the pertinence and effectiveness of alarms.

[0016] 2. By introducing demolding motion direction information and interference risk analysis, a multi-dimensional risk assessment system was constructed. By calculating the spatial relationship between the motion trajectory of the abnormal area and the theoretical envelope, the potential mechanical interference risk can be predicted in advance. This achieves an upgrade from static detection to dynamic prediction. It not only considers the current abnormal state, but also predicts the chain reaction that the abnormality may trigger during its development, providing a scientific basis for preventive maintenance and thus greatly improving the safety and reliability of mold use. Attached Figure Description

[0017] Figure 1 This is a flowchart of the image-based injection mold defect detection method of the present invention; Figure 2 This is a schematic diagram of the structure of the image-based injection mold defect detection system 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 skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] Example 1: Figure 1 The present invention provides a method for detecting defects in injection molds based on image generation, comprising: S1. Obtain the real-time image of the area to be detected in the injection mold and input it into the pre-trained generative model to obtain the corresponding generated reconstructed image; S2. Calculate the pixel-level differences between the real-time image and the generated reconstructed image, and identify all initial abnormal regions from the pixel-level differences based on a preset difference threshold. S3. Obtain the CAD design model of the injection mold and extract the functional partition information and demolding motion direction information corresponding to the area to be detected. S4. Analyze the spatial topological relationship between the initial abnormal area as a whole and the boundaries of different functional zones based on functional zone information, in order to assess whether there is a clustering and spreading trend across functional zones. S5. If there is no clustering and spreading trend, determine the basic risk level based on the functional zoning information into which the initial abnormal area falls and execute the corresponding alarm operation; if there is a clustering and spreading trend, construct the motion trajectory point set of the initial abnormal area based on the demolding motion direction information, and calculate the Hausdorff distance statistical characteristics between it and the theoretical envelope surface to assess the interference risk. S6. Dynamically adjust the basic risk level based on the clustering and spread trend and the risk of intervention, and execute corresponding alarm operations.

[0020] S1. Obtain the real-time image of the area to be detected in the injection mold and input it into the pre-trained generative model to obtain the corresponding generated reconstructed image. The specific implementation is as follows: During the image acquisition phase, real-time images of the area to be inspected on the injection mold need to be acquired under standard lighting conditions. These standard lighting conditions are achieved by configuring a ring-shaped LED light source; for example, the color temperature of the light source can be set to a range of 5500K±200K, and the illuminance uniformity controlled within ±10%. The light source illuminates the mold surface at a 45-degree angle, with the camera axis perpendicular to the mold surface to eliminate specular reflection interference. Real-time images are acquired using a 5-megapixel industrial camera. During acquisition, the camera aperture is set to F8, and the exposure time is dynamically adjusted according to the actual illuminance but does not exceed 50 milliseconds to ensure no motion blur. The acquisition area must completely cover the functional surfaces of the mold, including critical areas such as the cavity surface and core surface. To achieve precise focusing, a laser rangefinder sensor can be used to assist positioning, ensuring the working distance remains stable within, for example, a range of 300mm±5mm.

[0021] After acquiring the real-time image, preprocessing is required. Preprocessing includes two steps: size normalization and grayscale normalization. Size normalization scales the real-time image to a fixed size, such as 512 pixels × 512 pixels, using bilinear interpolation to maintain the image's aspect ratio. Grayscale normalization linearly transforms the image from a grayscale range of 0-255 to a floating-point range of 0-1, specifically by dividing each pixel value by 255. If the acquired image is color, it must first be converted to grayscale using a common weighted average method: grayscale value = 0.299 × R + 0.587 × G + 0.114 × B. The normalized image data is stored as a 32-bit floating-point tensor for easier subsequent model processing. To verify the preprocessing effect, the image signal-to-noise ratio can be calculated, ensuring its value is greater than 30 dB.

[0022] The preprocessed real-time images are input into a pre-trained variational autoencoder (VAE) generative model. This VAE employs an encoder-bottleneck-decoder structure. The encoder consists of four convolutional layers, each with a 3×3 kernel size and a stride of 2, producing 32, 64, 128, and 256 output channels respectively. The bottleneck layer contains two fully connected layers, outputting mean and variance vectors, each with a 128-dimensional dimension. The decoder uses a symmetric structure, progressively recovering the image size through four transposed convolutional layers. The model uses Kullback-Leibler divergence and mean squared error as the joint loss function, with weights set to 0.01 and 0.99, respectively. Training employs the Adam optimizer with a learning rate of 0.001 and a batch size of 16, trained for 200 epochs on a dataset containing 10,000 normal mold images. To improve model robustness, data augmentation operations, including random rotation (within ±5 degrees) and brightness adjustment (within ±10%), can be added during training.

[0023] The variational autoencoder generative model processes the input image through two stages: encoding and decoding. In the encoding stage, the preprocessed real-time image is processed by an encoder network to extract features, generating a latent space vector conforming to a Gaussian distribution at the bottleneck layer. Specifically, after feature extraction through convolutional layers, the input image is processed by two independent linear layers to calculate the mean vector μ and variance vector σ. Then, a reparameterization technique is used to sample the latent vector z = μ + ε × σ, where ε is random noise sampled from a standard normal distribution. In the decoding stage, the latent vector z is upsampled through a decoder network to progressively reconstruct a generated reconstructed image of the same size as the input image. Finally, a sigmoid activation function is used to constrain the output value to the range of 0-1, forming the final generated reconstructed image. This generated reconstructed image retains the visual features of a normal mold while blurring abnormal regions, thus providing a benchmark for subsequent difference calculations.

[0024] During model training, appropriate training termination conditions need to be set. For example, training should automatically stop when the validation set loss function no longer decreases for 10 consecutive epochs to avoid overfitting. Simultaneously, the training process needs to be monitored, recording changes in various metrics for each training round, including reconstruction error and KL divergence. After training, model evaluation is also necessary, using the test set to calculate metrics such as peak signal-to-noise ratio (PSNR) to ensure the quality of the generated reconstructed images meets requirements, such as a PNR greater than 30 dB.

[0025] To ensure system stability, a comprehensive anomaly handling mechanism is required. When image acquisition encounters anomalies, such as sudden changes in illumination or camera defocusing, the system should automatically detect and trigger a re-acquisition process. During model inference, if the input image size does not meet requirements or the data format is abnormal, the system should return an error code and log it. For cases where the generated reconstructed image exhibits significant distortion, filtering can be performed by setting a quality detection threshold. For example, if the image structure similarity index is below 0.9, the generation is considered a failure, and inference calculations must be re-performed.

[0026] All key parameters involved in the entire processing flow require calibration and verification. For example, camera calibration needs to be performed monthly to ensure that the geometric distortion coefficient is controlled within 0.1%. Light source intensity needs to be checked weekly, using an illuminance meter to ensure that the illuminance value is stable within ±5% of the set value. Model performance needs to be evaluated quarterly, and the model needs to be retrained when a performance degradation of more than 5% is detected. These maintenance measures ensure the long-term stable operation of the system and meet the reliability requirements of industrial inspection.

[0027] In practice, the settings of various parameters need to be adjusted according to the actual application scenario. For example, for the inspection of large molds, it may be necessary to increase the image resolution to 12 megapixels; for high-speed production lines, it may be necessary to shorten the exposure time to less than 20 milliseconds. These adjustments must be made while ensuring image quality, and the optimal parameter combination must be determined through experiments. After each parameter change, the system needs to be recalibrated and the corresponding configuration file updated to ensure the consistency of system parameters.

[0028] S2. Calculate the pixel-level differences between the real-time image and the generated reconstructed image, and identify all initial abnormal regions from the pixel-level differences based on a preset difference threshold. Specifically, this is implemented as follows: After acquiring the real-time image and the generated reconstructed image, the next step is to calculate the pixel-level differences between them and identify initial abnormal regions. Specifically, the grayscale difference between each pixel in the real-time image and the corresponding pixel in the generated reconstructed image is calculated first. Both the real-time image and the generated reconstructed image have been preprocessed into floating-point matrices of size 512 pixels × 512 pixels, with grayscale values ​​ranging from 0 to 1. The difference is calculated using a pixel-by-pixel absolute difference method. That is, for a pixel in the i-th row and j-th column of the image, the grayscale difference is the absolute value of the grayscale value of that pixel in the real-time image minus the grayscale value of the corresponding pixel in the generated reconstructed image. This calculation process traverses all 262,144 pixels of the image, generating a pixel-level difference map of the same size. The value of each pixel in this difference map represents the magnitude of the grayscale difference at that location, also ranging from 0 to 1. To ensure calculation accuracy, all operations are performed using 32-bit floating-point numbers to avoid the accumulation of rounding errors. In practical applications, if image registration deviation is encountered, subpixel-level alignment correction is required first. For example, the offset can be calculated by phase correlation and adjusted by bicubic interpolation to ensure that the pixel correspondence is accurate to within 0.1 pixels.

[0029] After obtaining the pixel-level difference map, candidate abnormal pixels need to be identified based on a preset difference threshold. The determination of the preset difference threshold requires consideration of the statistical characteristics of historical normal samples. For example, by collecting difference maps from 1000 images of defect-free molds, calculating the mean and standard deviation of the difference values ​​for each pixel, and setting the threshold to the mean plus three times the standard deviation. In practice, the mean and standard deviation distribution maps of each pixel location in historical samples can be calculated first, and then a dynamic threshold map can be set based on the normal distribution characteristics. Another dynamic setting method is to adjust the threshold based on the signal-to-noise ratio of the real-time image. For example, when the image signal-to-noise ratio is below 40dB, the threshold coefficient can be increased from three times the standard deviation to four times the standard deviation to reduce false alarms due to noise. During the labeling process, the grayscale value difference in the difference map is compared pixel by pixel with the preset difference threshold. If the difference is greater than the threshold, the pixel is marked as 1 in the binary labeling map, indicating a candidate abnormal pixel; otherwise, it is marked as 0. After labeling, a binary map of the same size as the original image is generated, where pixels with a value of 1 constitute the set of candidate abnormal pixels. To eliminate isolated noise points, the difference map can be first processed by Gaussian filtering, for example, by using a 5×5 Gaussian kernel with a standard deviation of 1.5 pixels for convolution smoothing, and then threshold comparison can be performed.

[0030] Next, clustering based on spatial connectivity is performed on the marked candidate anomalous pixels. The clustering algorithm uses an 8-connectivity region labeling method, where each pixel is considered connected to its upper, lower, left, right, and four diagonal adjacent pixels. Specifically, a two-pass scanning method is used: the first pass scans the binary labeled image row by row, checking the label status of each candidate anomalous pixel's upper and left adjacent pixels, assigning temporary labels, and recording equivalence relations; the second pass parses the equivalence relation table, merges connected regions, and assigns a unique identifier to each connected region. A minimum region area threshold needs to be set during clustering, for example, ignoring connected regions with fewer than 5 pixels to eliminate random noise interference. Each identified connected region is considered an initial anomalous region, and the system records the contour information of each initial anomalous region, such as using a boundary tracking algorithm to obtain the coordinates of the region's bounding rectangle or the coordinates of the minimum convex hull vertex. For adjacent regions with a spacing of less than 3 pixels, morphological closing operations can be used for merging, such as using a 3×3 rectangular structuring element to first perform dilation and then erosion operations to enhance region continuity.

[0031] The minimum region area threshold is set based on image resolution and noise characteristic analysis. In practice, the distribution characteristics of noise points in historical normal images are first statistically analyzed. For example, by analyzing the area distribution of connected regions in 1000 defect-free mold images, the mean and standard deviation are calculated. The threshold is then set to the mean plus three times the standard deviation to filter out 99.7% of random noise. Simultaneously, the actual image resolution is considered. For instance, when the physical size corresponding to a pixel is 0.02 mm, the minimum region area threshold is set to the physical area corresponding to 5 pixels × 5 pixels, ensuring that the ignored area is visually invisible and does not affect detection accuracy. After setting the threshold, it needs to be tested on a validation set to adjust it to a false alarm rate below 5%.

[0032] During clustering, special consideration must be given to handling boundary conditions. When candidate anomalous pixels are located at image boundaries, connectivity judgment only needs to consider existing neighboring points. For large, continuous anomalous regions, a block-based processing strategy can be adopted, dividing the image into 64×64 pixel sub-blocks for parallel processing, and finally merging the boundary regions. The region growing algorithm is implemented using a queue. Starting from the seed point, it checks 8 neighboring pixels, adding pixels that meet the criteria to the queue and marking them as visited, until the queue is empty, completing one region growth. During the growing process, a maximum region area limit can be set, such as 10,000 pixels, to avoid memory overflow caused by image anomalies.

[0033] Finally, all candidate anomalous pixels are traversed to ensure that clustering is completed without omission. The traversal process is achieved by iteratively accessing each pixel in the binary labeled image. When an unprocessed candidate anomalous pixel is found, a region growing algorithm is immediately initiated, recursively collecting all connected vertices until the region is complete. Upon completion, the system outputs an initial list of anomalous regions, each containing attributes such as region identifier, set of pixel coordinates, region area, center position, and bounding rectangle. To verify the clustering effect, a region compactness index can be calculated, such as the ratio of region area to the square of the boundary perimeter, filtering out pseudo-anomalies with overly discrete shapes. After all processing is complete, the initial anomalous region data is passed to subsequent analysis for functional partitioning mapping, ensuring the continuity of the detection process. The entire difference calculation and region identification process must be completed within 500 milliseconds to meet the real-time requirements of industrial inspection. The system records the detection confidence score for each initial anomalous region, which is calculated based on a combination of region area, contrast, and shape regularity, and is used for subsequent risk level assessment. Simultaneously, an anomalous region feature database is established, and threshold parameters and clustering algorithm parameters are continuously optimized to improve detection accuracy.

[0034] S3. Obtain the CAD design model of the injection mold, and extract the functional partition information and demolding motion direction information corresponding to the area to be detected. The specific implementation is as follows: After initial anomaly area identification, it is necessary to obtain the CAD design model of the injection mold and extract relevant information to support subsequent analysis. Specifically, the first step is to read the 3D geometric data and annotation information related to the area to be inspected from the stored CAD design model file. CAD design model files are typically stored in STEP or IGES format, and open-source parsing libraries such as OpenCASCADE are used for data reading. The reading process includes parsing the file header information, extracting geometric entity data and product manufacturing information annotation data. Geometric entity data includes surface data, curve data, and vertex data representing the boundary of the model. Product manufacturing information annotation data includes dimension annotations, tolerance annotations, and surface roughness annotations. For the area to be inspected, the geometric region corresponding to the real-time image acquisition area is located in the 3D model using a pre-established coordinate system correspondence. The location method uses a feature point matching algorithm, for example, selecting the center point of the positioning hole on the mold as a reference point and calculating its corresponding coordinates in the CAD model. Data integrity verification is required during the reading process, such as checking the closure of the surface data and the logical consistency of the annotation data. If data is missing, a data repair process is initiated.

[0035] Based on surface type annotations in 3D geometric data, the area to be inspected is divided into functional zones: cavity surface, core surface, slider surface, and venting groove. Surface type annotations are obtained from the layer attributes of the CAD model; for example, the cavity surface is annotated as the "Cavity" layer, and the core surface as the "Core" layer. The division process uses a rule-based feature recognition method: First, the parting surface position is identified through surface normal analysis, and the angle between the normal and the mold opening direction determines whether it belongs to the moving mold part or the fixed mold part; then, in the moving mold part, the core surface and cavity surface are distinguished based on the positive and negative values ​​of the draft angle; for example, surfaces with a draft angle greater than 0.5 degrees are classified as core surfaces; next, the slider surface is identified through motion mechanism analysis, and surfaces connected to the slider assembly and having a specific motion trajectory are found; finally, venting grooves are identified based on groove width characteristics, such as narrow groove areas with a width of less than 0.5 mm. Each functional zone generates a corresponding set of surfaces, and its process parameters are recorded; for example, the surface polishing grade of the cavity surface is recorded as Ra0.025, and the depth of the venting groove is recorded as 0.1 mm. The partitioning results are stored in a hierarchical data structure, establishing topological adjacency relationships between partitions.

[0036] Based on the ejection mechanism motion parameters defined in the CAD design model, the vector along the ejection direction is analyzed as the demolding motion direction information. Motion parameters are extracted from the fit constraints of the mold assembly, including the assembly relationship between the ejector pin and the ejector plate, and the ejection stroke settings of the injection molding machine. The analysis process first identifies the key components of the ejection mechanism, such as the ejector plate, ejector pin, and return spring, and then calculates the motion direction through kinematic analysis. Specific methods include: extracting unit vectors along the ejector pin axis and calculating the average of these vectors as the initial direction; then correcting the direction based on the guiding characteristics of the ejector plate guide rail, for example, by constraining the motion direction using the normal vector of the guide rail surface. The demolding motion direction information is represented in three-dimensional vector form and associated with the corresponding coordinate system, for example, using the direction vector [x, y, z] in the mold reference coordinate system. For complex molds with multiple demolding directions, it is necessary to establish a direction vector for each motion mechanism and record its range of action.

[0037] A spatial mapping relationship is established between functional partition information, demolding movement direction information, and the area to be detected in the real-time image. This mapping relationship is established using camera calibration parameters, including the transformation matrix from the world coordinate system to the camera coordinate system. Specifically, a 9-point calibration method is used to obtain the camera's intrinsic and extrinsic parameters. Intrinsic parameters include focal length, principal point coordinates, and distortion coefficients; extrinsic parameters include rotation matrix and translation vector. The 3D points in the CAD model are projected onto the image plane through coordinate transformation, and the corresponding region of each functional partition in the image is calculated. For example, the boundary point set of the cavity surface is transformed using perspective projection to calculate its pixel coordinates in a 512×512 pixel image, generating the corresponding polygonal region. Simultaneously, a depth mapping relationship is established. Depth information of the scene is obtained through binocular stereo vision or structured light measurement, associating each image pixel with its corresponding 3D coordinates. This mapping relationship needs to be verified periodically; recalibration is required when the camera position changes or the mold is reinstalled.

[0038] A data verification mechanism needs to be established during implementation. Version verification should be performed each time the CAD file is read to ensure consistency with the current physical mold. Quality checks should be conducted on the parsed geometric data, such as checking the continuity of surface curvature and the smoothness of boundaries. Logical verification should be performed on the functional zoning results to ensure that there is no overlap between zoning areas and that each area completely covers the area to be inspected. The rationality of the motion direction vectors should be checked, such as verifying their consistency with the mold opening direction. All extracted information should be stored in a structured data format, including geometric data, attribute data, and relational data, providing complete input for subsequent analysis.

[0039] The system needs to handle various anomalies. When the CAD file version is mismatched, a version synchronization process is initiated; when annotation information is missing, a neighborhood feature-based inference algorithm is used to supplement it; when the mapping error exceeds the allowable range, a recalibration process is triggered. The system records detailed logs for each data extraction, including processing time, data quality indicators, and anomaly handling records. Through the above implementation methods, the accuracy and reliability of the information extracted from the CAD design model are ensured, providing a solid foundation for subsequent anomaly area analysis. All processing is completed on dedicated computing equipment, guaranteeing the efficiency and stability of data processing.

[0040] S4. Based on functional zoning information, analyze the spatial topological relationship between the initial abnormal region as a whole and the boundaries of different functional zoning areas to assess whether there is a clustering and spreading trend across functional zoning areas. The specific implementation is as follows: After identifying the initial abnormal regions and extracting information from the CAD design model, it is necessary to analyze the spatial topological relationship between the initial abnormal regions as a whole and the boundaries of different functional zones based on the functional zoning information, in order to assess whether there is a clustering and spreading trend across functional zones. In practice, all initial abnormal regions are first mapped to the CAD design model space containing functional zoning information, forming a set of abnormal regions. The mapping process is achieved through a pre-established coordinate system transformation relationship, converting the pixel coordinates of each initial abnormal region in the real-time image into three-dimensional coordinates in the CAD model space. The transformation method uses an inverse perspective transformation algorithm, combined with the camera intrinsic and extrinsic parameter matrices, to calculate the three-dimensional point cloud data corresponding to each pixel in the abnormal region. For example, for each initial abnormal region in a 512 pixel × 512 pixel image, its boundary points are projected onto the world coordinate system of the CAD model using intrinsic parameters such as camera focal length, principal point coordinates, and distortion coefficients, as well as extrinsic parameters such as rotation matrix and translation vector, generating a corresponding three-dimensional region representation. Coordinate system unification processing is required during the mapping process to ensure that all data are under the same reference coordinate system. After mapping, the set of abnormal regions contains the three-dimensional location coordinates, geometric parameters and area information of each initial abnormal region, and establishes a spatial relationship with the functional partition data.

[0041] Next, the functional zones directly contacted by each initial anomalous region in the anomalous region set are identified. Direct contact is defined based on a geometric distance threshold of 0.1 mm. A direct contact relationship is determined when the nearest distance between the boundary of an initial anomalous region and the boundary of a functional zone is less than this threshold. The identification process employs a spatial indexing algorithm to accelerate the query. For example, an R-tree structure is used to store the boundary data of functional zones, and the minimum distance between each initial anomalous region and all functional zone boundaries is calculated. The distance calculation uses a point-to-surface nearest-point algorithm. For each boundary point of an initial anomalous region, the shortest distance to the surface of the functional zone is calculated, and the contacting functional zone identifier is recorded. The identification results are stored in a contact relationship table, recording the list of functional zones contacted by each initial anomalous region and detailed information such as the contact length ratio.

[0042] The contact distance threshold is set based on the accuracy requirements of the CAD model and measurement error analysis. First, the accuracy of the 3D scanning equipment is evaluated; for example, the repeatability of a laser scanner is 0.01 mm. Combined with the design tolerances of the CAD model itself, the contact distance threshold is set as the square root of the sum of the squares of the equipment accuracy and the model tolerance, rounded to provide a safety margin. Simultaneously, the thermal expansion coefficient of the mold is considered, and the threshold is appropriately increased in high-temperature environments, for example, by 0.01 mm for every 10 degrees Celsius increase.

[0043] Then, the analysis examines whether at least one initial abnormal region in the abnormal region set has direct contact with two or more different functional zones simultaneously. The analysis process traverses each initial abnormal region in the abnormal region set, checking the number of functional zones it contacts. For example, if an initial abnormal region has direct contact with both the cavity surface and the core surface, it meets the judgment condition. To achieve efficient inspection, a graph theory method is used to establish a contact relationship graph, where nodes represent functional zones and edges represent the contact relationships connecting initial abnormal regions. When an edge connecting multiple different functional zones is found, it is immediately marked as a positive result. Simultaneously, the number of initial abnormal regions with multi-zone contact and their spatial distribution density are statistically analyzed as auxiliary judgment indicators. The continuity of contact boundaries must be considered during the analysis; for example, a contact boundary length greater than 1 mm is considered a valid contact.

[0044] If at least one initial anomalous region is in direct contact with two or more different functional zones, it is directly identified as a cross-functional zone clustering and spreading trend. The determination result is recorded with a Boolean flag, linked to the specific initial anomalous region number and the involved functional zone information. The system also records the geometric characteristic parameters of the contact, such as the length, angle, and curvature of the contact boundary, to provide data support for subsequent risk analysis. A verification mechanism is included in the determination process; for example, manual verification is required when the contact boundary length is at a critical value to avoid misjudgments due to measurement errors. All determination results are recorded with a timestamp and confidence level assessment value.

[0045] If no direct contact relationship exists, the analysis further examines whether the spatial distribution of the anomalous region set exhibits continuous or quasi-continuous paths connecting at least two different functional zones, serving as a bridging pattern. The bridging pattern analysis first performs spatial clustering based on Euclidean distance on all initial anomalous regions in the set. A hierarchical clustering algorithm is used, with a preset clustering threshold of 5 mm. When the Euclidean distance between the centroids of two initial anomalous regions is less than this threshold, they are merged into the same cluster. The clustering process employs a bottom-up merging strategy. Initially, each initial anomalous region is treated as a cluster. The distance matrix between all clusters is calculated, and the cluster with the smallest distance is iteratively merged until the minimum distance exceeds the preset clustering threshold. After clustering, each cluster contains one or more initial anomalous regions, and its overall geometric properties, including centroid coordinates, volume, and shape features, are calculated.

[0046] The preset clustering threshold is determined based on the typical size of the mold's functional zones and the physical characteristics of anomalous spread. By analyzing historical anomaly data, the average spacing between anomalous regions is statistically analyzed. For example, in 100 cases, the spacing between spreading anomaly regions is mostly concentrated in the range of 3 to 7 millimeters; therefore, the median value of 5 millimeters is taken as the threshold. The mold size ratio is also considered; for example, for large molds (greater than 1 meter), the threshold is proportionally increased to 10 millimeters; for small molds (less than 0.3 meters), the threshold is reduced to 3 millimeters. After setting the threshold, the clustering effect needs to be evaluated to ensure that adjacent anomalous regions can be correctly merged.

[0047] Then, it is determined whether there exists at least one cluster whose circumscribed convex hull or minimum bounding polygon intersects with two or more different functional area regions. The circumscribed convex hull is calculated using the Graham scan algorithm to find the minimum convex polygon that contains all points of the cluster. The minimum bounding polygon is generated using the alpha shape algorithm, with the alpha parameter set to 3 mm to capture detailed features. Intersection is determined using a polygon collision detection algorithm, calculating the intersection area between the convex hull or polygon and each functional area region. When the intersection area is greater than 0.1 square millimeters, an intersection relationship is considered to exist. For example, if the convex hull of a cluster intersects with both the cavity surface and the slider surface region, then the cluster is considered to form a bridging pattern. Intersection detection needs to consider the three-dimensional geometric characteristics of the functional areas, transforming the three-dimensional intersection problem into a two-dimensional planar problem through projection transformation.

[0048] If a bridging pattern is identified, it is determined that there is a clustering and spreading trend across functional zones. The system records the specific characteristic parameters of the bridging pattern, including the cluster numbers involved, the connected functional zone pairs, and geometric parameters such as the length and width of the bridging path. Simultaneously, bridging strength indices are calculated, such as assessing the degree of spreading risk based on the continuity of the connecting path and the rate of change in width. The determination of a bridging pattern requires that the path continuity condition be met, i.e., the connecting path should not have discontinuities greater than 2 mm.

[0049] If no bridging pattern is identified, it is determined that there is no clustering or spreading trend across functional zones. The determination result needs to be validated for consistency, such as checking whether the minimum distance between all clusters and functional zones is greater than a safety threshold to ensure no omissions. The system generates a detailed determination report, including intermediate results and final conclusions for each analysis step. The report includes anomaly area distribution maps, functional zone mapping results, contact relationship matrices, and bridging pattern analysis data.

[0050] The safety threshold is set based on the critical safety distance of the functional zones. Through mold mechanics simulation analysis, the deformation of different functional zones under stress is calculated. For example, the maximum elastic deformation of the cavity surface under injection pressure is 0.02 mm. The safety threshold is set to 5 times the deformation (0.1 mm) to ensure reliability. Wear allowance is also considered, and the threshold is dynamically adjusted according to the mold's service life; for example, the safety threshold is increased by 0.01 mm after every 100,000 production cycles.

[0051] Throughout the analysis, various boundary conditions need to be addressed. When the initial anomaly region is located near the functional zone boundary, contact relationships are calculated with sub-pixel precision, and interpolation algorithms are used to improve measurement accuracy. When the cluster shapes are complex, multiple enclosing polygons are used for intersection testing to ensure the completeness of the detection. When the data contains noise, filtering algorithms are used to smooth the boundaries of the anomaly region; for example, a 3×3 Gaussian filter kernel is used to process boundary point data. All analysis results are stored as structured data, including spatial relationship matrices, topological connectivity diagrams, and risk assessment indicators, providing a complete basis for subsequent decision-making.

[0052] The system periodically calibrates analysis parameters, such as adjusting distance thresholds based on mold dimensions, to ensure analytical accuracy adapts to different application scenarios. Parameter calibration is based on historical data analysis, such as statistically analyzing the distance distribution characteristics of 100 normal samples to dynamically optimize threshold settings. Simultaneously, an error compensation mechanism is established to systematically compensate for camera calibration errors, model fitting errors, etc., improving the reliability of analysis results. Through the above implementation methods, the clustering and spread trend of initial abnormal areas is comprehensively assessed, providing accurate technical support for mold maintenance. The entire analysis process is completed on dedicated computing equipment, employing multi-threaded parallel computing technology to improve processing efficiency and ensure all analysis tasks are completed within a specified time.

[0053] S5. If there is no trend of clustering and spreading, determine the basic risk level based on the functional zoning information into which the initial abnormal area falls and execute the corresponding alarm operation; if there is a trend of clustering and spreading, construct the motion trajectory point set of the initial abnormal area based on the demolding motion direction information, and calculate its Hausdorff distance statistical characteristics with the theoretical envelope surface to assess the interference risk. The specific implementation is as follows: After determining the clustering and spread trend across functional zones, different processing procedures are executed based on the determination results. When it is determined that there is no clustering and spread trend across functional zones, the basic risk level is determined by querying a preset risk level mapping table based on the specific functional zone type in which each initial abnormal area falls in the CAD design model space. The risk level mapping table is established based on historical maintenance data statistical analysis, such as collecting data on production interruption time and maintenance costs caused by abnormalities in different functional zones over the past three years, and classifying the risk level into three levels: low risk, medium risk, and high risk. The specific mapping rules are as follows: abnormalities on the cavity surface correspond to the high risk level because the cavity surface directly affects the product's appearance quality; abnormalities on the core surface correspond to the medium risk level; and abnormalities in the exhaust groove correspond to the low risk level. The query process is implemented through database retrieval, using the functional zone type of each initial abnormal area as the query key value, and returning the corresponding risk level code. After determining the basic risk level, the first alarm operation corresponding to the basic risk level is triggered: a low risk level triggers a flashing yellow visual warning light, a medium risk level triggers a flashing orange visual warning light accompanied by an intermittent buzzer, and a high risk level triggers a constantly lit red visual warning light and a continuous buzzer alarm. The alarm operation is implemented by using an industrial PLC controller to output digital signals to drive the alarm device, with each risk level corresponding to a different combination of output signals.

[0054] When a clustering and spreading trend across functional zones is determined, a rigid body transformation is performed on the 3D contour of each initial abnormal region based on the demolding motion direction information. The rigid body transformation includes rotation and translation operations. The rotation matrix is ​​calculated based on the angle between the demolding motion direction vector and the coordinate system axis, while the translation vector is set at equal intervals along the demolding motion direction. The transformation process employs a homogeneous coordinate transformation method, applying a transformation matrix to the coordinates of each vertex in the 3D contour of the initial abnormal region. A series of discretely sampled motion trajectory point sets are generated along the demolding motion direction, with a sampling interval of 0.5 mm and a total motion stroke set to 100 mm based on the mold ejection distance, generating a total of 201 sampling positions. Each sampling position corresponds to a point set containing the coordinates of all vertices of the 3D contour of the initial abnormal region at that position. The generation of the motion trajectory point sets needs to consider the actual motion characteristics of the mold, such as the velocity curve and acceleration limitations of the ejection mechanism.

[0055] The Hausdorff distance between the motion trajectory point set and the theoretical safety envelope surface derived from the CAD design model is calculated. First, the geometric model of the product's inner surface corresponding to the demolding motion direction is obtained from the CAD design model as a reference surface. This surface is extracted using a feature recognition algorithm to ensure its geometric continuity. The reference surface is offset inward along the normal direction of the demolding motion by a preset safety margin threshold. The safety margin threshold is set to 0.05 mm based on the mold manufacturing tolerance to generate the theoretical safety envelope surface. The offset algorithm uses an equidistant offset method, moving each point on the reference surface along the normal vector direction by the safety margin threshold distance to generate a new surface model. The generation of the theoretical safety envelope surface must ensure the continuity and integrity of the surface, avoiding defects such as self-intersections or cracks.

[0056] The safety margin threshold is calculated based on the mold manufacturing tolerance system and a safety factor. First, the critical dimensional tolerances marked in the mold design drawings are obtained, for example, a cavity dimensional tolerance of ±0.02 mm. Combined with the ejector mechanism's motion accuracy (±0.01 mm), the safety margin threshold is set as the square root of the sum of the squares of the tolerance range multiplied by a safety factor of 1.5, resulting in approximately 0.035 mm, rounded to 0.05 mm. Simultaneously, considering material creep characteristics, for molds used long-term, the threshold is increased at a rate of 0.001 mm per month.

[0057] The minimum distance from each point in the motion trajectory point set to the theoretical safe envelope surface is calculated using a spatial nearest-point search algorithm. For each point in the motion trajectory point set, its Euclidean distance to all points on the theoretical safe envelope surface is calculated, and the minimum value is taken as the distance from that point to the surface. The search process is accelerated using a KD-tree spatial index, which discretizes the theoretical safe envelope surface into point cloud data to establish a spatial index structure. After calculation, a set of minimum distances is obtained, containing the minimum distance value corresponding to each point in the motion trajectory point set. The distance calculation accuracy is controlled within 0.01 mm to ensure the accuracy of the evaluation results.

[0058] The maximum value is extracted from the minimum distance set as the Hausdorff distance between the motion trajectory point set and the theoretical safe envelope. This maximum value reflects the maximum deviation between the motion trajectory point set and the theoretical safe envelope. Simultaneously, the average value from the distance set is extracted as an auxiliary statistical feature. The average value is calculated using the arithmetic mean method, summing all distance values ​​and dividing by the number of points in the set. The extraction of statistical features needs to consider the handling of outliers; for example, when a distance value deviates significantly from other values, the cause needs to be analyzed and a decision made regarding its inclusion in the calculation.

[0059] Interference risk levels are determined by mapping the magnitude of statistical characteristics. The maximum range of Hausdorff distance is divided into three intervals: 0 to 0.1 mm for low risk, 0.1 to 0.3 mm for medium risk, and greater than 0.3 mm for high risk. The average range is also divided into three intervals: 0 to 0.05 mm for low risk, 0.05 to 0.15 mm for medium risk, and greater than 0.15 mm for high risk. The final interference risk level is the higher of the two indicators. The mapping process is implemented using a lookup table to establish the correspondence between distance values ​​and risk levels. The risk level classification needs to be adjusted according to the specific mold's precision requirements and product characteristics; for example, high-precision molds require stricter risk level standards.

[0060] Throughout the process, an anomaly handling mechanism is required. When the motion trajectory point set intersects with the theoretical safety envelope, the minimum distance value is negative, and the intersection depth needs to be recorded as an additional risk assessment indicator. When the number of point sets is too large, a random sampling method is used to reduce the computational load, while ensuring that the sampling ratio is not less than 80%. All calculation results need to be verified, for example, a manual verification process is initiated when the Hausdorff distance exceeds 1 mm. The system periodically calibrates calculation parameters and optimizes the risk level mapping relationship based on actual production data. For example, the distance characteristics of historical interference events are statistically analyzed, and the distance threshold range is dynamically adjusted. Simultaneously, a data recording mechanism is established to save the process data and result data of each calculation for subsequent analysis and optimization. Through the above implementation methods, the accuracy and reliability of risk assessment are ensured, providing technical support for mold maintenance decisions.

[0061] S6. Dynamically adjust the basic risk level based on the clustering and spread trend and the risk of intervention, and execute corresponding alarm operations. The specific implementation is as follows: After determining the clustering and spread trend and assessing the intervention risk, the basic risk level needs to be dynamically adjusted based on the assessment results, and corresponding alarm operations need to be executed. Specifically, when a clustering and spread trend exists, the basic risk level is adjusted upwards by querying a predefined correction rule table based on the determined intervention risk level. The correction rule table is established based on historical accident data analysis, such as statistically analyzing cases of mold damage caused by abnormal spread in the past five years, and analyzing the correlation between the actual loss level and the basic risk level under different intervention risk levels. The correction rule table adopts a two-dimensional matrix structure, with the row index representing the basic risk level (including low, medium, and high risk levels), the column index representing the intervention risk level (also including low, medium, and high risk levels), and the matrix elements representing the final corrected risk level. For example, when the basic risk level is medium risk and the intervention risk level is high risk, the correction result is a high risk level. The correction process is implemented using a lookup table method, taking the basic risk level and the intervention risk level as input parameters, and querying the correction rule table to obtain the corrected risk level. The correction rule table needs to be updated regularly, for example, recalculating the correction rules quarterly based on new operational data to ensure the accuracy of the risk assessment. The method for constructing the revised rule table includes steps such as collecting historical case data, establishing a loss assessment model, and determining the risk level mapping relationship. Each step has clear operating procedures and verification mechanisms.

[0062] When there is no trend of clustered spread, the basic risk level is directly adopted as the final risk level. At this point, a verification check of the basic risk level is required, including confirming that the risk level mapping table is up-to-date, verifying the accuracy of functional area classification, and checking the correctness of the initial abnormal area location information. The system records the reasons for not making corrections and timestamp information, and also saves detailed calculation process data of the basic risk level for subsequent auditing and analysis. The determination of the final risk level requires a consistency check, such as comparing the risk assessment results at adjacent time points. When significant differences are found, a review process is initiated. The review process includes steps such as re-checking image acquisition quality, verifying CAD model matching accuracy, and reviewing functional area mapping relationships to ensure the reliability of the risk assessment results.

[0063] The second alarm operation is triggered based on the final risk level. This second alarm operation includes different levels of visual and audible warnings. Visual warnings are achieved using industrial-grade LED indicators: a solid green indicator for low risk, a flashing yellow indicator (1 Hz) for medium risk, and a rapidly flashing red indicator (3 Hz) for high risk. Audible warnings are achieved using piezoelectric buzzers: no audible alarm for low risk, an intermittent beep (60 dB loudness, 0.5-second intervals between 2-second beeps) for medium risk, and a continuous alarm (85 dB loudness, continuous beeping without interval) for high risk. Alarm triggering is controlled by a PLC digital output module, with each risk level corresponding to a specific combination of output signals. The installation location of the alarm device needs to consider the field of vision and hearing range of the operators. For example, a rotating warning light can be installed 1.5 meters above the detection equipment, and an audible and visual alarm can be installed on the control panel to ensure timely detection of alarm signals.

[0064] The duration of alarm operations is set according to the risk level. Low-risk alarms automatically stop after 5 minutes, medium-risk alarms require operator confirmation before stopping, and high-risk alarms require on-site maintenance and manual reset. Alarm records are saved to a historical database, including alarm time, risk level, handling personnel, and handling results. The system supports an alarm escalation mechanism; for example, if a high-risk alarm remains unhandled for 10 minutes, an SMS notification is automatically sent to management. Alarm testing functions need to be performed regularly, such as automatically testing the operational status of all alarm devices weekly. Tests include LED indicator brightness testing, buzzer loudness testing, and communication link checks to ensure the reliability of the alarm system. Test results are recorded in the system log, and maintenance work orders are automatically generated when anomalies are detected.

[0065] During implementation, an alarm shielding mechanism needs to be established. For example, alarms in specific areas can be temporarily shielded during equipment maintenance, but the reason for shielding, the operator, and the shielding time must be recorded. Alarm thresholds can be adjusted according to production requirements; for example, stricter alarm thresholds can be used during trial production, while standard alarm thresholds can be used during normal production. All alarm operations must comply with industrial site safety standards; for example, the loudness of the alarm sound must not exceed 90 decibels to avoid hearing damage, and the brightness of the alarm lights must ensure clear visibility in strong light environments. Maintenance of the alarm system includes regularly cleaning optical components, checking circuit connections, and calibrating acoustic equipment to ensure the alarm device is always in good working order. Through the above implementation methods, dynamic correction of risk levels and graded alarms can be achieved, providing effective protection for safe mold production. A comprehensive documentation and traceability mechanism needs to be established throughout the entire alarm handling process to ensure that every step is traceable.

[0066] Example 2: Figure 2A schematic diagram of the image-based injection mold defect detection system of the present invention is provided. The image-based injection mold defect detection system includes: The image generation module is used to acquire real-time images of the area to be detected in the injection mold and input them into the pre-trained generative model to obtain the corresponding generated reconstructed image; The anomaly detection module is used to calculate the pixel-level differences between the real-time image and the generated reconstructed image, and to identify all initial abnormal regions from the pixel-level differences based on a preset difference threshold. The information extraction module is used to acquire the CAD design model of the injection mold and extract the functional partition information and demolding movement direction information corresponding to the area to be detected. The spread assessment module is used to analyze the spatial topological relationship between the initial abnormal area as a whole and the boundaries of different functional zones based on functional zoning information, in order to assess whether there is a clustering and spread trend across functional zones. The classification analysis module is used to determine the basic risk level and execute the corresponding alarm operation based on the functional zoning information into which the initial abnormal area falls if there is no clustering and spreading trend; if there is a clustering and spreading trend, it constructs the motion trajectory point set of the initial abnormal area based on the demolding motion direction information, and calculates the Hausdorff distance statistical characteristics between it and the theoretical envelope surface to assess the interference risk. The alarm execution module is used to dynamically adjust the basic risk level based on the clustering and spread trend and the risk of interference, and to execute corresponding alarm operations.

[0067] The calculations involved in the embodiments are all dimensionless numerical calculations, and the preset parameters and thresholds in the calculations are set by those skilled in the art according to the actual situation.

[0068] It should be noted that this invention can be deployed on the device itself to realize embedded applications, or it can run on a PC or other terminal with a user interface, thereby meeting various hardware environments and usage requirements.

[0069] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions according to the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. Computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wireless or wired transmission; wired transmission methods include optical fiber, twisted pair, coaxial cable, etc.; wireless transmission includes infrared, microwave, etc. Computer-readable storage media can be any available medium that a computer can access or a data storage device such as a server or data center that contains one or more sets of available media. Available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media. Semiconductor media can be solid-state drives.

[0070] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and modules described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0071] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.

[0072] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0073] In addition, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.

[0074] If a function is implemented as a software module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0075] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0076] In conclusion, the above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for injection mold flaw detection generated based on images, characterized by, The method comprises the following steps: S1, acquiring a real-time image of a to-be-detected area of an injection mold and inputting the real-time image into a pre-trained generative model to obtain a corresponding generated reconstruction image; S2, calculating a pixel-level difference between the real-time image and the generated reconstruction image, and identifying all initial abnormal regions from the pixel-level difference based on a preset difference threshold; S3, acquiring a CAD design model of the injection mold, and extracting functional partition information and demolding motion direction information corresponding to the to-be-detected area from the CAD design model; S4, analyzing the spatial topological relationship between the initial abnormal regions as a whole and the boundaries of different functional partitions based on the functional partition information to evaluate whether there is an aggregative spreading trend across the functional partitions; S5, if there is no aggregative spreading trend, determining a basic risk level according to the functional partition information in which the initial abnormal regions fall and performing a corresponding alarm operation; if there is an aggregative spreading trend, constructing a motion trajectory point set of the initial abnormal regions according to the demolding motion direction information, and calculating statistical characteristics of the Hausdorff distance between the motion trajectory point set and a theoretical envelope surface to evaluate an interference risk; S6, dynamically correcting the basic risk level according to the aggregative spreading trend and the interference risk and performing a corresponding alarm operation.

2. The image-generated injection mold flaw detection method according to claim 1, characterized in that, S1 comprises: acquiring a real-time image of a to-be-detected area of an injection mold under standard lighting conditions; preprocessing the real-time image, the preprocessing including size normalization and grayscale normalization; inputting the preprocessed real-time image into a pre-trained variational autoencoder generative model; encoding and decoding the preprocessed real-time image through the variational autoencoder generative model to output a corresponding generated reconstruction image.

3. The image-generated injection mold flaw detection method according to claim 1, wherein S2 S2 comprises: calculating the difference between the grayscale values of each pixel point in the real-time image and the corresponding pixel point in the generated reconstruction image to obtain a pixel-level difference image; marking the pixel points with a grayscale value difference greater than a preset difference threshold in the pixel-level difference image as candidate abnormal pixel points; performing clustering processing on the marked candidate abnormal pixel points based on spatial connectivity, and identifying a set of spatially connected candidate abnormal pixel points as an initial abnormal region; after traversing all candidate abnormal pixel points, obtaining all initial abnormal regions.

4. The image-generated injection mold flaw detection method of claim 1, wherein, S3 comprises: reading three-dimensional geometric data and annotation information related to the to-be-detected area from a stored CAD design model file; dividing the to-be-detected area into functional partitions of a cavity surface, a core surface, a slider surface, and a vent groove based on the surface type annotations in the three-dimensional geometric data to obtain functional partition information; analyzing the vector along the ejection direction as demolding motion direction information according to the ejection mechanism motion parameters defined in the CAD design model; establishing a spatial mapping relationship between the functional partition information and the demolding motion direction information and the to-be-detected area in the real-time image.

5. The image-generated injection mold flaw detection method of claim 1, wherein, S4 comprises: mapping all initial abnormal regions to the CAD design model space containing the functional partition information to form an abnormal region set; identifying the functional partition directly contacted by each initial abnormal region in the abnormal region set; analyzing whether there is at least one initial abnormal region in the abnormal region set that simultaneously has a direct contact relationship with two or more different functional partitions; if so, it is determined that there is an aggregative spreading trend across the functional partitions; If not, further analyze whether the abnormal region set presents a continuous or quasi-continuous path connecting at least two different functional partitions in spatial distribution as a bridging mode; If the bridging mode is identified, determine that there is an aggregative spreading trend across functional partitions; If the bridging mode is not identified, determine that there is no aggregative spreading trend across functional partitions.

6. The image-generated injection mold flaw detection method according to claim 5, characterized in that, The analysis of whether the abnormal region set presents a continuous or quasi-continuous path connecting at least two different functional partitions in spatial distribution comprises: Perform spatial clustering on all initial abnormal regions in the abnormal region set based on Euclidean distance, and merge initial abnormal regions with a distance less than a preset clustering threshold into the same cluster; Determine whether there is at least one cluster whose circumscribed convex hull or minimum enclosing polygon intersects with two or more different functional partition regions; If so, determine that the cluster constitutes a bridging mode connecting different functional partitions.

7. The image-generated injection mold flaw detection method according to claim 1, characterized in that S5 Comprise: When it is determined that there is no aggregative spreading trend across functional partitions, according to the specific functional partition type into which each initial abnormal region falls in the CAD design model space, query a preset risk level mapping table to determine a basic risk level, and trigger a first alarm operation corresponding to the basic risk level; When it is determined that there is an aggregative spreading trend across functional partitions, perform rigid transformation on the three-dimensional profile of each initial abnormal region according to the demolding motion direction information to generate a series of motion trajectory point sets discretely sampled along the demolding motion direction; Calculate the Hausdorff distance between the motion trajectory point set and the theoretical safety envelope surface derived from the CAD design model; Extract the maximum and average values of the Hausdorff distance as statistical features; Determine the interference risk level according to the size range mapping of the statistical features.

8. The image-generated injection mold flaw detection method according to claim 7, characterized in that, The calculation of the Hausdorff distance between the motion trajectory point set and the theoretical safety envelope surface derived from the CAD design model comprises: Obtain the product inner surface geometric model corresponding to the demolding motion direction from the CAD design model as a reference surface; Offset the reference surface inward along the normal direction of the demolding motion direction by a preset safety margin threshold to generate a theoretical safety envelope surface; Calculate the minimum distance set of each point in the motion trajectory point set to the theoretical safety envelope surface; Extract the maximum value from the minimum distance set as the Hausdorff distance between the motion trajectory point set and the theoretical safety envelope surface.

9. The image-generated injection mold flaw detection method according to claim 1, characterized in that S6 Comprise: When there is an aggregative spreading trend, query a predefined correction rule table according to the determined interference risk level to correct the basic risk level upward; When there is no aggregative spreading trend, directly use the basic risk level as the final risk level; Trigger a corresponding second alarm operation according to the final risk level, and the second alarm operation comprises different levels of visual and audio warnings.

10. An image-based injection mold flaw detection system for implementing the image-based injection mold flaw detection method according to any one of claims 1 to 9, characterized in that Comprise: An image generation module for obtaining real-time images of the injection mold detection area and inputting them into a pre-trained generation model to obtain corresponding generated reconstruction images; An abnormality identification module is configured to calculate pixel-level differences between the real-time image and the generated reconstructed image, and identify all initial abnormal regions from the pixel-level differences based on a preset difference threshold; An information extraction module is configured to acquire a CAD design model of the injection mold, and extract functional partition information and demolding motion direction information corresponding to the to-be-detected region from the CAD design model; A spread evaluation module is configured to analyze spatial topological relations between the initial abnormal region as a whole and different functional partition boundaries based on the functional partition information, so as to evaluate whether there is an aggregated spread trend across the functional partitions; A classification analysis module is configured to determine a basic risk level and perform a corresponding alarm operation according to the functional partition information into which the initial abnormal region falls, if there is no aggregated spread trend; if there is the aggregated spread trend, construct a motion trajectory point set of the initial abnormal region according to the demolding motion direction information, and calculate Hausdorff distance statistical features of the motion trajectory point set and a theoretical envelope surface to evaluate an interference risk; An alarm execution module is configured to dynamically correct the basic risk level according to the aggregated spread trend and the interference risk, and perform a corresponding alarm operation.