Injection product defect detection method and system based on computer vision

Through the dual-flow convolutional autoencoder, the characteristic distribution of injection molded products is learned under different lighting conditions, and combined with reconstruction error and cross-modal feature difference coefficients, efficient and accurate defect detection of injection molded products is achieved, solving the problems of low efficiency and high leakage detection rate in traditional methods.

CN120279015AInactive Publication Date: 2025-07-08SHEN ZHEN XINDONGTAI ELECTRON CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510757243.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-09
Publication Date
2025-07-08
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The defect detection methods of existing injection molded products are inefficient, highly subjective, and have high leakage detection rate, especially in the case of scarce defect samples and single lighting conditions, it is difficult to effectively detect complex and low-contrast defects.

Method used

The dual-stream convolutional autoencoder architecture is adopted, and the two branch networks are trained using defect-free samples to learn the reconstruction ability and feature distribution under different lighting conditions. Through cross-modal comparison and reconstruction error fusion, a multi-dimensional anomaly score is formed to determine the existence of defects.

Benefits of technology

No rare defect annotation can improve the detection sensitivity of low contrast and light-sensitive defects, effectively identify unknown defect types, and enhance the generalization detection ability of gradient or composite defects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120279015A_ABST
    Figure CN120279015A_ABST
Patent Text Reader

Abstract

The invention discloses an injection molding product defect detection method and system based on computer vision, and relates to the field of intelligent detection.The method comprises the steps that firstly, product surface images under diffuse reflection light and low-angle grazing light are captured synchronously; then, a double-flow convolution auto-encoder architecture is adopted, defect-free samples are used for training two branch networks, the two branch networks are made to learn the reconstruction capacity and potential feature distribution of a normal product under the two illumination conditions, cross-modal comparison is carried out through local reasoning, and the consistency constraint relation between illumination view angles is extracted; and finally, forming a multi-dimensional abnormal score in combination with a double-flow reconstruction error and a cross-modal feature difference coefficient, and judging defects by using a dynamic threshold value. According to the method, the surface state base line can be modeled without marking rare defects, the detection sensitivity of low-contrast and light-sensitive defects is enhanced, unknown defect types are effectively identified, and the generalization detection capability of gradual change type or composite type defects is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of intelligent detection, and more specifically, to a method and system for detecting defects in injection-molded products based on computer vision. Background Art

[0002] Injection molding is a process for manufacturing complex-shaped parts by injecting molten plastic into a mold and cooling and solidifying it under pressure. It can not only produce products with high precision and good surface quality efficiently and in large quantities, but also be applicable to various materials, including engineering plastics and high-performance alloys. With the increasing requirements for product lightweight, strength, and design freedom, injection molding is increasingly widely used in fields such as the automotive industry, consumer electronics, and medical devices. However, the quality control of its products has become the core link to ensure the performance and safety of products in these key fields.

[0003] The main challenges faced by traditional injection-molded product defect detection lie in low efficiency, strong subjectivity, and high missed detection rates. The method relying on manual visual inspection cannot meet the requirements of modern manufacturing for speed and accuracy, and traditional machine vision methods based on rules are also difficult to handle complex defect patterns. Although deep learning technology has improved the detection accuracy, it still encounters multiple problems in actual deployment. First, deep supervised learning requires a large number of labeled samples to cover all possible defect types, but the defect types of injection-molded parts are numerous and uncertain, resulting in a high cost for constructing the sample library. Second, the distribution of actual production defect samples shows a long-tail characteristic, and rare defect samples are scarce, which easily causes the model to overfit to high-frequency defects. Third, the quality of manual labeling is limited by the operator's experience, and it is difficult to accurately define the boundaries for some complex or gradual defects, increasing the labeling noise and affecting the generalization ability of the model. In addition, although existing single-source image reconstruction anomaly detection methods can work under unsupervised conditions, due to the single lighting condition, their ability to capture complex defect features is limited, especially when dealing with low-contrast defects. These problems together constitute a major challenge for injection-molded part defect detection.

[0004] Therefore, an optimized injection-molded product defect detection scheme is expected, which can achieve highly robust defect detection under the condition of few samples or even zero defect samples. Summary of the Invention

[0005] To solve the above technical problems, this application is proposed.

[0006] According to one aspect of this application, a method for detecting defects in injection-molded products based on computer vision is provided, which includes:

[0007] Obtaining a diffuse illumination image and a low-angle grazing illumination image of the injection-molded product to be detected;

[0008] Perform visual encoding and image reconstruction on the diffuse reflection illumination image and the low-angle grazing illumination image to obtain the visual feature encoding map of the surface state of the injection-molded product under the first illumination condition, the visual feature encoding map of the surface state of the injection-molded product under the second illumination condition, the reconstructed image of the injection-molded product under diffuse reflection illumination, and the reconstructed image of the injection-molded product under low-angle grazing illumination;

[0009] Perform fine-grained contrast encoding and decoding under different illumination conditions on the visual feature encoding map of the surface state of the injection-molded product under the first illumination condition and the visual feature encoding map of the surface state of the injection-molded product under the second illumination condition to obtain the visual semantic feature difference coefficient under different illumination conditions;

[0010] Calculate the reconstruction errors between the reconstructed image of the injection-molded product under diffuse reflection illumination and the diffuse reflection illumination image, and between the reconstructed image of the injection-molded product under low-angle grazing illumination and the low-angle grazing illumination image to obtain the diffuse reflection image reconstruction error and the grazing illumination image reconstruction error;

[0011] Based on the visual semantic feature difference coefficient under different illumination conditions, the diffuse reflection image reconstruction error, and the grazing illumination image reconstruction error, determine whether the injection-molded product to be detected is qualified.

[0012] According to another aspect of the present application, there is provided a computer vision-based injection-molded product defect detection system, which includes:

[0013] An illumination image acquisition module for the product to be detected, configured to acquire the diffuse reflection illumination image and the low-angle grazing illumination image of the injection-molded product to be detected;

[0014] An illumination image encoding and reconstruction module, configured to perform visual encoding and image reconstruction on the diffuse reflection illumination image and the low-angle grazing illumination image to obtain the visual feature encoding map of the surface state of the injection-molded product under the first illumination condition, the visual feature encoding map of the surface state of the injection-molded product under the second illumination condition, the reconstructed image of the injection-molded product under diffuse reflection illumination, and the reconstructed image of the injection-molded product under low-angle grazing illumination;

[0015] A visual feature comparison module under different illumination conditions, configured to perform fine-grained contrast encoding and decoding under different illumination conditions on the visual feature encoding map of the surface state of the injection-molded product under the first illumination condition and the visual feature encoding map of the surface state of the injection-molded product under the second illumination condition to obtain the visual semantic feature difference coefficient under different illumination conditions;

[0016] A reconstruction error calculation module, configured to calculate the reconstruction errors between the reconstructed image of the injection-molded product under diffuse reflection illumination and the diffuse reflection illumination image, and between the reconstructed image of the injection-molded product under low-angle grazing illumination and the low-angle grazing illumination image to obtain the diffuse reflection image reconstruction error and the grazing illumination image reconstruction error;

[0017] A product qualification judgment module, which is used to determine whether the injection-molded product to be detected is qualified based on the visual semantic feature difference coefficient under the different illumination conditions, the reconstruction error of the diffuse reflection image, and the reconstruction error of the grazing illumination image.

[0018] Compared with the prior art, a method and system for detecting defects of injection-molded products based on computer vision provided by this application synchronously capture the surface images of products under diffuse reflection light and low-angle grazing light. Then, a two-stream convolutional autoencoder architecture is adopted, and two branch networks are trained with defect-free samples to enable them to learn the reconstruction ability and potential feature distribution of normal products under the two illumination conditions, and cross-modal comparison is performed through local reasoning to extract the consistency constraint relationship between the illumination perspectives. Finally, a multi-dimensional anomaly score is formed by combining the two-stream reconstruction error and the cross-modal feature difference coefficient, and dynamic thresholds are used to determine defects. This method can model the surface state baseline without rare defect annotations, enhances the detection sensitivity to low-contrast and light-sensitive defects, effectively identifies unknown defect types, and improves the generalization detection ability for gradual or composite defects. Description of the Drawings

