An effective detection method for easily confused defects
Through the fuzzy C-means clustering method and contour coefficient evaluation, the problem of misjudgment of uneven sandblasting defects in industrial quality inspection is solved, the detection accuracy and efficiency are improved, the cost of manual review is reduced, and it is suitable for multiple projects with large sample sizes detection.
Patent Information
- Application Number
- CN202111253353.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-27
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-10-27
AI Technical Summary
It is difficult for existing industrial quality inspection technology to accurately detect dense but discontinuous sandblasting uneven defects. They are often misjudged as multiple heterochromatic defects, resulting in detection results deviating from the actual standard. In addition, existing solutions rely on manual review and are costly. A lot of manpower, increased costs and low efficiency.
The fuzzy C-means clustering method is used to cluster the heterochromatic and uneven sandblasting defect data identified by industrial cameras. The clustering results are evaluated through the silhouette coefficient and the optimal cluster number is selected to distinguish the heterochromatic and uneven sandblasting defects. Reduce manual involvement and improve detection accuracy.
Without changing the scanning method of industrial cameras, it improves the detection accuracy of irregular colors and uneven sandblasting defects, reduces project costs and training costs, is suitable for large sample sizes, and assists in the accurate detection of multiple defects in multiple projects. .
Smart Images

Figure CN113808129B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of defect detection, and in particular to an effective detection method for easily confused defects. Background Art
[0002] In the existing industrial quality inspection technology, the method of defect detection of workpieces is usually to fix the workpieces on the inspection machine, and use industrial cameras to scan and identify them according to specific trajectories under different sizes of fields of view (industrial cameras can only identify anomalies but cannot determine the causes of anomalies). The defects identified by the scan are then classified through defect detection devices, and most of the defects can be correctly identified and detected into the defect category to which they belong.
[0003] However, due to the fixed movement trajectory of industrial cameras, some special dense but discontinuous defects will be scanned and identified by industrial cameras as multiple similar other defects. In the industrial quality inspection standards, uneven sandblasting defects belong to the type of dense but discontinuous defects. Uneven sandblasting defects are composed of many irregular block-shaped small defects and appear in pieces. Industrial cameras often identify uneven sandblasting defects as multiple irregular block-shaped small defects. The defect detection device judges these multiple irregular block-shaped small defects as heterochromatic defects. That is, the defect detection device will misjudge the uneven sandblasting defect that was originally one as multiple closely spaced heterochromatic defects, which leads to deviations between the detection results and the actual industrial quality inspection standards.
[0004] The existing solution is to use manual verification to review the easily misclassified defects identified by industrial cameras one by one, and manually re-label the inaccurately identified defects. This method consumes a lot of manpower, increases project costs, and it is difficult to improve efficiency. Summary of the invention
[0005] The present invention aims to solve at least one of the technical problems existing in the prior art.
[0006] To this end, the present invention proposes an effective detection method for easily confusing defects. Without changing the existing industrial camera scanning method, the accuracy of the equipment in detecting defects such as discoloration and uneven sandblasting is improved, which has the advantages of saving time and labor, reducing project costs and improving defect detection efficiency.
[0007] The effective detection method of confusable defects according to an embodiment of the present invention comprises the following steps:
[0008] Step 1: Obtain the color and uneven sandblasting defect data detected by the defect detection device after scanning and recognition by the industrial camera, and use the color and uneven sandblasting defect data as sample data;
[0009] Step 2: Perform central standardization on the sample data to remove the unit restrictions between the characteristic physical quantities in the sample data and convert them into dimensionless pure numerical data;
[0010] Step 3: Cluster the sample data using the fuzzy C-means clustering method;
[0011] Step 4: Use the silhouette coefficient to evaluate the clustering results: When the fuzzy C-means clustering is divided into two categories, the two categories are named A and B. The Euclidean distance between samples in each category is called the intra-class distance, expressed as a(i); the Euclidean distance between the two categories in A and B is called the average inter-class distance, expressed as b(i);
[0012] Assume that there is a third type of O sample, A e The average inter-class distance with class O can be obtained in the same way. Take A e The minimum value of the average inter-class distance with other non-A classes is taken as b(A e );
[0013] The silhouette coefficient is used as the criterion for evaluating clustering, and the formula is as follows:
[0014]
[0015] Among them, s(i) represents the silhouette coefficient; b(i) represents the average inter-class distance between the sample and all non-class samples; a(i) represents the intra-class distance between the sample and all samples of the class; max(a(i),b(i)) represents the maximum value of a(i) and b(i); the value range of s(i) is [-1,1]. The closer the silhouette coefficient is to 1, the better the clustering effect of the cluster number.
[0016] Take a sample A in class A e For example, A e The calculation formula of the silhouette coefficient is:
[0017]
[0018] Among them, s(A e ) means A e The silhouette coefficient of b(A e ) means A e The minimum distance between other samples of this class; a(A e ) means A e The distance within the class from all samples in this class; max(a(A e ),b(A e )) means taking a(A e ) and b(A e ) maximum value;
[0019] Calculate the average value of the silhouette coefficients of all samples in the sample data. This average value is the overall silhouette coefficient of clustering the sample data into two categories, A and B, in fuzzy C-means clustering.
[0020] Step 5: Use different cluster center numbers C as the fuzzy C-means cluster numbers, where C∈[1,n], n represents the number of data samples, and n is a positive integer greater than or equal to 1; repeat steps 3 and 4 to obtain n silhouette coefficients, and select the C value with the largest silhouette coefficient as the fuzzy C-means optimal cluster number for fuzzy C-means clustering; after clustering, the category with a sample size of 1 in category C is judged as a heterochromatic defect, and the category with a sample size greater than 1 in category C is judged as an uneven sandblasting defect.
[0021] The beneficial effect of the present invention is that the present invention cooperates with the defect detection device and is superimposed on the defect detection device. While meeting the dynamic needs of the industrial site, the execution efficiency is improved, the training cost and impact of the existing industrial camera movement trajectory and defect detection device are reduced, and an effective detection method for easily confused defects is used to specially handle special defects. This method does not require a lot of manpower and has a high accuracy rate. It is especially suitable for situations with large sample sizes and can assist in the completion of accurate defect detection and classification of multiple items and multiple defects.
[0022] Further specifically defined, in the above technical solution, in step 4, a sample A in class A is e For example, the calculation formula for the Euclidean distance between samples in class A is:
[0023]
[0024] Among them, a(A e ) represents the Euclidean distance between samples in class A; A e represents the e-th sample in class A; A q represents the qth sample in class A; n represents the number of data samples, and n is a positive integer greater than or equal to 1; n A Indicates the number of samples of type A data; A q Except A e Other A-type samples other than e ,A q ) means A e With A q The Euclidean distance between .
[0025] Further specifically defined, in the above technical solution, in step 4, a sample B in class B is f For example, the calculation formula for the Euclidean distance between samples in class B is:
[0026]
[0027] Among them, a(B f ) represents the Euclidean distance between samples in class B; B f represents the fth sample in class B; B r represents the rth sample in class B; n represents the number of data samples, and n is a positive integer greater than or equal to 1; n B Indicates the number of samples of category B data; B r is except B f Other B samples except f ,B r ) means B f With B r The Euclidean distance between .
[0028] Further specifically defined, in the above technical solution, in step 4, a sample A in class A is e For example, A e The calculation formula for the average inter-class distance with class B is:
[0029]
[0030] Among them, b(A e ) represents sample A in class A e The average inter-class distance with other non-A classes; A e represents the e-th sample in class A; B f is the fth sample in class B; n B Indicates the number of samples of type B data; d(A e ,B f ) means A e With B f The Euclidean distance between them; f is the value range of [1,n B ] is a positive integer.
[0031] Further specifically defined, in the above technical solution, in step 4, a(A e ) is smaller, indicating that sample A e The more it should be classified into Class A, the more likely it is to be classified into Class A. e ) is also called A e The intra-class dissimilarity of a(B f ) is smaller, indicating that sample B f The more it should be classified into Class B, the more likely it is to be classified into Class B. f ) is also called B f The intra-class dissimilarity.
[0032] To further specify, in the above technical solution, in step 5, the value set of C is 1, 2, 3, 4, ..., n*2 / 3, where n represents the number of data samples, and n is a positive integer greater than or equal to 1, n*2 / 3 is rounded up, and steps 3 and 4 are repeated, so that n*2 / 3 contour coefficients are obtained, where n*2 / 3 is rounded up.
[0033] To further specify, in the above technical solution, in step 1, the sample data set is checked for consistency, missing values and outliers are processed, and it is checked whether the data is missing. If so, the data is deleted. It is checked whether the value is within the range of the actual characteristic physical quantity. If it is out of the range, the data is deleted.
[0034] Further specifically defined, in the above technical solution, in step 2, a certain characteristic physical quantity sequence z1, z2, z3, ..., z n Perform standardization transformation, where n represents the number of data samples and is a positive integer greater than or equal to 1. The calculation formula for center standardization is:
[0035]
[0036] Among them, y i represents the characteristic physical quantity after central standardization transformation; i is a positive integer in the range of [1, n]; z represents a certain characteristic physical quantity; z i Represents the i-th value of a characteristic physical quantity; represents the mean of the characteristic physical quantity sequence z; σ represents the standard deviation;
[0037] The sequence of a characteristic physical quantity after central standardization is y1, y2, y3, ..., y n , remove the characteristic physical quantities whose standard deviation σ is 0.
[0038] Further specifically defined, in the above technical solution, the mean value of the characteristic physical quantity sequence z is The calculation formula is:
[0039]
[0040] Where n represents the number of data samples, and n is a positive integer greater than or equal to 1; z i Represents the i-th value of a characteristic physical quantity.
[0041] To further specifically define, in the above technical solution, the calculation formula of the standard deviation σ is:
[0042]
[0043] Where n represents the number of data samples, and n is a positive integer greater than or equal to 1; z i Represents the i-th value of a characteristic physical quantity; Represents the mean of the characteristic physical quantity sequence z. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0045] Figure 1 is a flow chart of the detection method of the present invention;
[0046] Figure 2 It is a flow chart of clustering;
[0047] Figure 3 It is a schematic diagram of defects captured by industrial cameras and identified by algorithms;
[0048] Figure 4 This is a schematic diagram of the fuzzy C-means clustering results when the cluster center number C value is equal to 2;
[0049] Figure 5 This is a schematic diagram of the fuzzy C-means clustering results when the cluster center number C value is equal to 3;
[0050] Figure 6 This is a schematic diagram of the fuzzy C-means clustering results when the cluster center number C value is equal to 5;
[0051] Figure 7 It is the silhouette coefficient distribution diagram of fuzzy C-means clustering with different cluster center numbers C. DETAILED DESCRIPTION
[0052] In order to make the technical problems, technical solutions and beneficial effects solved by the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0053] See Figure 1 and Figure 2 , an effective detection method for easily confusing defects of the present invention comprises the following steps:
[0054] Step 1: Obtain the discoloration and uneven sandblasting defect data detected by the defect detection device after scanning and identification by the industrial camera, and use the discoloration and uneven sandblasting defect data as sample data. Since the detection results of the defect detection device cannot be fully trusted, there is no label to distinguish the defect category in the sample data. Only the sample characteristic physical quantity is retained, and the sample data set is checked for consistency, missing values, and outliers. Check whether the data is missing. If it is missing, delete this data. Check whether the value is within the actual characteristic physical quantity value range. If it is out of range, delete this data.
[0055] Step 2: Perform central standardization on the sample data, remove the unit restrictions between the characteristic physical quantities in the sample data, and convert them into dimensionless pure numerical data, so that different characteristic physical quantities can be compared and weighted; for a certain characteristic physical quantity sequence z1, z2, z3, ..., z n Perform standardization transformation, where n represents the number of data samples and is a positive integer greater than or equal to 1. The calculation formula for center standardization is:
[0056]
[0057] Among them, y i represents the characteristic physical quantity after central standardization transformation; i is a positive integer in the range of [1, n]; z represents a certain characteristic physical quantity; z i Indicates the i-th value of a characteristic physical quantity; represents the mean of the characteristic physical quantity sequence z; σ represents the standard deviation;
[0058]
[0059]
[0060] The sequence of a characteristic physical quantity after central standardization is y1, y2, y3, ..., y n , remove the characteristic physical quantity with a standard deviation σ of 0. A standard deviation σ of 0 means that the characteristic physical quantity has the same performance on each data in the data set (the value remains unchanged), then the characteristic physical quantity is a redundant feature and is deleted.
[0061] Step 3: Use fuzzy C-means clustering to cluster the sample data. The principle is to assign a weight to each sample and each cluster (the weight indicates the degree to which the specified sample belongs to the cluster). Each sample is classified into the class with the largest weight. The weight range is between [0,1]. The closer to 1, the larger the weight, and the closer to 0, the smaller the weight. Before clustering the sample data using fuzzy C-means clustering, it is necessary to determine the number of clusters m and the number of cluster centers C, where m is a positive integer in the range of [1,∞), but the parameter of the number of clusters m is usually set to 2. First, select the number of clusters m = 2 and the number of cluster centers C = 2 for fuzzy C-means clustering. The specific steps of the clustering method are as follows:
[0062] Step 3.1: Randomly generate n*C weight matrix U (0) ; Since the sample data has been centrally standardized, the weight matrix U (0) The random values in are distributed between [0,1]; n represents the number of data samples, and n is a positive integer greater than or equal to 1; C represents the number of cluster centers, and its value range is a positive integer in [2,p], p is the number of features of the sample data, and p is a positive integer greater than or equal to 1; U (0) U represents the weight matrix, U (0) The 0 in indicates that the weight matrix value is the initial random value, i.e., the 0th iteration; the weight matrix U (t) The formula is as follows:
[0063]
[0064] Where t represents the tth iteration, and t∈[0,∞); u 11 represents the first cluster center of the first sample; u 12 represents the second cluster center of the first sample; u 13 represents the third cluster center of the first sample; u 1c represents the cth cluster center of the first sample; u 21 represents the first cluster center of the second sample; u 22 represents the second cluster center of the second sample; u 23 represents the third cluster center of the second sample; u 2c represents the cth cluster center of the second sample; u 31 represents the first cluster center of the third sample; u 32 represents the second cluster center of the third sample; u 33 represents the third cluster center of the third sample; u 3c represents the cth cluster center of the third sample; u n1 represents the first cluster center of the nth sample; u n2represents the second cluster center of the nth sample; u n3 represents the third cluster center of the nth sample; u nc Represents the cth cluster center of the nth sample.
[0065] Step 3.2: Calculate the jth cluster center c j ;c j The calculation formula is:
[0066]
[0067] Among them, c j represents the jth cluster center, j∈[1,p], p is the number of features of the sample data, and p is a positive integer greater than or equal to 1; x i represents the i-th sample, i∈[1,n], n represents the number of data samples, and n is a positive integer greater than or equal to 1; u ij Represents sample x i The weight belonging to the jth cluster center; Represents sample x i The mth power of the degree of membership (i.e., weight) of the jth cluster center; u ij The value of is obtained from the weight matrix U; m represents the number of clusters; where,
[0068]
[0069] Step 3.3: Recalculate the weight matrix U, denoted as U (t) , represents the tth iteration; the weight matrix U (t) The calculation method of each weight is:
[0070]
[0071] Among them, u ij Represents sample x i The weight of the jth cluster center; C represents the number of cluster centers; c j represents the jth cluster center, j∈[1,p], p is the number of features of the sample data, and p is a positive integer greater than or equal to 1; c k represents the kth cluster center, k∈[1,p], p is the number of features of the sample data, and p is a positive integer greater than or equal to 1; d(x i ,c j ) represents the sample x i The Euclidean distance to the jth cluster center; d(x i ,c k ) represents the sample x iThe Euclidean distance to the kth cluster center; taking samples g and h as examples, the Euclidean distance calculation method is:
[0072]
[0073] Where p is the number of features of the sample data, and p is a positive integer greater than or equal to 1; l represents the lth feature, l∈[1,p], l is a positive integer; d(g,h) represents the sample g(g1,g2,g3,...,g p ) to sample h(h1,h2,h3,...,h p ) is the Euclidean distance.
[0074] Step 3.4: Calculate the sum of squared errors (SSE) of this iteration. When the sum of squared errors is relatively small, a better clustering result is achieved. The calculation formula for the sum of squared errors is:
[0075]
[0076] in, Represents sample x i The mth power of the membership degree (i.e., weight) of the jth cluster center; d(x i ,c j ) represents the sample x i The Euclidean distance to the j-th cluster center.
[0077] Step 3.5: Repeat steps 3.1, 3.2, 3.3 and 3.4 to iteratively calculate the cluster center c j And the weight matrix U (t) , iterate to SSE (t+1) With SSE (t) The results are almost the same as SSE (t+1) Indicates the t+1th iteration, SSE (t) Indicates the tth iteration, take the C cluster centers and n*C weight matrix in the tth iteration, and determine the category of each sample according to the maximum membership principle in the fuzzy set based on the weight matrix after the tth iteration. In this way, the category to which each sample in the sample data set belongs can be determined when the cluster center C=2.
[0078] Step 4: Use the silhouette coefficient to evaluate the clustering results: When the fuzzy C-means clustering is divided into two categories (C=2), the two categories are named category A and category B. The Euclidean distance between samples in each category is called the intra-category distance, denoted as a(i). e For example, the calculation formula is:
[0079]
[0080] Among them, a(A e ) represents the Euclidean distance between samples in class A; A e represents the e-th sample in class A; A q represents the qth sample in class A; n represents the number of data samples, and n is a positive integer greater than or equal to 1; n A Indicates the number of samples of type A data; A q Except A e Other A-type samples other than e ,A q ) means A e With A q The Euclidean distance between e ) is smaller, indicating that sample A e The more it should be classified into Class A, the more likely it is to be classified into Class A. e ) is also called A e The intra-class dissimilarity of
[0081] Similarly, take a sample B in class B f For example, the calculation formula is:
[0082]
[0083] Among them, a(B f ) represents the Euclidean distance between samples in class B; B f represents the fth sample in class B; B r represents the rth sample in class B; n represents the number of data samples, and n is a positive integer greater than or equal to 1; n B Indicates the number of samples of category B data; B r is except B f Other B samples except f ,B r ) means B f With B r The Euclidean distance between f ) is smaller, indicating that sample B f The more it should be classified into Class B, the more likely it is to be classified into Class B. f ) is also called B f The intra-class dissimilarity of
[0084] The Euclidean distance between the two categories A and B is called the average inter-class distance, denoted as b(i). e For example, A e The calculation formula for the average inter-class distance with class B is:
[0085]
[0086] Among them, b(A e ) represents sample A in class A e The average inter-class distance with other non-A classes; A e represents the e-th sample in class A; B f is the fth sample in class B; n B Indicates the number of samples of type B data; d(A e ,B f ) means A e With B f The Euclidean distance between them; f is the value range of [1,n B ] is a positive integer;
[0087] Assume that there is a third type of O sample, A e The average inter-class distance of class O can be obtained in the same way. e The average inter-class distance with class B, A e Among the average inter-class distances with class O, take A e The minimum value of the average inter-class distance with other non-A classes is taken as b(A e );
[0088] The silhouette coefficient is used as the criterion for evaluating clustering, and the formula is as follows:
[0089]
[0090] Among them, s(i) represents the silhouette coefficient; b(i) represents the average inter-class distance between the sample and all non-class samples; a(i) represents the intra-class distance between the sample and all samples of the class; max(a(i),b(i)) represents the maximum value of a(i) and b(i); the value range of s(i) is [-1,1]. The closer the silhouette coefficient is to 1, the better the clustering effect of the cluster number.
[0091] Take a sample A in class A e For example, A e The calculation formula of the silhouette coefficient is:
[0092]
[0093] Among them, s(A e ) means A e The silhouette coefficient of b(A e ) means A e The minimum distance between other samples of this class; a(A e ) means A e The distance within the class from all samples in this class; max(a(A e ),b(A e)) means taking a(A e ) and b(A e ) maximum value;
[0094] Calculate the average silhouette coefficient of all samples in the sample data. This average is the overall silhouette coefficient of clustering the sample data into two categories A and B in fuzzy C-means clustering.
[0095] Step 5: Use different cluster center numbers C as the fuzzy C-means cluster numbers, where C∈[1,n], n represents the number of data samples, and n is a positive integer greater than or equal to 1; repeat steps 3 and 4 to obtain n silhouette coefficients, and select the C value with the largest silhouette coefficient as the fuzzy C-means optimal cluster number for fuzzy C-means clustering; after clustering, the category with a sample size of 1 in category C is judged as a heterochromatic defect, and the category with a sample size greater than 1 in category C is judged as an uneven sandblasting defect. It should be noted that when the optimal number of clusters is uncertain, the value of C can be any value within [1, n]. In order to improve work efficiency, the number of clusters [1, n*2 / 3] is selected for evaluation. Specifically, the value set of C is 1, 2, 3, 4, ..., n*2 / 3, where n represents the number of data samples and is a positive integer greater than or equal to 1. n*2 / 3 is rounded up, and steps 3 and 4 are repeated. In this way, n*2 / 3 silhouette coefficients are obtained, where n*2 / 3 is rounded up.
[0096] The defects of heterochromatic and uneven sandblasting are very similar. The difference is that heterochromatic is a single defect, while uneven sandblasting is a cluster of multiple heterochromatic defects that are dense but possibly discontinuous. Therefore, the category with a sample size of not 1 after clustering belongs to uneven sandblasting and conforms to the shape of uneven sandblasting. In this way, easily confused defects can be detected. This method is superimposed on the defect detection device and does not affect the detection results of other defects by the defect detection device. It only re-detects and judges the heterochromatic and uneven sandblasting defects separately, which improves efficiency while reducing the cost of manual participation.
[0097] See Figure 3 , a part of a workpiece photographed with an industrial camera. Among them, the white rectangular boxes are defects marked one by one by the industrial camera, and they are all identified as heterochromatic defects by the defect detection device. It can be clearly seen in the figure that due to the one-by-one marking by the industrial camera, it is difficult to accurately determine the type of defect after the defect is marked. The areas where the defects are closely clustered in the upper left corner and the lower right corner are two uneven sandblasting defects (industrial quality inspection standards), and the other three defects in the picture are heterochromatic defects (industrial quality inspection standards). The defect that was originally a whole piece of uneven sandblasting was marked separately, which may cause deviations in the detection results.
[0098] See Figure 4 , Figure 5 and Figure 6 , when C = 5, the category with more than 1 samples in the fuzzy C-means clustering result is uneven sandblasting defect, and the category with 1 sample is heterochromatic defect. This shows that when the fuzzy C-means clustering method is clustered into 5 categories, heterochromatic and uneven sandblasting defects can be distinguished.
[0099] See Figure 7 , the figure is a schematic diagram of the silhouette coefficient of fuzzy C-means clustering when C is equal to 2, 3, 4, 5, and 6 respectively. It can be clearly seen from the figure that when the number of clusters is 2, the silhouette coefficient is between 0.35 and 0.4; when the number of clusters is 3, the silhouette coefficient is 0.45; when the number of clusters is 4, the silhouette coefficient is between 0.45 and 0.5; when the number of clusters is 5, the silhouette coefficient is between 0.55 and 0.6; when the number of clusters is 6, the silhouette coefficient is between 0.4 and 0.45. Obviously, when C = 2, the clustering effect is poor; when C = 5, the clustering effect is relatively good, and the silhouette coefficient is the highest. Therefore, the data is clustered into 5 categories, and the sample size of each class after clustering is consistent with the distribution of heterochromatic and uneven sandblasting defects. This shows that the effective detection method for easily confused defects of the present invention can effectively improve the accuracy of equipment in detecting discoloration and uneven sandblasting defects without changing the existing industrial camera scanning method, and overcome the shackles of currently relying on manual verification of industrial camera shooting results.
[0100] The present invention cooperates with the defect detection device and is superimposed on the defect detection device. While meeting the dynamic needs of the industrial site, it improves the execution efficiency, reduces the training cost and impact of the existing industrial camera movement trajectory and defect detection device, and adopts an effective detection method for easily confused defects to handle special defects. This method does not require a lot of manpower and has a high accuracy rate. It is especially suitable for situations with large sample sizes and can assist in the completion of accurate defect detection and classification of multiple projects and multiple defects.
[0101] The effective detection method of easily confused defects of the present invention fully caters to the situation that the specific moving trajectory of industrial cameras in industrial sites and the huge defect detection device lead to inaccurate detection of heterochromatic and uneven sandblasting defect categories. In the case that the existing moving trajectory of the industrial camera cannot be changed, the manifestation of heterochromatic defects is very similar to some uneven sandblasting defects, and it is difficult for the defect detection device to distinguish the defects when compared separately. Therefore, the effective detection method of easily confused defects of the present invention is introduced, and each defect marked by the industrial camera is taken as a piece of data, and these data are used to perform fuzzy C-means clustering of different numbers of categories. The number of categories with better clustering effect is selected as the evaluation standard using the silhouette coefficient for clustering, so that each category is a defect after the clustering is completed, the number of categories with a data volume of 1 is a heterochromatic defect, and the number of categories with a data volume greater than 1 is an uneven sandblasting defect, so as to achieve the purpose of classifying heterochromatic and uneven sandblasting defects. This greatly reduces the training cost and impact of existing defect detection devices, and improves the accuracy and execution efficiency of industrial sites without destroying the defect detection device.
[0102] What is described above is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. An effective method for detecting confusing defects, characterized in that: The following steps are involved: Step 1: Obtain the color and uneven sandblasting defect data detected by the defect detection device after scanning and recognition by the industrial camera, and use the color and uneven sandblasting defect data as sample data; Step 2: Perform central standardization on the sample data to remove the unit restrictions between the characteristic physical quantities in the sample data and convert them into dimensionless pure numerical data; Step 3: Cluster the sample data using the fuzzy C-means clustering method; Step 4: Use the silhouette coefficient to evaluate the clustering results: When the fuzzy C-means clustering is clustered into two categories, the two categories are named A and B. The Euclidean distance between samples in each category is called the intra-class distance, and the Euclidean distance between each category is called the average inter-class distance. The silhouette coefficient is used as the criterion for evaluating clustering. The value range of the silhouette coefficient is [-1,1]. The closer the silhouette coefficient is to 1, the better the clustering effect. by represents the e-th sample in class A, The calculation formula of the silhouette coefficient is: in, express The silhouette coefficient of Represents samples in class A The average inter-class distance with other non-A classes; express The intra-class distance with all samples in this class; Indicates taking and The maximum value; Calculate the average value of the silhouette coefficients of all samples in the sample data, where the average value is the overall silhouette coefficient of clustering the sample data into two categories A and B in fuzzy C-means clustering; In step 4, the Euclidean distance between samples in class A is calculated as: in, Indicates the first e samples; Indicates the first q samples; n represents the number of data samples, and n is a positive integer greater than or equal to 1; Indicates the number of class A data samples; Except Other Class A samples other than express and The Euclidean distance between The calculation formula for the Euclidean distance between samples in class B is: in, Represents the Euclidean distance between samples in class B; Indicates the first f samples; Indicates the first r samples; n represents the number of data samples, and n is a positive integer greater than or equal to 1; Indicates the number of class B data samples; Except Other Class B samples other than express and The Euclidean distance between The calculation formula for the average inter-class distance with class B is: in, express and The Euclidean distance between f The value range is A positive integer of ; Step 5: Use different cluster center numbers C as the fuzzy C-means cluster numbers, where C∈[1,n], n represents the number of data samples, and n is a positive integer greater than or equal to 1; repeat steps 3 and 4 to obtain n silhouette coefficients, and select the C value with the largest silhouette coefficient as the fuzzy C-means optimal cluster number for fuzzy C-means clustering; after clustering, the category with a sample size of 1 in category C is judged as a heterochromatic defect, and the category with a sample size greater than 1 in category C is judged as an uneven sandblasting defect.
2. The effective detection method for easily confusing defects according to claim 1, characterized in that: In step 4, The smaller the value, the more samples The more it should be classified into Class A, Also known as The intra-class dissimilarity of The smaller the value, the more samples The more it should be classified into Class B, Also known as The intra-class dissimilarity.
3. The effective detection method for easily confusing defects according to claim 1, characterized in that: In step 5, the value set of C is 1, 2, 3, 4, ..., n*2 / 3, where n represents the number of data samples and is a positive integer greater than or equal to 1, n*2 / 3 is rounded up, and steps 3 and 4 are repeated to obtain n*2 / 3 silhouette coefficients, where n*2 / 3 is rounded up.
4. The effective detection method for easily confusing defects according to claim 1, characterized in that: In the first step, the sample data set is checked for consistency, missing values, and outliers are processed to check whether the data is missing. If so, delete the data. Check whether the value is within the range of the actual characteristic physical quantity. If it is out of range, delete the data.
5. The effective detection method for easily confusing defects according to claim 1, characterized in that: In the second step, for a characteristic physical quantity sequence Perform standardization transformation, where n represents the number of data samples and is a positive integer greater than or equal to 1. The calculation formula for center standardization is: in, It represents the characteristic physical quantity after the central normalization transformation; is a positive integer in the range [1,n]; Represents a characteristic physical quantity; Represents the i-th value of a characteristic physical quantity; Represents the mean value of the characteristic physical quantity sequence z; represents standard deviation; The sequence of a characteristic physical quantity after central standardization is , remove the standard deviation A characteristic physical quantity that is 0.
6. The effective detection method for easily confusing defects according to claim 5, characterized in that: The mean value of the characteristic physical quantity sequence z The calculation formula is: Where n represents the number of data samples, and n is a positive integer greater than or equal to 1; Represents the i-th value of a characteristic physical quantity.
7. The effective detection method for easily confusing defects according to claim 5, characterized in that: Standard Deviation The calculation formula is: Where n represents the number of data samples, and n is a positive integer greater than or equal to 1; Represents the i-th value of a characteristic physical quantity; Represents the mean of the characteristic physical quantity sequence z.
