A multi-scale feature fusion injection molding part defect identification method

By employing a multi-scale feature fusion method, the problem of insufficient feature extraction and fusion strategies for detecting minute defects in injection molded parts is solved, achieving efficient and accurate defect identification of injection molded parts, which is suitable for real-time detection in industrial production lines.

CN122135006APending Publication Date: 2026-06-02SUZHOU XINYUDA INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610177770.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-02-07
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

Existing technologies for defect detection in injection molded parts, especially for the detection of minute defects, have limitations in feature extraction and fusion strategies. This results in insufficient generalization ability and accurate localization ability of the model for complex and variable defects, making it difficult to meet the needs of efficient and stable automatic detection.

Method used

A multi-scale feature fusion method is constructed, including a parallel bi-branch feature fusion module and an attention mechanism. The local correlation is enhanced by a visual cognitive computing module, the feature pyramid is enhanced across levels, and adaptive anchor box clustering is combined to achieve dynamic modeling and weighted fusion of feature consistency and difference.

Benefits of technology

It significantly improves the detection rate and positioning accuracy of small target defects, enhances the robustness and adaptability of the model, and can accurately identify a variety of defects in complex backgrounds, making it suitable for real-time online inspection of industrial production lines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122135006A_ABST
    Figure CN122135006A_ABST
Patent Text Reader

Abstract

This invention discloses a multi-scale feature fusion method for defect recognition in injection molded parts, belonging to the field of computer vision and industrial product quality inspection technology. The method includes: constructing and preprocessing a dataset of defective injection molded parts images; extracting multi-scale feature maps using a deep convolutional neural network with an integrated visual cognitive computing module; enhancing small-target defect information by collaboratively modeling the consistency and differences of features through a parallel dual-branch feature fusion module; employing an attention-guided cross-level enhancement module to reweight the fused features through channels, highlighting key features; and finally, achieving accurate classification and localization of defects using a detection head network based on adaptive anchor boxes. This method can effectively improve the accuracy and recall rate of injection molded parts, especially for minute defects, and is suitable for online quality inspection on industrial production lines.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to computer vision and industrial product quality inspection, and more particularly to a method for identifying defects in injection molded parts through multi-scale feature fusion. Background Technology

[0002] As key components in industrial production, the surface quality of injection molded parts directly affects the overall performance and aesthetics of the product. Currently, the quality inspection of injection molded parts still largely relies on manual visual inspection, where inspectors judge the presence of defects such as bubbles, cracks, and color differences by visual observation. This method is not only inefficient and unable to meet the needs of modern large-scale production, but the inspection results are also easily affected by the inspector's experience, physical strength, and subjective judgment, making it difficult to guarantee the consistency and stability of standards. Furthermore, prolonged visual fatigue can easily lead to missed inspections and misjudgments.

[0003] To replace manual inspection, machine vision-based automatic detection technologies have emerged. These technologies can be broadly categorized into two types: one relies on traditional image processing algorithms (such as threshold segmentation, edge detection, and multi-scale template matching). While these methods have relatively low computational cost, they are highly demanding in terms of imaging environment (such as lighting and angle), lack sufficient feature discrimination, and are prone to missed detections or false alarms when faced with weak or atypical defects highly similar to normal background textures, exhibiting poor adaptability. The other type is based on deep learning methods, such as improved Faster R-CNN or YOLOv5 target detection models. These methods automatically learn features through convolutional neural networks, improving recognition accuracy and adaptability to some extent. However, they still face challenges in handling defects in injection molded parts, especially small defects (such as microbubbles and microcracks). The root cause lies in the limitations of the feature extraction and fusion strategies of standard models. Small target defects on the surface of injection molded parts account for a small proportion of the image, and their feature information is easily diluted or lost during the forward propagation of the convolutional neural network. Furthermore, although existing technologies have introduced attention mechanisms (such as CBAM) or multi-scale feature fusion (such as FPN) to improve performance, these improvements are mostly sequential or single-path fusions, which are difficult to balance the consistency and differences of features at the same time. They cannot fully preserve and enhance the detailed semantic information related to minor defects, resulting in the model's generalization ability and accurate localization ability for complex and variable defects still needing improvement. Summary of the Invention