[0019] By describing the embodiments of the present application in more detail with reference to the accompanying drawings, the above and other objects, features, and advantages of the present application will become more obvious. The accompanying drawings are used to provide a further understanding of the embodiments of the present application, and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation to the present application. In the accompanying drawings, the same reference numerals generally represent the same components or steps.

[0020] Figure 1 It is a flowchart of a method for detecting defects of injection-molded products based on computer vision according to an embodiment of the present application.

[0021] Figure 2 It is a flowchart of step S130 in the method for detecting defects of injection-molded products based on computer vision according to an embodiment of the present application.

[0022] Figure 3 It is a flowchart of step S132 in the method for detecting defects of injection-molded products based on computer vision according to an embodiment of the present application.

[0023] Figure 4 It is a block diagram of a system for detecting defects of injection-molded products based on computer vision according to an embodiment of the present application. Detailed Embodiments

[0024] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Instead, these embodiments are provided to more thoroughly and completely understand the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not used to limit the protection scope of the present disclosure.

[0025] It should be understood that the various steps recorded in the method embodiments of the present disclosure can be executed in different orders and / or executed in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this regard.

[0026] In view of the problems in the above-mentioned background art, in the technical solution of this application, a method for detecting defects in injection-molded products based on computer vision is proposed. Its technical concept is to use artificial intelligence analysis and processing technology based on computer vision to construct a defect detection framework through multi-modal illumination feature fusion and self-supervised representation learning. Specifically, first, images of the surface of the injection-molded product are synchronously captured under two complementary illumination conditions of diffuse reflection light and low-angle grazing light. The diffuse reflection light highlights color uniformity and macroscopic contours, while the low-angle light enhances the shadow contrast of microscopic concave and convex defects. Secondly, a two-stream convolutional autoencoder is constructed, and two branch networks are respectively trained using defect-free samples to enable them to learn the reconstruction ability and potential feature distribution laws of normal products under the two illumination modes. At the same time, fine-grained cross-modal comparison of the two-stream features is performed through local inference to extract the consistency constraint relationship between the illumination perspectives. Finally, the two-stream reconstruction error and the cross-modal feature difference coefficient are fused to form a multi-dimensional anomaly score, and the existence of defects is determined through a dynamic threshold.

[0027] Specifically, in view of the strong dependence of traditional methods on defect samples, an unsupervised two-stream architecture can be used to model the surface state baseline only with normal samples, avoiding the problem of rare defect annotation. In view of the problem of insufficient feature expression ability of single-source images, the detection sensitivity to low-contrast defects (such as superficial bubbles) and light-sensitive defects (such as microcracks) is enhanced by using bimodal complementarity. By introducing the cross-modal feature difference coefficient, the model can capture the inherent correlation of feature expressions of normal products under different illuminations, while abnormal defects will disrupt this correlation, thus effectively identifying unknown defect types. The weighted fusion strategy of reconstruction error and feature difference reduces the influence of artificial annotation noise on a single criterion and improves the generalization detection ability for gradual or composite defects.

[0028] Figure 1 FIG. is a flowchart of a method for detecting defects in injection-molded products based on computer vision according to an embodiment of this application. As Figure 1As shown, the computer vision-based injection product defect detection method according to an embodiment of the present application includes: S110, obtaining a diffuse reflection illumination image and a low-angle grazing illumination image of the injection product to be detected; S120, performing visual encoding and image reconstruction on the diffuse reflection illumination image and the low-angle grazing illumination image to obtain a visual feature encoding map of the surface state of the injection product under the first illumination condition, a visual feature encoding map of the surface state of the injection product under the second illumination condition, a reconstructed image of the injection product under diffuse reflection illumination, and a reconstructed image of the injection product under low-angle grazing illumination; S130, performing fine-grained contrast encoding and decoding under different illumination conditions on the visual feature encoding map of the surface state of the injection product under the first illumination condition and the visual feature encoding map of the surface state of the injection product under the second illumination condition to obtain a visual semantic feature difference coefficient under different illumination conditions; S140, calculating the reconstruction errors between the reconstructed image of the injection product under diffuse reflection illumination and the diffuse reflection illumination image and between the reconstructed image of the injection product under low-angle grazing illumination and the low-angle grazing illumination image to obtain a diffuse reflection image reconstruction error and a grazing illumination image reconstruction error; S150, determining whether the injection product to be detected is qualified based on the visual semantic feature difference coefficient under different illumination conditions, the diffuse reflection image reconstruction error, and the grazing illumination image reconstruction error.

[0029] In step S110, a diffuse reflection illumination image and a low-angle grazing illumination image of the injection product to be detected are obtained. It should be understood that the diffuse reflection illumination image refers to an image of the injection product to be detected obtained under diffuse reflection illumination conditions. Diffuse reflection refers to the phenomenon that light is reflected in all directions when it encounters an object with a rough or uneven surface. Under this illumination condition, the color uniformity and macroscopic contour of the surface of the injection product can be better highlighted, that is, the macroscopic-level characteristic information such as the overall appearance shape and color distribution of the product can be clearly presented. The low-angle grazing illumination image is an image of the injection product to be detected collected under low-angle grazing illumination conditions. Low-angle grazing light means that the light irradiates the surface of the injection product at a low angle. This illumination method can strengthen the shadow contrast of microscopic concave and convex defects on the product surface, making microscopic unevenness, cracks, holes and other defects on the product surface more obvious. Traditional injection product defect detection methods, such as single-source image reconstruction anomaly detection methods, due to the single illumination condition, cannot comprehensively capture various characteristic information on the product surface, especially difficult to effectively detect complex defects and low-contrast defects. And the defect types of injection products are diverse, including both macroscopic-level problems such as shape and color, and microscopic-level concave and convex, crack and other defects. A single illumination condition cannot meet the detection requirements for all defect types. Therefore, by obtaining a diffuse reflection illumination image and a low-angle grazing illumination image, the different characteristics presented by the images under two complementary illumination conditions can be utilized to achieve multimodal illumination feature fusion, providing richer and more reliable feature data for subsequent defect detection.

[0030] First, prepare a stable working platform for placing the injection-molded products to be inspected, ensuring that the products do not shake or displace during the acquisition process to guarantee the accuracy of the images. Above the platform, set up two different lighting devices. One group is a diffuse reflection light source. Select soft and uniform scattering light lamps, such as a diffuse reflection plate paired with a soft light tube, so that the light can evenly illuminate the product surface from all angles, thereby highlighting the color uniformity and macroscopic contour of the product. The other group is a low-angle grazing light source. Use an adjustable-angle spotlight and install it on a bracket that can flexibly adjust the position and angle, so as to accurately illuminate the product surface at a lower angle and enhance the shadow contrast of microscopic concave and convex defects.

[0031] Before acquiring the images, calibrate and debug the acquisition equipment. Select an industrial camera with high resolution and stable performance, install a suitable lens, and adjust parameters such as the focal length, aperture, and exposure time of the camera according to the size and detection accuracy requirements of the product to ensure that the camera can clearly and accurately capture the details of the product. At the same time, fix the camera on a stable tripod or robotic arm, keeping it at an appropriate distance and angle from the product to ensure that the acquired images are complete and distortion-free.

[0032] After all preparations are made, place the injection-molded products to be inspected at the designated position on the working platform. First, turn on the diffuse reflection light source and turn off the low-angle grazing light source. At this time, the industrial camera takes the diffuse reflection light image of the product according to the preset parameters and stores the image data in the designated storage device. After the shooting is completed, turn off the diffuse reflection light source, turn on the low-angle grazing light source, adjust its angle to the position that can best highlight the microscopic defects on the product surface, and then take the low-angle grazing light image of the product again through the industrial camera and save the image data. During the entire acquisition process, pay attention to the interference of ambient light and try to operate under dark or weak ambient light conditions to ensure that the quality of the acquired images is not affected by external light.

[0033] In step S120, visual coding and image reconstruction are performed on the diffuse reflection illumination image and the low-angle grazing illumination image to obtain a visual feature coding map of the surface state of the injection-molded product under the first illumination condition, a visual feature coding map of the surface state of the injection-molded product under the second illumination condition, a reconstructed image of the injection-molded product under diffuse reflection illumination, and a reconstructed image of the injection-molded product under low-angle grazing illumination, including: inputting the diffuse reflection illumination image and the low-angle grazing illumination image into a two-stream convolutional autoencoder including a first convolutional autoencoder and a second convolutional autoencoder to obtain the visual feature coding map of the surface state of the injection-molded product under the first illumination condition, the visual feature coding map of the surface state of the injection-molded product under the second illumination condition, the reconstructed image of the injection-molded product under diffuse reflection illumination, and the reconstructed image of the injection-molded product under low-angle grazing illumination. In particular, the two-stream convolutional autoencoder including the first convolutional autoencoder and the second convolutional autoencoder is trained only by the diffuse reflection illumination images and low-angle grazing illumination images labeled as defect-free. Correspondingly, considering that traditional supervised learning methods face fundamental bottlenecks due to the scarcity, diversity, and difficulty of defect sample annotation. Due to the complexity of the injection molding process, defects may randomly appear in unknown forms, and the visual features presented by the same defect under different illumination conditions vary significantly. For example, microcracks may only show local color unevenness under diffuse reflection light, but will form obvious shadows due to surface unevenness under low-angle grazing light. If the model is trained only with images under a single illumination condition or a limited number of defect samples, it will lead to insufficient detection ability for defect types sensitive to specific illumination, and it is difficult to generalize to new types of defects. In addition, the collection of defect samples in industrial scenarios requires a large amount of time and labor costs, especially for high-yield production lines, the acquisition of defect samples is extremely limited. Therefore, in this application, the diffuse reflection illumination image and the low-angle grazing illumination image are input into a two-stream convolutional autoencoder including a first convolutional autoencoder and a second convolutional autoencoder to obtain the visual feature coding map of the surface state of the injection-molded product under the first illumination condition, the visual feature coding map of the surface state of the injection-molded product under the second illumination condition, the reconstructed image of the injection-molded product under diffuse reflection illumination, and the reconstructed image of the injection-molded product under low-angle grazing illumination. In this way, only defect-free images are used for training, which can avoid relying on a large number of defect annotation samples and solve the problems of sample scarcity and distribution imbalance. At the same time, let the two-stream convolutional autoencoder master the potential feature distribution laws and reconstruction capabilities of normal injection-molded products under the two illumination modes by learning the defect-free diffuse reflection illumination images and low-angle grazing illumination images, providing a benchmark for subsequent detection of abnormalities.

[0034] The specific steps are as follows: First, construct a two-stream convolutional autoencoder. This encoder consists of two branches, namely the first convolutional autoencoder and the second convolutional autoencoder, corresponding to the processing paths of diffuse illumination images and low-angle grazing illumination images respectively. Each convolutional autoencoder has the ability to encode and decode. The encoding part is used to extract image features, and the decoding part is responsible for reconstructing the original image from the encoded features.

[0035] Then, collect a large number of pairs of diffuse illumination images and low-angle grazing illumination images that only contain normal products. These images need to be accurately labeled as defect-free to ensure the purity of the training data and avoid interference from defective samples to the model's learning of the features of normal products. The labeling process can be carried out by carefully checking and marking manually to ensure the accuracy of the labeling.

[0036] At the start of training, each pair of diffuse illumination images and low-angle grazing illumination images is respectively input into the corresponding first convolutional autoencoder and second convolutional autoencoder branches. In the first convolutional autoencoder, the diffuse illumination image passes through a series of convolutional layers in sequence. The convolutional kernels in the convolutional layers slide over the image to extract features of different regions in the image, such as macroscopic features like the shape and color distribution of the product. These convolutional operations gradually transform the image into a higher-level and more abstract feature representation, and finally obtain a visual feature encoding map of the surface state of the injection-molded product under the first lighting condition. Similarly, the second convolutional autoencoder processes the low-angle grazing illumination image, extracts relevant features such as microscopic concave-convex defects on the product surface through convolutional operations, and generates a visual feature encoding map of the surface state of the injection-molded product under the second lighting condition.

[0037] After the features are independently extracted in the two branches, these features need to be fused. A suitable fusion method can be adopted at the bottleneck layer or intermediate layer of the network, such as concatenation, that is, concatenating the feature maps obtained from the two branches along a certain dimension so that the fused features contain information under both lighting conditions; or weighted summation, where weights are assigned according to the importance of different lighting features and then summed; or a more complex attention mechanism can also be used to enable the model to automatically learn the importance of different lighting features, thereby more effectively fusing the features and forming a shared latent representation that can simultaneously represent information under both lighting conditions.

[0038] The decoding part of the autoencoder starts from the fused latent representation and reconstructs the original diffuse illumination image and the grazing illumination image respectively. The decoding process is the opposite of the encoding process. Through operations such as deconvolution, the abstract features are gradually restored to the pixel form of the image, obtaining the reconstructed image of the injection-molded product under diffuse illumination and the reconstructed image of the injection-molded product under low-angle grazing illumination. During the training process, by continuously adjusting the parameters in the convolutional autoencoder, such as the weights and biases of the convolutional kernels, the difference between the reconstructed image and the original input image is minimized. Loss functions such as the mean squared error (MSE) can be used to measure this difference. The gradient of the loss function with respect to the parameters is calculated through the backpropagation algorithm, and the parameters are updated according to the gradient, enabling the model to gradually learn the latent feature distribution law and reconstruction ability of normal products under the two illumination conditions.

[0039] Throughout the training process, only the images marked as defect-free are used for training. The purpose of doing this is to make the dual-stream convolutional autoencoder focus on learning the feature patterns of normal products and establish a baseline model of the surface state of normal products. When an injection-molded product to be detected is encountered, its diffuse illumination image and low-angle grazing illumination image are input into the trained dual-stream convolutional autoencoder. Based on the difference between the obtained reconstructed image and the original image, as well as the difference in the feature encoding maps under different illumination conditions, it can be determined whether the product has defects. This training method avoids relying on a large number of defect-labeled samples, effectively solves the problems of sample scarcity and uneven distribution, and lays a solid foundation for accurately detecting defects in injection-molded products subsequently.

[0040] In step S130, a fine-grained comparison encoding and decoding under different illumination conditions are performed on the visual feature encoding map of the surface state of the injection-molded product under the first illumination condition and the visual feature encoding map of the surface state of the injection-molded product under the second illumination condition to obtain the visual semantic feature difference coefficient under different illumination conditions. Figure 2 It is a flowchart of step S130 in the injection-molded product defect detection method based on computer vision according to an embodiment of the present application. Specifically, in the embodiment of the present application, as Figure 2As shown, in step S130, a fine-grained contrast encoding and decoding under different illumination conditions is performed on the visual feature encoding map of the surface state of the injection molded product under the first illumination condition and the visual feature encoding map of the surface state of the injection molded product under the second illumination condition to obtain the visual semantic feature difference coefficient under different illumination conditions, including: S131, expanding the visual feature encoding map of the surface state of the injection molded product under the first illumination condition and the visual feature encoding map of the surface state of the injection molded product under the second illumination condition into a visual feature encoding vector of the surface state of the injection molded product under the first illumination condition and a visual feature encoding vector of the surface state of the injection molded product under the second illumination condition respectively; S132, performing a fine-grained correlation progressive visual difference comparison and reasoning on the visual feature encoding vector of the surface state of the injection molded product under the first illumination condition and the visual feature encoding vector of the surface state of the injection molded product under the second illumination condition to obtain a fine-grained contrast correlation encoding vector of the visual features under different illumination conditions; S133, performing feature decoding on the fine-grained contrast correlation encoding vector of the visual features under different illumination conditions to obtain the visual semantic feature difference coefficient under different illumination conditions.

[0041] Specifically, in step S131, the visual feature encoding map of the surface state of the injection molded product under the first illumination condition and the visual feature encoding map of the surface state of the injection molded product under the second illumination condition are respectively expanded into a visual feature encoding vector of the surface state of the injection molded product under the first illumination condition and a visual feature encoding vector of the surface state of the injection molded product under the second illumination condition. It should be understood that considering the multi-dimensional spatial structure of the feature encoding map (such as height, width, number of channels), the subsequent cross-modal feature interaction calculation is complex, and it is difficult to achieve pixel-level or region-level fine-grained alignment, resulting in the traditional feature comparison method being easily affected by the natural fluctuations of the normal product surface texture and causing misjudgment. Based on this, in this application, the visual feature encoding map of the surface state of the injection molded product under the first illumination condition and the visual feature encoding map of the surface state of the injection molded product under the second illumination condition are respectively expanded into a visual feature encoding vector of the surface state of the injection molded product under the first illumination condition and a visual feature encoding vector of the surface state of the injection molded product under the second illumination condition. In this way, not only the spatial distribution information of the features in the original image (such as the relative position relationship of the defect areas) is retained, but also the complex two-dimensional feature comparison problem is transformed into a serialized interaction calculation in the vector space.

