An in-mold monitoring method

CN122975973APending Publication Date: 2026-10-27SUZHOU CM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611391644.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-09
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

然而,现有视觉监控方案在实际应用中仍面临诸多困难

Benefits of technology

[0062]本发明通过引入动态光照补偿模型,使得模腔监控在不同光照条件下均能保持稳定检测精度,结合模腔残留物检测与顶针状态检测的双重监测机制,有效防止因顶针未退、产品残留或异物遮挡等异常情况导致的模具合模损坏,并通过异常信号与控制指令的直接联动,实现了从视觉检测到执行器控制的闭环保护,显著提升了注塑生产的安全性和自动化水平。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122975973A_ABST
    Figure CN122975973A_ABST
Patent Text Reader

Abstract

The application discloses a kind of in-mold monitoring methods, it is related to injection molding technical field, comprising the following steps: S1, the reference template image of cavity region is obtained;S2, the real-time image of cavity region after injection molding machine opens mold is collected;S3, dynamic light compensation model is constructed;S4, cavity state detection is executed;S5, output monitoring signal;S6, control instruction is generated.The application effectively eliminates the influence of environmental light fluctuation on detection results by dynamic light compensation, combined with cavity residual and double detection of ejector pin state, significantly improves the detection accuracy and reliability of in-mold monitoring under light change conditions, effectively prevents mold damage, and ensures the safety of injection molding production.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of injection molding technology, and in particular to an in-mold monitoring method. Background Technology

[0002] Injection molding is one of the most important production methods for plastic products. Its production cycle includes multiple stages such as mold closing, injection, pressure holding, cooling, mold opening, and ejection. If, after mold opening and before mold closing again, there are abnormalities such as undemolded products, ejector pins not retracting, or foreign matter residue inside the mold cavity, the mold closing action will directly damage the mold cavity surface, potentially leading to mold failure or even equipment safety accidents. Therefore, real-time monitoring of the mold cavity status after mold opening to ensure that mold closing is only performed under safe conditions is an indispensable and crucial step in the injection molding production process.

[0003] Currently, some injection molding machines use mechanical limit switches or proximity sensors installed on the mold to detect whether the ejector pin has retracted, and photoelectric sensors to detect whether there are residues in the mold cavity. However, these traditional sensor solutions have obvious limitations: mechanical sensors can only detect a single physical quantity and cannot effectively identify complex-shaped product residues or foreign objects in the mold cavity; photoelectric sensors are easily contaminated by dust and oil and will fail; and the sensor installation position is limited by the mold structure, making it difficult to achieve full coverage detection of the entire mold cavity.

[0004] In recent years, with the development of machine vision technology, some solutions have attempted to introduce industrial cameras into the field of in-mold monitoring, capturing images of the mold cavity and comparing them with standard templates to determine if anomalies exist. However, existing visual monitoring solutions still face many difficulties in practical applications. The most prominent problem is the extremely unstable lighting conditions in the injection molding machine environment. Factors such as the starting and stopping of workshop lights, changes in natural light, fluctuations in reflections on the mold surface, and the displacement of the light source position caused by the vibration of the injection molding machine itself can all lead to significant changes in the grayscale of images captured from the same mold under the same conditions. When faced with changes in lighting, existing solutions with fixed image comparison thresholds are prone to generating a large number of false alarms or missed alarms, seriously affecting production efficiency and safety. To address the problem of lighting changes, some solutions attempt to compensate through global image normalization or simple histogram equalization. However, because different areas within the mold cavity respond differently to changes in lighting, a globally uniform correction method cannot guarantee the detection accuracy of each area, resulting in unsatisfactory detection results in localized areas even after correction.

[0005] Therefore, how to achieve high-precision and high-reliability visual inspection of the mold cavity state under fluctuating lighting conditions, while taking into account the real-time nature of the inspection and the universal adaptability to different mold structures, is an urgent technical problem to be solved. Summary of the Invention

[0006] The purpose of this invention is to provide an in-mold monitoring method to solve the problems mentioned in the background art.

[0007] To achieve the above objectives, the present invention provides the following technical solution: an in-mold monitoring method, comprising the following steps:

[0008] S1. Obtain a reference template image of the mold cavity region, wherein the reference template image contains preset detection region information;

[0009] S2. Acquire real-time images of the mold cavity area after the injection molding machine opens the mold;

[0010] S3. Based on the real-time image and the reference template image, a dynamic illumination compensation model is constructed. The dynamic illumination compensation model is used to perform illumination adaptive correction on the real-time image to eliminate the influence of ambient light fluctuations on the detection results.

[0011] S4. Based on the real-time image after illumination correction and the reference template image, perform mold cavity state detection, which includes at least mold cavity residue detection and ejector pin state detection.

[0012] S5. Based on the result of the mold cavity status detection, output a monitoring signal, which includes a normal signal or an abnormal signal;

[0013] S6. When an abnormal signal is output, a control command is generated. The control command is used to prohibit the injection molding machine from closing the mold and to trigger an alarm.

