CN120747643B - Automobile injection molding part defect classification method based on database comparison - Google Patents

Automobile injection molding part defect classification method based on database comparison

Info

Publication number
CN120747643B
CN120747643B CN202511212908.3A CN202511212908A CN120747643B CN 120747643 B CN120747643 B CN 120747643B CN 202511212908 A CN202511212908 A CN 202511212908A CN 120747643 B CN120747643 B CN 120747643B
Authority
CN
China
Prior art keywords
roi
target roi
target
distance
local
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202511212908.3A
Other languages
Chinese (zh)
Other versions
CN120747643A (en
Inventor
裴海峰
胡攀锋
胡小伟
胡昌
胡丽丽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xi'an Weier Precision Technology Co ltd
Original Assignee
Xi'an Weier Precision Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xi'an Weier Precision Technology Co ltd filed Critical Xi'an Weier Precision Technology Co ltd
Priority to CN202511212908.3A priority Critical patent/CN120747643B/en
Publication of CN120747643A publication Critical patent/CN120747643A/en
Application granted granted Critical
Publication of CN120747643B publication Critical patent/CN120747643B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/0464Convolutional networks [CNN, ConvNet]
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/25Determination of region of interest [ROI] or a volume of interest [VOI]
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/44Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
    • G06V10/443Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components by matching or filtering
    • G06V10/449Biologically inspired filters, e.g. difference of Gaussians [DoG] or Gabor filters
    • G06V10/451Biologically inspired filters, e.g. difference of Gaussians [DoG] or Gabor filters with interaction between the filter responses, e.g. cortical complex cells
    • G06V10/454Integrating the filters into a hierarchical structure, e.g. convolutional neural networks [CNN]
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/46Descriptors for shape, contour or point-related descriptors, e.g. scale invariant feature transform [SIFT] or bags of words [BoW]; Salient regional features
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/54Extraction of image or video features relating to texture
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Software Systems (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Biophysics (AREA)
  • Mathematical Physics (AREA)
  • General Engineering & Computer Science (AREA)
  • Biodiversity & Conservation Biology (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • Databases & Information Systems (AREA)
  • Medical Informatics (AREA)
  • Injection Moulding Of Plastics Or The Like (AREA)

Abstract

The invention belongs to the technical field of image processing, and particularly relates to a method for classifying defects of an automobile injection molding part based on database comparison, which comprises the steps of extracting feature vectors fused with multi-scale artificial information and deep learning information from normal, defects and areas to be detected; the method comprises the steps of calculating local abnormal factors of a region to be detected, comparing the local abnormal factors with a judging threshold value dynamically generated based on defect data, realizing efficient preliminary screening of the abnormal region, splicing an original feature vector and the quantized local abnormal factors into an enhanced feature vector, inputting the enhanced feature vector into a neural network classification model, and carrying out accurate defect type judgment. According to the invention, through a two-stage strategy of dynamic threshold primary screening and enhanced feature precision separation, the accuracy and stability of defect detection of the automobile injection molding part are improved.

Description

Automobile injection molding part defect classification method based on database comparison
Technical Field
The invention relates to the technical field of image processing. More particularly, the invention relates to a method for classifying defects of an automobile injection molding part based on database comparison.
Background
The automatic detection of the surface quality of industrial products, in particular automobile injection molding parts, is a key link for guaranteeing the product quality and improving the production efficiency. Currently, a defect detection technology based on machine vision is widely applied, and aims to replace manual visual inspection so as to realize rapid and objective identification of the defects on the surface of a product. And often combines traditional image processing with machine learning models to accomplish defect detection and classification.
In the related art, for example, a chinese patent document with an authorized bulletin number CN114926008B discloses an intelligent fabric defect image recognition and automatic classification method and system, which discloses performing feature analysis on classified fabric images, performing defect type recognition on each classified fabric image in a classified fabric image group, marking the image defect feature groups one by using a defect type marking group, summarizing the marked image feature groups, training a deep learning model according to the marked image feature group set, so as to obtain an automatic defect recognition model, and improving accuracy and efficiency of fabric defect recognition.
However, in complex industrial production environments, the prior art still faces many challenges. Firstly, complex textures are often present on the surface of an automobile injection molding part, when the defect features are weak, the morphology is atypical or the texture is highly similar to the normal background texture, the traditional detection algorithm is easy to generate missed detection or false alarm due to insufficient feature distinction, so that the detection is insensitive and the classification accuracy is not high. And a single dependent neural network may ignore specific, interpretable geometric or texture information and have limited generalization ability for new types of defects.
Disclosure of Invention
In order to solve the technical problems of insufficient defect detection accuracy and poor classification effect, the invention provides an automobile injection molding part defect classification method based on database comparison, which comprises the following steps:
Collecting a large number of sample images and a plurality of images to be detected, acquiring a plurality of normal ROIs, fault ROIs and ROIs to be detected through a characteristic region extraction technology, acquiring characteristic vectors of any ROI based on morphology, gray scale and texture characteristics of the normal ROIs, the fault ROIs and the ROIs to be detected under different observation scales, marking any ROIs as target ROIs, acquiring preliminary k-distances and preliminary k-neighborhood according to the characteristic vector differences of the ROIs to be detected and the normal ROIs, acquiring improved k-neighborhood of the ROIs to be detected and local anomaly factors of the ROIs to be detected based on the distances of the normal ROIs and the preliminary k-neighborhood, calculating the local anomaly factors of the fault ROIs, acquiring a dynamic anomaly judgment threshold value based on the difference of the local anomaly factors of the fault ROIs, comparing the local anomaly factors of the ROIs to be detected with the dynamic anomaly judgment threshold value to obtain preliminary classification of the ROIs to be detected, wherein the classification comprises the fault or normal ROIs, constructing an enhanced characteristic vector of the ROIs to be detected based on the characteristic vectors of the ROIs to be detected and the corresponding local anomaly factors, establishing an automobile injection molding part classification model based on a neural network technology, and inputting the enhanced characteristic vector of the automobile injection molding part to be detected into an automobile injection molding part classification model to be detected to obtain the fault type.
The invention provides an innovative two-stage classification strategy. The method comprises a first stage, a second stage and a third stage, wherein the first stage is used for introducing a dynamic anomaly judgment threshold value which is jointly constructed based on a normal sample and a defect sample, optimizing an improved local anomaly factor (LOF) algorithm, filtering a large number of normal background areas in a high-efficient and self-adaptive mode, effectively reducing the calculation burden of follow-up fine classification, adapting to normal texture drift caused by factors such as raw material batch, equipment aging and the like in the production process, and having stronger robustness, and the second stage is used for splicing the local anomaly factor produced in the first stage with an original feature vector to form an enhanced feature vector by taking the local anomaly factor produced in the first stage as new dimensional information, and then sending the enhanced feature vector into a neural network for classification, so that the classifier can learn the anomaly degree of the local anomaly factor, and the identification capability of fuzzy defects similar to the normal background textures but basically defective is greatly improved, and the detection accuracy and reliability are remarkably improved.
Preferably, the acquiring the feature vector of any ROI includes:
Downsampling the target ROI by using a multiscale decomposition algorithm to generate a decomposition image set of the target ROI;
a pretrained convolutional neural network is adopted as a depth feature extractor, and a target ROI is input into the depth feature extractor to obtain a depth feature vector of the target ROI;
And splicing morphology, gray scale, texture characteristics and depth characteristic vectors of the decomposed image set of the target ROI to obtain the characteristic vectors of the target ROI.
The invention realizes complementary advantages by fusing traditional characteristics such as morphology, gray scale, texture and the like extracted after multi-scale decomposition with deep abstract characteristics extracted by CNN. The fusion strategy can accurately capture defect information with clear physical meaning, and can automatically discover complex and abstract discriminant features which are difficult to design manually by deep learning, so that the finally formed feature vector information is more comprehensive, the discriminant force is stronger, and a solid foundation is laid for subsequent accurate anomaly detection and classification.
Preferably, the acquiring morphological features of the decomposed image set of the target ROI includes:
And performing binarization processing on any decomposed image of the target ROI by using an Ojin method to obtain a binary matrix of the decomposed image, accumulating elements with the value of 1 of the binary matrix of the decomposed image to obtain the area of the decomposed image of the target ROI, wherein morphological characteristics further comprise perimeter, circularity and length-width ratio.
Preferably, the obtaining of the texture feature includes:
acquiring a normalized gray level co-occurrence matrix of any decomposed image of the target ROI, wherein the texture characteristic is contrast;
The contrast of the kth decomposition image of the target ROI satisfies the expression:
;
In the formula, Contrast of the mth decomposition image representing the target ROI; represents the maximum value of the gray scale range; , is the number of gray levels; Gray level in gray level co-occurrence matrix of mth decomposition image representing target ROI Probability of occurrence of pixel pairs of (2) in a preset spatial relationship; and representing a normalization function, wherein the preset spatial relationship is a horizontal adjacent spatial relationship.
Preferably, the acquiring the preliminary k-distance and the preliminary k-neighborhood includes:
Marking any ROI to be measured as the target ROI to be measured, forming a normal feature space by using feature vectors of all normal ROIs, placing the target ROI to be measured in the normal feature space, calculating Euclidean distances between the target ROI to be measured and all feature vectors of the normal feature space, and finding out a k minimum Euclidean distance value, namely a preliminary k-distance of the target ROI to be measured, wherein all normal sample points with the distances to the target ROI to be measured not more than the k-distance form a preliminary k-neighborhood of the target ROI to be measured according to the sequence from small to large.
Preferably, the obtaining the improved k-distance of the ROI to be measured includes:
The improved k-distance of the target ROI to be measured satisfies the expression:
;
In the formula, Representing an improved k-distance from the neighborhood data point p to the target ROI to be measured,;Representing the preliminary k-distance of the target to-be-measured ROI; Representing Euclidean distance between the target to-be-detected ROI and the neighborhood data point p; is a distance weight function; Representing a maximum function, and the distance weight function is a gaussian function.
The invention calculates the improved k-distance by introducing a distance weight function, so that the neighborhood data points which are closer to the ROI to be measured have larger contribution in density estimation. The improvement accords with the physical intuition of local density, can reflect the real density environment of the region to be detected more accurately, so that the local anomaly factor score calculated later can quantify the outlier degree more accurately, and the sensitivity and accuracy of anomaly detection are improved.
Preferably, the obtaining of the local abnormality factor of the ROI to be measured includes:
calculating the local reachable density of the target ROI to be measured;
The ROI local anomaly factor to be measured satisfies the expression:
;
In the formula, Representing local anomaly factors of the target ROI to be measured; a local reachable density of the neighborhood data point p representing the target ROI to be detected; Representing the local reachable density of the target ROI to be measured; Representing a preliminary k-neighborhood of the target ROI to be measured.
The invention describes a calculation method of local anomaly factors, which is characterized in that the local reachable density of an ROI to be detected is compared with the average local reachable density of the neighborhood points of the ROI to be detected, and the isolation degree of one point relative to the surrounding environment of the ROI can be quantized, so that the calculation method is very effective for processing data with uneven density, such as complex textures on the surface of an automobile injection molding part, and can accurately identify real defects which are located in a normal texture area but have remarkably low density.
Preferably, the local reachable density of the target ROI to be measured includes:
and carrying out negative correlation normalization on the average improved reachable distance of the target to-be-detected ROI and all points in the preliminary k-neighborhood to obtain the local reachable density of the target to-be-detected ROI.
Preferably, the acquiring the dynamic anomaly determination threshold value includes:
;
In the formula, Representing a dynamic anomaly determination threshold; An average local anomaly factor representing a defect ROI; representing a sensitivity coefficient; the standard deviation of the local anomaly factor for all defects ROI is represented.
The dynamic anomaly determination threshold value of the present design is calculated based on local anomaly factor statistics for all known defect ROIs. The method can automatically adapt to the fluctuation of the environment of the production line and the change of the severity of the defects, for example, when the overall quality of the production line is improved and the defects become lighter, the threshold value can be correspondingly adjusted, so that the high detection rate and the low false alarm rate of the detection system in long-term operation are ensured, and the method with the robustness far exceeding the fixed threshold value is realized.
Preferably, the construction of the enhanced feature vector of the ROI to be detected comprises the steps of splicing the feature vector of the ROI to be detected with the corresponding local abnormal factor to form an enhanced feature vector.
The method has the beneficial effects that the method for detecting the defects of the automobile injection molding parts at two stages is provided by combining the dynamic threshold abnormal primary screening with the accurate classification of the enhanced features. The method comprises the steps of optimizing an improved local anomaly factor algorithm by utilizing a dynamic threshold value based on adaptive adjustment of fault data statistics, filtering a normal area efficiently and robustly, fusing quantized anomaly scores and original image features into enhanced feature vectors, and sending the enhanced feature vectors into a neural network for fine classification. The method solves the technical pain points that the traditional method has low recognition rate of the fuzzy defects and can not adapt to the environmental change of the production line, and remarkably improves the detection accuracy and stability.
Drawings
FIG. 1 is a flow chart schematically illustrating a database comparison-based automotive injection molding defect classification method in accordance with the present invention.
Detailed Description
The embodiment of the invention discloses a method for classifying defects of an automobile injection molding part based on database comparison, which comprises the following steps of S1-S4 with reference to FIG. 1:
s1, collecting a large number of sample images and a plurality of images to be detected, and acquiring a plurality of normal ROIs (regions of interest, region of Interest), defect ROIs and ROIs to be detected through a characteristic region extraction technology.
It should be noted that, classifying defects of an injection molded part of an automobile through a neural network requires a large amount of defect data as a database to train, so that the invention needs to acquire a plurality of defect data first. In addition, an image of the automotive injection molding to be detected needs to be acquired.
Specifically, a large number of sample images and a plurality of images to be detected are acquired. The sample images include two categories, a first category being normal sample images that are confirmed to be free of any visible defects and a second category being defect sample images that include various typical defects. The image to be detected is acquired in real time through an industrial camera arranged on the automobile injection molding production line. Through a characteristic region extraction technology, a plurality of normal ROIs (regions of interest, region of Interest) are marked on a normal sample image, a plurality of ROIs to be detected are marked on an image to be detected, a defect ROI is accurately marked on a defect sample image, and meanwhile, an accurate category label is given to each defect ROI. The number of the sample images is one thousand. The feature region extraction technology is based on the OpenCV library, and is used for carrying out edge detection, contour extraction, mask creation and region of interest extraction on the image. The category labels of the defects comprise white top, black spots, flash, welding lines, buckling deformation and the like.
So far, a plurality of normal ROIs, defect ROIs and ROIs to be measured are obtained.
S2, acquiring a feature vector of any ROI based on morphology, gray scale and texture features of the normal ROI, the defect ROI and the ROI to be detected under different observation scales.
It should be noted that different types of defects exhibit different significant characteristics at different observation scales, for example, a small bubble or black spot is characterized significantly at a small scale, and a long and shallow weld mark or large-area warp deformation is required to capture its morphology effectively at a large scale. The use of multi-scale analysis can provide more comprehensive defect information. On the other hand, CNN (convolutional neural network ) can automatically extract deep abstract features which are difficult to design manually and have more discriminant ability from an original image through end-to-end learning. For example, CNN can learn fine texture differences that distinguish between silver marks in a divergent shape caused by raw material moisture and scratches in a directional shape caused by external force. Therefore, the invention combines multi-scale feature extraction with CNN to obtain the feature of the ROI.
Specifically, an arbitrary ROI is marked as a target ROI, and downsampling is carried out on the target ROI by using a multi-scale decomposition algorithm to generate a decomposition image set of the target ROIIs marked asWhere k is the number of scales,Is a decomposition image of the kth scale of the target ROI.
It should be noted that morphological features are mainly used to describe the geometry and size of defects, which is important to distinguish defects with significant shape differences due to different physical causes. For example, a lack of glue manifests as a large area of absence, whereas a bubble is typically a small and round area. The gray scale features describe the brightness and contrast information of the defect areas. This is particularly effective in distinguishing between abnormal color type defects due to material changes or thermal effects. For example, scorching is generally manifested as a significant reduction in local area average gray scale value, i.e., darkening, while silver streaks cause an increase in local gray scale standard deviation due to light scattering. Texture features are used to quantify the microstructure and regularity of a surface and are critical to distinguishing defects that are similar in macroscopic shape and gray scale, but differ in surface texture. For example, flow marks exhibit a regular, gentle wavy texture, while sink mark surfaces are generally smoother and have less texture complexity. Therefore, the invention combines morphological characteristics, gray characteristics and texture characteristics of the ROI multi-scale image to comprehensively extract the characteristics of the ROI.
Preferably, extracting morphological, gray, texture features of the decomposed image set of any ROI includes:
taking a target ROI as an example, obtaining morphological characteristics of a decomposed image set of the target ROI, namely performing binarization processing on any decomposed image of the target ROI by using an Ojin method to obtain a binary matrix of the decomposed image, and accumulating elements with the value of 1 of the binary matrix of the decomposed image to obtain the area of the decomposed image of the target ROI. Morphology features also include perimeter, circularity, aspect ratio, and the like.
And acquiring gray scale characteristics of a decomposed image set of the target ROI, namely acquiring average gray scale value and gray scale standard deviation of any decomposed image of the target ROI. The average gray value reflects the overall brightness of the ROI, and the gray standard deviation reflects the gray contrast or the intensity of change in the ROI.
Acquiring texture characteristics of a decomposition image set of the target ROI, namely acquiring a normalized gray level co-occurrence matrix of any decomposition image of the target ROI, and recording the normalized gray level co-occurrence matrix of an mth decomposition image of the target ROI asIt should be noted that the gray level co-occurrence matrix is the prior art, soIn the case of an example of this,Representing the probability that a pair of pixels having gray values i and j appear in a particular spatial relationship, the particular spatial relationship being horizontally adjacent, thenThe probability that a pixel pair conforming to the horizontal adjacent spatial relationship is randomly selected, the gray value of the left pixel is 1, and the gray value of the right pixel is 2/9 is shown.
The contrast of the kth decomposition image of the target ROI satisfies the expression:
;
In the formula, Contrast of the mth decomposition image representing the target ROI; represents the maximum value of the gray scale range; , is the number of gray levels; Gray level in gray level co-occurrence matrix of mth decomposition image representing target ROI Probability of occurrence of pixel pairs of (2) in a preset spatial relationship; representing the normalization function. The preset spatial relationship is a horizontally adjacent spatial relationship.
It should be noted that, although the manually designed features have clear physical meaning, the expression capability is limited, and a great amount of priori knowledge is required, while CNN can automatically extract deep abstract features which are difficult to design manually and have more discriminant ability from the original image through end-to-end learning. Therefore, the invention combines the CNN technology to acquire the depth characteristics of the ROI.
Preferably, a pretrained convolutional neural network is adopted as a depth feature extractor, and the target ROI is input into the depth feature extractor to obtain a depth feature vector of the target ROI. It should be noted that, the convolutional neural network is a prior art, for example, a lightweight ResNet or MobileNet structure.
Preferably, the morphology, gray scale, texture features and depth feature vectors of the decomposed image set of the target ROI are spliced to obtain the feature vector of the target ROI.
Thus, the feature vector of each ROI which fuses the multi-scale information and the deep learning information is obtained.
S3, acquiring a preliminary k-distance and a preliminary k-neighborhood according to the feature vector difference of the ROI to be detected and the normal ROI, acquiring an improved k-neighborhood of the ROI to be detected and a local anomaly factor of the ROI to be detected based on the distance between the ROI to be detected and the normal ROI of the preliminary k-neighborhood, calculating the local anomaly factor of the defect ROI, acquiring a dynamic anomaly judgment threshold value based on the difference of the local anomaly factors of the defect ROI, and comparing the local anomaly factors of the ROI to be detected with the dynamic anomaly judgment threshold value to obtain preliminary classification of the ROI to be detected, wherein the classification comprises defects or normal.
It should be noted that, in injection molding production, not all areas different from the normal samples are defects to be removed. For example, the surface of the injection molded part allows for a range of texture fluctuations, or marks due to slight mold wear, but within tolerance. Directly feeding all candidate regions into the classifier can create a huge computational burden and a high false positive rate, as the classifier may misjudge these normal fluctuations as a certain defect. Therefore, it is important to introduce an unsupervised anomaly detection link. The local anomaly factor (Local Outlier Factor, LOF) algorithm anomaly detection algorithm has the core idea that anomalies are not judged based on a global and fixed standard, but rather the relative density of a data point and the local environment where the data point is located is considered, so that the method is suitable for processing industrial scenes with uneven data distribution. The invention further improves the standard LOF and introduces a dynamic threshold mechanism to optimize the defect detection effect.
It should be noted that, in order to evaluate the local density of the ROI to be measured, a neighborhood is first defined for the ROI, and the size of the neighborhood is determined by the parameter k.
Specifically, according to the difference of feature vectors of the ROI to be detected and the normal ROI, obtaining a preliminary k-distance and a preliminary k-neighborhood, wherein the method comprises the following steps:
Marking any ROI to be measured as the target ROI to be measured, forming a normal feature space by feature vectors of all normal ROIs, placing the target ROI to be measured in the normal feature space, calculating Euclidean distances of the target ROI to be measured and all feature vectors of the normal feature space, and finding a k minimum Euclidean distance value, namely a preliminary k-distance of the target ROI to be measured according to the sequence from small to large, wherein the k minimum Euclidean distance value is recorded as . All normal sample points with the distance to the target ROI to be detected not greater than the k-distance form a preliminary k-neighborhood of the target ROI to be detected, which is recorded as. It should be noted that the data points of the k-neighborhood are direct reference objects for evaluating the degree of the target ROI group.
It should be noted that, in calculating the effective distance from the target ROI to its neighboring data points, there is an assumption that the contributions of all neighboring data points are equal in the standard LOF algorithm. However, a neighborhood data point closer to the target ROI to be measured more reflects the true density at which it is located. Therefore, the invention introduces a weight function for adjusting the influence of the near-far neighbors, so that the density estimation is more accurate and robust.
Preferably, the obtaining the improved k-distance of the ROI to be measured and the local anomaly factor of the ROI to be measured based on the distance between the ROI to be measured and the normal ROI of the preliminary k-neighborhood comprises:
The improved k-distance of the target ROI to be measured satisfies the expression:
;
In the formula, Representing an improved k-distance from the neighborhood data point p to the target ROI to be measured,;Representing the preliminary k-distance of the target to-be-measured ROI; Representing Euclidean distance between the target to-be-detected ROI and the neighborhood data point p; is a distance weight function; representing the maximum function. The distance weight function is a gaussian function.
In the formula,Representing the target ROI to be measured if it is in a dense regionWill be small, the reachable distance is mainly determined by the true distanceDeciding that if the target ROI to be detected is in a sparse region, the reachable distance is more subjected to the self-sparseness of the neighborsBut close proximity toThe small influence will be weightedThe maximum of the two is chosen to make the improved k-distance more accurate.
The local density of a data point can be intuitively understood as the inverse of the average distance from its surrounding points to it. The smaller the average distance, the denser the dots.
The local reachable density of the target ROI to be measured satisfies the expression:
;
In the formula, Representing the local reachable density of the target ROI to be measured; Representing an improved k-distance from the neighborhood data point p to the target ROI to be measured; representing a preliminary k-neighborhood of the target to-be-detected ROI; representing a natural exponential function.
In the formula,Representing the sum of improved k-distances of the target ROI and the data points in the preliminary k-neighborhood; Representing the average improved reachable distance between the target to-be-measured ROI and all points in the preliminary k-neighborhood, wherein the smaller the average distance is, the denser the points around the target to-be-measured ROI are, and the larger the local reachable density value is.
It should be noted that the abnormal behavior of the ROI to be measured depends on how low its density is relative to the density of its neighboring data points. Thus, local anomaly factors of the ROI to be measured are calculated.
The local anomaly factor satisfies the expression:
;
In the formula, Representing local anomaly factors of the target ROI to be measured; a local reachable density of the neighborhood data point p representing the target ROI to be detected; Representing the local reachable density of the target ROI to be measured; Representing a preliminary k-neighborhood of the target ROI to be measured.
In the formula,Representing the ratio of the local reachable density of the neighborhood data point p of the target ROI to be measured to the local reachable density of the target ROI, wherein the value reflects the density degree 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 reflects the average density degree of the neighborhood data point relative to the target ROI to be measured, and the larger the average density degree is, the larger the local anomaly factor of the target ROI to be measured is.
If it isThen it is explained that the density of the target ROI to be measured is almost the same as its preliminary k-neighborhood data point, which may correspond to a normal surface texture fluctuation on the injection molded part, which is closely clustered with a large number of normal points in the feature space and thus is not considered abnormal, if≫ 1, Which illustrates that the density of the target ROI to be measured is significantly lower than the average density of the preliminary k-neighborhood data points, it is highly likely that on an injection molded part, the feature vectors of these defects will correspond to true defects, which will be far from the region consisting of a large number of normal surface points in the feature space.
It should be noted that, fixedThe threshold is feasible in a stable laboratory environment, but in real industrial production, the whole normal region can drift in a normal feature space due to fluctuation of factors such as raw material batch variation, equipment aging, process fine adjustment, workshop temperature and humidity and the like. At this point, the fixed threshold may become too tight or too loose. The dynamic threshold mechanism can make the decision criteria more accurate.
Preferably, the obtaining the dynamic anomaly determination threshold based on the difference of the local anomaly factors of the defect ROI includes:
;
In the formula, Representing a dynamic anomaly determination threshold; An average local anomaly factor representing a defect ROI; representing a sensitivity coefficient; The standard deviation of the local anomaly factor for all defects ROI is represented. It should be noted that the sensitivity coefficient is a configurable process parameter, e.g. for critical injection molded parts, a larger set For general appearance, a smaller one is setE.g., 2, to balance the detection rate and the overstock rate.
Preferably, for any ROI to be measured, if it is locally abnormalIf the local abnormality factor is smaller than the dynamic abnormality judgment threshold, the determination is normal, and the data is integrated into the defect ROI or normal ROI to form a new local abnormality factor and a new dynamic abnormality judgment threshold.
Thus, the abnormality determination of the ROI to be measured is completed.
And S4, splicing the feature vector of the ROI to be detected with the corresponding local abnormal factor to form an enhanced feature vector, and establishing an automobile injection molding defect classification model based on a neural network technology.
It should be noted that, conventional classifiers generally rely only on original features for classification. However, by the anomaly detection step of S3, we have obtained local anomaly factors regarding the degree of anomaly of the ROI to be measured. The fusion of the local anomaly factors with the original features can significantly improve the capability of the classifier in distinguishing complex and fuzzy boundary defects, so that the classifier can know the specific anomalies of the defects, which is crucial for identifying defects similar to normal background features but defective in nature, such as distinguishing slight flow marks from normal textures.
Specifically, the feature vector of the ROI to be detected is spliced with the corresponding local abnormal factor to form an enhanced feature vector.
It should be noted that, the neural network, especially the MLP (Multilayer Perceptron, multi-layer perceptron), has a strong nonlinear mapping capability, and can automatically learn complex decision boundaries in the high-dimensional feature space. This is particularly important for distinguishing problems such as complex features and fuzzy category boundaries, such as defects of the injection-molded parts of the automobiles, for example, warpage due to uneven cooling of the molds and sink marks due to insufficient pressure maintaining, which may be similar in some features, but can learn a deeper discriminating mode through a neural network.
Preferably, establishing an automobile injection molding part defect classification model comprises the following steps:
The method comprises the steps of establishing a network structure comprising an input layer, at least one hidden layer and an output layer, using a ReLU function and a Softmax function as activation functions, performing supervised learning training on the MLP network by using all defect ROIs, inputting enhanced feature vectors of all defect ROIs, outputting corresponding defect types of the defect ROIs, using a cross entropy loss function as a loss function, performing iterative optimization through optimization algorithms such as Adam or SGD, and completing training to obtain an automobile injection molding defect classification model.
And (3) inputting the enhanced feature vector of the ROI to be detected into an automobile injection molding part defect classification model to obtain the defect type of the ROI to be detected.
Thus, the classification of the defects of the automobile injection molding parts is completed.
While various embodiments of the present invention have been shown and described herein, it will be obvious to those skilled in the art that such embodiments are provided by way of example only. Many modifications, changes, and substitutions will now occur to those skilled in the art without departing from the spirit and scope of the invention.

Claims (7)

1.基于数据库对比的汽车注塑件疵点分类方法,其特征在于,包括:1. A method for classifying defects in automotive injection molded parts based on database comparison, characterized by comprising: 采集大量样本图像和多个待检测图像,通过特征区域提取技术,获取若干个正常ROI、疵点ROI、待测ROI;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. 基于正常ROI、疵点ROI、待测ROI在不同观察尺度下呈现的形态学、灰度、纹理特征,获取任意ROI的特征向量;将任意ROI记为目标ROI;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. 根据待测ROI和正常ROI的特征向量差异,获取初步k-距离,以及初步k-邻域;基于待测ROI和初步k-邻域的正常ROI的距离,获取待测ROI的改进k-邻域,以及待测ROI的局部异常因子,所述待测ROI的局部异常因子的获取,包括:对目标待测ROI和初步k-邻域内所有点的平均改进可达距离,进行负相关归一化,得到目标待测ROI的局部可达密度;待测ROI局部异常因子满足表达式:;式中,表示目标待测ROI的局部异常因子;表示目标待测ROI的邻域数据点p的局部可达密度;表示目标待测ROI的局部可达密度;表示目标待测ROI的初步k-邻域;计算疵点ROI的局部异常因子,基于疵点ROI的局部异常因子的差异,获取动态异常判定阈值,动态异常判定阈值满足表达式:;式中,表示动态异常判定阈值;表示疵点ROI的平均局部异常因子;表示灵敏度系数;表示所有疵点ROI的局部异常因子的标准差;将待测ROI的局部异常因子与动态异常判定阈值进行比较,得到待测ROI的初步分类,类别包含疵点或正常;Based on the difference in feature vectors between the target ROI and normal ROIs, a preliminary k-distance and a preliminary k-neighborhood are obtained. Based on the distance between the target ROI and normal ROIs within the preliminary k-neighborhood, an improved k-neighborhood and a local anomaly factor of the target ROI are obtained. The acquisition of the local anomaly factor of the target ROI includes: negatively normalizing the average improved reachability distance between the target ROI and all points within the preliminary k-neighborhood to obtain the local reachability density of the target ROI. The local anomaly factor of the target ROI satisfies 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. 基于待测ROI的特征向量与对应局部异常因子,构建待测ROI的增强特征向量;基于神经网络技术,建立汽车注塑件疵点分类模型;将待测ROI的增强特征向量输入汽车注塑件疵点分类模型,得到待测ROI的疵点类型。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.根据权利要求1所述的基于数据库对比的汽车注塑件疵点分类方法,其特征在于,所述获取任意ROI的特征向量,包括:2. The method for classifying defects in automotive injection molded parts based on database comparison according to claim 1, characterized in that, obtaining the feature vector of any ROI includes: 对目标ROI使用多尺度分解算法进行降采样,生成目标ROI的分解图像集;获取目标ROI的分解图像集的形态学特征、灰度特征、纹理特征;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. 采用预训练的卷积神经网络作为深度特征提取器,将目标ROI输入所述深度特征提取器,得到目标ROI的深度特征向量;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. 将目标ROI的分解图像集的形态学、灰度、纹理特征以及深度特征向量进行拼接,得到目标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.根据权利要求2所述的基于数据库对比的汽车注塑件疵点分类方法,其特征在于,所述获取目标ROI的分解图像集的形态学特征,包括:3. The method for classifying defects in automotive injection molded parts based on database comparison according to claim 2, characterized in that, obtaining the morphological features of the decomposed image set of the target ROI includes: 使用大津法对目标ROI的任意分解图像进行二值化处理,得到所述分解图像的二值矩阵,对所述分解图像的二值矩阵的数值为1的元素进行累计,得到目标ROI的所述分解图像的面积;形态学特征还包括周长、圆形度、长宽比。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.根据权利要求2所述的基于数据库对比的汽车注塑件疵点分类方法,其特征在于,所述纹理特征的获取,包括: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: 获取目标ROI的任意分解图像的归一化灰度共生矩阵;所述纹理特征是对比度;Obtain the normalized gray-level co-occurrence matrix of any decomposed image of the target ROI; the texture feature is contrast. 目标ROI的第k个分解图像的对比度满足表达式:The contrast of the k-th decomposed image of the target ROI satisfies the expression: ; 式中,表示目标ROI的第m个分解图像的对比度;表示灰度范围的最大值;是灰度的级数;表示目标ROI的第m个分解图像的灰度共生矩阵中灰度级为的像素对以预设空间关系出现的概率;表示归一化函数;所述预设空间关系是水平相邻空间关系。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.根据权利要求1所述的基于数据库对比的汽车注塑件疵点分类方法,其特征在于,所述获取初步k-距离,以及初步k-邻域,包括:5. The method for classifying defects in automotive injection molded parts based on database comparison according to claim 1, characterized in that obtaining the preliminary k-distance and the preliminary k-neighborhood includes: 将任意待测ROI记为目标待测ROI,将所有正常ROI的特征向量构成正常特征空间,将目标待测ROI置于正常特征空间,计算目标待测ROI与正常特征空间的所有特征向量的欧氏距离,按照从小到大排序,找到第k个最小的欧式距离值,也就是目标待测ROI的初步k-距离;所有与目标待测ROI的距离不大于所述k-距离的正常样本点,构成了目标待测ROI的初步k-邻域。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.根据权利要求1所述的基于数据库对比的汽车注塑件疵点分类方法,其特征在于,所述获取待测ROI的改进k-距离,包括:6. The method for classifying defects in automotive injection molded parts based on database comparison according to claim 1, characterized in that, obtaining the improved k-distance of the ROI to be tested includes: 目标待测ROI的改进k-距离满足表达式:The improved k-distance for the target ROI satisfies the following expression: ; 式中,表示从邻域数据点p到目标待测ROI的改进k-距离,表示目标待测ROI的初步k-距离;表示目标待测ROI与邻域数据点p的欧氏距离;是距离权重函数;表示最大值函数;所述距离权重函数是高斯函数。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.根据权利要求1所述的基于数据库对比的汽车注塑件疵点分类方法,其特征在于,所述构建待测ROI的增强特征向量,包括:将待测ROI的特征向量与对应局部异常因子进行拼接,构成一个增强特征向量。7. The method for classifying defects in automotive injection molded parts based on database comparison according to claim 1, characterized in that, the step of constructing 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.
CN202511212908.3A 2025-08-28 2025-08-28 Automobile injection molding part defect classification method based on database comparison Active CN120747643B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202511212908.3A CN120747643B (en) 2025-08-28 2025-08-28 Automobile injection molding part defect classification method based on database comparison

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202511212908.3A CN120747643B (en) 2025-08-28 2025-08-28 Automobile injection molding part defect classification method based on database comparison

Publications (2)

Publication Number Publication Date
CN120747643A CN120747643A (en) 2025-10-03
CN120747643B true CN120747643B (en) 2025-11-28

Family

ID=97196237

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202511212908.3A Active CN120747643B (en) 2025-08-28 2025-08-28 Automobile injection molding part defect classification method based on database comparison

Country Status (1)

Country Link
CN (1) CN120747643B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107491749A (en) * 2017-08-11 2017-12-19 南京邮电大学 Global and local anomaly detection method in a kind of crowd's scene
CN115082386A (en) * 2022-06-07 2022-09-20 华南理工大学 Injection molding part flaw detection method and device based on normal sample auxiliary feature extraction and medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113484817A (en) * 2021-06-30 2021-10-08 国网上海市电力公司 Intelligent electric energy meter automatic verification system abnormity detection method based on TSVM model
CN118331822A (en) * 2024-04-21 2024-07-12 济南浪潮数据技术有限公司 Abnormal information detection method and device, storage medium and electronic device
CN118965216B (en) * 2024-07-17 2025-09-19 北京理工大学 Welding implicit anomaly detection and identification method based on multi-source data
CN120147710A (en) * 2025-02-25 2025-06-13 广州市东建工程建设监理有限公司 A method for identifying engineering construction quality defects based on artificial intelligence
CN120356002A (en) * 2025-04-18 2025-07-22 淮阴工学院 Packaging material flaw detection method and system based on machine vision

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107491749A (en) * 2017-08-11 2017-12-19 南京邮电大学 Global and local anomaly detection method in a kind of crowd's scene
CN115082386A (en) * 2022-06-07 2022-09-20 华南理工大学 Injection molding part flaw detection method and device based on normal sample auxiliary feature extraction and medium

Also Published As

Publication number Publication date
CN120747643A (en) 2025-10-03

Similar Documents

Publication Publication Date Title
CN111179251B (en) Defect detection system and method based on twin neural network and by utilizing template comparison
CN111862064B (en) Silver wire surface flaw identification method based on deep learning
CN115082683A (en) Injection molding defect detection method based on image processing
CN119919400B (en) Intelligent detection method for automobile decorative plate machining process
CN118644483A (en) A method and system for detecting defects in a flexible circuit board
CN108229458A (en) A kind of intelligent flame recognition methods based on motion detection and multi-feature extraction
CN114494780A (en) Semi-supervised industrial defect detection method and system based on feature comparison
CN115439405B (en) Method for classifying surface defects of steel plate
CN111445471A (en) Product surface defect detection method and device based on deep learning and machine vision
CN119991544B (en) Intelligent classification method and system for strain clamp defects of power transmission line based on two-dimensional image
CN120833319B (en) Mobile phone silica gel shell appearance detection system based on optical image sensor
CN120580226B (en) Automatic detection and classification method of intelligent manufacturing defects based on machine vision
CN120612327A (en) A visual inspection system and method for minor defects in industrial products
TW202034421A (en) Color filter inspection device, inspection device, color filter inspection method, and inspection method
CN120235842A (en) Intelligent detection method, device and equipment for plastic containers
CN120890989A (en) AI-based intelligent inspection system and method for multimodal visual quality of precast components
CN108615039A (en) Cartridge case defect automatic testing method based on computer vision
CN121258912A (en) Computer vision-based glass flaw identification method, system, equipment and medium
CN120747643B (en) Automobile injection molding part defect classification method based on database comparison
CN118918104B (en) Automatic identification method and system for defects of concrete member
CN120783127A (en) Fabric defect real-time identification method and device based on deep learning
CN118225803B (en) Visual detection method for appearance of blade surface of bulldozer
CN120088182A (en) Precision injection mold surface defect visual recognition system and method
CN117635581A (en) A method for automotive VIN etching image positioning and defect detection
CN120808037B (en) Clock spare and accessory part flaw part classification and identification method and system based on vision technology

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant