Defect classification method for automobile injection molding parts based on database comparison

By combining multi-scale decomposition and convolutional neural networks with a local anomaly factor algorithm to optimize a two-stage classification strategy, the problems of insensitivity and low classification accuracy in the detection of defects in automotive injection molded parts are solved, achieving efficient identification and adaptive detection in complex backgrounds.

CN120747643BActive Publication Date: 2025-11-28XIAN WEIER PRECISION TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202511212908.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-28
Publication Date
2025-11-28
Estimated Expiration
2045-08-28

AI Technical Summary

Technical Problem

Existing technologies for detecting defects in automotive injection molded parts face challenges such as insensitivity, low classification accuracy, difficulty in identifying subtle defect features against complex texture backgrounds, and limited generalization ability for new types of defects.

Method used

A two-stage classification strategy based on database comparison is adopted. First, features are extracted through multi-scale decomposition and convolutional neural network, and the threshold is dynamically adjusted by combining the local anomaly factor algorithm to filter out normal background areas. Then, the local anomaly factor is concatenated with the original features and input into the neural network for fine classification.

Benefits of technology

It significantly improves the ability to identify defects in complex backgrounds and the accuracy of detection, can adapt to changes in the production environment, and enhances the robustness and reliability of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120747643B_ABST
    Figure CN120747643B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of image processing, and particularly relates to a defect classification method for automobile injection molding parts based on database comparison, which comprises the following steps: extracting a feature vector fused with multi-scale artificial information and deep learning information for normal, defect and to-be-detected areas; realizing efficient preliminary screening of abnormal areas by calculating a local anomaly factor of the to-be-detected area and comparing the local anomaly factor with a dynamic determination threshold generated based on defect data; and splicing the original feature vector and the quantized local anomaly factor into an enhanced feature vector, inputting the enhanced feature vector into a neural network classification model, and performing accurate defect category determination. The two-stage strategy of dynamic threshold preliminary screening and enhanced feature accurate division improves the accuracy and stability of defect detection of automobile injection molding parts.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing. More particularly, the present application relates to a method for classifying defects of automobile injection molding parts based on database comparison. BACKGROUND

[0002] The automatic detection of surface quality of industrial products, especially automobile injection molding parts, is a key link to ensure product quality and improve production efficiency. Currently, defect detection technology based on machine vision has been widely applied, aiming to replace manual inspection and achieve rapid and objective identification of product surface defects. Traditional image processing and machine learning models are often combined to complete defect detection and classification.

[0003] In related technologies, for example, the Chinese patent document with the authorization announcement number CN114926008B discloses an intelligent woven fabric defect image recognition and automatic classification method and system, which discloses feature analysis of classified woven fabric images, defect type recognition of each classified woven fabric image in the classified woven fabric image group, one-to-one labeling of the image defect feature group using the defect type label group, and aggregation of the labeled image feature group. According to the labeled image feature group set, a deep learning model is trained to obtain a defect automatic recognition model, improving the accuracy and efficiency of woven fabric defect recognition.

[0004] However, in complex industrial production environments, existing technologies still face many challenges. First, the surface of automobile injection molding parts often has complex textures. When the defect features are weak, atypical in shape, or highly similar to normal background textures, traditional detection algorithms may miss or misreport due to insufficient feature differentiation, resulting in insensitive detection and low classification accuracy. And relying solely on neural networks may ignore specific, highly interpretable geometric or texture information, and have limited generalization ability for new types of defects. SUMMARY

[0005] To solve the above technical problems of insufficient defect detection accuracy and poor classification effect, the present application provides a method for classifying defects of automobile injection molding parts based on database comparison, comprising:

[0006] A large number of sample images and a plurality of images to be detected are collected, a plurality of normal ROIs, defect ROIs and to-be-detected ROIs are obtained through feature region extraction technology, feature vectors of any ROI are obtained based on morphological, gray scale and texture features of the normal ROIs, the defect ROIs and the to-be-detected ROIs under different observation scales, the to-be-detected ROI is recorded as a target ROI, a preliminary k-distance and a preliminary k-neighborhood are obtained according to differences between the feature vectors of the to-be-detected ROI and the normal ROIs, an improved k-neighborhood of the to-be-detected ROI and a local anomaly factor of the to-be-detected ROI are obtained based on distances between the to-be-detected ROI and the normal ROIs of the preliminary k-neighborhood, the local anomaly factor of the defect ROI is calculated, a dynamic anomaly judgment threshold is obtained based on differences between the local anomaly factors of the defect ROIs, the local anomaly factor of the to-be-detected ROI is compared with the dynamic anomaly judgment threshold, a preliminary classification of the to-be-detected ROI is obtained, and the classification includes a defect or normal, an enhanced feature vector of the to-be-detected ROI is constructed based on the feature vector of the to-be-detected ROI and the corresponding local anomaly factor, a defect classification model of the automobile injection part is established based on neural network technology, and a defect type of the to-be-detected ROI is obtained by inputting the enhanced feature vector of the to-be-detected ROI into the defect classification model of the automobile injection part.

[0007] The application proposes an innovative two-stage classification strategy. In the first stage, the improved local outlier factor (LOF) algorithm is optimized by introducing a dynamic anomaly judgment threshold based on normal samples and defect samples, which can efficiently and adaptively filter out a large number of normal background regions, effectively reduce the computational burden of subsequent fine classification, and adapt to normal texture drift caused by factors such as raw material batch and equipment aging in the production process, and has stronger robustness. In the second stage, the local anomaly factor output by the first stage is used as a new dimension information, which is spliced with the original feature vector into an enhanced feature vector, and then sent to a neural network for classification, which enables the classifier to know the abnormality degree, greatly improves the recognition ability of fuzzy defects similar to normal background texture but essentially defective, and significantly improves the accuracy and reliability of detection.

[0008] Preferably, the feature vector of any ROI comprises:

[0009] A multiscale decomposition algorithm is used for downsampling on the target ROI to generate a decomposition image set of the target ROI, morphological features, gray scale features and texture features of the decomposition image set of the target ROI are obtained.

[0010] A pre-trained convolutional neural network is used as a deep feature extractor, the target ROI is input into the deep feature extractor, and a deep feature vector of the target ROI is obtained.

[0011] The morphological, gray scale, texture features and depth feature vectors of the target ROI are spliced to obtain the feature vector of the target ROI.

[0012] The present application realizes complementary advantages by fusing the morphological, gray scale, texture features and depth abstract features extracted after multi-scale decomposition.

[0013] Preferably, the morphological features of the target ROI are obtained by:

[0014] The Otsu method is used for binaryzation processing of any decomposition image of the target ROI to obtain a binary matrix of the decomposition image, and the elements with a value of 1 in the binary matrix of the decomposition image are accumulated to obtain the area of the decomposition image of the target ROI.

[0015] Preferably, the texture features are obtained by:

[0016] A normalized gray scale co-occurrence matrix of any decomposition image of the target ROI is obtained, and the texture feature is contrast.

[0017] The contrast of the kth decomposition image of the target ROI satisfies the expression:

[0018] ;

[0019] In the formula, represents the contrast of the mth decomposition image of the target ROI; represents the maximum value of the gray scale range; , is the number of gray scales; represents the probability of the pixel pair with a gray scale of in the gray scale co-occurrence matrix of the mth decomposition image of the target ROI appearing in a preset spatial relationship; represents a normalization function; and the preset spatial relationship is a horizontal adjacent spatial relationship.

[0020] Preferably, the preliminary k-distance and the preliminary k-neighborhood are obtained by:

[0021] The arbitrary to-be-tested ROI is denoted as a target to-be-tested ROI, feature vectors of all normal ROIs form a normal feature space, the target to-be-tested ROI is placed in the normal feature space, Euclidean distances of the target to-be-tested ROI and all feature vectors of the normal feature space are calculated, the kth smallest Euclidean distance value is found according to the order from small to large, that is, a preliminary k-distance of the target to-be-tested ROI; all normal sample points with a distance not greater than the k-distance from the target to-be-tested ROI form a preliminary k-neighborhood of the target to-be-tested ROI.

[0022] Preferably, the improved k-distance of the to-be-tested ROI is obtained, and the improved k-distance of the to-be-tested ROI is obtained by the following steps.

[0023] The improved k-distance of the target to-be-tested ROI satisfies the expression:

[0024] ;