[0004] Purpose of the invention: The purpose of this invention is to provide a detection method that can effectively integrate multi-scale features and pay special attention to defects in small targets.

[0005] Technical solution: A method for defect identification of injection molded parts through multi-scale feature fusion, comprising the following steps: S1. Dataset Construction and Preprocessing: Collect surface images of injection molded parts containing various defects, including bubbles, cracks, and color differences, to form the original dataset; perform data augmentation operations on the original dataset to expand the sample size, including random rotation, brightness adjustment, and noise addition; divide the expanded image dataset into training set, validation set, and test set according to a predetermined ratio, and label the defect targets in all images to generate corresponding bounding boxes and category labels; S2. Multi-scale Feature Extraction: A feature extraction backbone network based on a deep convolutional neural network is constructed to extract feature maps of different levels from the input image. The feature extraction backbone network contains at least four downsampling stages, each stage outputting feature maps with decreasing resolution but increasing semantic information, denoted as {C1, C2, C3, C4}, where C1 is a shallow high-resolution feature map rich in detailed texture information, and C4 is a deep low-resolution feature map rich in high-level semantic information. The basic building block of the feature extraction backbone network is a visual cognitive computing module, which uses an attention mechanism to construct the correlation between local regions of the image to enhance the attention to small defect features. Its attention encoding process is represented as follows: , where Q, K, V are the query, key, and value matrices, respectively, which are obtained from the input feature map through a 1x1 convolution transformation, and d is the embedding dimension; S3. Parallel Two-Branch Feature Fusion: The multi-scale feature maps {C2, C3, C4} obtained in step S2 are input into the parallel two-branch feature fusion module. The fusion module performs upsampling or downsampling operations on each group of adjacent scale feature maps to unify the resolution, and processes them through two independent parallel branches: the first branch models the consistency of features in adjacent layers by combining max pooling and average pooling, and the second branch models the differences in features by calculating the pixel-level differences between feature maps. Subsequently, the outputs of the two branches are weighted and concatenated to generate a set of fused feature maps {P2, P3, P4} that enhance the defect information of small targets and unify the scale. S4. Attention-guided cross-level enhancement: The fused feature maps {P2, P3, P4} are input into the attention-guided cross-level enhancement module. This module first performs 3x3 convolution thinning on the lower-level feature map P2, and simultaneously upsamples the higher-level feature map P4 by 2x, and adds it element-wise with the P3 feature map. The result of the addition is upsampled by 2x again, and then concatenated with the thinned P2 feature map through channels. Finally, the channel attention mechanism is used to reweight each channel of the concatenated feature map to highlight the feature channels most relevant to defect detection, and the final feature pyramid {F2, F3, F4} is output. S5. Defect Identification and Localization: The final feature pyramid {F2, F3, F4} obtained in step S4 is input into the detection head network. The detection head network includes a region proposal network and a classification regression network. The region proposal network presets a set of anchor boxes with different scales and aspect ratios at each level of the feature pyramid, and determines whether each anchor box contains a defect target and performs preliminary position fine-tuning. The classification regression network performs accurate defect category classification and bounding box coordinate regression on the candidate regions output by the region proposal network, and finally outputs the category, confidence level and accurate location bounding box of the injection molded part defect.

[0006] Furthermore, in step S1, cluster analysis is performed on the original dataset, and the K-means++ algorithm is used to adaptively determine the initial size and aspect ratio of the anchor boxes used by the region proposal network in step S5, so as to improve the matching degree between the anchor boxes and the real defect boxes, thereby accelerating the model training convergence and improving the detection accuracy.

[0007] Furthermore, the visual cognition computing module described in step S2 has the following serial execution order: the input features are first processed through a 3x3 convolution layer for local feature extraction, then the attention encoding described in claim 1 is performed to capture global contextual dependencies, and finally the output of the attention encoding is residually connected to the initial input of the module to alleviate the gradient vanishing problem in deep networks.