[0014] Preferably, in step S3, the step of constructing the dynamic illumination compensation model specifically includes:

[0015] Extract the illumination reference features of the non-detection region in the real-time image, wherein the non-detection region is the cavity fixing structure region outside the detection region;

[0016] The illumination compensation coefficient is calculated based on the illumination reference features and the reference features of the corresponding region in the reference template image;

[0017] The illumination compensation coefficient is used to perform pixel value mapping correction on the detection area of ​​the real-time image, so that the illumination conditions of the corrected detection area are close to the illumination conditions of the reference template image.

[0018] Preferably, the step of calculating the illumination compensation coefficient specifically includes:

[0019] Multiple reference sub-windows are defined within the non-detection areas of the real-time image and the reference template image, respectively;

[0020] Calculate the mean and variance of gray levels within each reference sub-window to construct a local illumination feature vector;

[0021] The local illumination feature vectors of multiple reference sub-windows are weighted and fused to obtain the global illumination feature value;

[0022] The gain compensation coefficient is determined based on the ratio of the global illumination feature value of the real-time image to the global illumination feature value of the reference template image.

[0023] When the gain compensation coefficient exceeds the preset gain threshold range, a multi-level compensation strategy is activated.

[0024] The multi-level compensation strategy includes: the first level uses linear gain correction, the second level uses nonlinear correction based on histogram matching, and the third level triggers an abnormal lighting warning.

[0025] Preferably, in step S4, the step of performing mold cavity state detection specifically includes:

[0026] The detection area of ​​the real-time image after illumination correction is divided into several sub-detection blocks;

[0027] For each sub-detection block, calculate the structural similarity index with the block corresponding to the baseline template image;

[0028] The overall matching score is calculated based on the structural similarity index of each sub-detection block and the preset block weight coefficient.

[0029] The overall matching score is compared with the adaptive matching threshold. If it is lower than the adaptive matching threshold, an anomaly is determined.

[0030] The adaptive matching threshold is dynamically updated based on historical normal detection results.

[0031] Preferably, the calculation of the structural similarity index incorporates an edge direction consistency factor, which is obtained through the following method:

[0032] Extract the edge direction histograms of the real-time image after illumination correction and the reference template image in the corresponding sub-detection blocks;

[0033] Calculate the cross-correlation coefficient between the histograms of the two edge directions as a measure of edge direction consistency;

[0034] The edge direction consistency measure is nonlinearly fused with brightness similarity and contrast similarity to obtain an enhanced structural similarity index, wherein the fusion weight of the edge direction consistency measure increases with the increase of the illumination compensation coefficient.

[0035] Preferably, in step S4, the pin state detection step specifically includes:

[0036] Acquire the pin position sensor signal that is synchronously acquired with the real-time image;

[0037] In the real-time image, the ejector pin region is identified, and the feature information of the ejector pin region is extracted. The feature information includes at least the actual position coordinates of the ejector pin end and the shape contour of the ejector pin end.

[0038] The feature information of the pin region is compared with the pin reference features in the reference template image to obtain the visual detection result;

[0039] The visual detection result is fused with the pin position sensor signal using a confidence weighting to obtain a comprehensive pin status determination result.

[0040] When the visual detection result is inconsistent with the judgment conclusion of the sensor signal, the visual detection result shall prevail, and the abnormal sensor signal shall be marked.

[0041] Preferably, in step S1, obtaining the reference template image specifically includes:

[0042] During the initial debugging or replacement of the mold, multiple frames of initial images of the mold cavity area are continuously acquired.

[0043] Multi-scale temporal filtering is performed on multiple initial images to eliminate random noise and obtain a fused image;

[0044] Receive the detection area and pin area delineated on the fused image, as well as the detection sensitivity and alarm delay frame number set for each area;

[0045] Based on the fused image and the operator's settings, the reference template image and its corresponding configuration parameter file are generated. The configuration parameter file supports storage, export, and cross-mold reuse.

[0046] When reusing configuration parameter files across molds, the system automatically checks whether the current mold model matches the mold model recorded in the configuration parameter file. If they do not match, a matching prompt is issued.

[0047] Preferably, in step S2, after acquiring the real-time image, running blur detection is performed on the real-time image;

[0048] When the motion blur detected exceeds the preset blur threshold, the current frame is determined to be a blur frame, the cavity state detection of the frame is abandoned, and the continuous frame detection mode is started.

[0049] In the continuous frame detection mode, K subsequent frames of images are continuously acquired, motion blur detection is performed on each frame of image, and the frame with the lowest blur is selected for cavity state detection.

[0050] If K consecutive frames of images fail to meet the clarity requirements, an alarm signal for camera malfunction or injection molding machine speed malfunction will be generated.

[0051] Preferably, step S6 further includes a multi-level exception triggering and reset mechanism, specifically including:

[0052] When an anomaly is detected for the first time, an anomaly signal is output and the injection molding machine is prohibited from closing the mold, while the anomaly start time is recorded.

[0053] During the period of anomaly, real-time images are continuously acquired and mold cavity status detection is performed, recording the number of frames of the anomaly and the change curve of the degree of anomaly.

[0054] When the abnormal state is automatically eliminated, the abnormal signal is not cleared immediately, and the system enters a confirmation waiting state. In the confirmation waiting state, the mold closing command is prohibited until manual confirmation is received, after which the abnormal signal is cleared and the system is reset.

[0055] If the abnormal status is not manually confirmed within a preset time, an upgraded alarm message will be automatically sent to the remote monitoring terminal, and the abnormality degree change curve will be uploaded along with the alarm message.

[0056] Preferably, it also includes a scene-aware working mode switching step, specifically including:

[0057] During the initial preheating stage of the injection molding machine, it automatically enters the learning mode. In the learning mode, the gain coefficient of the dynamic lighting compensation model is locked at the nominal value, and only the lighting fluctuation trend is recorded without triggering the lighting anomaly warning.

[0058] After the injection molding machine enters the stable production stage, it automatically switches to monitoring mode, in which complete light adaptation correction and anomaly detection logic are enabled;

[0059] In response to a manually input pause command, the system switches from monitoring mode to pause mode. In pause mode, the system stops outputting the prohibition of mold closing control command, but still performs image acquisition and mold cavity status detection and records the detection log.

[0060] In pause mode, if M consecutive abnormal events are detected, the monitoring mode will automatically resume.

[0061] The technical effects and advantages of this invention are as follows:

[0062] This invention introduces a dynamic illumination compensation model, enabling stable detection accuracy of mold cavity monitoring under different illumination conditions. Combined with a dual monitoring mechanism of mold cavity residue detection and ejector pin status detection, it effectively prevents mold closing damage caused by abnormalities such as ejector pins not retracting, product residue, or foreign objects obstructing the mold. Furthermore, through the direct linkage between abnormal signals and control commands, it achieves closed-loop protection from visual detection to actuator control, significantly improving the safety and automation level of injection molding production.

[0063] This invention extracts the illumination reference features of non-detection areas in real-time images, calculates a gain compensation coefficient based on these reference features and the reference features of corresponding areas in a benchmark template image, and uses this coefficient to perform pixel value mapping correction on the detection area of ​​the real-time image. Since the physical state of the non-detection area remains unchanged during the injection molding cycle, its image grayscale changes truly reflect the fluctuations in ambient illumination. Using it as a reference for correction can accurately eliminate the influence of illumination changes on the detection area, enabling the in-mold monitoring system to stably adapt to the complex and ever-changing illumination environment of the workshop.

[0064] This invention extracts the edge direction histogram of image blocks and calculates its cross-correlation coefficient with the template, taking edge direction consistency as an important dimension for similarity evaluation. At the same time, the fusion weight of the edge direction consistency measure is dynamically adjusted with the change of the illumination compensation coefficient. This dynamic weight mechanism enables the detection algorithm to maintain a high sensitivity to changes in the shape and contour of the product even after illumination correction, effectively avoiding missed detections caused by the weakening of local edge information due to illumination correction in traditional solutions. Attached Figure Description

[0065] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used together with the embodiments of the invention to explain the invention, but do not constitute a limitation thereof. In the drawings:

[0066] Figure 1 This is a flowchart of the method of the present invention.

[0067] Figure 2 This is a flowchart of the dynamic illumination compensation process of the present invention.

[0068] Figure 3 This is a flowchart of the pin state detection process of the present invention. Detailed Implementation

[0069] 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.

[0070] This invention provides, for example Figures 1-3 The method for in-mold monitoring shown includes the following steps:

[0071] S1. Obtain a reference template image of the mold cavity region. The reference template image contains preset detection region information.

[0072] S2. Acquire real-time images of the mold cavity area after the injection molding machine opens the mold;

[0073] S3. Based on real-time images and reference template images, a dynamic illumination compensation model is constructed. The dynamic illumination compensation model is used to perform illumination adaptive correction on real-time images to eliminate the influence of ambient light fluctuations on the detection results.

[0074] S4. Based on the real-time image after illumination correction and the reference template image, perform mold cavity status detection. Mold cavity status detection includes at least mold cavity residue detection and ejector pin status detection.

[0075] S5. Based on the results of the mold cavity status detection, output a monitoring signal, which includes a normal signal or an abnormal signal.

[0076] S6. When an abnormal signal is output, a control command is generated. The control command is used to prohibit the injection molding machine from closing the mold and to trigger an alarm.

[0077] This embodiment introduces a dynamic lighting compensation model, enabling stable detection accuracy of the mold cavity monitoring under different lighting conditions. Combined with a dual monitoring mechanism of mold cavity residue detection and ejector pin status detection, it effectively prevents mold closing damage caused by abnormalities such as ejector pins not retracting, product residue, or foreign objects obstructing the mold. Through the direct linkage between abnormal signals and control commands, it achieves closed-loop protection from visual detection to actuator control, significantly improving the safety and automation level of injection molding production.

