Defect screening method, product classification method, apparatus, and computer device
By constructing a data space and dividing it into subspaces, and using key features and constraint features to classify and screen defects, the problem of distinguishing between defects and non-defects in industrial products is solved, and more efficient quality inspection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-01
- Publication Date
- 2026-03-24
AI Technical Summary
Existing technologies struggle to accurately distinguish between defects and non-defects in industrial product images, especially non-defects such as dirt, resulting in poor detection performance.
By constructing a data space and dividing it into multiple independent subspaces, key features and constraint features are used to classify and screen defects to determine whether they are defects.
It improves the accuracy of distinguishing between defects and non-defects, reduces the rate of missed detections and over-detections, and enhances the quality inspection effect of industrial products.
Smart Images

Figure CN115577135B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of testing technology, and in particular to a defect screening method, a product classification method, a defect screening device, a product classification device, a computer device, and a readable storage medium. Background Technology
[0002] Currently, both consumers and manufacturers have higher requirements for the appearance quality of industrial products, especially for the appearance quality of glass covers for displays such as mobile phones and tablets. This is because the appearance quality of the cover not only affects the aesthetics but can also affect display performance, waterproofing, and other aspects. To ensure product quality and reduce the cost of defective products during production, industrial processes require quality inspection at key stages.
[0003] During the high-precision inspection of industrial products using intelligent AOI (Automatic Optical Inspection) equipment, various results are detected. These results include both defects and non-defects such as dust, dirt, and water stains. Therefore, it is necessary to classify and screen defects to distinguish between detected defects and non-defects, thereby classifying products as OK or NG (Not Acceptable) products.
[0004] However, non-defect images (such as dirt) are similar to defect images and difficult to distinguish. Therefore, how to accurately classify and screen defects from non-defects such as dirt and interference has become an urgent problem to be solved. Summary of the Invention
[0005] In view of this, this application provides a defect screening method, a product classification method, a defect screening device, a product classification device, a computer device, and a readable storage medium, which solves the problem in related technologies that cannot effectively distinguish between defect domains and non-defects in images.
[0006] In a first aspect, embodiments of this application provide a defect screening method, comprising: acquiring multiple defects to be screened; constructing a data space based on the feature quantities of the multiple defects to be screened, and dividing the data space into multiple independent subspaces, wherein the multiple defects to be screened are a set of points in the data space; for a target defect to be screened among the multiple defects to be screened, classifying the target defect to be screened into a target subspace corresponding to the target key feature based on the target key feature of the target defect; if the constraint feature of the target defect to be screened satisfies the constraint conditions added to the target subspace, then the target defect to be screened is determined to be a defect; if the constraint feature of the target defect to be screened does not satisfy the constraint conditions added to the target subspace, then the target defect to be screened is determined to be a non-defect.
[0007] Secondly, embodiments of this application provide a product classification method, including: acquiring multiple product images of a product and segmenting defects to be screened from the multiple product images; determining whether the defects to be screened are defects according to the method of the first aspect; if the defects to be screened are defects, determining the defect level of the defects to be screened and counting the number of defects to be screened at different defect levels; and determining the product classification based on the defect level of the defects to be screened and the number of defects to be screened at different defect levels.
[0008] Thirdly, embodiments of this application provide a defect screening device, comprising: an acquisition module for acquiring multiple defects to be screened; a division module for constructing a data space based on the feature quantities of the multiple defects to be screened, and dividing the data space into multiple independent subspaces, wherein the multiple defects to be screened are a set of points in the data space; and a screening module for, for a target defect to be screened among the multiple defects to be screened, dividing the target defect to be screened into a target subspace corresponding to the target key feature based on the target key feature of the target defect to be screened, wherein if the constraint feature of the target defect to be screened satisfies the constraint conditions added to the target subspace, the target defect to be screened is determined to be a defect, and if the constraint feature of the target defect to be screened does not satisfy the constraint conditions added to the target subspace, the target defect to be screened is determined to be a non-defect.
[0009] Fourthly, embodiments of this application provide a product classification device, comprising: an acquisition module, configured to acquire multiple product images of a product and segment out defects to be screened from the multiple product images; a judgment module, configured to determine whether the defects to be screened are defects according to the device of the third aspect; a determination module, configured to determine the defect level of the defects to be screened if the defects to be screened are defects, and count the number of defects to be screened at different defect levels; and a classification module, configured to determine the classification of the product based on the defect level of the defects to be screened and the number of defects to be screened at different defect levels.
[0010] Fifthly, embodiments of this application provide a computer device including a processor and a memory, the memory storing programs or instructions executable on the processor, the programs or instructions, when executed by the processor, implementing the steps of the methods as described in the first or second aspect.
[0011] In a sixth aspect, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method as described in the first or second aspect.
[0012] In a seventh aspect, embodiments of this application provide a chip, which includes a processor and a communication interface, the communication interface and the processor being coupled together, the processor being used to run programs or instructions to implement the methods as described in the first or second aspect.
[0013] Eighthly, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the method as described in the first or second aspect.
[0014] In this embodiment, multiple defects to be screened are acquired. These defects can be segmented from product images of industrial products requiring quality inspection, or they can be sample images. A data space is constructed based on the feature values of the multiple defects to be screened, thereby transforming the defects into a set of points distributed within the data space. The data space is then divided into multiple independent subspaces, where defects and non-defects are classified and screened. Specifically, for any one of the multiple defects to be screened (i.e., the target defect), the target defect is assigned to the target subspace corresponding to the target key feature based on the value of its target key feature. Then, whether the target defect is a true defect is determined based on whether its constraint features satisfy the constraints in the target subspace.
[0015] The technical solution of this application can accurately distinguish whether the defect to be screened is a defect or not, thereby reducing the missed detection rate and the over-detection rate of industrial products and improving the quality inspection effect of industrial products.
[0016] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0017] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0018] Figure 1 A flowchart illustrating the defect screening method according to an embodiment of this application is shown;
[0019] Figure 2 A schematic diagram of the length and width of the two-dimensional coordinate system data space according to an embodiment of this application is shown;
[0020] Figure 3 A schematic diagram of the three-dimensional coordinate system data space of length, width, and contrast according to an embodiment of this application is shown;
[0021] Figure 4 A schematic diagram of the secondary two-dimensional coordinate system data space for contrast and area according to an embodiment of this application is shown;
[0022] Figure 5 A flowchart illustrating the product classification method according to an embodiment of this application is shown;
[0023] Figure 6 A structural block diagram of a defect screening device according to an embodiment of this application is shown;
[0024] Figure 7 A structural block diagram of a product sorting device according to an embodiment of this application is shown;
[0025] Figure 8 A structural block diagram of a computer device according to an embodiment of this application is shown. Detailed Implementation
[0026] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0027] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0028] The defect screening method, product classification method, defect screening device, product classification device, computer equipment, and readable storage medium provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.
[0029] This application provides a defect screening method, such as... Figure 1 As shown, the method includes:
[0030] Step 101: Obtain multiple defects to be screened;
[0031] Step 102: Construct a data space based on the feature quantities of multiple defects to be screened, and divide the data space into multiple independent subspaces, wherein the multiple defects to be screened are a set of points in the data space;
[0032] Step 103: For the target defect to be screened among multiple defects to be screened, the target defect to be screened is divided into the target subspace corresponding to the target key features according to the target key features of the target defect.
[0033] Step 104: Determine whether the constraint features of the target defect to be screened meet the constraint conditions added to the target subspace. If the constraint features of the target defect to be screened meet the constraint conditions added to the target subspace, proceed to step 105. If the constraint features of the target defect to be screened do not meet the constraint conditions added to the target subspace, proceed to step 106.
[0034] Step 105: Determine the target defect to be screened as a defect;
[0035] Step 106: Determine that the target defect to be screened is a non-defect.
[0036] In this embodiment, multiple defects to be screened are acquired. These defects can be segmented from product images of industrial products requiring quality inspection, or they can be sample images. A data space is constructed based on the feature values of the multiple defects to be screened, thereby transforming the defects into a set of points distributed within the data space. The data space is then divided into multiple independent subspaces, where defects and non-defects are classified and screened within the subspaces.
[0037] Specifically, for any one of the multiple defects to be screened (i.e., the target defect to be screened), based on the numerical values of the target key features of the target defect, the target defect to be screened is divided into a target subspace corresponding to the target key features. Then, whether the target defect to be screened is a true defect is determined based on whether its constraint features satisfy the constraint conditions in the target subspace. For example, the length and width of the target defect to be screened satisfy... Figure 3 If the length and width values corresponding to subspace B are used, then the target defect to be screened is assigned to subspace B. If the value of the constraint feature (i.e., contrast) of the target defect to be screened still satisfies the constraint conditions corresponding to subspace B, then the target defect to be screened is determined to be a defect; if the value of the constraint feature of the target defect to be screened does not satisfy the constraint conditions corresponding to subspace B, then the target defect to be screened is determined to be a non-defect.
[0038] The technical solution of this application can accurately distinguish whether the defect to be screened is a defect or not, thereby reducing the missed detection rate and the over-detection rate of industrial products and improving the quality inspection effect of industrial products.
[0039] In one embodiment of this application, a data space is constructed based on the feature quantities of multiple defects to be screened, and the data space is divided into multiple independent subspaces. This includes: calculating the feature quantity of each defect to be screened, wherein the feature quantity includes key features and constraint features; constructing the data space using the key features; determining a numerical scale; dividing the data space into multiple independent subspaces based on the boundary lines generated by the numerical scale; and adding constraint conditions of constraint features to each subspace.
[0040] In this embodiment, the feature quantities of each defect to be screened are calculated. These feature quantities serve as the basic attributes of the defect, including but not limited to: length, width, aspect ratio, average length and width (i.e., (length + width) / 2), area, absolute value of the difference between the average grayscale value of the defect and the average grayscale value of the background, linearity, equivalent bone length, etc. In practical applications, a dozen to several dozen feature quantities can be selectively calculated as needed. These feature quantities can be classified according to attribute type as: scale features, derived scale features, position features, morphological features, grayscale features, defect grayscale features, defect domain grayscale features, etc. According to their function, they can be divided into key features and constraint features. Key features are used to divide the subspace, including but not limited to: length, width, aspect ratio, average length and width, area, etc. Constraint features are used to distinguish the corresponding defects to be screened in the subspace as defects or non-defects. Features other than key features can be used as constraint features.
[0041] Let d be the defect to be screened, and each defect to be screened contains n features x1, x2, ..., xn. n Then there are m samples d1, d2, ..., dm. m This forms a set D. Based on this, let's transform the concept: consider set D as a set distributed across x1, x2, ..., xn. n The goal of defect classification and screening is to find one or more boundaries that accurately divide the set of points distributed in this data space into defect sets D, which are the point sets formed by these n-dimensional features. t Non-defect set D f .
[0042] Select key features, construct a data space, and divide the data space into multiple subspaces based on inspection requirements and screening experience by setting numerical scales, that is, multiple subclasses. Then, the defects to be screened will fall into the corresponding subspace according to the value of their key features.
[0043] Furthermore, in each subspace, constraints of the constraint features are added to filter and distinguish between defects and non-defects.
[0044] The embodiments of this application, through the above-described method, determine how to select feature quantities and how to set constraints, simplify the condition setting for distinguishing between defects and non-defects, unify the methods and ideas for defect screening, thereby reducing the difficulty of distinguishing between defects and non-defects, and greatly improving the speed and capability of engineering deployment.
[0045] In one embodiment of this application, key features include: length, width, aspect ratio, average length and width, and contrast. A data space is constructed using these key features, and numerical scales are determined. Based on the boundary lines generated by the numerical scales, the data space is divided into multiple independent subspaces. This includes: establishing a two-dimensional coordinate system data space with length as the first coordinate axis and width as the second coordinate axis; determining multiple different length values, multiple different aspect ratios, and multiple different average length and width values, and adding boundary lines for these values to divide the two-dimensional coordinate system data space into multiple regions; converting these regions into a three-dimensional coordinate system data space with contrast as the third coordinate axis; determining multiple different contrast values, and adding boundary lines for these values to divide the three-dimensional coordinate system data space into multiple independent subspaces.
[0046] In this embodiment, the user selects key features, including length L, width W, and aspect ratio K, average length and width N, and contrast A derived from the length and width coordinate system, thereby establishing a three-dimensional coordinate system data space through the key features selected by the user, wherein the average length and width N = (L + W) / 2.
[0047] Specifically, such as Figure 2 As shown, firstly, a two-dimensional coordinate system data space is established with length L as the Y-axis (i.e., the first coordinate axis) and width W as the X-axis (i.e., the second coordinate axis). Then, multiple user-defined length values (including 41, 80, 90, 150, and 180), multiple different aspect ratios (including 1, 2, and 4.5), and multiple different average length and width values (including 8, 25, and 50) are determined. This adds boundary lines for different length values, different aspect ratios, and different average length and width values to the two-dimensional coordinate system data space, thereby dividing the two-dimensional coordinate system data space into multiple regions.
[0048] For example, the specific data in Table 1 is divided into 10 regions, and a defect parent class is established for each region. For example, region 1 is named: 1.0 Linear Defect.
[0049] Table 1
[0050]
[0051]
[0052] Then, the data space is elevated from two-dimensional to three-dimensional. Specifically, a key one-dimensional feature, contrast, is added to the two-dimensional coordinate system data space; that is, contrast is used as the Z-axis (i.e., the third coordinate axis), thus transforming it into a three-dimensional coordinate system data space. In such cases... Figure 3 In the shown three-dimensional coordinate system data space, you can select contrast A and add numerical scales of 30 and 60. Figure 2 Region 2 in the diagram corresponds to subspace B. Subspace B is treated as a subclass and named: 2.1 Moderate Block Defect.
[0053] After dividing the space into multiple independent subspaces, constraint conditions can be added to each subspace to classify and filter defects. For example, in subspace B, representative features are selected as constraint features to distinguish defects from non-defects based on their characteristics. In this embodiment, the selected constraint conditions for subspace B are: area > 50, the ratio of the defect to its minimum bounding rectangle > 0.3, and the number of high-gradient pixels > 10. Here, a defect is an irregular region, and the ratio of its area to its minimum bounding rectangle is the minimum bounding rectangle ratio. Defects in subspace B that satisfy these constraints are considered defects, while those that do not are considered non-defects.
[0054] It should be noted that the constraint features to be selected for different subspaces need to be determined according to the actual screening situation, and this application embodiment does not limit this.
[0055] In this embodiment of the application, by establishing a data space and dividing it into subspaces, defects and non-defects can be classified and filtered within the subspaces.
[0056] In one embodiment of this application, key features include: length, width, aspect ratio, average length and width, contrast, and area. A data space is constructed using these key features, and numerical scales are determined. Based on the boundary lines generated by the numerical scales, the data space is divided into multiple independent subspaces. This includes: establishing a primary two-dimensional coordinate system data space with length as the first coordinate axis and width as the second coordinate axis; determining multiple different length values, multiple different aspect ratios, and multiple different average length and width values, and adding boundary lines for multiple different length values, multiple different aspect ratios, and multiple different average length and width values to the two-dimensional coordinate system data space to divide the primary two-dimensional coordinate system data space into multiple regions; converting the multiple regions into a secondary two-dimensional coordinate system data space with contrast as the first coordinate axis and area as the second coordinate axis; determining multiple different contrast values and multiple different area values, and adding boundary lines for multiple different contrast values and multiple different area values to the secondary two-dimensional coordinate system data space to divide the secondary two-dimensional coordinate system data space into multiple independent subspaces.
[0057] In this embodiment, the user selects key features, including length L, width W, and aspect ratio K, average length and width N, contrast A, and area S derived from the length and width coordinate system, thereby establishing a two-dimensional coordinate system data space through the key features selected by the user, wherein the average length and width N = (L + W) / 2.
[0058] Specifically, such as Figure 2 As shown, firstly, a primary two-dimensional coordinate system data space is established with length L as the Y-axis (i.e., the first coordinate axis) and width W as the X-axis (i.e., the second coordinate axis). Then, multiple user-defined length values (including 41, 80, 90, 150, and 180), multiple aspect ratios (including 1, 2, and 4.5), and multiple average length and width values (including 8, 25, and 50) are determined. This allows the addition of boundary lines for different length values, different aspect ratios, and different average length and width values within the primary two-dimensional coordinate system data space, thereby dividing the primary two-dimensional coordinate system data space into multiple regions.
[0059] Then, as Figure 4 As shown, contrast A and area S are selected in each region respectively. A secondary two-dimensional coordinate system data space is constructed with contrast A as the Y-axis (i.e., the first coordinate axis) and area S as the X-axis (i.e., the second coordinate axis). Boundary lines with different contrast values and different area values are added to this secondary two-dimensional coordinate system data space to obtain multiple subspaces. Different subspaces are treated as a subclass, for example... Figure 2 The subspace C is obtained from region 2 in the diagram.
[0060] After dividing the space into multiple independent subspaces, constraint conditions can be added to each subspace to classify and filter defects. For example, in subspace C, representative features are selected as constraint features to distinguish defects from non-defects based on their characteristics. In this embodiment, subspace C is named "2.1 Block Scratches." The selected constraint conditions include, but are not limited to: the minimum bounding rectangle ratio of the defect > 0.5, and the number of independent regions < 3. Here, a defect is an irregular region, and the area of this region divided by its minimum bounding rectangle is the minimum bounding rectangle ratio. When multiple non-connected regions are merged into a single defect, the number of non-connected regions of this defect is called the number of independent regions. Defects in subspace C that satisfy these constraints are considered defects, while those that do not satisfy the constraints are considered non-defects.
[0061] It should be noted that the constraint features to be selected for different subspaces need to be determined according to the actual screening situation, and this application embodiment does not limit this.
[0062] In this embodiment of the application, by establishing a data space and dividing it into subspaces, defects and non-defects can be classified and filtered within the subspaces.
[0063] In one embodiment of this application, after dividing the two-dimensional coordinate system data space or the first-level two-dimensional coordinate system data space into multiple regions, the method further includes: determining the target region where the key features of the defect to be screened are located, and using the classification label corresponding to the target region as the type of the defect to be screened.
[0064] In this embodiment, the user can add a corresponding category label to each region. This category label is related to the key features of the region, thus enabling the naming of each region. For example, Figure 2 Zone 1 can be named 1.0 Linear Defect. If a defect to be screened falls within a zone, the type of defect to be screened can be determined based on the naming of that zone. For example, the length and width of the defect to be screened meet the following conditions: Figure 2 If the length and width values corresponding to zone 1 are used, then the defect to be screened is classified into zone 1, that is, the defect to be screened may be a linear defect.
[0065] The above method enables the determination of the specific type of defect to be screened.
[0066] In one embodiment of this application, after classifying the target defect to be screened into the target subspace corresponding to the target key features, the method further includes: using the classification label corresponding to the target subspace as the type of the target defect to be screened.
[0067] In this embodiment, the user can add a corresponding classification label to each subspace. This classification label is related to the feature quantity of the subspace, thus enabling naming of each subspace. For example, Figure 3 Subspace B in the code can be named 2.1 Moderate Blocky Defect. If a defect to be screened falls into a subspace, the type of defect to be screened can be determined based on the naming of that subspace. For example, the length, width, and contrast of the target defect to be screened meet the following criteria: Figure 3 If the length, width, and contrast values corresponding to subspace B are used, then the defect to be screened is assigned to subspace B. In other words, the defect to be screened may be a moderate block defect.
[0068] The above method enables the determination of the specific type of defect to be screened.
[0069] In one embodiment of this application, the numerical scale is greater than a preset threshold; the method further includes: identifying defects to be screened whose key features are located in a subspace as out-of-specification defects.
[0070] In this embodiment, the user can set the numerical scale corresponding to the key feature, so that the smallest numerical scale is greater than a preset threshold. The preset threshold is a dividing value that can distinguish between defects within the specification and defects outside the specification. Specifically, defects to be screened whose key features are less than the preset threshold are excluded from the subspace, while defects to be screened within the subspace are defects outside the specification.
[0071] The above methods enable the identification of out-of-specification defects.
[0072] This application provides a product classification method, such as... Figure 5 As shown, the method includes:
[0073] Step 501: Obtain multiple product images of the product and segment out the defects to be screened from the multiple product images;
[0074] Step 502: Determine whether the defect to be screened is a defect. If the defect to be screened is a defect, determine the defect level of the defect to be screened and count the number of defects to be screened at different defect levels.
[0075] Step 503: Determine the product classification based on the defect level of the defects to be screened and the number of defects to be screened at different defect levels.
[0076] In this embodiment, firstly, multiple product images captured under different camera and light source angles are acquired, referred to as multiple image channels. Then, the image channel with clear defect imaging is selected to segment the defect, obtaining a defect mask (i.e., the defect to be screened). Next, the feature quantities on the product image corresponding to the defect to be screened are calculated, including key features and constraint features. Key features are selected to construct a data space, which is then divided into multiple independent subspaces according to inspection regulations and screening experience. Constraint conditions for constraint features are added to each subspace. Based on whether the constraint features of any defect to be screened satisfy the constraint conditions corresponding to its subspace, it is determined whether the defect to be screened is a true defect. Finally, if it is determined to be a true defect, the defect level of the defect to be screened is determined.
[0077] Using the above method, multiple defects to be screened are segmented, and their true and false defects are judged, along with the defect level of the true defects. This allows for the statistical analysis of defects to be screened at different defect levels. By statistically analyzing the level and number of true defects in a product, the product's classification—OK, NG, or Quality B—is determined.
[0078] For example, the defect levels are divided into 1 to 5, with the defect severity increasing sequentially. If a product is found to have 1 or 0 Level 1 defects and no higher-level defects, the product is deemed OK; if a product is found to have 2 or more Level 1 defects and no higher-level defects, the product is deemed Quality B; if a product is found to have 1 or more Level 2 or higher defects, the product is deemed NG.
[0079] The embodiments of this application can accurately determine product quality, reduce the over-inspection rate and under-inspection rate of product appearance quality inspection, and improve the quality inspection effect of products.
[0080] In one embodiment of this application, determining the defect level of a defect to be screened includes: determining the numerical range of a specific feature among the features of the defect to be screened; and taking the defect level corresponding to the numerical range of the specific feature as the defect level of the defect to be screened.
[0081] In this embodiment, a specific feature is selected from the feature quantities to classify the defect level of the true defect. The specific feature is either a key feature or a constraint feature, and the smaller the value of the selected specific feature, the lower the defect level.
[0082] Specifically, the defect level is determined based on the numerical range of a specific feature. For example, area is selected as the specific feature for defect level classification: areas ranging from 50 to 100 are classified as Level 1, areas ranging from 100 to 200 as Level 2, areas ranging from 200 to 350 as Level 3, areas ranging from 350 to 500 as Level 4, and areas ranging from 500 to infinity as Level 5.
[0083] The above methods enable accurate classification of defect levels, providing a basis for product quality inspection.
[0084] As a specific implementation of the above-mentioned defect screening method, this application provides a defect screening device. For example... Figure 6 As shown, the defect screening device 600 includes: an acquisition module 601, a division module 602, and a screening module 603.
[0085] The module 601 is used to acquire multiple defects to be screened; the partitioning module 602 is used to construct a data space based on the feature quantities of the multiple defects to be screened, and to divide the data space into multiple independent subspaces, wherein the multiple defects to be screened are a set of points in the data space; the screening module 603 is used to, for the target defect to be screened among the multiple defects to be screened, to partition the target defect to be screened into the target subspace corresponding to the target key feature based on the target key feature of the target defect to be screened. If the constraint feature of the target defect to be screened satisfies the constraint conditions added to the target subspace, then the target defect to be screened is determined to be a defect; if the constraint feature of the target defect to be screened does not satisfy the constraint conditions added to the target subspace, then the target defect to be screened is determined to be a non-defect.
[0086] In this embodiment, multiple defects to be screened are acquired. These defects can be segmented from product images of industrial products requiring quality inspection, or they can be sample images. A data space is constructed based on the feature values of the multiple defects to be screened, thereby transforming the defects into a set of points distributed within the data space. The data space is then divided into multiple independent subspaces, where defects and non-defects are classified and screened within the subspaces.
[0087] Specifically, for any one of the multiple defects to be screened (i.e., the target defect to be screened), the target defect to be screened is divided into the target subspace corresponding to the target key feature according to the value of the target key feature. Then, whether the target defect to be screened is a true defect is determined according to whether the constraint feature of the target defect to be screened satisfies the constraint conditions in the target subspace.
[0088] The technical solution of this application can accurately distinguish whether the defect to be screened is a defect or not, thereby reducing the missed detection rate and the over-detection rate of industrial products and improving the quality inspection effect of industrial products.
[0089] Furthermore, the partitioning module 602 is specifically used for: calculating the feature quantity of each defect to be screened, wherein the feature quantity includes key features and constraint features; constructing a data space using key features and determining a numerical scale; dividing the data space into multiple independent subspaces based on the boundary lines generated by the numerical scale; and adding constraint conditions of constraint features to each subspace.
[0090] Furthermore, key features include: length, width, aspect ratio, average length and width, and contrast. The partitioning module 602 is specifically used for: establishing a two-dimensional coordinate system data space with length as the first coordinate axis and width as the second coordinate axis; determining multiple different length values, multiple different aspect ratios, and multiple different average length and width values, and adding boundary lines for multiple different length values, multiple different aspect ratios, and multiple different average length and width values to the two-dimensional coordinate system data space to divide the two-dimensional coordinate system data space into multiple regions; converting the multiple regions into a three-dimensional coordinate system data space with contrast as the third coordinate axis; determining multiple different contrast values, and adding boundary lines for multiple different contrast values to the three-dimensional coordinate system data space to divide the three-dimensional coordinate system data space into multiple independent subspaces.
[0091] Furthermore, the key features include: length, width, aspect ratio, average length and width, contrast, and area; the partitioning module 602 is specifically used for: establishing a primary two-dimensional coordinate system data space with length as the first coordinate axis and width as the second coordinate axis; determining multiple different length values, multiple different aspect ratios, and multiple different average length and width values, and adding boundary lines for multiple different length values, multiple different aspect ratios, and multiple different average length and width values in the two-dimensional coordinate system data space to divide the primary two-dimensional coordinate system data space into multiple regions; converting the multiple regions into a secondary two-dimensional coordinate system data space with contrast as the first coordinate axis and area as the second coordinate axis; determining multiple different contrast values and multiple different area values, and adding boundary lines for multiple different contrast values and multiple different area values in the secondary two-dimensional coordinate system data space to divide the secondary two-dimensional coordinate system data space into multiple independent subspaces.
[0092] Furthermore, the filtering module 603 is also used to use the classification label corresponding to the target subspace as the type of the defect to be filtered.
[0093] Furthermore, the numerical scale is greater than a preset threshold; the screening module 603 is also used to identify defects to be screened whose key features are located in a subspace as out-of-specification defects.
[0094] As a specific implementation of the above product classification method, this application provides a product classification device. For example... Figure 7 As shown, the product classification device 700 includes: an acquisition module 701, a judgment module 702, a determination module 703, and a classification module 704.
[0095] The acquisition module 701 is used to acquire multiple product images of the product and segment out the defects to be screened from the multiple product images; the judgment module 702 is used to determine whether the defects to be screened are defects according to the device of the third aspect; the determination module 703 is used to determine the defect level of the defects to be screened if the defects to be screened are defects, and count the number of defects to be screened at different defect levels; the classification module 704 is used to determine the classification of the product according to the defect level of the defects to be screened and the number of defects to be screened at different defect levels.
[0096] In this embodiment, firstly, multiple product images captured under different camera and light source angles are acquired, referred to as multiple image channels. Then, the image channel with clear defect imaging is selected to segment the defect, obtaining a defect mask (i.e., the defect to be screened). Next, the feature quantities on the product image corresponding to the defect to be screened are calculated, including key features and constraint features. Key features are selected to construct a data space, which is then divided into multiple independent subspaces according to inspection regulations and screening experience. Constraint conditions for constraint features are added to each subspace. Based on whether the constraint features of any defect to be screened satisfy the constraint conditions corresponding to its subspace, it is determined whether the defect to be screened is a true defect. Finally, if it is determined to be a true defect, the defect level of the defect to be screened is determined.
[0097] Using the above method, multiple defects to be screened are segmented, and their true and false defects are judged, along with the defect level of the true defects. This allows for the statistical analysis of defects to be screened at different defect levels. By statistically analyzing the level and number of true defects in a product, the product's classification—OK, NG, or Quality B—is determined.
[0098] The embodiments of this application can accurately determine product quality, reduce the over-inspection rate and under-inspection rate of product appearance quality inspection, and improve the quality inspection effect of products.
[0099] Furthermore, the determining module 703 is specifically used to determine the numerical range of a specific feature among the feature quantities of the defect to be screened, and to take the defect level corresponding to the numerical range of the specific feature as the defect level of the defect to be screened.
[0100] The apparatus described in the embodiments of this application may be a computer device or a component in a computer device, such as an integrated circuit or a chip, and the computer device may be an AOI device.
[0101] The apparatus provided in this application embodiment can achieve... Figure 1 or Figure 5 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.
[0102] This application also provides a computer device, such as... Figure 8 As shown, the computer device 800 includes a processor 801 and a memory 802. The memory 802 stores a program or instruction that can run on the processor 801. When the program or instruction is executed by the processor 801, it implements the various steps of the above-described defect screening method embodiment or product classification method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0103] The memory 802 can be used to store software programs and various data. The memory 802 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 802 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 802 in this embodiment includes, but is not limited to, these and any other suitable types of memory.
[0104] Processor 801 may include one or more processing units; optionally, processor 801 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 801.
[0105] In one embodiment of this application, taking an AOI device for inspecting the appearance of a mobile phone glass cover as an example, it includes:
[0106] The optical imaging device consists of two line-scan cameras positioned vertically and horizontally within a single inspection station, along with multiple light sources at different angles. By employing various combinations of cameras and light sources, it achieves defect imaging from multiple perspectives.
[0107] Preferably, the optical imaging device is specifically used to: combine the projected bright field, the projected dark field, the reflected bright field, and the reflected dark field to achieve clear imaging of the product's outline and imaging of defects. Imaging the product's outline facilitates the location of the detection area in the image, while clear imaging of defects facilitates the detection and segmentation of defects.
[0108] The detection platform software is used to integrate image input, output, cropping, and storage, as well as to build detection operator processes and defect classification filters.
[0109] The defect detection module is used to build the operator process for defect detection, realizing the detection of defective regions and the calculation of defect feature quantities. The detection process can be divided into five main steps: establishing a coordinate system, data format conversion, contour region acquisition, defect detection, and defect feature quantity calculation.
[0110] The defect classification and screening module is used to distinguish and screen true defects, classify defects such as scratches and dents, and divide defects into 5 levels to achieve product classification.
[0111] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described defect screening method embodiment or product classification method embodiment and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0112] This application also provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled. The processor is used to run programs or instructions to implement the various processes of the above-described defect screening method embodiment or product classification method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0113] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0114] This application also provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the defect screening method embodiment or product classification method embodiment described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0115] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0116] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A defect screening method, characterized in that, include: Obtain multiple defects to be screened; A data space is constructed based on the feature quantities of multiple defects to be screened, and the data space is divided into multiple independent subspaces, wherein the multiple defects to be screened are a set of points in the data space; For the target defect among the plurality of defects to be screened, the target defect to be screened is divided into the target subspace corresponding to the target key features according to the target key features; If the constraint features of the target defect to be screened satisfy the constraint conditions added to the target subspace, then the target defect to be screened is determined to be a defect. If the constraint features of the target defect to be screened do not meet the constraint conditions added to the target subspace, then the target defect to be screened is determined to be a non-defect. The step of constructing a data space based on the feature quantities of multiple defects to be screened, and dividing the data space into multiple independent subspaces, includes: Calculate the feature quantity for each of the defects to be screened, wherein the feature quantity includes key features and constraint features; The data space is constructed using the key features, and a numerical scale is determined. Based on the boundary lines generated by the numerical scale, the data space is divided into multiple independent subspaces, and the constraint conditions of the constraint features are added to each subspace.
2. The method according to claim 1, characterized in that, The key features include: length, width, aspect ratio, average length and width, and contrast. The process of constructing the data space using the key features and determining the numerical scale, and dividing the data space into multiple independent subspaces based on the boundary lines generated by the numerical scale, includes: A two-dimensional coordinate system data space is established with the length as the first coordinate axis and the width as the second coordinate axis; Multiple different length values, multiple different aspect ratios, and multiple different average length and width values are determined, and boundary lines for the multiple different length values, multiple different aspect ratios, and multiple different average length and width values are added in the two-dimensional coordinate system data space to divide the two-dimensional coordinate system data space into multiple regions. Using the contrast ratio as the third coordinate axis, the multiple regions are converted into a three-dimensional coordinate system data space; Multiple different contrast values are determined, and boundary lines for the multiple different contrast values are added in the three-dimensional coordinate system data space to divide the three-dimensional coordinate system data space into multiple mutually independent subspaces.
3. The method according to claim 1, characterized in that, The key features include: length, width, aspect ratio, average length and width, contrast, and area; The process of constructing the data space using the key features and determining the numerical scale, and dividing the data space into multiple independent subspaces based on the boundary lines generated by the numerical scale, includes: A first-level two-dimensional coordinate system data space is established with the length as the first coordinate axis and the width as the second coordinate axis; Multiple different length values, multiple different aspect ratios, and multiple different average length and width values are determined, and boundary lines for the multiple different length values, multiple different aspect ratios, and multiple different average length and width values are added in the two-dimensional coordinate system data space to divide the first-level two-dimensional coordinate system data space into multiple regions. Using the contrast as the first coordinate axis and the area as the second coordinate axis, the multiple regions are converted into a secondary two-dimensional coordinate system data space; Multiple different contrast values and multiple different area values are determined, and boundary lines for the multiple different contrast values and multiple different area values are added in the secondary two-dimensional coordinate system data space to divide the secondary two-dimensional coordinate system data space into multiple mutually independent subspaces.
4. The method according to any one of claims 1 to 3, characterized in that, After dividing the target defects to be screened into the target subspace corresponding to the target key features, the method further includes: The classification label corresponding to the target subspace is used as the type of defect to be screened.
5. The method according to any one of claims 1 to 3, characterized in that, The numerical scale is greater than a preset threshold; the method further includes: Defects whose key features are located within the subspace are identified as out-of-specification defects.
6. A product classification method, characterized in that, include: Acquire multiple product images of the product, and segment out the defects to be screened from the multiple product images; According to the defect screening method as described in any one of claims 1 to 5, determine whether the defect to be screened is a defect; If the defect to be screened is the defect, then the defect level of the defect to be screened is determined, and the number of defects to be screened at different defect levels is counted. The product is classified based on the defect level of the defect to be screened and the number of defects to be screened at different defect levels.
7. The method according to claim 6, characterized in that, Determining the defect level of the defect to be screened includes: Determine the numerical range of a specific feature among the features of the defects to be screened; The defect level corresponding to the numerical range of the specific feature is used as the defect level of the defect to be screened.
8. A defect screening device, characterized in that, include: The acquisition module is used to acquire multiple defects to be screened; The partitioning module is used to construct a data space based on the feature quantities of multiple defects to be screened, and to divide the data space into multiple independent subspaces, wherein the multiple defects to be screened are a set of points in the data space; The filtering module is used to classify a target defect among the plurality of defects to be filtered into a target subspace corresponding to the target key features based on the target key features of the target defect. If the constraint features of the target defect satisfy the constraint conditions added to the target subspace, the target defect is determined to be a defect. If the constraint features of the target defect do not satisfy the constraint conditions added to the target subspace, the target defect is determined to be a non-defect. The partitioning module is specifically used for: Calculate the feature quantity for each of the defects to be screened, wherein the feature quantity includes key features and constraint features; The data space is constructed using the key features, and a numerical scale is determined. Based on the boundary lines generated by the numerical scale, the data space is divided into multiple independent subspaces, and the constraint conditions of the constraint features are added to each subspace.
9. The apparatus according to claim 8, characterized in that, The key features include: length, width, aspect ratio, average length and width, and contrast. The partitioning module is specifically used for: A two-dimensional coordinate system data space is established with the length as the first coordinate axis and the width as the second coordinate axis; Multiple different length values, multiple different aspect ratios, and multiple different average length and width values are determined, and boundary lines for the multiple different length values, multiple different aspect ratios, and multiple different average length and width values are added in the two-dimensional coordinate system data space to divide the two-dimensional coordinate system data space into multiple regions. Using the contrast ratio as the third coordinate axis, the multiple regions are converted into a three-dimensional coordinate system data space; Multiple different contrast values are determined, and boundary lines for the multiple different contrast values are added in the three-dimensional coordinate system data space to divide the three-dimensional coordinate system data space into multiple mutually independent subspaces.
10. The apparatus according to claim 8, characterized in that, The key features include: length, width, aspect ratio, average length and width, contrast, and area; The partitioning module is specifically used for: A first-level two-dimensional coordinate system data space is established with the length as the first coordinate axis and the width as the second coordinate axis; Multiple different length values, multiple different aspect ratios, and multiple different average length and width values are determined, and boundary lines for the multiple different length values, multiple different aspect ratios, and multiple different average length and width values are added in the two-dimensional coordinate system data space to divide the first-level two-dimensional coordinate system data space into multiple regions. Using the contrast as the first coordinate axis and the area as the second coordinate axis, the multiple regions are converted into a secondary two-dimensional coordinate system data space; Multiple different contrast values and multiple different area values are determined, and boundary lines for the multiple different contrast values and multiple different area values are added in the secondary two-dimensional coordinate system data space to divide the secondary two-dimensional coordinate system data space into multiple mutually independent subspaces.
11. The apparatus according to any one of claims 8 to 10, characterized in that, The filtering module is further configured to use the classification label corresponding to the target subspace as the type of the target defect to be filtered.
12. The apparatus according to any one of claims 8 to 10, characterized in that, The numerical scale is greater than a preset threshold; The screening module is also used to identify defects to be screened whose key features are located within the subspace as out-of-specification defects.
13. A product sorting device, characterized in that, include: The acquisition module is used to acquire multiple product images of a product and segment out the defects to be screened from the multiple product images; The judgment module is used to determine whether the defect to be screened is a defect according to the defect screening device as described in any one of claims 8 to 12; The determination module is used to determine the defect level of the defect to be screened if the defect to be screened is the defect, and to count the number of defects to be screened with different defect levels. A classification module is used to determine the classification of the product based on the defect level of the defect to be screened and the number of the defect to be screened at different defect levels.
14. The apparatus according to claim 13, characterized in that, The determining module is specifically used to determine the numerical range of a specific feature among the features of the defect to be screened, and to take the defect level corresponding to the numerical range of the specific feature as the defect level of the defect to be screened.
15. A computer device, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that run on the processor, the program or instructions being executed by the processor to implement the steps of the defect screening method as described in any one of claims 1 to 5, or the steps of the product classification method as described in claim 6 or 7.
16. A readable storage medium having a program or instructions stored thereon, characterized in that, When the program or instructions are executed by the processor, they implement the steps of the defect screening method as described in any one of claims 1 to 5, or the steps of the product classification method as described in claim 6 or 7.
Citation Information
Patent Citations
Method of defect classification and system thereof
US20190333208A1