[0042] Specifically, in step S132, a fine-grained correlation progressive visual difference comparison and reasoning is performed on the visual feature encoding vector of the surface state of the injection molded product under the first lighting condition and the visual feature encoding vector of the surface state of the injection molded product under the second lighting condition to obtain a fine-grained comparison correlation encoding vector of visual features under different lighting conditions. In particular, considering that the feature differences under different lighting modalities often have locality and concealment. For example, the local shadow features caused by microcracks under low-angle grazing light may have a spatial correspondence with the color abnormality in the same area under diffuse reflection light, but it is difficult for traditional global feature comparison methods to capture this cross-modal local correlation. Since defects may only affect a tiny area of the product surface, and the defect representations under different lighting conditions have spatial asymmetry (such as the color diffusion in the defect area under diffuse reflection light and the shadow offset under low-angle light do not completely overlap), directly calculating the global feature similarity is likely to submerge local anomalies in the feature consistency of the normal area. In addition, the high-dimensional nature of the feature encoding vector makes it difficult for simple dot product or cosine similarity metrics to model complex local interaction patterns, especially when there are natural texture fluctuations on the surface of normal products, global comparison is prone to misjudgment. Therefore, in order to deeply explore the subtle differences and correlations of features under these two lighting conditions, so as to more comprehensively understand the surface state of the product, in the technical solution of this application, a fine-grained correlation progressive visual difference comparison and reasoning is performed on the visual feature encoding vector of the surface state of the injection molded product under the first lighting condition and the visual feature encoding vector of the surface state of the injection molded product under the second lighting condition to obtain a fine-grained comparison correlation encoding vector of visual features under different lighting conditions.

[0043] Figure 3 FIG. is a flowchart of step S132 in the injection molded product defect detection method based on computer vision according to an embodiment of the present application. More specifically, in the embodiment of the present application, as Figure 3As shown in the figure, in step S132, a fine-grained association progressive visual difference comparison and reasoning is performed on the visual feature coding vector of the surface state of the injection-molded product under the first lighting condition and the visual feature coding vector of the surface state of the injection-molded product under the second lighting condition to obtain a fine-grained comparison association coding vector of visual features under different lighting conditions, including: S1321, performing one-dimensional local implicit feature convolution coding on the visual feature coding vector of the surface state of the injection-molded product under the first lighting condition and the visual feature coding vector of the surface state of the injection-molded product under the second lighting condition respectively to obtain a set of local visual implicit feature coding vectors of the surface state of the injection-molded product under the first lighting condition and a set of local visual implicit feature coding vectors of the surface state of the injection-molded product under the second lighting condition; S1322, performing fine-grained comparison and association on each group of corresponding local visual implicit feature coding vectors of the surface state of the injection-molded product under the first lighting condition and the local visual implicit feature coding vectors of the surface state of the injection-molded product under the second lighting condition in the set of local visual implicit feature coding vectors of the surface state of the injection-molded product under the first lighting condition and the set of local visual implicit feature coding vectors of the surface state of the injection-molded product under the second lighting condition to obtain a set of local visual fine-grained feature comparison and association coding vectors under different lighting conditions; S1323, performing progressive reasoning based on fine-grained association weight modulation on the set of local visual fine-grained feature comparison and association coding vectors under different lighting conditions to obtain the fine-grained comparison association coding vector of visual features under different lighting conditions.

[0044] Specifically, in step S1321, performing one-dimensional local implicit feature convolution coding on the visual feature coding vector of the surface state of the injection-molded product under the first lighting condition and the visual feature coding vector of the surface state of the injection-molded product under the second lighting condition respectively to obtain a set of local visual implicit feature coding vectors of the surface state of the injection-molded product under the first lighting condition and a set of local visual implicit feature coding vectors of the surface state of the injection-molded product under the second lighting condition, this process is represented by the formula:

[0045]

[0046]

[0047] Among them, is the visual feature coding vector of the surface state of the injection-molded product under the first lighting condition, is the visual feature coding vector of the surface state of the injection-molded product under the second lighting condition, is the one-dimensional local implicit feature convolution coding, is the length of the one-dimensional convolution kernel, , , and They are the 1st, 2nd, th, and th local visual implicit feature encoding vectors in the set of local visual implicit feature encoding vectors of the injection-molded product surface state under the first lighting condition, , , and They are the 1st, 2nd, th, and th local visual implicit feature encoding vectors in the set of local visual implicit feature encoding vectors of the injection-molded product surface state under the second lighting condition, is and The number of vectors in, and and Have the same length.

[0048] It should be understood that defects often manifest as abnormal microstructures or surface texture changes in local areas. For example, microcracks may only exhibit local shadow features under low-angle grazing light, while the color difference in the corresponding area in diffuse reflection light may be extremely subtle. In addition, although the original feature encoding vectors contain spatial distribution information, when directly performing cross-modal correlation calculations due to their high-dimensional characteristics, they are susceptible to redundant feature interference and it is difficult to capture local serialization patterns. Therefore, in this application, one-dimensional local implicit feature convolution encoding is performed on the visual feature encoding vectors of the injection-molded product surface state under the first lighting condition and the visual feature encoding vectors of the injection-molded product surface state under the second lighting condition respectively, so as to use the one-dimensional convolution kernel to slide and scan along the feature sequence, and extract the implicit patterns within the local window in a parameter-sharing manner, obtaining the set of local visual implicit feature encoding vectors of the injection-molded product surface state under the first lighting condition and the set of local visual implicit feature encoding vectors of the injection-molded product surface state under the second lighting condition, providing a structured fine-grained input for subsequent cross-modal feature correlation.

[0049] Specifically, in step S1322, each group of corresponding local visual implicit feature encoding vectors of the injection-molded product surface state under the first lighting condition and the local visual implicit feature encoding vectors of the injection-molded product surface state under the second lighting condition in the set of local visual implicit feature encoding vectors of the injection-molded product surface state under the first lighting condition and the set of local visual implicit feature encoding vectors of the injection-molded product surface state under the second lighting condition are respectively subjected to fine-grained comparison and correlation to obtain a set of cross-illumination condition local visual fine-grained feature comparison and correlation encoding vectors. This process is expressed by the formula:

[0050]

[0051] Among them, is the th local visual implicit feature coding vector of the surface state of the injection molded product under the first lighting condition, is the th local visual implicit feature coding vector of the surface state of the injection molded product under the second lighting condition, is dot product by position, is addition by position, is subtraction by position, is concatenation operation, is the th fine-grained feature contrast correlation weight matrix in the set of fine-grained feature contrast correlation weight matrices, is the th fine-grained feature contrast correlation bias vector in the set of fine-grained feature contrast correlation bias vectors, is the th local visual fine-grained feature contrast correlation coding vector in the set of local visual fine-grained feature contrast correlation coding vectors under different lighting conditions.

[0052] Correspondingly, due to the implicit and complex nature of local feature associations under different lighting modalities. For example, the color gradient in a certain area under diffuse light may correspond to the micro-texture fluctuations at the same position under low-angle grazing light. This cross-modal feature association presents a stable complementary relationship in normal products, while defective areas (such as superficial bubbles) will disrupt this local association pattern. Traditional global feature contrast methods are difficult to capture such cross-modal local contradictions because they ignore the sequential correspondence of local features. Especially when the defect only affects a limited area, the global feature similarity calculation is likely to submerge local anomalies in the consistency of normal features. In addition, directly performing interaction contrast in the high-dimensional original feature space is vulnerable to interference from redundant information. For example, normal texture fluctuations near the mold parting line may be misjudged as anomalies, resulting in an increased false detection rate. Based on this, the present application decouples the cross-modal feature contrast into the dynamic association of multiple local units by performing fine-grained contrast correlation on each group of corresponding local visual implicit feature coding vectors of the surface state of the injection molded product under the first lighting condition and the second lighting condition respectively, and obtains a set of local visual fine-grained feature contrast correlation coding vectors under different lighting conditions by parametrically learning the difference in local association patterns between normal and abnormal areas.