[0078] In a preferred embodiment, obtaining the reference template image of the mold cavity region specifically includes:

[0079] After the initial mold debugging is completed or the mold is replaced, multiple frames of initial images of the mold cavity area are continuously acquired. To ensure the representativeness of the template, this embodiment acquires 5 to 10 frames of images. Multi-scale temporal filtering is performed on the multiple initial frames to eliminate random noise and pixel fluctuations caused by vibration, resulting in a fused image. Specifically, the multi-scale temporal filtering uses Gaussian pyramid decomposition to decompose each frame of image into a low-frequency approximation layer and a high-frequency detail layer. The high-frequency detail layer is then weighted and averaged in the temporal domain before the image is reconstructed, thereby obtaining a stable fused image.

[0080] Then, the fused image is displayed to the operator through a human-computer interaction interface. The operator uses a mouse or stylus to circle one or more detection areas and non-detection areas on the image. Detection areas include areas that need to participate in similarity determination, such as the product forming area and the ejector pin end area; non-detection areas include areas that do not participate in similarity determination, such as the mold fixing structure and positioning pins, which are subsequently used for the extraction of lighting reference features. At the same time, the operator sets the detection sensitivity (divided into 1 to 10 levels) and alarm delay frame number for each detection area (for example, allowing three consecutive frames of abnormal detection before triggering an alarm to avoid instantaneous interference and false alarms).

[0081] Finally, the system generates a baseline template image based on the fused image, the defined area, and the set parameters. It also automatically identifies the current mold model (either through manual input or by reading the mold code), packages the baseline template image and configuration parameters into a configuration parameter file, and stores it locally or on a server. This configuration parameter file can be exported for reuse on other injection molding machines with the same mold model. When reusing molds across different molds, the system automatically reads the current mold model and compares it with the mold model recorded in the configuration parameter file. If they do not match, a "mold model mismatch" message is displayed on the human-machine interface, prompting the operator to recalibrate or confirm.

[0082] In summary, this embodiment generates stable fused images through multi-scale temporal filtering, effectively suppressing random noise in the initial acquisition stage and providing a high-quality reference benchmark for subsequent detection. It supports operators in flexibly delineating detection and non-detection areas, allowing the detection area of ​​interest to be customized according to the structural characteristics of different molds, demonstrating strong versatility. The storage and cross-mold reuse function of configuration parameter files reduces repeated calibration time, and skilled operators can complete the template setting of a new mold within 1 minute. Automatic comparison prompts across mold models avoid detection failures caused by misuse of incompatible templates.

[0083] In a preferred embodiment, an anti-interference processing step is performed after acquiring real-time images and before constructing the dynamic illumination compensation model. Specifically:

[0084] The acquired real-time image is first subjected to motion blur detection, that is, the Laplacian gradient variance of the image is calculated. If the variance value is lower than the preset sharpness threshold (the threshold is determined by multiplying the mean of the gradient variances of multiple sharp images by 0.6), the current frame is determined to be a blur frame, the frame is discarded for subsequent detection, and the continuous frame detection mode is started at the same time.

[0085] In continuous frame detection mode, K frames of images are continuously acquired; in this embodiment, K is set to 3. Motion blur detection is performed on each frame (i.e., the Laplacian gradient variance of each frame is calculated), and the frame with the largest variance value, i.e., the clearest frame, is selected for mold cavity status detection. If three consecutive frames do not meet the clarity requirements, a camera abnormality or injection molding machine speed abnormality alarm signal is generated and recorded in the log, and detection is paused until manual reset.

[0086] In summary, the anti-interference processing in this embodiment can effectively avoid misjudgments caused by excessively fast mold opening speed of the injection molding machine, vibration, or oil contamination leading to blurred images, ensuring that the images entering subsequent illumination compensation and status detection have sufficient clarity, thus improving the robustness of the overall monitoring system. The continuous frame detection mode provides an alternative mechanism when a single frame is blurred, avoiding interruption of the entire detection cycle due to single frame acquisition failure, and ensuring the continuity of monitoring.

[0087] In a preferred embodiment, the step of constructing the dynamic illumination compensation model specifically includes:

[0088] Extract illumination reference features from non-detection areas in the real-time image. These non-detection areas are the structural regions unaffected by the product, such as the fixed metal surfaces and positioning posts at the edge of the mold cavity, as defined by the operator. Within these areas, multiple reference sub-windows (e.g., 5×5 pixel square windows evenly distributed within the non-detection area) are pre-defined. Calculate the mean grayscale value m within each reference sub-window. i and gray variance v i This constitutes the local illumination feature vector F. i =(m i v i ).

[0089] Then, the local illumination feature vectors of multiple reference sub-windows are weighted and fused to obtain the global illumination feature value. The fusion method is as follows:

[0090]