[0025] In the formula, denotes the improved k-distance from the neighborhood data point p to the target to-be-tested ROI, ; denotes the preliminary k-distance of the target to-be-tested ROI; denotes the Euclidean distance between the target to-be-tested ROI and the neighborhood data point p; is a distance weight function; denotes a maximum function; the distance weight function is a Gaussian function.

[0026] The improved k-distance is calculated by introducing the distance weight function, so that the neighborhood data points closer to the to-be-tested ROI contribute more in density estimation. This improvement is more in line with the physical intuition of local density, and can more accurately reflect the real density environment in which the to-be-tested region is located, so that the subsequently calculated local anomaly factor score can more accurately quantify the outlying degree, and the sensitivity and accuracy of anomaly detection are improved.

[0027] Preferably, the local anomaly factor of the to-be-tested ROI is obtained, and the local anomaly factor of the to-be-tested ROI is obtained by the following steps.

[0028] The local reachable density of the target to-be-tested ROI is calculated;

[0029] The local anomaly factor of the to-be-tested ROI satisfies the expression:

[0030] ;

[0031] In the formula, denotes the local anomaly factor of the target to-be-tested ROI; denotes the local reachable density of the neighborhood data point p of the target to-be-tested ROI; denotes the local reachable density of the target to-be-tested ROI; The preliminary k-neighborhood representing the target ROI to be measured.

[0032] The application describes a method for calculating the local anomaly factor, which is based on comparing the local reachable density of the target ROI to be measured with the average local reachable density of its neighborhood points. The method can quantify the degree of isolation of a point relative to its surrounding environment, and is therefore very effective for processing data with uneven density, such as the complex texture of the surface of an injection molded part of a car, and can accurately identify real defects that are located in the normal texture area but have a significantly lower density.

[0033] Preferably, the local reachable density of the target ROI to be measured comprises:

[0034] The average improved reachable distance of all points in the target ROI to be measured and the preliminary k-neighborhood is negatively correlated and normalized to obtain the local reachable density of the target ROI to be measured.

[0035] Preferably, the method for obtaining the dynamic anomaly determination threshold comprises:

[0036] ;

[0037] In the formula, The dynamic anomaly determination threshold is represented by T; The average local anomaly factor of the defect ROI is represented by F; The sensitivity coefficient is represented by S; The standard deviation of the local anomaly factor of all defect ROIs is represented by σ.

[0038] The dynamic anomaly determination threshold designed by the application is calculated based on the statistical quantity of the local anomaly factor of all known defect ROIs. This method makes the determination standard automatically adapt to the fluctuations in the production line environment and changes in the severity of defects. For example, when the overall quality of the production line improves and the defects become less severe, the threshold can also be adjusted accordingly, ensuring high detection rate and low false alarm rate of the detection system in long-term operation, and the robustness far exceeds the fixed threshold method.

[0039] Preferably, the method for constructing the enhanced feature vector of the ROI to be measured comprises: splicing the feature vector of the ROI to be measured with the corresponding local anomaly factor to form an enhanced feature vector.

[0040] The beneficial effects of the present application are that the present application proposes a two-stage automobile injection part defect detection method combining dynamic threshold abnormality preliminary screening and enhanced feature accurate classification. It first uses a dynamic threshold based on defect data statistics self-adaptive adjustment to optimize the improved local anomaly factor algorithm, efficiently and robustly filters out normal areas; then, the quantized "abnormal score" and the original image features are fused into "enhanced feature vectors", which are then sent to a neural network for fine classification. This method solves the technical pain points of low recognition rate of fuzzy defects and inability to adapt to changes in production line environment of traditional methods, significantly improving the accuracy and stability of detection. BRIEF DESCRIPTION OF DRAWINGS

[0041] Figure 1 is a flowchart schematically showing the automobile injection part defect classification method based on database comparison in the present application. DETAILED DESCRIPTION

[0042] The automobile injection part defect classification method based on database comparison disclosed in the embodiments of the present application is described below with reference to Figure 1 , which comprises steps S1-S4:

[0043] S1: Collect a large number of sample images and a plurality of images to be detected, and obtain a plurality of normal ROIs (Region of Interest), defect ROIs, and ROIs to be detected through feature region extraction technology.

[0044] It should be noted that a large amount of defect data is needed as a database for training by the neural network for classifying automobile injection part defects, so the present application first needs to obtain a plurality of defect data. In addition, images of automobile injection parts to be detected need to be collected.

