Defect Detection Method, Electronic Device, and Storage Medium

By performing dimensionality reduction processing on image data and combining Gaussian hybrid model to detect defects, the problem of low detection accuracy is solved and efficient defect detection effect is achieved.

CN114943674BActive Publication Date: 2025-07-25FU TAI HUA IND SHENZHEN +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110183357.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-09
Publication Date
2025-07-25
Estimated Expiration
2041-02-09

AI Technical Summary

Technical Problem

In the prior art, when detecting defects in image data, there is a problem that the detection accuracy is low due to high characteristic similarity.

Method used

Direct dimensionality reduction processing of image data is used, and defect detection is performed in combination with Gaussian mixed model. Dimension reduction is performed through principal component analysis, random projection, isometric mapping and t-distribution random neighborhood embedding algorithm. The Gaussian mixed model is used for scoring, simplifying the convolution feature extraction process.

Benefits of technology

Improves the accuracy of defect detection, simplifies the computing process, and avoids information loss.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114943674B_ABST
    Figure CN114943674B_ABST
Patent Text Reader

Abstract

The present invention provides a defect detection method, including: dividing a plurality of product images to be detected into linear images or non-linear images; performing dimensionality reduction processing on the product images after image division according to a plurality of dimensionality reduction algorithms to obtain a plurality of dimensionality reduction data; determining the optimal dimensionality reduction data among the plurality of dimensionality reduction data; inputting the optimal dimensionality reduction data into a Gaussian mixture model to obtain scoring data of the product images; comparing the scoring data with a threshold value to determine whether the scoring data is less than the threshold value; and when the scoring data is less than the threshold value, determining that there are defects in the product images. The present invention also provides an electronic device and a storage medium. In the data processing process of the present invention, there is no need to extract convolution features, which simplifies the operation process and avoids information loss, thereby effectively improving the accuracy of defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of appearance detection, and particularly to a defect detection method, an electronic device, and a storage medium. Background Art

[0002] With the development of science and technology, neural network models based on deep learning, such as convolutional neural networks, are widely used in the field of artificial intelligence and can achieve the automation of various functions, such as the automated detection and classification of data such as modulated data and image data. When detecting defect signals in image data, it is usually necessary to train a convolutional neural network according to a data set, extract features from the last convolutional layer during the training process, and then perform subsequent defect signal detection. However, when the similarity of the original image data is relatively high, the similarity of the extracted features will also be relatively high and difficult to classify, thereby reducing the detection accuracy of defect signals. Summary of the Invention

[0003] In view of this, it is necessary to provide a defect detection method, an electronic device, and a storage medium that directly perform dimensionality reduction processing on the image data to be detected and combine a Gaussian mixture model for defect detection to improve the detection accuracy.

[0004] The first aspect of the present invention provides a defect detection method, and the method includes:

[0005] Dividing multiple product images to be detected into linear images or non-linear images;

[0006] Performing dimensionality reduction processing on the product images after image division according to multiple dimensionality reduction algorithms to obtain multiple dimensionality reduction data;

[0007] Determining the optimal dimensionality reduction data among the multiple dimensionality reduction data;

[0008] Inputting the optimal dimensionality reduction data into a Gaussian mixture model to obtain scoring data of the product images;

[0009] Comparing the scoring data with a threshold value to determine whether the scoring data is less than the threshold value; and

[0010] When the scoring data is less than the threshold value, determining that there are defects in the product images.

[0011] Preferably, the method further includes:

[0012] When the scoring data is greater than or equal to the threshold value, determining that there are no defects in the product images.

[0013] Preferably, the dividing multiple product images to be detected into linear images or non-linear images includes:

[0014] Normalize the product image to be detected;

[0015] Input the pixel values of the product image into a linear scoring function to obtain classification scores for the linear image and the non - linear image;

[0016] Determine whether the classification score of the linear image is greater than the classification score of the non - linear image;

[0017] When it is determined that the classification score of the linear image is greater than the classification score of the non - linear image, classify the product image as a linear image; and

[0018] When the classification score of the linear image is not greater than the classification score of the non - linear image, classify the product image as a non - linear image.