[0091] Where N is the total number of reference sub-windows; m i Let q be the average grayscale value of the i-th sub-window; i Let be the weighting coefficient for the i-th sub-window. This weighting coefficient is inversely proportional to the distance from the sub-window to the image center, in order to reduce the impact of edge shadows on global feature estimation. Similarly, the same sub-window division and weighted fusion method are used for the non-detection regions of the benchmark template image to obtain the benchmark global illumination feature value I. ref .

[0092] Then calculate the gain compensation coefficient G, using the following formula:

[0093]

[0094] The pixel value mapping correction of the detection area of ​​the real-time image is performed using a gain compensation coefficient, so that the illumination conditions of the corrected detection area are close to those of the reference template image. When G is within the preset gain threshold range [0.6, 1.4], linear gain correction is directly adopted, that is, the gray value p of each pixel in the detection area of ​​the real-time image is multiplied by the gain compensation coefficient G;

[0095] When the gain compensation coefficient exceeds the preset gain threshold range, a multi-level compensation strategy is activated. Specifically, this includes: the first level uses linear gain correction to map the grayscale values ​​to a range close to the baseline; the second level uses non-linear correction based on histogram matching, which matches the histogram of the real-time image detection region after correction with the histogram of the baseline template detection region, and uses the cumulative distribution function to make the shapes of the two histograms converge; the third level triggers an abnormal lighting warning, records the abnormal event, and prompts the operator to check whether the on-site lighting is faulty or whether the mold is obstructed.

[0096] In summary, this embodiment achieves accurate estimation of illumination changes by extracting illumination reference features from non-detection areas and leveraging the characteristic that the fixed structure within the mold cavity is unaffected by product status. The weighted fusion strategy reduces interference from edge shadows and improves the accuracy of illumination feature estimation. The calculation of the gain compensation coefficient provides a quantitative basis for subsequent correction. The introduction of a multi-level compensation strategy enables the system to maintain stable correction effects under both mild illumination fluctuations and drastic illumination changes, avoiding false detections and missed detections caused by illumination changes, and significantly improving the monitoring system's adaptability to changes in the workshop environment.

[0097] In a preferred embodiment, the step of performing mold cavity state detection specifically includes:

[0098] The detection region of the real-time image after illumination correction is divided into several sub-detection blocks. For example, the entire detection region is divided into a 16×16 pixel grid, and blocks with edges less than 16 pixels are treated as their actual size. For each sub-detection block, its structural similarity index with the corresponding block in the reference template image is calculated.

[0099] Specifically, for each sub-detection block, the average brightness u of the real-time image block and the reference template image block is extracted respectively. x u y Standard deviation σ x σ y and covariance σ xy The formulas for calculating luminance similarity l(x,y) and contrast similarity c(x,y) are as follows:

[0100]

[0101]

[0102] C1 and C2 are constants to avoid the denominator being zero.

[0103] Furthermore, an edge orientation consistency factor is introduced into the calculation of the structural similarity index. This factor is obtained as follows: the gradient magnitude and orientation of the real-time block and the baseline block are extracted using the Sobel operator, and an edge orientation histogram is constructed (dividing 0° to 180° into 9 intervals and calculating the percentage of edge pixels within each interval). The cross-correlation coefficient ρ between the two orientation histograms is then calculated as a measure of edge orientation consistency. The closer ρ is to 1, the more consistent the edge orientation distribution.

[0104] By nonlinearly fusing brightness similarity, contrast similarity, and edge orientation consistency measures, the enhanced structural similarity index SSIM is obtained. enh The calculation method is as follows:

[0105]

[0106] Wherein, α, β, and γ are weighting indices, and in this embodiment, α = 0.3, β = 0.3, and γ = 0.4. In particular, the value of γ is related to the illumination compensation coefficient G. That is, the further G deviates from 1, the greater the illumination correction force. At this time, edge direction information is more important for the judgment. Therefore, γ increases linearly with |1−G|, with an upper limit of 0.6, to enhance the contribution of edge direction in similarity evaluation.

[0107] After calculating the enhanced structural similarity index for each sub-detection block, and combining it with the preset weight coefficients for each block (operators can assign different weights to different blocks when setting the detection area, for example, high weight for the product center area and low weight for the edges), the overall matching score is calculated:

[0108]

[0109] Where N is the total number of sub-blocks, w i Let w be the weight coefficient of the i-th block, satisfying ∑w i =1.

[0110] The overall matching score S is compared with the adaptive matching threshold T. If S < T, an anomaly is determined in the detection area (e.g., product residue, foreign object obstruction). The adaptive matching threshold T is dynamically updated based on historical normal detection results. During the continuous and stable production phase of the injection molding machine without any abnormal alarms, the overall matching score of each normal detection is recorded, and the threshold is updated using an exponentially weighted moving average.

[0111]

[0112] Where α is the forgetting factor (taken as 0.7). It is the weighted moving average of the scores from the most recent 20 normal tests.