[0045] Specifically, a large number of sample images and a plurality of images to be detected are collected. The sample images include two categories: the first category is normal sample images confirmed to have no visible defects; and the second category is defect sample images containing various typical defects. The images to be detected are collected in real time by an industrial camera arranged on an automobile injection part production line. Through feature region extraction technology, a plurality of normal ROIs (Region of Interest) are labeled on the normal sample images, a plurality of ROIs to be detected are labeled on the images to be detected, and defect ROIs are accurately labeled on the defect sample images, and each defect ROI is assigned an accurate category label. It should be noted that the number of sample images is one thousand. The feature region extraction technology is a prior art based on the OpenCV library, which performs edge detection, contour extraction, mask creation, and extraction of regions of interest on images. The category labels of defects include top white, black spots, flash, weld lines, and warping deformation.

[0046] At this point, several normal ROIs, defect ROIs, and to-be-tested ROIs are obtained.

[0047] S2: Based on the morphological, gray, and texture features of the normal ROIs, defect ROIs, and to-be-tested ROIs under different observation scales, a feature vector of an arbitrary ROI is obtained.

[0048] It should be noted that different types of defects exhibit different significant features under different observation scales. For example, a small bubble or black spot is obvious in a small scale, while a long and shallow weld mark or large-area warping deformation needs to be captured in a large scale. Multi-scale analysis can provide more comprehensive defect information. On the other hand, a CNN (Convolutional Neural Network) can automatically extract deep abstract features that are difficult to design manually from the original image through end-to-end learning. For example, the CNN can learn to distinguish the fine texture differences between the silver streaks caused by material moisture and the scratches caused by external force. Therefore, the present application combines multi-scale feature extraction and CNN to obtain the features of the ROI.

[0049] Specifically, an arbitrary ROI is denoted as a target ROI, and a multi-scale decomposition algorithm is used to downsample the target ROI to generate a decomposition image set of the target ROI , denoted as , where k is the number of scales, is the decomposition image of the target ROI at the kth scale.

[0050] It should be noted that the morphological features are mainly used to describe the geometric shape and size of the defect, which is crucial for distinguishing defects with significant shape differences caused by different physical causes. For example, a lack of glue appears as a large area of missing, while a bubble is usually a small and round area. The gray feature describes the brightness and contrast information of the defect area. This is particularly effective for distinguishing color anomaly defects caused by material changes or thermal effects. For example, burning usually shows a significant decrease in the average gray value of the local area, that is, blackening, while silver streaks cause the local gray standard deviation to increase due to light scattering. The texture feature is used to quantify the microstructure and regularity of the surface, which is crucial for distinguishing defects with similar macro shapes and gray levels but different surface textures. For example, a flow mark appears as a regular and gentle wave-like texture, while the surface of a shrink mark is usually smooth and has low texture complexity. Therefore, the present application combines the morphological, gray, and texture features of the ROI multi-scale image to comprehensively extract the features of the ROI.

[0051] Preferably, the morphological, gray, and texture features of the decomposition image set of the arbitrary ROI include:

[0052] Taking a target ROI as an example, the morphological features of the decomposed image set of the target ROI are obtained as follows: Otsu's method is used to binarize any decomposed image of the target ROI to obtain a binary matrix of the decomposed image. The elements with a value of 1 in the binary matrix of the decomposed image are accumulated to obtain the area of ​​the decomposed image of the target ROI. It should be noted that morphological features also include perimeter, roundness, aspect ratio, etc.

[0053] Obtain the grayscale features of the decomposed image set of the target ROI: Obtain the average grayscale value and grayscale standard deviation of any decomposed image of the target ROI. It should be noted that the average grayscale value reflects the overall brightness of the ROI, and the grayscale standard deviation reflects the grayscale contrast or the degree of change within the ROI.

[0054] Obtain the texture features of the decomposed image set of the target ROI: Obtain the normalized gray-level co-occurrence matrix of any decomposed image of the target ROI, and denote the normalized gray-level co-occurrence matrix of the m-th decomposed image of the target ROI as... It should be noted that the gray-level co-occurrence matrix is ​​an existing technology. For example, , representing the probability that pixel pairs with gray values ​​i and j appear in a specific spatial relationship, where the specific spatial relationship is horizontal adjacency. This means that when a random pair of pixels that are horizontally adjacent is selected, the probability that the gray value of the left pixel is 1 and the gray value of the right pixel is 2 is 2 / 9.