[0053] Specifically, in the embodiments of the present application, in step S1323, progressive inference based on fine-grained association weight modulation is performed on the set of local visual fine-grained feature contrast association coding vectors under the different illumination conditions to obtain the visual feature fine-grained contrast association coding vectors under the different illumination conditions, including: S1323-1, based on the feature distribution characteristics of each local visual fine-grained feature contrast association coding vector in the set of local visual fine-grained feature contrast association coding vectors under the different illumination conditions, determining the progressive inference fine-grained association weights of each local visual fine-grained feature contrast association coding vector under the different illumination conditions to obtain a set of progressive inference fine-grained association weights of local visual implicit features under the different illumination conditions; S1323-2, based on the set of progressive inference fine-grained association weights of local visual implicit features under the different illumination conditions, performing weighted modulation on the set of local visual fine-grained feature contrast association coding vectors under the different illumination conditions to obtain a set of local visual fine-grained feature contrast association modulation coding vectors under the different illumination conditions; S1323-3, inputting the set of local visual fine-grained feature contrast association modulation coding vectors under the different illumination conditions into a progressive inference device based on a forward LSTM model to obtain the visual feature fine-grained contrast association coding vectors under the different illumination conditions.

[0054] Specifically, in step S1323-1, based on the feature distribution characteristics of each local visual fine-grained feature contrast association coding vector in the set of local visual fine-grained feature contrast association coding vectors under the different illumination conditions, determining the progressive inference fine-grained association weights of each local visual fine-grained feature contrast association coding vector under the different illumination conditions to obtain a set of progressive inference fine-grained association weights of local visual implicit features under the different illumination conditions, this process is represented by the formula:

[0055]

[0056] Wherein, is the -th local visual fine-grained feature contrast association coding vector in the set of local visual fine-grained feature contrast association coding vectors under the different illumination conditions, is the -th eigenvalue in , is the square of the Euclidean norm of the calculation vector, is the number of eigenvalues in, is function, is the -th progressive inference fine-grained association weight of local visual implicit features in the set of progressive inference fine-grained association weights of local visual implicit features under the different illumination conditions.

[0057] It should be understood that there are significant differences in the contribution degrees of the cross-modal feature comparison correlations in different local regions to defect determination. For example, the texture fluctuations near the mold parting line on the surface of a normal product may cause slight fluctuations in the local feature comparison correlation coding vectors, while the local comparison correlation coding vectors corresponding to the microcrack region show a significant abnormal distribution (such as high variance or non-linear pattern). Treating the comparison results of all local regions equally will cause the key abnormal signals to be submerged by the noise in the non-critical regions. Therefore, in this application, based on the feature distribution characteristics of the local visual fine-grained feature comparison correlation coding vectors under each different illumination condition, the local visual implicit feature progressive inference fine-grained correlation weights of the local visual fine-grained feature comparison correlation coding vectors under each different illumination condition are determined. For example, for the local comparison correlation coding vectors showing a high non-linear distribution (which may correspond to the cross-modal feature contradiction caused by microcracks), a higher correlation weight is assigned; while for the local vectors with a stable distribution (corresponding to the feature consistency in the normal region), a lower weight is assigned. In this process, the feature distribution characteristics are mapped to dynamic weight values, rather than relying on fixed threshold rules, so as to adapt to the feature expression patterns of different defect types.

[0058] Specifically, in the technical solution of this application, step S1323-2, based on the set of local visual implicit feature progressive inference fine-grained correlation weights under the different illumination conditions, performing weighted modulation on the set of local visual fine-grained feature comparison correlation coding vectors under the different illumination conditions to obtain a set of local visual fine-grained feature comparison correlation modulation coding vectors under the different illumination conditions, includes:

[0059] Performing dynamic optimization of gradient decoupling and spectral domain modulation on the set of local visual implicit feature progressive inference fine-grained correlation weights under the different illumination conditions to obtain a set of local visual implicit feature progressive inference fine-grained correlation optimized weights. This process is represented by the formula:

[0060] , , ;

[0061]

[0062]

[0063] ;

[0064] Wherein, is the th local visual implicit feature coding vector of the surface state of the injection molded product under the first illumination condition in the set of local visual implicit feature coding vectors of the surface state of the injection molded product under the first illumination condition, is the th local visual implicit feature coding vector in the set of local visual implicit feature coding vectors of the injection molded product surface state under the second lighting condition, is the th fine-grained correlation weight of local visual implicit feature progressive inference under different lighting conditions, is the th local visual implicit feature gradient alignment energy term in the set of local visual implicit feature gradient alignment energy terms under different lighting conditions, is the th local visual implicit feature gradient difference energy term in the set of local visual implicit feature gradient difference energy terms under different lighting conditions, is the th local visual implicit feature oscillation coupling energy term in the set of local visual implicit feature oscillation coupling energy terms under different lighting conditions, is the base logarithm function value of the natural constant, is the th local visual implicit feature spectral domain dynamic equilibrium factor in the set of local visual implicit feature spectral domain dynamic equilibrium factors under different lighting conditions, is the th local visual implicit feature spectral co-phase factor in the set of local visual implicit feature spectral co-phase factors under different lighting conditions, and are respectively and corresponding weight coefficients, is the th local visual implicit feature progressive inference fine-grained correlation optimization weight in the set of local visual implicit feature progressive inference fine-grained correlation optimization weights under different lighting conditions;

[0065] Based on the set of local visual implicit feature progressive inference fine-grained correlation optimization weights under different lighting conditions, the set of local visual fine-grained feature contrast correlation coding vectors under different lighting conditions is weighted and modulated to obtain the set of local visual fine-grained feature contrast correlation modulated coding vectors. This process is represented by the formula:

[0066]

[0067]

[0068] where, is the th local visual fine-grained feature contrast correlation coding vector under different illumination conditions, is the th local visual implicit feature progressive inference fine-grained correlation optimization weight under different illumination conditions, is the th local visual fine-grained feature contrast correlation modulation coding vector under different illumination conditions, is the set of local visual fine-grained feature contrast correlation modulation coding vectors under different illumination conditions.

[0069] Specifically, when calculating the local visual fine-grained feature contrast correlation coding vectors under different illumination conditions, it is necessary to fuse the interaction operations (such as , , etc.) of the local visual implicit feature coding vectors of the surface state of the injection-molded product under the first illumination condition and the local visual implicit feature coding vectors of the surface state of the injection-molded product under the second illumination condition. These operations essentially correspond to different interaction constraints and form differential spatial constraint co-correlations in the feature interaction space.

[0070] Therefore, in order to improve the canonical dynamic co-gain of the local visual implicit feature progressive inference fine-grained correlation weights under different illumination conditions, it is necessary to correct them based on the gradient space decoupling of the interaction constraints: Define , as the gradient matching effect (the gradient direction is consistent with the interaction direction), while represents the oscillation coupling effect (the gradient direction is orthogonal to the interaction direction). For feature statistics (such as , , ), the oscillation coupling effect will cause a local spectral modulation effect in the gradient aggregation feature representation direction, and it is necessary to calculate its spectral domain dynamic equilibrium factor:

[0071]

[0072] Among them, as a quantization index of the gradient aggregation feature representation, its size expansion in the logarithmic domain will enhance the contribution intensity of the oscillation coupling effect.

[0073] At the same time, the oscillation coupling effect will cause phase distortion of the gradient aggregation feature representation, and it is necessary to perform spectral co-phase correction: .

[0074] Correct the fine-grained correlation weights of local visual implicit features in progressive inference under different illumination conditions by integrating the above factors : 。

[0075] This method strengthens the correlation coupling between different interaction constraints by decoupling the spatial constraint collaborative paradigm of interaction operations in the feature space, and finally optimizes the calculation robustness of the fine-grained correlation weights of local visual implicit features in progressive inference under different illumination conditions.

[0076] Next, based on the fine-grained correlation weights of local visual implicit features in progressive inference under each different illumination condition, the set of local visual fine-grained feature contrast correlation coding vectors under the different illumination conditions is weighted and modulated to obtain a set of local visual fine-grained feature contrast correlation modulated coding vectors. That is to say, this process applies weights to each local contrast correlation coding vector based on the weight set calculated in the previous stage (reflecting the importance of each local unit). For example, the high-weight local vectors corresponding to the microcrack region will be amplified, and their cross-modal feature contradictions will dominate in subsequent inferences; while the low-weight vectors corresponding to the normal region will be suppressed to reduce their interference with global decisions. During this process, the model realizes information distillation through weight modulation, concentrating limited inference resources on high-value local units, while retaining the weight distribution pattern in the spatial sequence (such as the high-weight sequence corresponding to the flash defect is continuously distributed along the product edge), providing a structured input for inference.