[0008] Furthermore, in step S3, the outputs of the two parallel branches are weighted and concatenated. The weight coefficients are trainable parameters that are adaptively learned through the backpropagation algorithm during model training. This allows the network to dynamically adjust its dependence on feature consistency and difference information based on different defect characteristics.

[0009] Furthermore, the channel attention mechanism described in step S4 is specifically implemented using a squeeze-excitation structure: first, the spatial information of each channel is compressed into a scalar through global average pooling; then, the correlation between channels is learned through a bottleneck structure composed of two fully connected layers, and the weight vector of each channel is output; finally, the weight vector is multiplied with the original feature map channel by channel to complete the reweighting of the feature channels.

[0010] Furthermore, the region proposal network and classification / regression network described in step S5 use a multi-task loss function during training, which is defined as: ,in and For classification loss, a focus loss function is used to alleviate the imbalance between positive and negative samples; and For bounding box regression loss, the Smooth L1 loss function is used.

[0011] Furthermore, after step S5, the following steps are also included: S6, Model Optimization and Deployment: The trained defect recognition model is evaluated using the test set, and the model is pruned or quantized according to the evaluation results to reduce the model size and improve the inference speed; the optimized model is deployed in the industrial computer or embedded device of the injection molding production line to perform online defect detection and recognition on the real-time collected injection molding images.

[0012] An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of a multi-scale feature fusion method for identifying defects in injection molded parts.

[0013] Beneficial effects: (1) This invention constructs a parallel dual-branch feature fusion module, simultaneously modeling the consistency and differences between features at adjacent levels, and introduces learnable dynamic weights for weighted concatenation. Compared with traditional single feature pyramid network (FPN) or path aggregation network (PANet), this fusion strategy can integrate feature information at different scales more comprehensively and in a more refined manner, effectively avoiding the smoothing or ignoring of small target defect features during the fusion process, and significantly enhancing the representational ability of the fused feature map.

[0014] (2) In the feature extraction stage, this invention introduces a visual cognitive computing module based on an attention mechanism. This module constructs the correlation between local regions of the image, enabling the network to adaptively focus on key regions related to defects and suppress interference from irrelevant background information. Combined with the subsequent attention-guided cross-level enhancement module's channel reweighting of the feature pyramid, the feature channels that are crucial for defect classification and localization are further highlighted. The synergistic effect of this dual attention mechanism enables the model to have stronger feature discrimination ability and robustness when facing defects with complex backgrounds, low contrast, or varied shapes.

[0015] (3) The method of this invention forms a complete technical closed loop from feature extraction, fusion, enhancement to final identification and localization. Each step is progressive and complementary, working together to solve the core difficulties in detecting small target defects in injection molded parts. This method is not only expected to significantly improve the detection rate and localization accuracy of easily missed defects such as bubbles and microcracks, but also enhances the ability to identify various common defects due to its full utilization of multi-dimensional features. In addition, through optimization techniques such as adaptive anchor frame clustering, the convergence efficiency of the model training process is also improved, laying a solid technical foundation for the final deployment on industrial production lines to achieve real-time and efficient online quality inspection. Attached Figure Description

[0016] Figure 1 This is a schematic diagram of the method flow of the present invention; Figure 2 This is a comparison diagram of the effects of the method of the present invention and the traditional method. Detailed Implementation