[0055] The contrast of the k-th decomposed image of the target ROI satisfies the expression:

[0056] ;

[0057] In the formula, The contrast of the m-th decomposed image of the target ROI; Indicates the maximum value within the grayscale range; , It represents the grayscale level; The gray levels in the gray-level co-occurrence matrix of the m-th decomposed image of the target ROI are... The probability of pixel pairs appearing in a preset spatial relationship; This represents the normalization function. The preset spatial relationship is a horizontally adjacent spatial relationship.

[0058] It should be noted that although the artificially designed features have clear physical meaning, their expression ability is limited and a large amount of prior knowledge is required, and the CNN can automatically extract deep abstract features that are difficult to design manually from the original image through end-to-end learning. Therefore, the present application combines the CNN technology to obtain the deep features of the ROI.

[0059] Preferably, a pre-trained convolutional neural network is used as a deep feature extractor, and the target ROI is input into the deep feature extractor to obtain a deep feature vector of the target ROI. It should be noted that the convolutional neural network is a prior art, such as a lightweight ResNet or MobileNet structure.

[0060] Preferably, the morphological, gray scale, texture features and deep feature vectors of the target ROI are spliced to obtain a feature vector of the target ROI.

[0061] At this point, the feature vector of each ROI is obtained, which combines multi-scale information and deep learning information.

[0062] S3: According to the difference between the feature vectors of the to-be-tested ROI and the normal ROI, a preliminary k-distance and a preliminary k-neighborhood are obtained; based on the distance between the to-be-tested ROI and the normal ROI of the preliminary k-neighborhood, an improved k-neighborhood of the to-be-tested ROI and a local anomaly factor of the to-be-tested ROI are obtained; the local anomaly factor of the defect ROI is calculated, and based on the difference between the local anomaly factors of the defect ROIs, a dynamic anomaly judgment threshold is obtained; the local anomaly factor of the to-be-tested ROI is compared with the dynamic anomaly judgment threshold to obtain a preliminary classification of the to-be-tested ROI, and the category includes defects or normal.

[0063] It should be noted that in injection molding production, not all regions that are different from normal samples are defects that need to be removed. For example, the surface of the injection molded part allows a certain range of texture fluctuations, or traces caused by slight wear of the mold, but within the tolerance range. Directly sending all candidate regions to the classifier will cause a huge computational burden and a high false positive rate, because the classifier may misjudge these normal fluctuations as a certain defect. Therefore, it is crucial to introduce an unsupervised anomaly detection step. The core idea of the Local Outlier Factor (LOF) algorithm anomaly detection algorithm is not to judge the anomaly based on a global and fixed standard, but to investigate the relative density of a data point and its local environment, so it is suitable for processing industrial scenes with uneven data distribution. The present application further improves the standard LOF and introduces a dynamic threshold mechanism to optimize the defect detection effect.

[0064] It should be noted that in order to evaluate the local density of the to-be-tested ROI, it is necessary to first define a neighborhood for the to-be-tested ROI, and the size of the neighborhood is determined by the parameter k.

[0065] Specifically, according to the feature vector difference between the to-be-tested ROI and the normal ROI, a preliminary k-distance and a preliminary k-neighborhood are obtained, including:

[0066] An arbitrary to-be-tested ROI is denoted as a target to-be-tested ROI, the feature vectors of all normal ROIs form a normal feature space, the target to-be-tested ROI is placed in the normal feature space, the Euclidean distance between the target to-be-tested ROI and all feature vectors of the normal feature space is calculated, the k-th smallest Euclidean distance value is found according to the order from small to large, that is, the preliminary k-distance of the target to-be-tested ROI, denoted as All normal sample points with a distance from the target to-be-tested ROI not greater than the k-distance form a preliminary k-neighborhood of the target to-be-tested ROI, denoted as It should be noted that the data points of the k-neighborhood are direct reference objects for evaluating the clustering degree of the target to-be-tested ROI.

[0067] It should be noted that in calculating the effective distance of the target to-be-tested ROI to the neighborhood data points, the standard LOF algorithm has an assumption that the contribution of all neighborhood data points is equal. However, the neighborhood data points closer to the target to-be-tested ROI can better reflect the real density thereof. Therefore, the present application introduces a weight function for adjusting the influence of the near and far neighbors, so that the density estimation is more accurate and robust.