[0077] Specifically, in step S1323-3, the set of local visual fine-grained feature contrast correlation modulated coding vectors under the different illumination conditions is input into a progressive inference device based on a forward LSTM model to obtain the visual feature fine-grained contrast correlation coding vectors under the different illumination conditions. This process is represented by the formula:

[0078]

[0079] where is the forward LSTM encoding, is the visual feature fine-grained contrast correlation coding vector under different illumination conditions.

[0080] Finally, based on the respective features, a feature phase reshaping gain operator for extracting local phase-encoded vectors is used to perform feature phase saliency reshaping on the set of initial feature local phase-encoded vectors to obtain the enhanced feature vectors. That is, the gain operator is transformed into a specific feature operation to enhance and reshape the feature phase information, and finally, enhanced feature vectors are generated. Saliency reshaping emphasizes not only simple feature amplification or reduction but, more importantly, adjusting the structure and distribution of features so that important phase information can be made more prominent and unimportant information can be suppressed, thereby ultimately enhancing the discriminative power and expressive ability of features.

[0081] Specifically, in step S133, feature decoding is performed on the visually fine-grained contrast correlation encoding vector under different illumination conditions to obtain the visually semantic feature difference coefficient under different illumination conditions, including: using a difference analyzer based on a decoder to perform feature decoding on the visually fine-grained contrast correlation encoding vector under different illumination conditions to obtain the visually semantic feature difference coefficient under different illumination conditions. It should be understood that the visually fine-grained contrast correlation encoding vector under different illumination conditions is a high-dimensional vector obtained through a series of complex processes and contains rich information about the surface state of the injection-molded product under different illumination conditions, but this information exists in an abstract encoded form. The decoder can convert this abstract encoded information into a form that is easier to understand and analyze, thereby mining the deep-level feature information and helping to further analyze the surface state of the product. That is, through feature decoding by the decoder, the difference information about visual features under different illumination conditions contained in the encoded vector can be quantified and converted into a specific visually semantic feature difference coefficient. The result of this quantification is convenient for subsequent numerical comparison and analysis and provides a quantifiable index for judging whether there are defects in the injection-molded product and the degree of the defects.

[0082] Specifically, first, the visually fine-grained contrast correlation encoding vector under different illumination conditions is input into a difference analyzer based on a decoder. The decoder usually consists of multiple layers of neural networks, and its structure corresponds to that of the encoder, aiming to convert abstract encoded information into a form that is easier to understand and analyze. In the first layer of the decoder, a linear transformation is performed on the input encoded vector according to the dimension of the encoded vector and a preset weight matrix. This weight matrix is learned through an optimization algorithm during the model training process, and its purpose is to enable the decoder to restore the information related to the original image features as accurately as possible. After the linear transformation, the result is input into an activation function, which can increase the non-linear expression ability of the model. For example, the commonly used ReLU function can set the negative output to 0 and keep the positive output unchanged, thereby screening and strengthening the features.

[0083] As the data is passed through the decoder and processed by multiple layers of linear transformations and activation functions, a low-dimensional feature representation is gradually generated. These low-dimensional feature representations begin to exhibit semantic information related to the surface state of the injection-molded product, but at this time, it is not yet precise enough.

[0084] In the last layer of the decoder, the low-dimensional feature representation is converted into a specific numerical value, namely the visual semantic feature difference coefficient under different illumination conditions, through a specific mapping function. The design of this mapping function needs to consider how to quantify the feature difference information under different illumination conditions contained in the low-dimensional features. For example, a weighted summation method can be used to assign different weights to the low-dimensional features of different dimensions. These weights are also learned during the training process to highlight the feature dimensions that are important for defect detection. Through such calculations, a coefficient that can quantify the semantic differences of visual features under different illumination conditions is finally obtained.

[0085] During the entire implementation process, the difference analyzer based on the decoder needs to be trained and optimized with a large amount of training data. Using the image data of known normal injection-molded products under different illumination conditions, the encoded vectors obtained through encoding and fine-grained contrast association are used as inputs, and at the same time, the true values pre-labeled to reflect the semantic differences of visual features under different illumination conditions are used as labels. By continuously adjusting the weight parameters in the decoder, the error between the visual semantic feature difference coefficient output by the decoder and the true value is minimized, thereby improving the accuracy and reliability of the difference analyzer.

[0086] In step S140, the reconstruction errors between the reconstructed image of the injection-molded product under diffuse illumination and the diffuse illumination image, and between the reconstructed image of the injection-molded product under low-angle grazing illumination and the low-angle grazing illumination image are calculated to obtain the diffuse image reconstruction error and the grazing illumination image reconstruction error. Correspondingly, considering that although diffuse illumination can evenly present the overall color and deformation of the product, it is not sensitive enough to micron-scale scratches on the surface; although low-angle grazing illumination can enhance the contrast of concave and convex defects through shadows, it is easily interfered by the difference in material light transmittance, resulting in missed detection of internal bubble and other volume defects. If only relying on the reconstruction error of a single modality as a criterion, it is easy to lead to modal bias in defect detection and missed detection of defect types that are insensitive to illumination conditions. Based on this, in this application, the reconstruction errors between the reconstructed image of the injection-molded product under diffuse illumination and the diffuse illumination image, and between the reconstructed image of the injection-molded product under low-angle grazing illumination and the low-angle grazing illumination image are calculated to obtain the diffuse image reconstruction error and the grazing illumination image reconstruction error, and these are used as important indicators for judging whether there are defects in the injection-molded product.

[0087] The specific implementation process is as follows:

[0088] First, calculate the reconstruction error of the diffuse reflection illumination image. Compare the reconstructed image under diffuse reflection illumination with the original diffuse reflection illumination image pixel by pixel. Since an image is composed of a pixel matrix, for a color image, each pixel contains the values of three channels: red (R), green (G), and blue (B); for a grayscale image, there is only one grayscale value. Taking a color image as an example, assume that the RGB value of a certain pixel in the original diffuse reflection illumination image is , and the RGB value of the corresponding pixel in the reconstructed image is . Calculate the square of the difference between these two pixels in each channel, that is, , and , and then add the squared differences of these three channels to obtain the difference value of this pixel. Perform such an operation on all pixels in the image, and then accumulate the difference values of all pixels. To make the result more general and not affected by the image size, divide the accumulated result by the total number of pixels in the image. The obtained value is the reconstruction error of the diffuse reflection image. It is expressed by the mathematical formula as . Among them, represents the total number of pixels in the image, and represents the th pixel.

[0089] Next, calculate the reconstruction error of the specular illumination image between the reconstructed image and the specular illumination image under low-angle specular illumination of the injection molded product in the same way. For the original image and the reconstructed image under low-angle specular illumination, perform the above calculation process pixel by pixel, that is, calculate the sum of the squared differences of each pixel in the RGB channels (or grayscale values), and then divide by the total number of pixels to obtain the reconstruction error of the specular illumination image. Its calculation formula is similar to that of the diffuse reflection image reconstruction error: . Here, , , are the RGB values of the th pixel in the original specular illumination image under low angle, , , are the RGB values of the th pixel in the corresponding reconstructed image, and is also the total number of pixels in the image.

[0090] Through the above calculations, the reconstruction error of the diffuse reflection image and the reconstruction error of the specular illumination image are obtained respectively. These two reconstruction error values reflect the ability of the model to capture and restore the characteristics of the original image of the injection molded product under different illumination conditions, and are important bases for subsequent judgment of whether there are defects in the injection molded product.

[0091] In step S150, based on the visual semantic feature difference coefficient under the different illumination conditions, the reconstruction error of the diffuse reflection image, and the reconstruction error of the grazing illumination image, it is determined whether the injection-molded product to be detected is qualified. Specifically, in the technical solution of the present application, determining whether the injection-molded product to be detected is qualified based on the visual semantic feature difference coefficient under the different illumination conditions, the reconstruction error of the diffuse reflection image, and the reconstruction error of the grazing illumination image includes: calculating the weighted sum of the visual semantic feature difference coefficient under the different illumination conditions, the reconstruction error of the diffuse reflection image, and the reconstruction error of the grazing illumination image to obtain a multi-dimensional comprehensive error characterization value; based on the comparison between the multi-dimensional comprehensive error characterization value and a preset threshold, determining whether the injection-molded product to be detected is qualified. It should be understood that the visual semantic feature difference coefficient under the different illumination conditions reflects the semantic differences of visual features under different illumination conditions, and focuses on describing the changes in the surface state of the product at the semantic level under different illuminations, and may be more sensitive to some subtle feature changes that are difficult to directly observe through images; the reconstruction error of the diffuse reflection image and the reconstruction error of the grazing illumination image mainly reflect the ability of the model to capture and restore the original image features of the product under different illuminations from the perspective of image reconstruction. Different indicators reflect the relevant information of the injection-molded product from different dimensions. Using only one indicator alone may not comprehensively and accurately describe the state of the product. By calculating the weighted sum, these multi-dimensional information can be integrated, and the multi-dimensional comprehensive error characterization value can provide a unified quantitative evaluation standard for the defect detection of the injection-molded product to comprehensively reflect the surface state of the product and the degree of the model's grasp of the product features. Correspondingly, considering that the multi-dimensional comprehensive error characterization value is a quantitative value, it integrates multi-faceted information such as the visual semantic feature difference coefficient under the different illumination conditions, the reconstruction error of the diffuse reflection image, and the reconstruction error of the grazing illumination image. By setting a preset threshold, a clear, objective, and quantifiable standard is provided for judging whether the injection-molded product is qualified, so as to accurately screen out the injection-molded products with quality problems. That is, only when the comprehensive error characterization value of the product is within a reasonable range, that is, less than the preset threshold, is the product considered qualified, which helps to ensure that the products flowing into the market meet the quality standards, improve the overall quality and reliability of the products, and reduce after-sales problems and customer complaints caused by product defects.

[0092] In summary, a computer vision-based injection product defect detection method according to an embodiment of the present application is elucidated. It synchronously captures product surface images under diffuse reflection light and low-angle grazing light. Then, a two-stream convolutional autoencoder architecture is adopted to train two branch networks using defect-free samples, enabling them to learn the reconstruction ability and latent feature distribution of normal products under the two lighting conditions, and performing cross-modal comparison through local reasoning to extract the consistency constraint relationship between lighting perspectives. Finally, a multi-dimensional anomaly score is formed by combining the two-stream reconstruction error and the cross-modal feature difference coefficient, and a dynamic threshold is used to determine defects. This method can model the surface state baseline without rare defect annotations, enhances the detection sensitivity to low-contrast and light-sensitive defects, effectively identifies unknown defect types, and improves the generalization detection ability for gradual or composite defects.

[0093] Figure 4 FIG. is a block diagram of a computer vision-based injection product defect detection system according to an embodiment of the present application. As Figure 4 shown, a computer vision-based injection product defect detection system 100 according to an embodiment of the present application includes: a lighting image acquisition module 110 for the product to be detected, configured to acquire a diffuse reflection lighting image and a low-angle grazing lighting image of the injection product to be detected; a lighting image encoding and reconstruction module 120, configured to perform visual encoding and image reconstruction on the diffuse reflection lighting image and the low-angle grazing lighting image to obtain a visual feature encoding map of the surface state of the injection product under the first lighting condition, a visual feature encoding map of the surface state of the injection product under the second lighting condition, a reconstructed image of the injection product under diffuse reflection lighting, and a reconstructed image of the injection product under low-angle grazing lighting; a visual feature comparison module 130 under different lighting conditions, configured to perform fine-grained comparison encoding and decoding of the visual feature encoding map of the surface state of the injection product under the first lighting condition and the visual feature encoding map of the surface state of the injection product under the second lighting condition under different lighting conditions to obtain a visual semantic feature difference coefficient under different lighting conditions; a reconstruction error calculation module 140, configured to calculate the reconstruction error between the reconstructed image of the injection product under diffuse reflection lighting and the diffuse reflection lighting image, and between the reconstructed image of the injection product under low-angle grazing lighting and the low-angle grazing lighting image to obtain a diffuse reflection image reconstruction error and a grazing lighting image reconstruction error; and a product qualification determination module 150, configured to determine whether the injection product to be detected is qualified based on the visual semantic feature difference coefficient under different lighting conditions, the diffuse reflection image reconstruction error, and the grazing lighting image reconstruction error.

[0094] Here, those skilled in the art can understand that the specific operations of each step in the above computer vision-based injection product defect detection system have been described in detail above with reference to Figures 1 to 3 the description of the computer vision-based injection product defect detection method, and thus, the repeated description thereof will be omitted.

[0095] As described above, the computer vision-based injection product defect detection system 100 according to an embodiment of the present disclosure can be implemented in various wireless terminals, such as a server having a computer vision-based injection product defect detection algorithm. In a possible implementation manner, the computer vision-based injection product defect detection system 100 according to an embodiment of the present disclosure can be integrated into the wireless terminal as a software module and / or a hardware module. For example, the computer vision-based injection product defect detection system 100 can be a software module in the operating system of the wireless terminal, or can be an application developed for the wireless terminal; of course, the computer vision-based injection product defect detection system 100 can also be one of the many hardware modules of the wireless terminal.

[0096] Alternatively, in another example, the computer vision-based injection product defect detection system 100 and the wireless terminal can also be separate devices, and the computer vision-based injection product defect detection system 100 can be connected to the wireless terminal through a wired and / or wireless network and transmit interaction information in accordance with a predefined data format.

[0097] In summary, it is intended that the above detailed description be considered illustrative rather than restrictive, and it should be understood that the above embodiments should be construed as merely illustrative of the present invention and not for limiting the scope of protection of the present invention. After reading the content described in the present invention, those skilled in the art can make various changes or modifications to the present invention, and these equivalent changes and modifications also fall within the scope defined by the claims of the present invention.

Claims

1. A method for detecting defects in injection-molded products based on computer vision, characterized in that, Including: Obtaining a diffuse reflection illumination image and a low-angle grazing illumination image of the injection-molded product to be detected; Performing visual coding and image reconstruction on the diffuse reflection illumination image and the low-angle grazing illumination image to obtain a visual feature coding map of the surface state of the injection-molded product under the first illumination condition, a visual feature coding map of the surface state of the injection-molded product under the second illumination condition, a reconstructed image of the injection-molded product under diffuse reflection illumination, and a reconstructed image of the injection-molded product under low-angle grazing illumination; Performing fine-grained contrast encoding and decoding under different illumination conditions on the visual feature coding map of the surface state of the injection-molded product under the first illumination condition and the visual feature coding map of the surface state of the injection-molded product under the second illumination condition to obtain a visual semantic feature difference coefficient under different illumination conditions; Calculating the reconstruction errors between the reconstructed image of the injection-molded product under diffuse reflection illumination and the diffuse reflection illumination image, and between the reconstructed image of the injection-molded product under low-angle grazing illumination and the low-angle grazing illumination image to obtain a diffuse reflection image reconstruction error and a grazing illumination image reconstruction error; Determining whether the injection-molded product to be detected is qualified based on the visual semantic feature difference coefficient under different illumination conditions, the diffuse reflection image reconstruction error, and the grazing illumination image reconstruction error; 2. The method for detecting defects of injection-molded products based on computer vision according to claim 1, characterized in that Performing visual coding and image reconstruction on the diffuse reflection illumination image and the low-angle grazing illumination image to obtain a visual feature coding map of the surface state of the injection-molded product under the first illumination condition, a visual feature coding map of the surface state of the injection-molded product under the second illumination condition, a reconstructed image of the injection-molded product under diffuse reflection illumination, and a reconstructed image of the injection-molded product under low-angle grazing illumination, including: Inputting the diffuse reflection illumination image and the low-angle grazing illumination image into a dual-stream convolutional autoencoder including a first convolutional autoencoder and a second convolutional autoencoder to obtain the visual feature coding map of the surface state of the injection-molded product under the first illumination condition, the visual feature coding map of the surface state of the injection-molded product under the second illumination condition, the reconstructed image of the injection-molded product under diffuse reflection illumination, and the reconstructed image of the injection-molded product under low-angle grazing illumination.