[0019] Preferably, the obtaining of multiple dimensionality - reduced data by performing dimensionality - reduction processing on the product image after image classification according to multiple dimensionality - reduction algorithms includes:

[0020] When the product image is a linear image, perform dimensionality - reduction on the product image using the principal component analysis algorithm and the random projection algorithm respectively; and

[0021] When the product image is a non - linear image, perform dimensionality - reduction on the product image using the isometric mapping algorithm and the t - distributed stochastic neighbor embedding algorithm respectively.

[0022] Preferably, the determination of the best dimensionality - reduced data among the multiple dimensionality - reduced data:

[0023] Calculate the average distance between the multiple dimensionality - reduced data obtained by each dimensionality - reduction algorithm; and

[0024] Determine the dimensionality - reduced data with the largest average distance as the best dimensionality - reduced data.

[0025] Preferably, the obtaining of the scoring data of the product image by inputting the best dimensionality - reduced data into a Gaussian mixture model includes:

[0026] Determine the number of Gaussian models in the Gaussian mixture model according to the number of types of defects to be detected; and

[0027] Calculate the expected value and the model parameter values of each iteration of the Gaussian mixture model according to the best dimensionality - reduced data and the EM algorithm; and

[0028] Deduce the best parameters of the Gaussian mixture model as the scoring data according to the expected value and the model parameter values calculated in each iteration.

[0029] Preferably, the threshold is the difference between the mean of the model parameter values calculated in each iteration and three times the standard deviation of the scoring data.

[0030] Preferably, the method further includes:

[0031] Marking the defective area on the product image and displaying the marked product image on the display screen.

[0032] A second aspect of the present invention provides an electronic device, including:

[0033] A processor; and

[0034] A memory, in which a plurality of program modules are stored, and the plurality of program modules are loaded and executed by the processor to perform the above-mentioned defect detection method.

[0035] A third aspect of the present invention provides a storage medium, on which at least one computer instruction is stored, and the instruction is loaded and executed by the processor to perform the above-mentioned defect detection method.

[0036] The above-mentioned defect detection method, electronic device and storage medium directly perform dimensionality reduction processing on the image data to be detected, and combine the Gaussian mixture model for defect detection. During the data processing process, there is no need to extract convolution features, which simplifies the operation process and avoids information loss, thereby effectively improving the accuracy of defect detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained according to the provided drawings without creative efforts.

[0038] Figure 1 It is a schematic structural diagram of an electronic device provided by a preferred embodiment of the present invention.

[0039] Figure 2 It is a schematic structural diagram of a defect detection system provided by a preferred embodiment of the present invention.

[0040] Figure 3 It is a flowchart of a defect detection method provided by a preferred embodiment of the present invention.

[0041] MAIN ELEMENT SYMBOL DESCRIPTION

[0042] Electronic device 1 Processor 10 Defect detection system 100 Acquisition module 101 Partitioning module 102 Dimensionality reduction module 103 Determination module 104 Calculation module 105 Judgment module 106 Display module 107 Memory 20 Computer program 30 Display screen 40

[0043] The following specific embodiments will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION OF THE INVENTION

[0044] In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, without conflict, the embodiments of the present application and the features in the embodiments may be combined with each other.

[0045] In the following description, many specific details are set forth in order to provide a thorough understanding of the present invention. The described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of protection of the present invention.

[0046] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which the present invention belongs. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments, and are not intended to limit the present invention.

[0047] Please refer to Figure 1 shown, which is a schematic structural diagram of an electronic device provided by a preferred embodiment of the present invention.

[0048] The defect detection method in the present invention is applied to the electronic device 1. The electronic device 1 may be an electronic device installed with a defect detection program, such as a personal computer, a server, etc. Among them, the server may be a single server, a server cluster or a cloud server, etc.

[0049] The network where the electronic device 1 is located includes, but is not limited to, the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (VPN), etc.