[0068] Preferably, based on the distance between the to-be-tested ROI and the normal ROIs in the preliminary k-neighborhood, an improved k-distance of the to-be-tested ROI and a local anomaly factor of the to-be-tested ROI are obtained, including:

[0069] The improved k-distance of the target to-be-tested ROI satisfies the expression:

[0070] ;

[0071] In the formula, represents the improved k-distance from the neighborhood data point p to the target to-be-tested ROI, ; represents the preliminary k-distance of the target to-be-tested ROI; represents the Euclidean distance between the target to-be-tested ROI and the neighborhood data point p; is a distance weight function; represents a maximum function. It should be noted that the distance weight function is a Gaussian function.

[0072] In the formula, represents that if the target to-be-tested ROI is in a dense area, will be small, and the reachable distance is mainly determined by the real distance If the target ROI is in a sparse area, the reachable distance is more affected by the sparsity of the neighbors themselves, but the small effect of the near neighbors will be amplified by the weight and the maximum of the two is selected, making the improved k-distance more accurate.

[0073] It is noted that the local density of a data point can be intuitively understood as the inverse of the average distance of its surrounding points to it. The smaller the average distance, the denser the point.

[0074] The local reachable density of the target ROI satisfies the expression:

[0075] ;

[0076] In the expression, denotes the local reachable density of the target ROI; denotes the improved k-distance from the neighbor data point p to the target ROI; denotes the preliminary k-neighborhood of the target ROI; denotes the natural exponential function.

[0077] In the expression, denotes the sum of the improved k-distances of the target ROI and the data points in the preliminary k-neighborhood; denotes the average improved reachable distance of all points in the target ROI and the preliminary k-neighborhood. The smaller the average distance, the denser the points around the target ROI, and the greater the value of the local reachable density of the target ROI.

[0078] It is noted that the abnormal performance of the target ROI depends on how low its density is relative to the density of its neighbor data points. Thus, the local anomaly factor of the target ROI is calculated.

[0079] The local anomaly factor satisfies the expression:

[0080] ;

[0081] In the expression, denotes the local anomaly factor of the target ROI; denotes the local reachable density of the neighbor data point p of the target ROI; denotes the local reachable density of the target ROI; denotes the preliminary k-neighborhood of the target ROI.

[0082] In the expression, ​the ratio of the local reachable density of the neighborhood data point p representing the target ROI to be measured to the local reachable density of the target ROI to be measured, which reflects the density of the neighborhood data point p relative to the target ROI to be measured; the average ratio of the local reachable density of the neighborhood data point representing the target ROI to be measured to the local reachable density of the target ROI to be measured, which reflects the average density of the neighborhood data point relative to the target ROI to be measured, and the greater the value, the greater the local anomaly factor of the target ROI to be measured.

[0083] It should be noted that if , it means that the density of the target ROI to be measured is similar to that of its preliminary k-neighborhood data point, which may correspond to a normal surface texture fluctuation on the injection molded part, which is closely gathered with a large number of normal points in the feature space, and thus is not considered as an anomaly; if ≫1, it means that the density of the target ROI to be measured is significantly lower than the average density of the preliminary k-neighborhood data point, which is most likely to correspond to a real defect on the injection molded part, and the feature vector of the defect is far away from the area composed of a large number of normal surface points in the feature space.

[0084] It should be noted that the fixed threshold is feasible in a stable laboratory environment, but in real industrial production, due to fluctuations in factors such as raw material batch changes, equipment aging, process fine-tuning, workshop temperature and humidity, the entire normal area may shift as a whole in the normal feature space. At this time, the fixed threshold will become too strict or too loose. The dynamic threshold mechanism can make the judgment standard more accurate.

[0085] Preferably, the dynamic anomaly judgment threshold is obtained based on the difference of the local anomaly factors of the defect ROIs, comprising:

[0086] ;

[0087] In the formula, represents the dynamic anomaly judgment threshold; represents the average local anomaly factor of the defect ROIs; represents a sensitivity coefficient; represents the standard deviation of the local anomaly factors of all defect ROIs. It should be noted that the sensitivity coefficient is a configurable process parameter, for example, for a key injection molded part, a larger such as 5 is set to make the judgment more strict; for a general appearance part, a smaller such as 2 is set to balance the detection rate and the kill rate.