[0017] To make the technical solution of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0018] Example A multi-scale feature fusion method for defect identification in injection molded parts, such as Figure 1 As shown, it includes the following steps: Dataset Construction and Preprocessing This embodiment uses a publicly available dataset of surface defects in injection molded parts (e.g., image data containing various defect types such as bubbles, cracks, flash, shrinkage marks, and color differences) as the original dataset. This dataset initially contains approximately 5000 high-resolution (2448×2048 pixels) images of injection molded parts surfaces. To expand the dataset and improve model robustness, the following data augmentation operations were performed: each original image was randomly rotated clockwise or counterclockwise by 90, 180, or 270 degrees; the overall brightness of the image was linearly adjusted within a brightness increment range of [-30, 30]; and Gaussian noise with a mean of 0 and a standard deviation of 0.02 was added. After augmentation, the dataset size was expanded to approximately 20,000 images. Subsequently, the augmented dataset was randomly divided into training, validation, and test sets in a 7:2:1 ratio. The LabelImg annotation tool was used to finely annotate the defect targets in all images, drawing precise bounding boxes for each defect and assigning it a corresponding category label (e.g., bubble, crack, etc.), generating a standard PASCAL VOC format annotation file. In addition, K-means++ clustering analysis was performed on the training set to adaptively determine the initial size of the anchor boxes in the subsequent region proposal network. The number of cluster centers K was set to 9, and the resulting anchor box size better fits the distribution of real defects in the dataset, which helps to accelerate model convergence.

[0019] Construction and Training of Multi-Scale Feature Extraction Network The feature extraction backbone network uses a ResNet-50 model pre-trained on the ImageNet dataset. It contains four significant downsampling stages and can output feature maps C2, C3, C4, and C5 (corresponding to the original...). Figure 1(Features at scales of 1 / 4, 1 / 8, 1 / 16, and 1 / 32). To enhance the network's ability to perceive subtle defect features, the basic residual block at the end of each stage is replaced with the visual cognitive computing module designed in this invention. The specific operation flow of this module is as follows: The input feature map first undergoes local feature enhancement through a 3x3 convolutional layer; then, the enhanced feature map is transformed into a query matrix Q, a key matrix K, and a value matrix V through three independent 1x1 convolutional layers, respectively; next, the attention weight matrix is ​​calculated, specifically by multiplying the transposes of Q and K, then scaling by dividing by the square root of the embedding dimension d, and then normalizing using the Softmax function; finally, the normalized attention weights are multiplied by the value matrix V to obtain the attention-weighted feature output, and this output is residually connected to the initial input of the module to stabilize the training process. This module enables the network to adaptively focus on key regions related to defects and suppress background interference by constructing the association between any two spatial locations within the feature map.

[0020] Parallel dual-branch feature fusion process The C2, C3, C4, and C5 feature maps obtained from the backbone network (C5 is considered a supplement to the deeper C4 after 1x1 convolution dimensionality reduction) are input into the parallel two-branch feature fusion module. First, the resolution of the C3, C4, and C5 feature maps is unified to the same as C2 through bilinear interpolation upsampling or max pooling downsampling. Then, for each pair of adjacent scale feature maps (such as the processed C3 and C2), they are fed into two parallel branches: the first branch (consistency branch) performs global average pooling and global max pooling on the two feature maps respectively, and the sum of the pooling results is used as a measure of feature consistency; the second branch (dissimilarity branch) calculates the absolute difference between corresponding pixels in the two feature maps to capture local differences in features. Next, the output feature maps from the two branches are concatenated along the channel dimension and weighted and fused through a trainable 1x1 convolutional layer (whose weights are learned through backpropagation during training), dynamically adjusting the contribution of consistency and dissimilarity information. Finally, a set of feature pyramids P2, P3, and P4, which integrate multi-scale information and have uniform resolution, are generated.

[0021] Attention-guided cross-level enhancement The fused feature pyramids P2, P3, and P4 are input into an attention-guided cross-level enhancement module. First, a 3x3 convolution operation is performed on the bottom-level P2 feature map to further refine the details. Simultaneously, the top-level P4 feature map is upsampled by 2x and then element-wise added to the P3 feature map to obtain the enhanced P3' feature map. Next, the P3' feature map is upsampled by 2x again and then concatenated with the refined P2 feature map along the channel dimension. Finally, the stitched feature map is fed into a squeeze-excitation structure channel attention mechanism: This mechanism first compresses the two-dimensional features of each channel into a scalar through global average pooling, then passes through a bottleneck structure composed of two fully connected layers (the first fully connected layer reduces the number of channels to 1 / 16 of the original, and the second fully connected layer restores the original number of channels), and is activated using the Sigmoid function to generate weight coefficients for each channel (between 0 and 1); finally, these weight coefficients are multiplied with the original stitched feature map channel by channel to achieve reweighting of feature channels, highlighting feature channels that are crucial for defect identification, and outputting the final enhanced feature pyramids F2, F3, and F4.