[0113] In summary, this embodiment improves the targeting of detection by dividing and weighting detection blocks into sub-detection areas, allowing for differentiated configuration of the detection focus area based on the importance of the mold structure. The enhanced structural similarity index introduces an edge direction consistency factor on top of traditional brightness and contrast similarity, making the detection more sensitive to changes in the product's shape and texture. Meanwhile, the dynamic adjustment of edge direction weights further optimizes the detection effect after illumination correction. The adaptive matching threshold mechanism can adapt to slow changes such as slight mold wear and surface stain accumulation, avoiding false alarms or missed alarms caused by fixed thresholds, and significantly improving the long-term stability and accuracy of detection.

[0114] In a preferred embodiment, the pin state detection step specifically includes:

[0115] While acquiring real-time images, the sensor signal (such as a proximity switch or limit switch digital signal, 0 indicating no retraction and 1 indicating retraction) of the ejector pin retraction position in the injection molding machine PLC is read. Feature information is extracted from the ejector pin area in the real-time images. The ejector pin area is the area of ​​the ejector pin end circled by the operator on the reference template image in the previous steps. Specifically, the actual position coordinates of the ejector pin end are located by edge detection and compared with the ejector pin reference position in the reference template image to calculate the position offset d; at the same time, the shape contour of the ejector pin end is extracted and compared with the reference contour using Hu moment comparison to obtain the shape similarity H (between 0 and 1, 1 indicating a perfect match).

[0116] The positional offset and shape similarity are weighted and fused into a visual detection confidence score V:

[0117]

[0118] Where f(d) is the position offset mapping function, which is close to 1 when the offset is less than a preset threshold and decreases linearly as the offset increases; β is the weighting coefficient, which is 0.5 in this embodiment. The sensor signal is converted into sensor confidence Sens. If the sensor signal is in a retreat state, Sens = 0.9; otherwise, it is 0.1. The final comprehensive judgment value P of the pin state is obtained by confidence weighted fusion:

[0119]

[0120] Where λ is the visual weight, which is 0.7 in this embodiment. If P is lower than the set normal threshold for the ejector pin (e.g., 0.6), the ejector pin is determined not to have retracted. When the visual detection result is inconsistent with the sensor signal's determination (e.g., the visual detection shows that the ejector pin has not retracted while the sensor signal indicates that it has retracted), the visual detection result shall prevail, i.e., it shall be determined that the ejector pin has not retracted. At the same time, the event shall be marked as an abnormal sensor signal and recorded, prompting maintenance personnel to check whether the sensor is faulty or the wiring is loose.

[0121] In summary, this embodiment fully leverages the advantages of visual information in intuitively reflecting the physical state and the rapid response of sensor signals by using a confidence-weighted fusion of visual inspection and sensor signals, thereby improving the reliability of pin state determination. When the conclusions of the two signal sources are inconsistent, visual inspection takes precedence and the sensor is marked as abnormal. This ensures a safety-first determination logic and provides a basis for sensor fault diagnosis, effectively avoiding safety hazards caused by the failure of a single signal source.

[0122] In a preferred embodiment, the intra-mold monitoring method further includes a multi-level anomaly triggering and reset mechanism, specifically including:

[0123] When an anomaly is detected for the first time (i.e., either the mold cavity status detection or the ejector pin status detection result is abnormal), the system immediately issues an audible and visual alarm via a buzzer, allowing on-site operators to be promptly notified. Simultaneously, a mold-closing prohibition control command is generated and sent to the injection molding machine controller via the IO interface, forcibly locking the mold-closing action. The system records the anomaly start time, anomaly type (product residue, ejector pin not retracted, foreign object obstruction, etc.), and anomaly severity (expressed as deviation from the overall matching score).

[0124] During the period of anomaly, the camera continues to acquire and detect, continuously acquiring real-time images and performing cavity state detection, recording the number of frames of the anomaly and the curve of the change in the degree of anomaly;

[0125] When the abnormal state is automatically eliminated (e.g., residue is shaken off and the overall matching score recovers to above the threshold after testing), the system does not immediately clear the abnormal signal and lift the mold-closing prohibition command. Instead, it enters a confirmation waiting state. In this state, the mold-closing prohibition command remains valid, and the human-machine interface displays a message indicating the abnormality has disappeared, requesting manual confirmation. Only after the operator has inspected the site and confirmed safety, and then pressed the reset button, will the system clear the abnormal signal, lift the mold-closing prohibition command, and resume normal monitoring.

[0126] If the abnormal status is not manually confirmed within a preset time (e.g., 5 minutes), the system will automatically send an upgraded alarm message to the remote monitoring terminal (such as Chengmo MES or workshop management server), and upload the abnormality degree change curve, the number of frames of abnormality duration, and relevant image snapshots to facilitate remote diagnosis and traceability.