[0088] Preferably, for any ROI to be measured, if its local anomaly factor If the local anomaly factor of the ROI is greater than the dynamic anomaly determination threshold, the ROI is determined to be a defect; if the local anomaly factor of the ROI is less than the dynamic anomaly determination threshold, the ROI is determined to be normal, and the data is integrated into the defect ROI or the normal ROI to form a new local anomaly factor and a new dynamic anomaly determination threshold.

[0089] At this point, the anomaly determination of the ROI to be tested is completed.

[0090] S4: The feature vector of the ROI to be tested is spliced with the corresponding local anomaly factor to form an enhanced feature vector; and a defect classification model of an automobile injection part is established based on neural network technology.

[0091] It should be noted that the traditional classifier usually only relies on the original features for classification. However, through the anomaly detection link of S3, we have obtained the local anomaly factor of the ROI to be tested. The fusion of the local anomaly factor and the original features can significantly improve the ability of the classifier to distinguish complex and fuzzy boundary defects, so that the classifier can know the specific abnormality of the defect, which is crucial for identifying defects that are similar to normal background features but are essentially defects, such as distinguishing between slight flow marks and normal textures.

[0092] Specifically, the feature vector of the ROI to be tested is spliced with the corresponding local anomaly factor to form an enhanced feature vector.

[0093] It should be noted that neural networks, especially MLP (Multilayer Perceptron), have strong non-linear mapping capabilities and can automatically learn complex decision boundaries in high-dimensional feature spaces. This is particularly important for distinguishing defects of automobile injection parts, which have complex features and fuzzy class boundaries, such as distinguishing between warping deformation caused by uneven mold cooling and shrinkage caused by insufficient pressure retention. They may be similar in some features, but through neural networks, deeper discrimination patterns can be learned.

[0094] Preferably, the defect classification model of the automobile injection part comprises:

[0095] A network structure comprising an input layer, at least one hidden layer, and an output layer is established; ReLU function and Softmax function are used as activation functions; all defect ROIs are used for supervised learning and training of the MLP network, the input is the enhanced feature vector of all defect ROIs, and the output is the corresponding defect type of the defect ROI; a cross-entropy loss function is used as the loss function, and an Adam or SGD optimization algorithm is used for iterative optimization; after training, a defect classification model of the automobile injection part is obtained.

[0096] The enhanced feature vector of the ROI to be tested is input into the defect classification model of the automobile injection part to obtain the defect type of the ROI to be tested.

[0097] Thus far, the classification of the defects of the automobile injection-molded parts has been completed.

[0098] While the present specification has shown and described several embodiments of the present application, it is to be understood that such embodiments are merely illustrative of and not restrictive on the present application. Many modifications, changes, and substitutions can occur to one having ordinary skill in the art without departing from the spirit and scope of the present application.

Claims

1. A method for classifying defects in automotive injection molded parts based on database comparison, characterized in that, include: A large number of sample images and multiple images to be tested are collected. Through feature region extraction technology, several normal ROIs, defect ROIs, and ROIs to be tested are obtained. Based on the morphological, grayscale, and texture features of normal ROI, defective ROI, and ROI under test at different observation scales, the feature vector of any ROI is obtained; any ROI is denoted as the target ROI. Based on the difference in feature vectors between the ROI to be tested and the normal ROI, a preliminary k-distance and a preliminary k-neighborhood are obtained. Based on the distance between the ROI to be tested and the normal ROI in the preliminary k-neighborhood, an improved k-neighborhood of the ROI to be tested and a local anomaly factor of the ROI to be tested are obtained. The acquisition of the local anomaly factor of the ROI to be tested includes: performing negative correlation normalization on the average improved reachability distance between the target ROI to be tested and all points in the preliminary k-neighborhood to obtain the local reachability density of the target ROI to be tested. The local anomaly factors of the ROI to be tested satisfy the expression: In the formula, Represents local anomalies in the target ROI; This represents the local reachability density of neighborhood data points p of the target ROI; This represents the local reachability density of the target ROI. The initial k-neighborhood of the target ROI is represented; the local anomaly factor of the defect ROI is calculated, and based on the difference in the local anomaly factor of the defect ROI, the dynamic anomaly judgment threshold is obtained. The dynamic anomaly judgment threshold satisfies the expression: In the formula, Indicates the threshold for dynamic anomaly detection; The average local anomaly factor representing the defect ROI; Indicates the sensitivity coefficient; The standard deviation of the local anomaly factor of all defective ROIs is represented; the local anomaly factor of the ROI to be tested is compared with the dynamic anomaly judgment threshold to obtain the preliminary classification of the ROI to be tested, which includes defective or normal categories. Based on the feature vector of the ROI to be tested and the corresponding local anomaly factor, an enhanced feature vector of the ROI to be tested is constructed; based on neural network technology, a defect classification model for automotive injection molded parts is established; the enhanced feature vector of the ROI to be tested is input into the defect classification model for automotive injection molded parts to obtain the defect type of the ROI to be tested.