3. The method for detecting defects of injection molded products based on computer vision according to claim 2, wherein, The dual-stream convolutional autoencoder including the first convolutional autoencoder and the second convolutional autoencoder is trained only by the diffuse reflection illumination image and the low-angle grazing illumination image labeled as defect-free.

4. The method for detecting defects of injection molded products based on computer vision according to claim 1, characterized in that, Performing fine-grained contrast encoding and decoding under different illumination conditions on the visual feature coding map of the surface state of the injection-molded product under the first illumination condition and the visual feature coding map of the surface state of the injection-molded product under the second illumination condition to obtain a visual semantic feature difference coefficient under different illumination conditions, including: Respectively expanding the visual feature coding map of the surface state of the injection-molded product under the first illumination condition and the visual feature coding map of the surface state of the injection-molded product under the second illumination condition into a visual feature coding vector of the surface state of the injection-molded product under the first illumination condition and a visual feature coding vector of the surface state of the injection-molded product under the second illumination condition; Performing fine-grained associated progressive visual difference contrast reasoning on the visual feature coding vector of the surface state of the injection-molded product under the first illumination condition and the visual feature coding vector of the surface state of the injection-molded product under the second illumination condition to obtain a fine-grained contrast associated coding vector of visual features under different illumination conditions; Perform feature decoding on the visual feature fine-grained contrast correlation encoding vector under the different illumination conditions to obtain the visual semantic feature difference coefficient under the different illumination conditions.

5. The method for detecting defects of injection-molded products based on computer vision according to claim 4, wherein Perform fine-grained correlation progressive visual difference comparison reasoning on the visual feature encoding vector of the surface state of the injection-molded product under the first illumination condition and the visual feature encoding vector of the surface state of the injection-molded product under the second illumination condition to obtain the visual feature fine-grained contrast correlation encoding vector under the different illumination conditions, including: Perform one-dimensional local implicit feature convolution encoding on the visual feature encoding vector of the surface state of the injection-molded product under the first illumination condition and the visual feature encoding vector of the surface state of the injection-molded product under the second illumination condition respectively to obtain a set of local visual implicit feature encoding vectors of the surface state of the injection-molded product under the first illumination condition and a set of local visual implicit feature encoding vectors of the surface state of the injection-molded product under the second illumination condition; Perform fine-grained contrast correlation on each group of corresponding local visual implicit feature encoding vectors of the surface state of the injection-molded product under the first illumination condition and the local visual implicit feature encoding vectors of the surface state of the injection-molded product under the second illumination condition in the set of local visual implicit feature encoding vectors of the surface state of the injection-molded product under the first illumination condition and the set of local visual implicit feature encoding vectors of the surface state of the injection-molded product under the second illumination condition to obtain a set of local visual fine-grained feature contrast correlation encoding vectors under the different illumination conditions; Perform progressive reasoning based on fine-grained correlation weight modulation on the set of local visual fine-grained feature contrast correlation encoding vectors under the different illumination conditions to obtain the visual feature fine-grained contrast correlation encoding vector under the different illumination conditions.

6. The method for detecting defects of injection molded products based on computer vision according to claim 5, characterized in that Perform progressive reasoning based on fine-grained correlation weight modulation on the set of local visual fine-grained feature contrast correlation encoding vectors under the different illumination conditions to obtain the visual feature fine-grained contrast correlation encoding vector under the different illumination conditions, including: Based on the feature distribution characteristics of each local visual fine-grained feature contrast correlation encoding vector in the set of local visual fine-grained feature contrast correlation encoding vectors under the different illumination conditions, determine the progressive reasoning fine-grained correlation weights of each local visual fine-grained feature contrast correlation encoding vector under the different illumination conditions to obtain a set of progressive reasoning fine-grained correlation weights of local visual implicit features under the different illumination conditions; Based on the set of progressive reasoning fine-grained correlation weights of local visual implicit features under the different illumination conditions, perform weighted modulation on the set of local visual fine-grained feature contrast correlation encoding vectors under the different illumination conditions to obtain a set of local visual fine-grained feature contrast correlation modulation encoding vectors under the different illumination conditions; Input the set of local visual fine-grained feature contrast correlation modulation encoding vectors under the different illumination conditions into a progressive reasoning device based on a forward LSTM model to obtain the visual feature fine-grained contrast correlation encoding vector under the different illumination conditions.

7. The method for detecting defects of injection-molded products based on computer vision according to claim 6, characterized in that, Based on the set of fine-grained correlation weights gradually inferred from the local visual implicit features under the heterogeneous illumination conditions, performing weighted modulation on the set of local visual fine-grained feature contrast correlation encoding vectors under the heterogeneous illumination conditions to obtain a set of local visual fine-grained feature contrast correlation modulation encoding vectors, including: Performing dynamic optimization of gradient decoupling and spectral domain modulation on the set of fine-grained correlation weights gradually inferred from the local visual implicit features under the heterogeneous illumination conditions to obtain a set of fine-grained correlation optimized weights for the local visual implicit features gradually inferred under the heterogeneous illumination conditions; Based on the set of fine-grained correlation optimized weights for the local visual implicit features gradually inferred under the heterogeneous illumination conditions, performing weighted modulation on the set of local visual fine-grained feature contrast correlation encoding vectors under the heterogeneous illumination conditions to obtain the set of local visual fine-grained feature contrast correlation modulation encoding vectors under the heterogeneous illumination conditions.

8. The computer vision-based injection product defect detection method according to claim 7, wherein Performing feature decoding on the fine-grained contrast correlation encoding vectors of the visual features under the heterogeneous illumination conditions to obtain the visual semantic feature difference coefficients under the heterogeneous illumination conditions, including: using a difference analyzer based on a decoder to perform feature decoding on the fine-grained contrast correlation encoding vectors of the visual features under the heterogeneous illumination conditions to obtain the visual semantic feature difference coefficients under the heterogeneous illumination conditions.

9. The method for detecting defects of injection-molded products based on computer vision according to claim 8, wherein, Based on the visual semantic feature difference coefficients under the heterogeneous illumination conditions, the diffuse reflection image reconstruction error, and the specular illumination image reconstruction error, determining whether the injection-molded product to be detected is qualified, including: Calculating the weighted sum among the visual semantic feature difference coefficients under the heterogeneous illumination conditions, the diffuse reflection image reconstruction error, and the specular illumination image reconstruction error to obtain a multi-dimensional comprehensive error characterization value; Based on the comparison between the multi-dimensional comprehensive error characterization value and a preset threshold, determining whether the injection-molded product to be detected is qualified.

10. An injection molding product defect detection system based on computer vision, characterized in that, Including: A module for obtaining illumination images of the product to be detected, configured to obtain the diffuse reflection illumination image and the low-angle specular illumination image of the injection-molded product to be detected; An illumination image encoding and reconstruction module, configured to perform visual encoding and image reconstruction on the diffuse reflection illumination image and the low-angle specular illumination image to obtain a visual feature encoding map of the surface state of the injection-molded product under the first illumination condition, a visual feature encoding map of the surface state of the injection-molded product under the second illumination condition, a reconstructed image of the injection-molded product under diffuse reflection illumination, and a reconstructed image of the injection-molded product under low-angle specular illumination; A visual feature contrast module under heterogeneous illumination conditions, configured to perform fine-grained contrast encoding and decoding under heterogeneous illumination conditions on the visual feature encoding map of the surface state of the injection-molded product under the first illumination condition and the visual feature encoding map of the surface state of the injection-molded product under the second illumination condition to obtain the visual semantic feature difference coefficients under the heterogeneous illumination conditions; A reconstruction error calculation module, configured to calculate the reconstruction errors between the reconstructed image of the injection-molded product under diffuse reflection illumination and the diffuse reflection illumination image and between the reconstructed image of the injection-molded product under low-angle specular illumination and the low-angle specular illumination image to obtain the diffuse reflection image reconstruction error and the specular illumination image reconstruction error; A product qualification judgment module, which is used to determine whether the injection-molded product to be detected is qualified based on the visual semantic feature difference coefficient under the different illumination conditions, the reconstruction error of the diffuse reflection image, and the reconstruction error of the grazing illumination image.

Citation Information

Cited By

  • Injection molding product defect detection method and equipment based on SAM2-U-Net and semi-supervised training

    CN121236006A