[0127] In summary, this embodiment achieves closed-loop rapid protection from visual detection to actuator control by immediately triggering an alarm and prohibiting mold closing upon the first anomaly, effectively preventing mold damage. After the anomaly is cleared, it does not automatically reset but requires manual confirmation, avoiding safety hazards caused by momentary interference or misjudgment, and ensuring that each anomaly is manually checked before production can resume. The upgraded alarm mechanism ensures that abnormal states can still be effectively handled when unattended or when operators are negligent, improving the controllability and safety of production management.

[0128] In a preferred embodiment, the in-module monitoring method further includes a scene-aware working mode switching step, specifically including:

[0129] During the initial preheating phase of the injection molding machine (the system automatically determines this by detecting the consistency of the mold closing cycle; preheating is considered complete when the cycle time fluctuation is less than ±2% for five consecutive cycles; the period before this is considered the preheating phase), the system automatically enters learning mode. In learning mode, the gain compensation coefficient G of the dynamic illumination compensation model is locked at the nominal value of 1, meaning that illumination correction is not performed on the real-time image, and the original image data is used directly for detection. However, the system still records the illumination fluctuation trend and detection score to provide initial data for subsequent adaptive matching thresholds, while not triggering illumination anomaly warnings to avoid false alarms caused by unstable lighting during the preheating phase.

[0130] After the injection molding machine enters the stable production stage, the system automatically switches to monitoring mode. In monitoring mode, the complete lighting adaptation correction and anomaly detection logic is enabled, that is, all the steps mentioned above, such as dynamic lighting compensation model construction, enhanced structural similarity detection and ejector pin comprehensive judgment, are executed.

[0131] The system also responds to operator-inputted pause commands, switching from monitoring mode to pause mode. This pause command is issued via the pause monitoring button on the human-machine interface and is suitable for special scenarios such as mold trials and maintenance. In pause mode, the system stops outputting prohibition of mold closing control commands (i.e., allowing the injection molding machine to close the mold freely), but the camera continues to acquire images and perform mold cavity status detection. All detection results and logs are recorded as usual; only alarms and control outputs are not executed. If three consecutive abnormal events are detected in pause mode, the system automatically returns to monitoring mode to prevent operators from forgetting to resume and to ensure subsequent production safety.

[0132] In summary, this embodiment utilizes a learning mode to record data without implementing corrections or warnings during the warm-up phase, avoiding interference from unstable factors during equipment startup and accumulating initial data for subsequent adaptive threshold use. The monitoring mode during the stable production phase enables all detection logic, ensuring the highest level of safety protection. The pause mode provides a flexible monitoring strategy for special scenarios such as trial molding and maintenance, without affecting on-site operations, while retaining complete records of detection data. Furthermore, the automatic recovery mechanism avoids security vulnerabilities caused by human negligence, achieving an organic balance between monitoring flexibility and security.

[0133] 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 variations 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. An in-mold monitoring method, characterized in that, Includes the following steps: S1. Obtain a reference template image of the mold cavity region, wherein the reference template image contains preset detection region information; S2. Acquire real-time images of the mold cavity area after the injection molding machine opens the mold; S3. Based on the real-time image and the reference template image, a dynamic illumination compensation model is constructed. The dynamic illumination compensation model is used to perform illumination adaptive correction on the real-time image to eliminate the influence of ambient light fluctuations on the detection results. S4. Based on the real-time image after illumination correction and the reference template image, perform mold cavity state detection, which includes at least mold cavity residue detection and ejector pin state detection. S5. Based on the result of the mold cavity status detection, output a monitoring signal, which includes a normal signal or an abnormal signal; S6. When an abnormal signal is output, a control command is generated. The control command is used to prohibit the injection molding machine from closing the mold and to trigger an alarm.

2. The in-mold monitoring method according to claim 1, characterized in that, In step S3, the step of constructing the dynamic illumination compensation model specifically includes: Extract the illumination reference features of the non-detection region in the real-time image, wherein the non-detection region is the cavity fixing structure region outside the detection region; The illumination compensation coefficient is calculated based on the illumination reference features and the reference features of the corresponding region in the reference template image; The illumination compensation coefficient is used to perform pixel value mapping correction on the detection area of ​​the real-time image, so that the illumination conditions of the corrected detection area are close to the illumination conditions of the reference template image.

3. The in-mold monitoring method according to claim 2, characterized in that, The steps for calculating the illumination compensation coefficient specifically include: Multiple reference sub-windows are defined within the non-detection areas of the real-time image and the reference template image, respectively; Calculate the mean and variance of gray levels within each reference sub-window to construct a local illumination feature vector; The local illumination feature vectors of multiple reference sub-windows are weighted and fused to obtain the global illumination feature value; The gain compensation coefficient is determined based on the ratio of the global illumination feature value of the real-time image to the global illumination feature value of the reference template image. When the gain compensation coefficient exceeds the preset gain threshold range, a multi-level compensation strategy is activated. The multi-level compensation strategy includes: the first level uses linear gain correction, the second level uses nonlinear correction based on histogram matching, and the third level triggers an abnormal lighting warning.