[0022] Defect identification and location The enhanced feature pyramids F2, F3, and F4 are input into the detection head. This detection head is based on the Faster R-CNN architecture and includes a region proposal network (RPN) and a classification / regression network (CRN). In the RPN stage, a set of anchor boxes obtained from K-means++ clustering is pre-defined at each level of the feature pyramid. The RPN performs binary classification (foreground / background) and preliminary bounding box regression on each anchor box. Then, the classification / regression network performs precise defect category (multi-class) and bounding box coordinate regression on the candidate regions proposed by the RPN. Model training is optimized using a multi-task loss function, which is the sum of four terms: the RPN classification loss, the RPN regression loss, the classification loss of the classification / regression network, and the classification / regression loss of the classification / regression network. The classification loss uses a focus loss function to mitigate the imbalance between positive and negative samples, and the regression loss uses a Smooth L1 loss function. The constructed complete network is trained end-to-end using the training set with a stochastic gradient descent optimizer, an initial learning rate of 0.005, and a learning rate decay strategy. During training, a validation set is used to monitor model performance and prevent overfitting.

[0023] Model optimization and deployment application After training, the model is evaluated using a test set, and metrics such as mean precision are calculated to measure model performance. To meet the real-time requirements of industrial environments, the trained model is pruned, removing some unimportant convolutional kernels, and the model weights are quantized using INT8 to significantly reduce model size and improve inference speed. The optimized model is deployed to an industrial control computer (equipped with an NVIDIA Jetson AGX Orin module) next to the injection molding production line. During actual inspection, industrial cameras installed on the production line capture images of injection molded parts in real time. These images are fed into the deployed model for inference, and the model outputs the defect category, confidence level, and precise bounding box coordinates. Based on the recognition results, the system automatically triggers a sorting device to remove defective products, thereby achieving online, automatic, and efficient identification of defects in injection molded parts.

[0024] like Figure 2 As shown, the multi-scale feature fusion method (orange area) outperforms the traditional method (blue area) in all dimensions (accuracy, precision, recall, F1 score, average precision (mAP), and processing speed), especially showing significant improvements in recall and F1 score. This indicates that multi-scale feature fusion technology can more effectively identify defects in injection molded parts, improving overall recognition performance while maintaining high accuracy.

[0025] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.

Claims

1. A method for defect identification of injection molded parts through multi-scale feature fusion, characterized in that, Includes the following steps: S1. Dataset Construction and Preprocessing: Collect surface images of injection molded parts containing various defects, including bubbles, cracks, and color differences, to form the original dataset; perform data augmentation operations on the original dataset to expand the sample size, including random rotation, brightness adjustment, and noise addition. The expanded image dataset is divided into training, validation and test sets according to a predetermined ratio, and the defect targets in all images are labeled to generate corresponding bounding boxes and category labels. S2. Multi-scale Feature Extraction: A feature extraction backbone network based on a deep convolutional neural network is constructed to extract feature maps of different levels from the input image. The feature extraction backbone network contains at least four downsampling stages, each stage outputting feature maps with decreasing resolution but increasing semantic information, denoted as {C1, C2, C3, C4}, where C1 is a shallow high-resolution feature map rich in detailed texture information, and C4 is a deep low-resolution feature map rich in high-level semantic information. The basic building block of the feature extraction backbone network is a visual cognitive computing module, which uses an attention mechanism to construct the correlation between local regions of the image to enhance the attention to small defect features. Its attention encoding process is represented as follows: , where Q, K, V are the query, key, and value matrices, respectively, which are obtained from the input feature map through a 1x1 convolution transformation, and d is the embedding dimension; S3. Parallel Two-Branch Feature Fusion: The multi-scale feature maps {C2, C3, C4} obtained in step S2 are input into the parallel two-branch feature fusion module. The fusion module performs upsampling or downsampling operations on each group of adjacent scale feature maps to unify the resolution, and processes them through two independent parallel branches: the first branch models the consistency of features in adjacent layers by combining max pooling and average pooling, and the second branch models the differences in features by calculating the pixel-level differences between feature maps. Subsequently, the outputs of the two branches are weighted and concatenated to generate a set of fusion feature maps {P2, P3, P4} that enhance the defect information of small targets and unify the scale. S4. Attention-guided cross-level enhancement: Input the fused feature map {P2, P3, P4} into the attention-guided cross-level enhancement module; This module first performs 3x3 convolution on the lower-level feature map P2 to refine it, while simultaneously upsampling the higher-level feature map P4 by a factor of 2 and adding it element-wise with the feature map P3. The result of the addition is upsampled by a factor of 2 again and concatenated with the refined feature map P2. Finally, a channel attention mechanism is used to reweight each channel of the concatenated feature map to highlight the feature channels most relevant to defect detection, and the final feature pyramid {F2, F3, F4} is output. S5. Defect Identification and Localization: The final feature pyramid {F2, F3, F4} obtained in step S4 is input into the detection head network; the detection head network includes a region proposal network and a classification regression network; the region proposal network presets a set of anchor boxes with different scales and aspect ratios at each level of the feature pyramid, and determines whether each anchor box contains a defect target and performs preliminary position fine-tuning. The classification and regression network performs precise defect category classification and bounding box coordinate regression on the candidate regions output by the region proposal network, and finally outputs the category, confidence level and precise location bounding box of the injection molded part defect.

