A method of sample processing defect severity grading
Patent Information
- Application Number
- CN202311653593.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-05
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-12-05
AI Technical Summary
[0009]本发明要解决的技术问题是:为了解决现有的样本缺陷严重程度分级方法存在耗费人力大、分级耗时、分级准确率低、智能化程度低、无可量化样本缺陷严重程度指标和效率低的问题,提供一种样本处理缺陷严重程度分级方法
[0040]本发明的有益效果是,本发明的一种样本处理缺陷严重程度分级方法,将样本等级细分,如将样本等级划分为1~10级,级数越大,缺陷严重程度越高。通过设计一个可量化样本缺陷严重程度等级的评价指标Score,通过人工挑选每种等级中少量典型样本进行标注,通过AI分割+分类的结果计算出Score,将Score映射到样本的不同细分分级区间上,从而实现对每个样本量化打分得出样本Score,进而通过映射Score获取样本缺陷等级。
Smart Images

Figure CN117636041B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method for classifying the severity of defects, and more particularly to a method for classifying the severity of defects in sample processing. Background Technology
[0002] Common target inspection objects in the field of machine vision include: battery electrode defects, battery aluminum shell defects, mobile phone panel defects, etc. Defect samples can be divided into three different severity levels: OK, Marginal, and NG. The OK level indicates that there is a product defect in the image, but the defect parameters do not reach the scrapping specification. The NG level indicates that the defect is severe and the defect parameters reach the scrapping specification. The Marginal level indicates that the defect is a borderline defect between OK and NG.
[0003] Efficient, accurate, and automated sample processing has become a research hotspot in recent years, especially the subdivision of defect severity levels within sample processing, which presents a significant challenge due to the scarcity of successful research cases. While it's easy to collect simple severity levels of defects during sample collection, such as OK, Marginal, and NG, further subdivision of these levels is difficult.
[0004] Currently, some research is also being used for the classification of defect severity:
[0005] First, the process involves manually selecting typical samples for each sub-level and visually comparing the appearance similarity between the sample to be classified and the typical sample. When the sample data is large, manual processing is labor-intensive, and the more sub-levels there are, the more ambiguous the judgment becomes, which can easily lead to inaccurate classification.
[0006] Second: By combining manual processing with traditional algorithms, traditional image processing algorithms extract feature parameter values, rely on human experience to set subdivision conditions for the severity of defects, and judge the relationship between sample feature parameter values and subdivision conditions to classify samples. However, due to varying or insufficient understanding of defects among human personnel, it is not possible to design grading conditions in a complete and accurate manner. Therefore, it is easy to select samples that are slightly OK or severely NG, but there will be a large number of marginal samples that cannot be subdivided.
[0007] Third: By using a combination of manual and machine learning methods, the sample training set is manually subdivided and labeled, and the feature values of defects in each subdivided level are extracted to create a training dataset. This dataset is then input into a machine learning classifier for training and classification, ultimately achieving the subdivision of sample levels. This requires manual labeling of the defect levels of most samples, which carries the risk of labeling errors. Furthermore, for the classifier, the sample level is the same as the sample category, and the number of levels is the same as the number of categories. Therefore, there may be issues such as a small number of samples in each category and an imbalanced sample structure, resulting in low classification accuracy.
[0008] In summary, existing methods for classifying the severity of sample defects suffer from problems such as high manpower consumption, time-consuming classification, low classification accuracy, low level of intelligence, lack of quantifiable indicators of sample defect severity, and low efficiency. Summary of the Invention
[0009] The technical problem to be solved by this invention is to provide a method for classifying the severity of sample defects, which addresses the problems of high manpower consumption, time-consuming classification, low accuracy, low level of intelligence, lack of quantifiable indicators of sample defect severity, and low efficiency in existing sample defect severity classification methods.
[0010] The technical solution adopted by this invention to solve its technical problem is: a method for classifying the severity of sample processing defects, comprising the following steps:
[0011] Step 1, obtain the defect integrity IOU:
[0012] 1.1 Manually annotate the samples to obtain the actual location and area of the defects. The area of the annotated defects is designated as Area1.
[0013] 1.2 AI segmentation of the samples in 1.1, outputting a segmentation result heatmap, setting a value range based on the color intensity of the heatmap, and setting a probability threshold within the value range to extract the segmentation area Area2 in the AI segmentation result heatmap;
[0014] Area1 obtained in 1.3 and 1.1 and Area2 obtained in 1.2 are obtained through...
[0015]
[0016] The defect integrity score (IOU) of the current sample is obtained;
[0017] Step 2, obtain the defect matching degree P:
[0018] 2.1 The samples from step 1 are manually labeled into three levels: OK, Marginal, and NG.
[0019] 2.2 Input any level of sample from 2.1 into the classification model, and the classification model outputs the matching degree of the current sample;
[0020] 2.3 Repeat 2.2 to obtain the sample matching degree for each level: OK, Marginal, and NG, where:
[0021] The matching degree of the OK sample is ,
[0022] The matching degree of the Marginal sample is ,
[0023] The matching degree of the NG samples is ;
[0024] Step 3, Defect Level Mapping:
[0025] Based on the piecewise function established in steps 1 and 2, the mapping fraction is calculated using the following formula:
[0026]
[0027] in:
[0028] a represents the weight of the defect integrity IOU obtained in step 1, and b represents the weight of the defect matching degree P obtained in step 2.
[0029] OK sample corresponds to the first mapping segment c is the proportion coefficient of OK samples in the piecewise function;
[0030] The Marginal sample corresponds to the second mapping segment. d is the proportionality coefficient of the Marginal sample in the piecewise function;
[0031] The NG sample corresponds to the third segment of the mapping. , e is the proportion coefficient of the NG sample in the piecewise function.
[0032] To address the issues of ambiguous judgment and insufficient cognition in the samples, the value range of step 1 is 0 to 1. The more severe the defect, the higher the probability threshold, and the darker the color of the resulting heatmap.
[0033] To address the issue of sample imbalance, the defect completeness (IOU) in step 1 is positively correlated with the severity of the defect. The more severe the defect, the greater the completeness of the extracted data; conversely, the less severe the defect, the smaller the completeness of the extracted data.
[0034] To further address the issue of sample imbalance, in step 2, the more severe the defect level of the test sample, the higher the matching degree; conversely, the less severe the defect level of the test sample, the lower the matching degree. This process is used to obtain the sample matching degree for each of the OK, Marginal, and NG levels.
[0035] To further address the issue of imbalanced samples, step 3 subdivides the sample levels into 1 to 10 levels, with corresponding scores of 0 to 1. Each sample corresponds one-to-one with a level of defect severity, and each level corresponds to a score of 0.1.
[0036] Specifically, scores of 0-0.3 are classified as OK samples, corresponding to levels 1-3; scores of 0.4 are classified as Marginal samples, corresponding to level 4; and scores of 0.5-1 are classified as NG samples, corresponding to levels 5-10.
[0037] The formula for the piecewise function mapping defect level is as follows:
[0038]
[0039] The higher the mapping score Y of a sample, the more severe the defect is within the corresponding subdivision level. The mapping score Y is the value of the segmentation and classification result.
[0040] The beneficial effect of this invention is that it provides a method for classifying the severity of defects in sample processing. This method subdivides sample levels, such as dividing them into 1 to 10 levels, with higher levels indicating greater defect severity. By designing a quantifiable evaluation index, "Score," a small number of typical samples from each level are manually selected and labeled. The Score is calculated using AI segmentation and classification results. This Score is then mapped to different subdivision and classification intervals of the sample, thereby achieving a quantitative score for each sample. Finally, the defect level of the sample is obtained by mapping the Score.
[0041] This invention solves the problems of time-consuming large-sample defect severity classification, low level of intelligence, and lack of quantifiable indicators for sample defect severity, and brings the following beneficial effects:
[0042] First: It can automatically classify large samples, greatly improving efficiency and classification accuracy;
[0043] Second: When the severity level of sample defects is subdivided, it can be used as an evaluation index for the grading model to quantify the degree of misclassification between levels, that is, the relative accuracy of grading. Misclassification between adjacent levels is acceptable, misclassification between non-adjacent levels is unacceptable, and the greater the distance between misclassifications, the greater the error of the grading model.
[0044] Third: It facilitates the adjustment of the proportion of OK, Marginal, and NG sample categories, that is, by dividing OK, Marginal, and NG into their respective proportions in the total sample, the labeling and number of samples can be adjusted accordingly.
[0045] Fourth: Some samples can be manually labeled, and the AI can be trained to perform coarse classification of large samples as OK, Marginal, and NG, which improves human efficiency and standardization of sample processing.
[0046] Fifth: The severity level of sample defects can be quantified through the Score index, thus enabling a detailed breakdown of sample defect levels;
[0047] Sixth: When the sample level is highly segmented, the sample proportion coefficient and starting point coefficient of OK, Marginal, and NG can be adjusted to change the OK, Marginal, and NG attributes of the sample, thus avoiding repeated training of samples due to changes in sample attributes.
[0048] In summary, this invention features low labor costs, short grading time, high grading accuracy, high level of intelligence, quantifiable indicators of sample defect severity, and high efficiency. Attached Figure Description
[0049] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0050] Figure 1 This is a schematic diagram of a real pit defect.
[0051] Figure 2 This is a schematic diagram showing the area of manually marked pit defects, Area1.
[0052] Figure 3 This is a schematic diagram of AI segmentation of the pit defect area, Area2.
[0053] Figure 4 This is a diagram illustrating the defect level mapping. Detailed Implementation
[0054] The present invention will now be described in further detail with reference to the accompanying drawings and preferred embodiments. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.
[0055] like Figures 1 to 4 The method shown is a sample processing defect severity classification method that calculates a mapping score based on an AI segmentation + classification structure.
[0056] Step 1, obtain the defect integrity IOU:
[0057] 1.1 Manually annotate the samples to obtain the location and area of the actual defects, where Area1 represents the area of the defect annotation;
[0058] 1.2 AI segmentation of the samples in 1.1 outputs a heatmap of the segmentation results, representing the probability distribution of defects. The value ranges from 0 to 1; the more severe the defect, the higher the probability value and the redder the color. When a probability threshold is set, such as ≥0.4, the defect area in the heatmap can be extracted, where Area2 represents the segmented area in the AI segmentation heatmap. Based on 1.1 and 1.2 above, the defect integrity ratio (IOU) of the current sample can be calculated using the following formula:
[0059]
[0060] The defect completeness parameter is positively correlated with the severity of the defect. The more severe the defect, the greater the completeness of the extracted defect; the less severe the defect, the less complete the extracted defect.
[0061] Step 2, obtain the defect matching degree P:
[0062] 2.1 First, the samples in step 1 are divided into three categories: OK, Marginal, and NG, and the sample types are manually labeled.
[0063] 2.2 Only one type of sample is input at a time, i.e., OK, Marginal, or NG. In this case, the training set contains only samples of the same category. The classification model will output the matching degree of the current level of the sample; that is, the more severe the defect level of the test sample, the higher the matching degree, and the milder the defect level, the lower the matching degree. This allows us to obtain the matching degree of samples at each level: OK, Marginal, and NG. The matching degree can also be called the confidence level. Indicates the sample matching degree of OK level. Indicates the sample matching degree at the Marginal level. This indicates the matching degree of the NG grade samples.
[0064] For fully manual sampling, samples can be classified into three levels: OK, Marginal, and NG, but it is not possible to further subdivide OK and NG into different levels.
[0065] While manual processing combined with traditional algorithms can identify exceptionally good and severely NG samples, a large number of samples are classified as Marginal, which is inconsistent with reality. Therefore, it is necessary to continuously compress the Marginal to make it increasingly closer to the actual situation. Step 3: Defect Level Mapping:
[0066] For example, the sample levels can be subdivided into 1 to 10 levels, corresponding to scores from 0 to 1. This relationship allows for a one-to-one correspondence between samples and defect severity levels. A score of 0 to 0.3 is designated as OK, corresponding to levels 1 to 3; a score of 0.4 is designated as Marginal, corresponding to level 4; and a score of 0.5 to 1 is designated as NG, corresponding to levels 5 to 10. Defect completeness is calculated based on segmentation, and defect matching degree is calculated based on classification. The mapping score is then calculated by weighting the defect completeness and defect matching degree, as shown in the following formula:
[0067]
[0068] This formula is a piecewise function, corresponding to the Score segmentation mapping diagram in the technical roadmap. OK samples correspond to the first segment, Marginal samples to the second segment, and NG samples to the third segment; where IOU represents the defect completeness. For OK defect matching degree, For Marginal defect matching degree, Let be the NG defect matching degree, 'a' be the weight of IOU, and 'b' be the weight of p. The piecewise proportionality coefficient of 0.3 for OK samples indicates the proportion of OK samples in the score. The piecewise proportionality coefficient of 0.1 for Marginal samples indicates the proportion of Marginal samples in the score, and the starting coefficient of 0.3 indicates that the mapping for Marginal samples starts from a score of 0.3. The piecewise proportionality coefficient of 0.6 for NG samples indicates the proportion of NG samples in the score, and the starting coefficient of 0.4 indicates that the mapping for NG samples starts from a score of 0.4. This mapping formula ensures that the higher the segmentation and classification result value of a sample, the more severe the segmentation within the corresponding sub-level, without causing erroneous skipping of mappings between OK, Marginal, and NG.
[0069] First, as mentioned above, the sample levels are subdivided into 1 to 10 levels, corresponding to scores from 0 to 1. A score of 0 to 0.3 is considered OK, corresponding to levels 1 to 3. A score of 0.4 is considered Marginal, corresponding to level 4. A score of 0.5 to 1 is considered NG, corresponding to levels 5 to 10. This is just an example for the sake of illustration. The sample levels can also be subdivided into 1 to 20 or 1 to 5 levels, and the scores will be adjusted accordingly.
[0070] Secondly, as mentioned above, the piecewise function scaling factor is 0.3 in OK samples, and 0.1 in Marginal samples, representing the proportion of Marginal samples in the score. The starting point factor of 0.3 indicates that the Marginal samples are mapped starting from a score of 0.3. In NG samples, the piecewise function scaling factor of 0.6 represents the proportion of NG samples in the score, and the starting point factor of 0.4 indicates that the NG samples are mapped starting from a score of 0.4. All these coefficients are examples for illustrative purposes. The piecewise function scaling factor of 0.3 in OK samples can also be 0.1 or 0.4, and the other coefficients are adjusted accordingly.
[0071] In summary, based on steps 1 and 2, a piecewise function is established, as shown in the following formula:
[0072]
[0073] in:
[0074] a represents the weight of the defect integrity IOU obtained in step 1, and b represents the weight of the defect matching degree P obtained in step 2.
[0075] OK sample corresponds to the first mapping segment c is the proportion coefficient of OK samples in the piecewise function;
[0076] The Marginal sample corresponds to the second mapping segment. d is the proportionality coefficient of the Marginal sample in the piecewise function;
[0077] The NG sample corresponds to the third segment of the mapping. , e is the proportion coefficient of the NG sample in the piecewise function.
[0078] The samples are common target detection objects in the field of machine vision, such as mobile phone frames, battery electrodes, aluminum casings, and mobile phone panels.
[0079] The above description is merely a specific embodiment of the present invention. Various examples and illustrations do not constitute a limitation on the substantive content of the present invention. Those skilled in the art can make modifications or variations to the specific embodiments described above after reading the specification, without departing from the essence and scope of the invention.
Claims
1. A method for classifying the severity of sample processing defects, characterized in that: Includes the following steps: Step 1, obtain the defect integrity IOU: 1.1 Manually annotate the samples to obtain the actual location and area of the defects. The area of the annotated defects is designated as Area1. 1.2 AI segmentation of the samples in 1.1, outputting a segmentation result heatmap, setting a value range based on the color intensity of the heatmap, and setting a probability threshold within the value range to extract the segmentation area Area2 in the AI segmentation result heatmap; Area1 obtained in 1.3 and 1.1 and Area2 obtained in 1.2 are obtained through... , The defect integrity score (IOU) of the current sample is obtained; Step 2, obtain the defect matching degree P: 2.1 The samples from step 1 are manually labeled into three levels: OK, Marginal, and NG. 2.2 Input any level of sample from 2.1 into the classification model, and the classification model outputs the matching degree of the current sample; 2.3 Repeat 2.2 to obtain the sample matching degree for each level: OK, Marginal, and NG, where: The matching degree of the OK sample is , The matching degree of the Marginal sample is , The matching degree of the NG samples is ; Step 3, Defect Level Mapping: Based on steps 1 and 2, a piecewise function is established, and the mapping fraction is calculated using the following formula: , in: a represents the weight of the defect integrity IOU obtained in step 1, and b represents the weight of the defect matching degree P obtained in step 2. OK sample corresponds to the first mapping segment c is the proportion coefficient of OK samples in the piecewise function; The Marginal sample corresponds to the second mapping segment. d is the proportionality coefficient of the Marginal sample in the piecewise function; The NG sample corresponds to the third segment of the mapping. e is the proportion coefficient of the NG sample in the piecewise function; The higher the mapping score Y of a sample, the more severe the defect is within the corresponding subdivision level. The mapping score Y is the value of the segmentation and classification result.
2. The method for classifying the severity of sample processing defects as described in claim 1, characterized in that: The value range of step 1 is 0 to 1. The more severe the defect, the higher the probability threshold, and the darker the color of the resulting heat map.
3. The method for classifying the severity of sample processing defects as described in claim 1, characterized in that: The defect integrity (IOU) in step 1 is positively correlated with the severity of the defect. The more severe the defect, the greater the integrity of the extracted defect; the less severe the defect, the smaller the integrity of the extracted defect.
4. The method for classifying the severity of sample processing defects as described in claim 1, characterized in that: In step 2, the more severe the defect level of the test sample, the higher the matching degree; the more slight the defect level of the test sample, the lower the matching degree, thereby obtaining the sample matching degree for each level: OK, Marginal, and NG.
5. The method for classifying the severity of sample processing defects as described in claim 1, characterized in that: In step 3, the sample level is subdivided into 1 to 10 levels, with corresponding scores of 0 to 1. Each sample corresponds to a level of defect severity, and each level corresponds to a score of 0.
1.
6. The method for classifying the severity of sample processing defects as described in claim 5, characterized in that: The scores of 0 to 0.3 are considered OK samples, corresponding to levels 1 to 3; scores of 0.4 are considered Marginal samples, corresponding to level 4; and scores of 0.5 to 1 are considered NG samples, corresponding to levels 5 to 10. The formula for the piecewise function mapping defect level is as follows: 。
Citation Information
Patent Citations
Industrial defect detection method based on semantic segmentation and target detection fusion model
CN113724231A
Segmentation model evaluation method based on industrial defect detection
CN114897869A