An efficient industrial quality inspection data cleaning method, storage medium and electronic device
Patent Information
- Application Number
- CN202511329783.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-17
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2045-09-17
AI Technical Summary
然而,深度学习模型的训练通常依赖于大量的高质量标注数据,尤其是缺陷数据
本发明中,通过第一SAM模型来提取不同类别标注数据的高维特征,并转化成每一缺陷标注图像对应的高维特征向量。由于缺陷标注图像是经过分类标注的图像,所以同一类别的缺陷图像在特征维度具有更高的相似性,而不同类别之间缺陷图像在特征维度具有更低的相似性,对应的由此转换而来的高维特征向量,也具有同一类别的缺陷图像的高维特征向量之间的距离更近,而不同类别之间的缺陷图像的高维特征向量之间的距离更远的特点。有基于此,通过对数据特征分布的深入分析,尤其是对潜在缺陷或异常值的识别。通过结合统计分析、距离度量和密度估计等方法来计算异常度,通过异常度能够有效识别出不符合正常数据分布的异常数据点,并予以清洗处理。本发明中的数据质检过程实现了完全自动化的数据清洗流程,同时基于高维特征向量可以更加客观的展示出不同图片之间的相似度,进而可能更加客观的评价标注的正确与否,减少了人为干预对数据质量的影响。同时因为该方法可以帮助验收人员过滤大量优质标签减少了人工核对的工作。在工业质检方面,它提高了质检的效率和准确性,减少了误报和漏报,从而节省了时间和资源。
Smart Images