[0050] The electronic device 1 includes, but is not limited to, a processor 10, a memory 20, a computer program 30 stored in the memory 20 and executable on the processor 10, and a display screen 40. For example, the computer program 30 is a defect detection program. When the processor 10 executes the computer program 30, the steps in the defect detection method are implemented, such as Figure 3 the steps S301 to S309 shown. Alternatively, when the processor 10 executes the computer program 30, the functions of each module / unit in the defect detection system are implemented, such as Figure 2 the modules 101-107 in

[0051] Exemplarily, the computer program 30 may be divided into one or more modules / units, which are stored in the memory 20 and executed by the processor 10 to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program 30 in the electronic device 1. For example, the computer program 30 may be divided into Figure 3 the acquisition module 101, the division module 102, the dimensionality reduction module 103, the determination module 104, the calculation module 105, the judgment module 106, and the display module 107 in Figure 3 . For the specific functions of each module, refer to the functions of each module in the embodiment of the defect detection system.

[0052] Those skilled in the art can understand that the schematic diagram is only an example of the electronic device 1, and does not constitute a limitation on the electronic device 1. It may include more or fewer components than shown in the figure, or combine some components, or different components. For example, the electronic device 1 may further include input / output devices, network access devices, buses, etc.

[0053] The so-called processor 10 may be a central processing unit (CPU), or may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor, or the processor 10 may also be any conventional processor, etc. The processor 10 is the control center of the electronic device 1, and connects various parts of the entire electronic device 1 through various interfaces and lines.

[0054] The memory 20 can be used to store the computer program 30 and / or modules / units. The processor 10 implements various functions of the electronic device 1 by running or executing the computer program and / or modules / units stored in the memory 20 and calling the data stored in the memory 20. The memory 20 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the electronic device 1 (such as audio data, a phone book, etc.), etc. In addition, the memory 20 can include a volatile memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other storage devices.

[0055] See also Figure 2 As shown, it is a functional module diagram of the defect detection system provided in a preferred embodiment of the present invention.

[0056] In some embodiments, the defect detection system 100 runs in the electronic device 1. The defect detection system 100 may include a plurality of functional modules composed of program code segments. The program code of each program segment in the defect detection system 100 may be stored in the memory 20 of the electronic device 1 and executed by the at least one processor 10 to implement the defect detection function.

[0057] In this embodiment, the defect detection system 100 can be divided into multiple functional modules according to the functions it performs. Figure 2 As shown, the functional modules may include an acquisition module 101, a division module 102, a dimensionality reduction module 103, a determination module 104, a calculation module 105, a judgment module 106 and a display module 107. The module referred to in the present invention refers to a series of computer program segments that can be executed by at least one processor and can complete fixed functions, which are stored in the memory 20. It can be understood that in other embodiments, the above modules may also be program instructions or firmware solidified in the processor 10.

[0058] The acquisition module 101 is used for acquiring the product image to be detected according to the defect detection request when a defect detection request is received.

[0059] In this embodiment, the defect detection request may be triggered by a user (eg, triggered by a preset function button) or may be automatically triggered within a preset time.

[0060] In this embodiment, the defect detection request at least includes detection object information. Specifically, the defect detection request is parsed to obtain the detection object information in the defect detection request, and the product image to be detected is obtained from the image library to be detected according to the detection object information. Among them, the detection object information may be a product name, a product model, etc.

[0061] The partitioning module 102 is configured to partition a plurality of product images to be detected into linear images or non-linear images.

[0062] In this embodiment, the partitioning module 102 performs normalization processing on the product image to be detected, inputs the pixel values of the product image into a linear scoring function to obtain classification scores of the linear image and the non-linear image, and determines whether the classification score of the linear image is greater than the classification score of the non-linear image. When it is determined that the classification score of the linear image is greater than the classification score of the non-linear image, the product image is partitioned into a linear image; when the classification score of the linear image is not greater than the classification score of the non-linear image, the product image is partitioned into a non-linear image.