2. The method for classifying defects in automotive injection molded parts based on database comparison according to claim 1, characterized in that, The process of obtaining the feature vector of any ROI includes: The target ROI is downsampled using a multi-scale decomposition algorithm to generate a decomposed image set of the target ROI; the morphological features, grayscale features, and texture features of the decomposed image set of the target ROI are obtained. A pre-trained convolutional neural network is used as a deep feature extractor. The target ROI is input into the deep feature extractor to obtain the deep feature vector of the target ROI. The morphological, grayscale, texture, and depth feature vectors of the decomposed image set of the target ROI are concatenated to obtain the feature vector of the target ROI.

3. The method for classifying defects in automotive injection molded parts based on database comparison according to claim 2, characterized in that, The acquisition of morphological features of the decomposed image set of the target ROI includes: The Otsu method is used to binarize any decomposed image of the target ROI to obtain a binary matrix of the decomposed image. The elements with a value of 1 in the binary matrix of the decomposed image are accumulated to obtain the area of ​​the decomposed image of the target ROI. Morphological features also include perimeter, roundness, and aspect ratio.

4. The method for classifying defects in automotive injection molded parts based on database comparison according to claim 2, characterized in that, The acquisition of the texture features includes: Obtain the normalized gray-level co-occurrence matrix of any decomposed image of the target ROI; the texture feature is contrast. The contrast of the k-th decomposed image of the target ROI satisfies the expression: ; In the formula, The contrast of the m-th decomposed image of the target ROI; Indicates the maximum value within the grayscale range; , It represents the grayscale level; The gray levels in the gray-level co-occurrence matrix of the m-th decomposed image of the target ROI are... The probability of pixel pairs appearing in a preset spatial relationship; The function represents the normalization function; the preset spatial relationship is a horizontal adjacent spatial relationship.

5. The method for classifying defects in automotive injection molded parts based on database comparison according to claim 1, characterized in that, The process of obtaining the preliminary k-distance and the preliminary k-neighborhood includes: Any ROI to be tested is denoted as the target ROI. The feature vectors of all normal ROIs are used to construct the normal feature space. The target ROI is placed in the normal feature space. The Euclidean distance between the target ROI and all feature vectors in the normal feature space is calculated. The vectors are sorted in ascending order, and the k-th smallest Euclidean distance value is found, which is the initial k-distance of the target ROI. All normal sample points whose distance from the target ROI is not greater than the k-distance constitute the initial k-neighborhood of the target ROI.

6. The method for classifying defects in automotive injection molded parts based on database comparison according to claim 1, characterized in that, The method for obtaining the improved k-distance of the ROI to be measured includes: The improved k-distance for the target ROI satisfies the following expression: ; In the formula, This represents the improved k-distance from a neighboring data point p to the target ROI. ; This represents the initial k-distance of the target ROI to be measured; This represents the Euclidean distance between the target ROI and its neighboring data point p; It is a distance weighting function; The maximum value function is represented by the distance weight function, which is a Gaussian function.

7. The method for classifying defects in automotive injection molded parts based on database comparison according to claim 1, characterized in that, The construction of the enhanced feature vector of the ROI to be tested includes: concatenating the feature vector of the ROI to be tested with the corresponding local anomaly factor to form an enhanced feature vector.

Citation Information

Patent Citations

  • Data quality assessment method and system

    CN114926008B

  • Method for detecting global and local abnormal behaviors in crowd scene

    CN107491749A

  • Injection molding part defect detection method and device based on normal sample auxiliary feature extraction and medium

    CN115082386A