Figure CN121074440B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of deep learning and computer vision technology, and in particular to an efficient method for cleaning industrial quality inspection data, a storage medium, and an electronic device. Background Technology
[0002] With the rapid advancement of artificial intelligence technology, traditional manual quality inspection is gradually being replaced by machine vision technology based on deep learning. Deep learning-based visual quality inspection systems have significantly surpassed manual quality inspection in terms of detection accuracy and processing efficiency, achieving efficient, automated, and high-precision defect detection. However, training deep learning models typically relies on large amounts of high-quality labeled data, especially defect data. Acquiring high-quality defect data during the labeling process faces several major challenges: 1. Diverse and complex defect types: Due to the variety of defect types and forms, labelers struggle to accurately identify all types of defects, resulting in low standardization of data labeling. 2. Inconsistent labeling standards: To improve labeling efficiency, multiple labeling engineers are often responsible for a batch of data. However, differences in experience and judgment standards among these engineers can lead to inconsistent labeling of defect categories, further affecting the quality of training data. These issues directly impact the quality of model training, thereby affecting the final detection results.
[0003] To ensure that deep learning models can be trained efficiently and achieve high accuracy, enterprises typically need to assign dedicated personnel to perform secondary checks on the labeled data. This process not only requires significant human resources but also faces problems such as repetitive work, inefficient acceptance, and human error. With the increasing complexity of defect types and forms, traditional manual review methods are no longer sufficient to meet the demands of industrial-grade data processing. Summary of the Invention
[0004] To address one of the aforementioned technical problems, the present invention adopts the following technical solution: According to one aspect of the present invention, an efficient method for cleaning industrial quality inspection data is provided, the method comprising the following steps: Each defect-annotated image to be inspected is input into the first SAM model to generate a high-dimensional feature vector corresponding to each defect-annotated image. The first SAM model includes an image encoder and a fully connected layer. The output of the image encoder is connected to the input of the fully connected layer. The high-dimensional feature vector is output by the fully connected layer.
[0005] The K-NN algorithm is used to cluster all high-dimensional feature vectors corresponding to all defect-annotated images to generate multiple clusters corresponding to preset categories.
[0006] Based on the sample points corresponding to each defect-annotated image after clustering, the anomaly degree of each defect-annotated image is obtained; where, cluster C i The anomaly degree P(x) corresponding to sample point x in the data satisfies the following condition: ; ; ; ; ; Where DI(x) is the distribution index corresponding to sample point x, Dintra(x) is the Euclidean distance between sample point x and the cluster center of its own cluster, Dinter(x) is the minimum Euclidean distance from sample point x to the cluster centers of other clusters, and LDD(x) is the local density deviation of sample point x; ρ Ci mediam It is C i The median neighborhood density of all sample points in the dataset, where ρ(x) is the neighborhood density of sample point x; u i It is cluster C i The center, u j It is cluster C j The center, It is the Euclidean distance between two points; N is the total number of clusters; i=1, 2...N, j=1, 2...N; If P(x)>Y3, then the defect annotation image corresponding to sample point x is identified as an abnormal annotation image and removed; Y3 is the anomaly threshold.
[0007] According to a second aspect of the present invention, a non-transitory computer-readable storage medium is provided, which stores a computer program that, when executed by a processor, implements the above-described efficient industrial quality inspection data cleaning method.
[0008] According to a third aspect of the present invention, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described efficient industrial quality inspection data cleaning method.
[0009] This invention has at least one of the following beneficial effects: In this invention, a first SAM model is used to extract high-dimensional features from different categories of labeled data and transform them into high-dimensional feature vectors corresponding to each defect-labeled image. Since defect-labeled images are classified and labeled, defect images of the same category have higher similarity in feature dimensions, while defect images of different categories have lower similarity. Correspondingly, the high-dimensional feature vectors derived from this process also exhibit the characteristic that the distance between high-dimensional feature vectors of defect images of the same category is closer, while the distance between high-dimensional feature vectors of defect images of different categories is farther. Based on this, through in-depth analysis of the data feature distribution, especially the identification of potential defects or outliers, and by combining statistical analysis, distance metrics, and density estimation methods to calculate the anomaly degree, abnormal data points that do not conform to the normal data distribution can be effectively identified and cleaned. The data quality inspection process in this invention achieves a fully automated data cleaning workflow. Furthermore, based on high-dimensional feature vectors, the similarity between different images can be displayed more objectively, thus potentially leading to a more objective evaluation of the correctness of the labeling and reducing the impact of human intervention on data quality. Simultaneously, this method helps acceptance personnel filter a large number of high-quality labels, reducing the workload of manual verification. In industrial quality inspection, it improves the efficiency and accuracy of inspection, reduces false alarms and omissions, thereby saving time and resources. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 A flowchart illustrating an efficient industrial quality inspection data cleaning method provided in this embodiment of the invention; Figure 2 This is a visualization of the distribution of defect feature points and anomalies after processing with t-SNE technology, provided in an embodiment of the present invention. Figure 3 This is a diagram illustrating the defect similarity matrix provided in an embodiment of the present invention. Figure 4 This is a visualization of abnormal tag data provided in an embodiment of the present invention. Detailed Implementation
[0012] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0013] As one possible embodiment of the present invention, such as Figure 1 As shown, an efficient method for cleaning industrial quality inspection data is provided, which includes the following steps: S100: Input each defect-annotated image to be inspected into the first SAM model to generate a high-dimensional feature vector corresponding to each defect-annotated image. The first SAM model includes an image encoder and a fully connected layer. The output of the image encoder is connected to the input of the fully connected layer, and the high-dimensional feature vector is output by the fully connected layer.
[0014] SAM (Segment Anything Model) is an image segmentation model consisting of three core modules: an image encoder, a cue encoder, and a mask decoder. In this embodiment, the cue encoder and mask decoder are replaced with a fully connected layer. This allows the high-dimensional features extracted by the image encoder to be converted into a one-dimensional vector, which includes feature values of various dimensions. For example, the fully connected layer can output a 256-dimensional high-dimensional feature vector, facilitating subsequent K-NN clustering operations.
[0015] When training the first SAM model, historical data that has passed quality control can be used for training. For example, historical data can be cropped into 256x256 pixel defect images centered on defect annotations. To reduce background interference, the area outside the maximum bounding rectangle of the annotations is set to black, and the length and width of the maximum bounding rectangle are ensured to be no less than 50 pixels to guarantee the integrity of the defect information. A corresponding training set is then generated for training.
[0016] In addition, when training the first SAM model, the loss function L total The following conditions must be met: L total =L CE +λL contrastive Among them, L CE It is the cross-entropy loss, L contrastive It is a similarity metric loss. λ is a hyperparameter.
[0017] Cross-entropy: Excels at optimizing classification tasks, ensuring the model accurately assigns samples to the correct categories, focusing on the clarity of the "decision boundary." Similarity loss: Such as contrastive loss, triplet loss, or directly using cosine similarity as a regularization term, encouraging similar samples to be closer together in the feature space, and dissimilar samples to be further apart. By combining both, the model not only performs well in classification accuracy, but also learns features with better discriminativeness and structure, which is beneficial for downstream tasks (such as clustering, retrieval, and transfer learning).
[0018] Prior to S100, the method also includes: S110: Using the defect annotation as the center, crop the new annotated image into a 256x256 pixel defect image. The length and width of the largest bounding rectangle of the defect image area in the defect image shall not be less than 50 pixels.
[0019] S120: Set the background of the defect image to black to generate a defect annotation image to be inspected.
[0020] In this embodiment, the defect-annotated images to be inspected can be annotated images from the new project's annotation dataset. This dataset has been initially annotated by annotation engineers and is awaiting further inspection by annotation acceptance personnel. Before being input into the first SAM model, the defect-annotated images to be inspected undergo the same cropping process as historical data: the new project data is cropped into 256x256 pixel defect images centered on the defect annotations, and background processing is performed to ensure that the length and width of the largest bounding rectangle are not less than 50 pixels. During the defect feature extraction process, the accuracy and effectiveness of defect features are significantly improved through the comprehensive application of background blackening, large model fine-tuning, and metric learning strategies. These techniques help extract more accurate defect features, thereby enhancing the model's recognition capabilities.
[0021] S200: Using the K-NN algorithm, clustering is performed on all high-dimensional feature vectors corresponding to all defect-annotated images to generate multiple clusters corresponding to preset categories.
[0022] Since defect-annotated images are categorized and labeled, defect images of the same category have higher similarity in the feature dimension, while defect images of different categories have lower similarity. Correspondingly, the resulting high-dimensional feature vectors also exhibit the characteristic that high-dimensional feature vectors of defect images of the same category are closer together, making them more likely to cluster into the same category, while high-dimensional feature vectors of defect images of different categories are farther apart. Therefore, based on the distribution characteristics of each cluster after clustering, the annotation quality of defect images is judged, and abnormal annotation images are identified. The K value in this step can be determined based on the number of defect categories included in the new quality inspection data.
[0023] Before S300, the method further includes: S310: Generate the intra-class difference L of the defect annotation images to be quality inspected in the current batch according to the dispersion of the internal samples in each clustering cluster 类内 , L 类内 Satisfies the following conditions: .
[0024] Or, S320: Generate the inter-class difference L of the defect annotation images to be quality inspected in the current batch according to the separation degree between different category clustering clusters 类间 , L 类间 Satisfies the following conditions: .
[0025] S330: If L 类内 < Y1 and / or L 类间 < Y2, obtain and remove the abnormal annotation images in the defect annotation images to be quality inspected in the current batch. Y1 is the intra-class difference threshold, such as Y1 = 0.3. Y2 is the inter-class difference threshold, such as Y2 = 0.2.
[0026] Specifically, the intra-class difference is used to represent the dispersion degree of each clustering cluster. The larger this value is, the greater the dispersion degree of each clustering cluster, and correspondingly, it indicates that there is a greater possibility of mixing images that do not belong to this category in the same annotation category. The inter-class difference represents the distance between the centers of different clustering clusters. The larger this index value is, the clearer the separation boundary between different categories, and the smaller the variation within the category. On the contrary, the smaller the index value, the more overlap between different categories, and the more annotation errors in the images, and further adjustment is required.
[0027] That is, if the intra-class difference exceeds the threshold or the inter-class difference exceeds the threshold, it indicates that the annotation quality of the current data is poor and it is not feasible for subsequent data cleaning, and the annotator needs to re-annotate. If the intra-class difference is less than the threshold or the inter-class difference is less than the threshold, it means that the annotation quality is basically qualified. At this time, it can enter the abnormal annotation data cleaning stage of subsequent steps such as S300, and further improve the data quality through cleaning and adjustment.
[0028] Thus, based on the intra-class difference and the inter-class difference, this embodiment can judge the quality of the data annotation in the current batch as a whole, and decide whether to perform subsequent cleaning and adjustment to further improve the data quality, so as to avoid wasting energy on secondary quality inspection of data with unqualified overall annotation quality.
[0029] S300: Obtain the abnormality degree corresponding to each defect annotation image according to the sample points corresponding to each defect annotation image after clustering. Among them, the clustering cluster C iThe anomaly degree P(x) corresponding to sample point x in the data satisfies the following condition: .
[0030] . .
[0031] . .
[0032] Where DI(x) is the distribution index corresponding to sample point x, Dintra(x) is the Euclidean distance between sample point x and the cluster center of its own cluster, Dinter(x) is the minimum Euclidean distance from sample point x to the cluster centers of other clusters, and LDD(x) is the local density deviation of sample point x. ρ Ci mediam It is C i The neighborhood density is the median of the neighborhood density of all sample points in the dataset. In this embodiment, the neighborhood refers to a specific spatial range surrounding a central point (sample point). For example, in a two-dimensional plane, it can be the set of all points whose Euclidean distance is less than a certain threshold. The neighborhood density can be the number of all sample points included in the neighborhood. ρ(x) is the neighborhood density of sample point x. i It is cluster C i The center, u j It is cluster C j The center, It is the Euclidean distance between two points. N is the total number of clusters. i=1, 2...N, j=1, 2...N.
[0033] In this step, DI(x) indicates the compactness of the cluster where sample point x belongs by the distribution of the overall clusters. Dintra(x) and Dinter(x) characterize whether sample point x is closer to its own cluster by using distance values. LDD(x) compares the number of neighbor points around sample point x in the same cluster with the number of neighbor points around most sample points in the same cluster. This can characterize whether sample point x is in a position closer to most sample points or in a remote position in the entire cluster.
[0034] Because high-dimensional feature vectors of defect images within the same category are closer together, they are more likely to cluster into the same category, while high-dimensional feature vectors of defect images from different categories are farther apart. Therefore, by combining these multiple dimensions of features, we can more accurately characterize whether a sample point x is an outlier far from the cluster center. The more remote the outlier, the lower the similarity between the sample point x and the inherent features of its category, meaning it is more likely to be mislabeled image data. Thus, the higher the anomaly score, the more it indicates that the defect annotation image corresponding to the sample point has an annotation error. In this way, the S400 algorithm can be used to identify and remove the abnormal annotation images.
[0035] S400: If P(x) > Y3, then the defect annotation image corresponding to sample point x is identified as an anomaly annotation image and removed. Y3 is the anomaly threshold, such as Y3=3.
[0036] After obtaining the anomaly-annotated image, the method also includes: S500: Based on the high-dimensional feature vector corresponding to each defect-annotated image, t-SNE technology is used to visualize all high-dimensional feature vectors, generating an initial annotation data distribution map. The initial annotation data distribution map includes the distribution points corresponding to each defect-annotated image.
[0037] S600: Based on the cluster category to which each defect annotation image belongs and whether it is an abnormal annotation image, the distribution points corresponding to each defect annotation image are set to be displayed differently.
[0038] The S600 includes: S601: If the defect annotation image is an abnormal annotation image, then add an abnormal label to the distribution points corresponding to the defect annotation image and / or set an abnormal selection box around the distribution points corresponding to the defect annotation image.
[0039] S602: Both the anomaly label and the anomaly checkbox are associated with the image location of the trap-marked image, which is used to locate and display the trap-marked image.
[0040] like Figure 2 As shown, the t-SNE visualization tool is used to visualize the detected suspected anomaly data, facilitating manual inspection. Anomalies are typically labeled with an "interesting" field to indicate potentially problematic data. Clicking the frame (selection box) of the anomaly displays the location information of the defective feature points in the image, such as... Figure 4 As shown, the labeling and acceptance personnel can use this location information to revise the label categories again to ensure data accuracy. The labeling and acceptance personnel verify and correct all suspected abnormal data, and then overwrite the original data with the verified data to ensure the high quality and consistency of the dataset. This completes the cleaning of the unqualified labeled data.
[0041] This method possesses the ability to monitor data streams in real time, enabling it to promptly identify and report new abnormal data points during data processing. This feature is particularly suitable for industrial quality inspection tasks that require rapid problem response, helping to identify and correct issues in the data in a timely manner, ensuring the efficiency and accuracy of the quality inspection process.
[0042] The method also includes removing anomalously labeled images.
[0043] S700: Based on the center vector corresponding to each cluster, calculate the similarity between any two cluster categories to generate a similarity matrix between defect categories, such as... Figure 3 As shown. Of course, the mean of the high-dimensional feature vectors extracted from the images of each defect type can also be used to calculate the similarity matrix between defects.
[0044] S800: If the similarity between any two cluster categories is greater than the similarity threshold, then the defect labels of the defect-annotated images included in the two cluster categories will be merged into the same defect category label.
[0045] S900: Use the remaining quality-inspected defect-annotated images to train and update the first SAM model.
[0046] This invention can periodically or in real-time detect and process abnormal data points, ensuring the high quality of the dataset and providing reliable data support for subsequent deep learning training. The defect annotation data processed in this embodiment is all of higher annotation quality. Therefore, the data after quality inspection can be used to retrain the first SAM model, enabling it to have higher recognition accuracy and gradually increase its ability to recognize new defect categories. This allows for the gradual enhancement of the first SAM model's capabilities.
[0047] Meanwhile, since some images of different types of defects are very similar and their features are highly similar, if these two types of labeled data are not merged, the model will forcibly distinguish between the two types of defect images during subsequent model training. However, the accuracy of the model will drop significantly and the generated results will not be able to provide a reference. Therefore, in this embodiment, these images are merged to avoid affecting the model's recognition performance. For such similar images, manual quality inspection can be performed again.
[0048] This invention holds immense potential in deep model training and industrial quality inspection. Its main advantage lies in its ability to automatically identify noise and outliers in data, significantly improving the stability and accuracy of deep models. Furthermore, by ensuring high data quality, it helps the model generalize better to unseen data, which is particularly important in the complex and ever-changing scenarios of industrial quality inspection. This method also reduces data acceptance costs because it helps inspectors filter a large number of high-quality labels, reducing manual verification work. In industrial quality inspection, it improves the efficiency and accuracy of the inspection system, reducing false positives and false negatives, thus saving time and resources. The system's automation means it can be integrated into workflows to clean data periodically or in real-time, mitigating the risk of human intervention. Moreover, it is highly adaptable and can be configured to meet the needs of different industries and application areas. In conclusion, the data cleaning method based on defect feature distribution is an important approach to improving the performance of deep models and optimizing industrial quality inspection tasks, and it will play an increasingly important role as data volume continues to increase and quality inspection requirements become more stringent.
[0049] Furthermore, although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.
[0050] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0051] In an exemplary embodiment of this disclosure, an electronic device capable of implementing the above-described method is also provided.
[0052] Those skilled in the art will understand that various aspects of the present invention can be implemented as systems, methods, or program products. Therefore, various aspects of the present invention can be specifically implemented in the following forms: entirely in hardware, entirely in software (including firmware, microcode, etc.), or in a combination of hardware and software, collectively referred to herein as “circuit,” “module,” or “system.”
[0053] An electronic device according to this embodiment of the invention. The electronic device is merely an example and should not be construed as limiting the functionality or scope of the embodiments of the invention.
[0054] Electronic devices are manifested in the form of general-purpose computing devices. Components of an electronic device may include, but are not limited to: at least one processor, at least one memory, and buses connecting different system components (including memory and processor).
[0055] The memory stores program code that can be executed by a processor, causing the processor to perform the steps described in the "Exemplary Methods" section above, according to various exemplary embodiments of the present invention.
[0056] The storage may include readable media in the form of volatile storage, such as random access memory (RAM) and / or cache memory, and may further include read-only memory (ROM).
[0057] The storage may also include a program / utility method having a set (at least one) of program modules, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0058] A bus can represent one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus that uses any of the various bus architectures.
[0059] The electronic device can also communicate with one or more external devices (e.g., keyboards, pointing devices, Bluetooth devices, etc.), one or more devices that enable a user to interact with the electronic device, and / or any device that enables the electronic device to communicate with one or more other computing devices (e.g., routers, modems, etc.). This communication can be performed via input / output (I / O) interfaces. Furthermore, the electronic device can communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter. The network adapter communicates with other modules of the electronic device via a bus. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with the electronic device, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0060] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the methods described above is stored. In some possible embodiments, various aspects of the present invention may also be implemented as a program product comprising program code that, when the program product is run on a terminal device, causes the terminal device to perform the steps of the various exemplary embodiments of the present invention described in the "Exemplary Methods" section above.
[0061] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0062] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.
[0063] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0064] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0065] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of the present invention, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.
[0066] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0067] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A highly efficient method for cleaning industrial quality inspection data, characterized in that, The method includes the following steps: Each defect-annotated image to be inspected is input into the first SAM model to generate a high-dimensional feature vector corresponding to each defect-annotated image; the first SAM model includes an image encoder and a fully connected layer, the output of the image encoder is connected to the input of the fully connected layer; the high-dimensional feature vector is output by the fully connected layer; The K-NN algorithm is used to cluster all high-dimensional feature vectors corresponding to all defect-annotated images to generate multiple clusters corresponding to preset categories. Based on the sample points corresponding to each defect-annotated image after clustering, the anomaly degree of each defect-annotated image is obtained; where, cluster C i The anomaly P(x) corresponding to sample point x in the data satisfies the following condition: ; ; ; ; ; Where DI(x) is the distribution index corresponding to sample point x, Dintra(x) is the Euclidean distance between sample point x and the cluster center of its own cluster, Dinter(x) is the minimum Euclidean distance from sample point x to the cluster centers of other clusters, and LDD(x) is the local density deviation of sample point x; ρ Ci mediam It is C i The median neighborhood density of all sample points in the set, where ρ(x) is the neighborhood density of sample point x; u i It is cluster C i The center, u j It is cluster C j The center It is the Euclidean distance between two points; N is the total number of clusters; i=1, 2...N, j=1, 2...N; If P(x) > Y3, then the defect annotation image corresponding to sample point x is identified as an abnormal annotation image and removed; Y3 is the anomaly threshold. Before obtaining the anomaly degree corresponding to each defect annotation image, the method further includes: Based on the dispersion of samples within each cluster, the intra-cluster difference L of the defect annotation images to be inspected in the current batch is generated. 类内 L 类内 The following conditions must be met: ; or, Based on the separation degree between different clusters, the inter-class difference L is generated for the defect annotation images of the current batch awaiting quality inspection. 类间 L 类间 The following conditions must be met: ; If L 类内 <Y1 and / or L 类间 <Y2, then obtain and remove the abnormal labeled images in the defect labeled images to be quality inspected in the current batch; Y1 is the intra-class difference threshold, and Y2 is the inter-class difference threshold; After removing the abnormally labeled images, the method further includes; Based on the center vector corresponding to each cluster, the similarity between any two cluster categories is calculated to generate a similarity matrix between defect categories; If the similarity between any two cluster categories is greater than the similarity threshold, then the defect labels of the defect-annotated images included in the two cluster categories will be merged into the same defect category label. After merging the defect labels of the defect-annotated images included in the two clustering categories into a single defect category label, the method further includes: The remaining defect-annotated images that passed quality inspection were used to train and update the first SAM model.
2. The method according to claim 1, characterized in that, After obtaining the anomaly-annotated image, the method further includes: Based on the high-dimensional feature vector corresponding to each defect-annotated image, the t-SNE technique is used to visualize all high-dimensional feature vectors to generate an initial annotation data distribution map; the initial annotation data distribution map includes the distribution points corresponding to each defect-annotated image. Based on the cluster category to which each defect-annotated image belongs and whether it is an abnormal annotated image, the distribution points corresponding to each defect-annotated image are displayed differently.
3. The method according to claim 2, characterized in that, Differentiated display settings for the distribution points corresponding to each defect annotation image include: If the defect annotation image is an abnormal annotation image, then it is necessary to add an abnormal label to the distribution points corresponding to the defect annotation image and / or to circle an abnormal selection box around the distribution points corresponding to the defect annotation image; The anomaly label and anomaly selection box are both associated with the image location of the trap-marked image, and are used to locate and display the trap-marked image.
4. The method according to claim 1, characterized in that, When training the first SAM model, the loss function L total The following conditions must be met: L total =L CE +λL contrastive Among them, L CE It is the cross-entropy loss, L contrastive It is a similarity metric loss; λ is a hyperparameter.
5. The method according to claim 1, characterized in that, Before inputting the labeled image of each defect to be inspected into the first SAM model, the method further includes: Centered on the defect annotation, the new annotated image is cropped into a 256x256 pixel defect image; the length and width of the largest bounding rectangle of the defect image area in the defect image are not less than 50 pixels. Set the background of the defect image to black to generate a defect annotation image to be inspected.
6. A non-transitory computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements an efficient industrial quality inspection data cleaning method as described in any one of claims 1 to 5.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements an efficient industrial quality inspection data cleaning method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
PCB panel defect classification method, system and equipment and storage medium
CN117473409A
Metal material surface defect detection image automatic labeling algorithm and device, storage medium and program product
CN118486028A