[0063] For example, the linear scoring function is f(x i , W, b) = Wx i + b. Assume that each image data is stretched into a column vector with a length of D, having a size of [D x 1]. Among them, the matrix W with a size of [KxD] and the column vector b with a size of [Kx1] are parameters of the linear scoring function, and x i contains all pixel information of the i-th image, and these pixel information are stretched into a column vector of [px1]. The size of W is [qxp], and the size of b is [qx1]. Among them, p is the number of pixel points of the product image, and q is the number of categories. In this embodiment, q is 2. Therefore, P numbers (original pixel values) are input into the linear scoring function, and the linear scoring function outputs 2 numbers (scores obtained from different classifications), and then the scores of different classifications are compared. Among them, the parameter W is the weight, and b is called the bias vector.

[0064] The dimensionality reduction module 103 is configured to perform dimensionality reduction processing on the product image after image partitioning according to a plurality of dimensionality reduction algorithms to obtain a plurality of dimensionality reduction data.

[0065] In this embodiment, when the product image is a linear image, the dimensionality reduction module 103 respectively uses the principal component analysis algorithm (PCA) and the random projection algorithm (Random Project) to perform dimensionality reduction on the product image. When the product image is a non-linear image, the dimensionality reduction module 103 respectively uses the isometric mapping algorithm (Isomap) and the t-distributed stochastic neighbor embedding algorithm (t-SNE) to perform dimensionality reduction on the product image.

[0066] Specifically, when performing dimensionality reduction using the principal component analysis algorithm, the dimensionality reduction module 103 first subtracts the sample mean from the sample data, then calculates the principal components of the data by computing the data covariance matrix, and finally maps the data onto the principal components through a transformation matrix, thereby achieving dimensionality reduction of the product image.

[0067] When performing dimensionality reduction using the random projection algorithm, the dimensionality reduction module 103 first selects a mapping matrix R ∈ R K×N , fills the mapping matrix with random numbers, normalizes each row in the mapping matrix, and then reduces the dimensionality of the data through y = RX. Here, X is the input data and y is the data after dimensionality reduction.

[0068] When performing dimensionality reduction using the isometric mapping algorithm, the dimensionality reduction module 103 determines the k-nearest neighbors in the sample data, that is, the product image pixel points, sets the distance between the pixel points and their k-nearest neighbors as the Euclidean distance, and the distance to other points as infinity. It uses the shortest path algorithm to calculate the distance between any two pixel points, and takes this distance as the input data of the multidimensional scaling analysis algorithm. Through the multidimensional scaling analysis algorithm, it outputs the projection of the product image pixel points in the low-dimensional space, thereby obtaining the dimensionality-reduced image.

[0069] When performing dimensionality reduction using the t-distributed stochastic neighbor embedding algorithm (t-SNE), the dimensionality reduction module 103 converts the high-dimensional Euclidean distance between the sample data, that is, the pixel points of the product image, into a conditional probability representing similarity through stochastic neighbor embedding (SNE). For the low-dimensional counterparts of the high-dimensional data points Xi and Xj, it calculates a similar conditional probability, uses the gradient descent method to minimize the KL distance, and defines the perplexity, thereby obtaining the corresponding low-dimensional data.

[0070] The determination module 104 is used to determine the optimal dimensionality-reduced data among the multiple dimensionality-reduced data.

[0071] In this embodiment, the determination module 104 calculates the average distance between the multiple dimensionality-reduced data obtained by each dimensionality reduction algorithm, and determines the multiple dimensionality-reduced data with the largest average distance as the optimal dimensionality-reduced data. It should be noted that the greater the distance between the dimensionality-reduced data, the better the dimensionality reduction effect. In this embodiment, the distance between the multiple dimensionality-reduced data is the distance of the data points in the adjacency graph.

[0072] The calculation module 105 is configured to input the optimal dimensionality-reduced data into a Gaussian mixture model to obtain the scoring data of the product image.

[0073] In this embodiment, the calculation module 105 performs mean pooling on the optimal dimensionality-reduced data to obtain a target vector, and then inputs the target vector into a pre-trained Gaussian mixture model to obtain the scoring data. Among them, the Gaussian mixture model can accurately quantify the score corresponding to the target vector by using the Gaussian probability density function (normal distribution image curve).