2. The multi-scale feature fusion method for defect identification of injection molded parts according to claim 1, characterized in that, In step S1, cluster analysis is performed on the original dataset, and the K-means++ algorithm is used to adaptively determine the initial size and aspect ratio of the anchor boxes used by the region proposal network in step S5, so as to improve the matching degree between the anchor boxes and the real defect boxes, thereby accelerating the model training convergence and improving the detection accuracy.

3. The multi-scale feature fusion method for defect identification of injection molded parts according to claim 1, characterized in that, The visual cognition computing module described in step S2 has the following serial execution order: the input features are first processed by a 3x3 convolution layer for local feature extraction, then the attention encoding described in claim 1 is performed to capture global contextual dependencies, and finally the output of the attention encoding is residually connected to the initial input of the module to alleviate the gradient vanishing problem in deep networks.

4. The multi-scale feature fusion method for defect identification of injection molded parts according to claim 1, characterized in that, The weighted concatenation of the outputs of the two parallel branches described in step S3 uses trainable parameters that are adaptively learned through backpropagation during model training. This allows the network to dynamically adjust its dependence on feature consistency and difference information based on different defect characteristics.

5. The multi-scale feature fusion method for defect identification of injection molded parts according to claim 1, characterized in that, The channel attention mechanism described in step S4 is specifically implemented using a squeeze-excitation structure: First, the spatial information of each channel is compressed into a scalar through global average pooling. Then, the correlation between channels is learned through a bottleneck structure composed of two fully connected layers, and the weight vector of each channel is output. Finally, the weight vector is multiplied with the original feature map channel by channel to complete the reweighting of the feature channels.

6. The multi-scale feature fusion method for defect identification of injection molded parts according to claim 1, characterized in that, The region proposal network and classification / regression network described in step S5 use a multi-task loss function during training, which is defined as: ,in and For classification loss, a focus loss function is used to alleviate the imbalance between positive and negative samples; and For bounding box regression loss, the Smooth L1 loss function is used.

7. The multi-scale feature fusion method for defect identification of injection molded parts according to claim 1, characterized in that, After step S5, the following steps are also included: S6, model optimization and deployment: the performance of the trained defect recognition model is evaluated using the test set, and the model is pruned or quantized according to the evaluation results to reduce the model size and improve the inference speed; the optimized model is deployed in the industrial computer or embedded device of the injection molding production line to perform online defect detection and recognition on the real-time collected injection molding images.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the multi-scale feature fusion method for defect identification of injection molded parts as described in any one of claims 1 to 7.