4. The in-mold monitoring method according to claim 3, characterized in that, In step S4, the step of performing mold cavity state detection specifically includes: The detection area of ​​the real-time image after illumination correction is divided into several sub-detection blocks; For each sub-detection block, calculate the structural similarity index with the block corresponding to the baseline template image; The overall matching score is calculated based on the structural similarity index of each sub-detection block and the preset block weight coefficient. The overall matching score is compared with the adaptive matching threshold. If it is lower than the adaptive matching threshold, an anomaly is determined. The adaptive matching threshold is dynamically updated based on historical normal detection results.

5. The in-mold monitoring method according to claim 4, characterized in that, The calculation of the structural similarity index incorporates an edge direction consistency factor, which is obtained through the following method: Extract the edge direction histograms of the real-time image after illumination correction and the reference template image in the corresponding sub-detection blocks; Calculate the cross-correlation coefficient between the histograms of the two edge directions as a measure of edge direction consistency; The edge direction consistency measure is nonlinearly fused with brightness similarity and contrast similarity to obtain an enhanced structural similarity index, wherein the fusion weight of the edge direction consistency measure increases with the increase of the illumination compensation coefficient.

6. The in-mold monitoring method according to claim 5, characterized in that, In step S4, the pin state detection step specifically includes: Acquire the pin position sensor signal that is synchronously acquired with the real-time image; In the real-time image, the ejector pin region is identified, and the feature information of the ejector pin region is extracted. The feature information includes at least the actual position coordinates of the ejector pin end and the shape contour of the ejector pin end. The feature information of the pin region is compared with the pin reference features in the reference template image to obtain the visual detection result; The visual detection result is fused with the pin position sensor signal using a confidence weighting to obtain a comprehensive pin status determination result. When the visual detection result is inconsistent with the judgment conclusion of the sensor signal, the visual detection result shall prevail, and the abnormal sensor signal shall be marked.

7. The in-mold monitoring method according to claim 6, characterized in that, In step S1, obtaining the reference template image specifically includes: During the initial debugging or replacement of the mold, multiple frames of initial images of the mold cavity area are continuously acquired. Multi-scale temporal filtering is performed on multiple initial images to eliminate random noise and obtain a fused image; Receive the detection area and pin area delineated on the fused image, as well as the detection sensitivity and alarm delay frame number set for each area; Based on the fused image and the operator's settings, the reference template image and its corresponding configuration parameter file are generated. The configuration parameter file supports storage, export, and cross-mold reuse. When reusing configuration parameter files across molds, the system automatically checks whether the current mold model matches the mold model recorded in the configuration parameter file. If they do not match, a matching prompt is issued.

8. The in-mold monitoring method according to claim 1, characterized in that, In step S2, after acquiring the real-time image, blur detection is performed on the real-time image. When the motion blur detected exceeds the preset blur threshold, the current frame is determined to be a blur frame, the cavity state detection of the frame is abandoned, and the continuous frame detection mode is started. In the continuous frame detection mode, K subsequent frames of images are continuously acquired, motion blur detection is performed on each frame of image, and the frame with the lowest blur is selected for cavity state detection. If K consecutive frames of images fail to meet the clarity requirements, an alarm signal for camera malfunction or injection molding machine speed malfunction will be generated.

9. The in-mold monitoring method according to claim 8, characterized in that, Step S6 also includes a multi-level exception triggering and reset mechanism, specifically including: When an anomaly is detected for the first time, an anomaly signal is output and the injection molding machine is prohibited from closing the mold, while the anomaly start time is recorded. During the period of anomaly, real-time images are continuously acquired and mold cavity status detection is performed, recording the number of frames of the anomaly and the change curve of the degree of anomaly. When the abnormal state is automatically eliminated, the abnormal signal is not cleared immediately, and the system enters a confirmation waiting state. In the confirmation waiting state, the mold closing command is prohibited until manual confirmation is received, after which the abnormal signal is cleared and the system is reset. If the abnormal status is not manually confirmed within a preset time, an upgraded alarm message will be automatically sent to the remote monitoring terminal, and the abnormality degree change curve will be uploaded along with the alarm message.

10. The in-mold monitoring method according to claim 9, characterized in that, It also includes the scene-aware working mode switching steps, specifically including: During the initial preheating stage of the injection molding machine, it automatically enters the learning mode. In the learning mode, the gain coefficient of the dynamic lighting compensation model is locked at the nominal value, and only the lighting fluctuation trend is recorded without triggering the lighting anomaly warning. After the injection molding machine enters the stable production stage, it automatically switches to monitoring mode, in which complete light adaptation correction and anomaly detection logic are enabled; In response to a manually input pause command, the system switches from monitoring mode to pause mode. In pause mode, the system stops outputting the prohibition of mold closing control command, but still performs image acquisition and mold cavity status detection and records the detection log. In pause mode, if M consecutive abnormal events are detected, the monitoring mode will automatically resume.