[0074] Specifically, the calculation module 105 determines the number of Gaussian models in the Gaussian mixture model according to the number of types of defects to be detected, calculates the expected value of the Gaussian mixture model and the model parameter values of each iteration according to the optimal dimensionality-reduced data and the EM (Expectation-Maximum) algorithm, and calculates the optimal parameters of the Gaussian mixture model as the scoring data according to the expected value and the model parameter values calculated in each iteration. In this embodiment, the number of Gaussian models in the Gaussian mixture model is 2.

[0075] In this embodiment, the calculation module 105 may divide the training sample data into a training set, a test set, and a validation set, and then, based on the maximum expectation algorithm, iteratively train multiple low-dimensional vectors in the training set to obtain a learner, and then use the multiple low-dimensional vectors in the test set to test the learner to obtain a test result. When the test result is less than the configured value, the calculation module 105 uses the multiple low-dimensional vectors in the validation set to adjust the parameters in the learner to obtain the pre-trained Gaussian mixture model. In this embodiment, the calculation module 105 calculates the number of the multiple low-dimensional vectors, and when the number is less than the preset number, uses a data augmentation algorithm to increase the number of the multiple low-dimensional vectors.

[0076] The judgment module 106 is configured to compare the scoring data with a threshold to judge whether the scoring data is less than the threshold.

[0077] In this embodiment, the threshold is the difference between the mean of the model parameter values calculated in each iteration and three times the standard deviation of the scoring data.

[0078] The determination module 104 further determines that there are defects in the product image when the scoring data is less than the threshold.

[0079] The determination module 104 further determines that there are no defects in the product image when the scoring data is greater than or equal to the threshold.

[0080] The display module 107 is configured to mark the defective areas on the product image and display the marked product image on the display screen.

[0081] Please refer to Figure 3 shown in the flowchart of the defect detection method provided by the preferred embodiment of the present invention. According to different requirements, the order of steps in the flowchart can be changed, and some steps can be omitted.

[0082] S301, when a defect detection request is received, obtain the product image to be detected according to the defect detection request.

[0083] In this embodiment, the defect detection request can be triggered by a user (for example: triggered by a preset function key), or can be automatically triggered within a preset time.

[0084] In this embodiment, the defect detection request at least includes detection object information. Specifically, analyze the defect detection request to obtain the detection object information in the defect detection request, and obtain the product image to be detected from the image library to be detected according to the detection object information. Among them, the detection object information can be a product name, a product model, etc.

[0085] S302, divide the multiple product images to be detected into linear images or non-linear images.

[0086] In this embodiment, perform normalization processing on the product image to be detected, input the pixel value of the product image into a linear scoring function to obtain the classification scores of the linear image and the non-linear image, and determine whether the classification score of the linear image is greater than the classification score of the non-linear image. When it is determined that the classification score of the linear image is greater than the classification score of the non-linear image, divide the product image into a linear image. When the classification score of the linear image is not greater than the classification score of the non-linear image, divide the product image into a non-linear image.

[0087] For example, the linear scoring function is f(x i , W, b) = Wx i + b. Assume that each image data is stretched into a column vector with a length of D, with a size of [D x 1]. Among them, the matrix W with a size of [KxD] and the column vector b with a size of [Kx1] are the parameters of the linear scoring function, x iIt contains all the pixel information of the i-th image. These pixel information are pulled into a column vector of [px1]. The size of W is [qxp], and the size of b is [qx1]. Among them, p is the number of pixel points of the product image, and q is the number of categories. In this embodiment, q is 2. Therefore, P numbers (original pixel values) are input into the linear scoring function. The linear scoring function outputs 2 numbers (scores obtained from different classifications), and then the scores of different classifications are compared. Among them, the parameter W is the weight, and b is called the bias vector.

[0088] S303. Perform dimensionality reduction processing on the product image after image division according to multiple dimensionality reduction algorithms to obtain multiple dimensionality reduction data.

[0089] Specifically, when using the principal component analysis algorithm for dimensionality reduction, first subtract the sample mean from the sample data, then calculate the principal components of the data by calculating the data covariance matrix, and finally map the data to the principal components through the transformation matrix, so as to realize the dimensionality reduction of the product image.

[0090] When using the random projection algorithm for dimensionality reduction, first select the mapping matrix R∈R K×N , fill the mapping matrix with random numbers, normalize each row in the mapping matrix, and then perform dimensionality reduction on the data through y = RX. Where X is the input data and y is the data after dimensionality reduction.

[0091] When using the isometric mapping algorithm for dimensionality reduction, determine the k-nearest neighbors of the sample data, that is, the pixel points of the product image. Set the distance between the pixel points and their k-nearest neighbors as the Euclidean distance, and the distance to other points as infinity. Use the shortest path algorithm to calculate the distance between any two pixel points, and use the distance as the input data of the multidimensional scaling analysis algorithm. Output the projection of the product image pixel points in the low-dimensional space through the multidimensional scaling analysis algorithm, so as to obtain the dimensionality-reduced image.

[0092] When using the t-distributed stochastic neighbor embedding algorithm (t-SNE) for dimensionality reduction, convert the high-dimensional Euclidean distance between the sample data, that is, the pixel points of the product image, into a conditional probability representing similarity through stochastic neighbor embedding (SNE). For the low-dimensional corresponding points of the high-dimensional data points Xi and Xj, calculate the similar conditional probability, use the gradient descent method to minimize the KL distance, and define the perplexity, so as to obtain the corresponding low-dimensional data.

[0093] S304. Determine the best dimensionality reduction data among the multiple dimensionality reduction data.

[0094] In this embodiment, calculate the average value of the distances between the multiple dimensionality reduction data obtained by each dimensionality reduction algorithm, and determine the multiple dimensionality reduction data with the largest average distance as the best dimensionality reduction data.

[0095] S305. Input the optimal dimensionality-reduced data into a Gaussian mixture model to obtain the scoring data of the product image.

[0096] In this embodiment, perform mean pooling on the optimal dimensionality-reduced data to obtain a target vector, and then input the target vector into a pre-trained Gaussian mixture model to obtain the scoring data. Among them, the Gaussian mixture model can accurately quantify the score corresponding to the target vector using a Gaussian probability density function (normal distribution image curve).

[0097] Specifically, determine the number of Gaussian models in the Gaussian mixture model according to the number of types of defects to be detected, calculate the expected value of the Gaussian mixture model and the model parameter values for each iteration according to the optimal dimensionality-reduced data and the EM (Expectation-Maximum) algorithm, and deduce the optimal parameters of the Gaussian mixture model as the scoring data according to the expected value and model parameter values calculated for each iteration.

[0098] In this embodiment, the training sample data can be divided into a training set, a test set, and a validation set, and then, based on the maximum expectation algorithm, iteratively train multiple low-dimensional vectors in the training set to obtain a learner. Then, use multiple low-dimensional vectors in the test set to test the learner to obtain a test result. When the test result is less than a configured value, use multiple low-dimensional vectors in the validation set to adjust the parameters in the learner to obtain the pre-trained Gaussian mixture model. In this embodiment, calculate the number of the multiple low-dimensional vectors. When the number is less than a preset number, use a data augmentation algorithm to increase the number of the multiple low-dimensional vectors.

[0099] S306. Compare the scoring data with a threshold to determine whether the scoring data is less than the threshold.

[0100] In this embodiment, the threshold is the difference between the mean of the model parameter values calculated for each iteration and three times the standard deviation of the scoring data. When the scoring data is less than the threshold, the process proceeds to S307. When the scoring data is greater than or equal to the threshold, the process proceeds to S309.

[0101] S307. Determine that there are defects in the product image.

[0102] S308. Mark the area with defects on the product image and display the marked product image on a display screen.

[0103] S309. Determine that there are no defects in the product image.

[0104] If the modules / units integrated in the electronic device 1 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, to implement all or part of the processes in the above-described embodiment methods of the present invention, it can also be completed by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), etc.

[0105] The defect detection method, electronic device, and storage medium provided by the present invention directly perform dimensionality reduction processing on the image data to be detected and combine it with the Gaussian mixture model for defect detection. During the data processing process, there is no need to extract convolutional features, which simplifies the operation process and avoids information loss, thereby effectively improving the accuracy of defect detection.

[0106] For those skilled in the art, it is obvious that the present invention is not limited to the details of the above-described exemplary embodiments, and without departing from the spirit or basic characteristics of the present invention, the present invention can be implemented in other specific forms. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-limiting. The scope of the present invention is defined by the appended claims rather than the above description. Therefore, it is intended to cover all changes falling within the meaning and scope of the equivalent elements of the claims in the present invention. Any reference signs in the claims should not be regarded as limiting the claimed rights. In addition, obviously, the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. The multiple units or devices stated in the apparatus claims can also be implemented by the same unit or device through software or hardware. First, second, etc. are used to denote names and do not represent any specific order.

[0107] The above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention.

Claims

1. A flaw detection method, characterized in that, The method includes: Dividing a plurality of product images to be detected into linear images or non-linear images; Performing dimensionality reduction processing on the product images after image division according to a plurality of dimensionality reduction algorithms to obtain a plurality of dimensionality reduction data, including: when the product image is a linear image, respectively using a principal component analysis algorithm and a random projection algorithm to perform dimensionality reduction on the product image, and when the product image is a non-linear image, respectively using an isometric mapping algorithm and a t-distributed stochastic neighbor embedding algorithm to perform dimensionality reduction on the product image; Determining the optimal dimensionality reduction data among the plurality of dimensionality reduction data; Inputting the optimal dimensionality reduction data into a Gaussian mixture model to obtain scoring data of the product image; Comparing the scoring data with a threshold value to determine whether the scoring data is less than the threshold value; and When the scoring data is less than the threshold value, determining that there are defects in the product image.

2. The defect detection method according to claim 1, characterized in that The method further includes: When the scoring data is greater than or equal to the threshold value, determining that there are no defects in the product image.

3. The defect detection method according to claim 1, wherein The dividing the plurality of product images to be detected into linear images or non-linear images includes: Performing normalization processing on the product images to be detected; Inputting the pixel values of the product images into a linear scoring function to obtain classification scores of the linear images and the non-linear images; Determining whether the classification score of the linear image is greater than the classification score of the non-linear image; When it is determined that the classification score of the linear image is greater than the classification score of the non-linear image, dividing the product image into a linear image; and When the classification score of the linear image is not greater than the classification score of the non-linear image, dividing the product image into a non-linear image.

4. The defect detection method according to claim 1, characterized in that, The determining the optimal dimensionality reduction data among the plurality of dimensionality reduction data: Calculating the average value of the distances between the plurality of dimensionality reduction data obtained by each dimensionality reduction algorithm; and Determining the plurality of dimensionality reduction data with the largest average value of the distances as the optimal dimensionality reduction data.

5. The defect detection method according to claim 1, wherein The inputting the optimal dimensionality reduction data into a Gaussian mixture model to obtain the scoring data of the product image includes: Determining the number of Gaussian models in the Gaussian mixture model according to the number of defect types to be detected; and Calculating the expected value of the Gaussian mixture model and the model parameter values of each iteration according to the optimal dimensionality reduction data and the EM algorithm; and Deducing the optimal parameters of the Gaussian mixture model as the scoring data according to the expected value and the model parameter values calculated in each iteration.

6. The defect detection method according to claim 5, wherein: The threshold value is the difference between the mean value of the model parameter values calculated in each iteration and three times the standard deviation of the scoring data.

7. The defect detection method according to claim 1, characterized in that, The method further includes: Marking the area with defects on the product image and displaying the marked product image on a display screen.

8. An electronic device, characterized in that, The electronic device includes: A processor; and A memory, in which a plurality of program modules are stored, and the plurality of program modules are loaded and executed by the processor to perform the defect detection method according to any one of claims 1 to 7.

9. A storage medium having at least one computer instruction stored thereon, characterized in that, The instructions are loaded and executed by the processor to perform the defect detection method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • High-frequency resistance straight seam welding quality state online detection method

    CN105787940A

  • Drone system, drone, movable body, drone system control method, and drone system control program

    WO2020116392A1