Defect detection method and device, electronic equipment and storage medium

By detecting abnormal areas and extracting attribute features on the target image of the workpiece, and combining the correspondence between preset attribute features and defect types, the defect type is automatically determined, which solves the problem of low defect detection efficiency and manual dependence in the prior art, and efficient and accurate automated defect detection is achieved.

CN119887608APending Publication Date: 2025-04-25HANGZHOU HIKROBOT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311393273.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-25
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

In the prior art, the efficiency of defect detection of workpieces in industrial production is low, and the accuracy is easily affected by subjective factors of the inspector.

Method used

By obtaining the target image of the workpiece to be detected, abnormal area detection and target attribute characteristics are extracted, and matching relationship entries are retrieved for each exception area in the corresponding relationship between the preset attribute characteristics and the defect type, and the defect type is determined.

Benefits of technology

Automatic defect detection of workpieces is realized, the efficiency and accuracy of defect detection are improved, and the changes in production processes can be adapted to faster.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119887608A_ABST
    Figure CN119887608A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a defect detection method and device, electronic equipment and a storage medium. The method comprises the steps that a target image about a to-be-detected workpiece is acquired; performing abnormal region detection on the target image, and extracting a plurality of target attribute features of each detected abnormal region; for each abnormal region, in a preset corresponding relationship between attribute features and defect types, searching whether target relationship entries matched with a plurality of target attribute features of the abnormal region exist or not; if yes, determining the defect type of the abnormal region as the defect type included in the target relation entry; and otherwise, determining the defect type of the abnormal region as a specified defect type, and determining the attribute characteristics of the specified defect type according to the plurality of target attribute characteristics of the abnormal region. By applying the method provided by the embodiment of the invention, the workpiece defect detection efficiency and accuracy in industrial production can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer vision technology, and in particular to a defect detection method, device, electronic device and storage medium. Background Art

[0002] In industrial production, due to production process and other reasons, some of the workpieces produced may have defects. Therefore, in the process of industrial production, it is usually necessary to perform defect detection on the produced workpieces. For example, in the production process of battery pole pieces, it is necessary to perform defect detection on the produced battery pole pieces.

[0003] In the related technology, the defect detection of workpieces mainly relies on human visual observation and simple measurement. For example, the human visual observation is used to detect whether there are defects such as leaking foil, dark marks, white spots, etc. on the battery pole piece; the pole piece is measured by a measuring instrument to determine whether the size specification of the battery pole piece exceeds the limit, etc.

[0004] However, in the above-mentioned related technologies, the efficiency of defect detection of workpieces through manual observation and manual measurement is low, and the accuracy is easily affected by the subjective factors of the inspectors. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a defect detection method, device, electronic device and storage medium to improve the efficiency and accuracy of defect detection of workpieces in industrial production. The specific technical solution is as follows:

[0006] In a first aspect, an embodiment of the present application provides a defect detection method, the method comprising:

[0007] Acquire a target image of the workpiece to be inspected;

[0008] Performing abnormal region detection on the target image, and extracting a plurality of target attribute features of each detected abnormal region;

[0009] For each abnormal area, in the preset correspondence between the attribute feature and the defect type, searching whether there is a target relationship entry matching multiple target attribute features of the abnormal area;

[0010] If so, the defect type of the abnormal area is determined as: the defect type included in the target relationship entry;

[0011] Otherwise, the defect type of the abnormal area is determined as: a specified defect type, and the attribute characteristics of the specified defect type are determined according to the multiple target attribute characteristics of the abnormal area.

[0012] Optionally, in a specific implementation, for each abnormal region, searching for a target relationship entry matching multiple target attribute features of the abnormal region in a preset correspondence relationship between attribute features and defect types includes:

[0013] For each abnormal area, traverse each relationship entry in the preset correspondence between the attribute feature and the defect type, and when traversing each relationship entry, determine, from multiple target attribute features of the abnormal area, a target attribute feature of the same attribute feature type as that included in the relationship entry as the designated attribute feature;

[0014] Determine whether the characteristic value of the specified attribute feature satisfies the characteristic value interval of the attribute feature included in the relationship entry;

[0015] If satisfied, the relationship entry is a target relationship entry that matches multiple target attribute features of the abnormal area;

[0016] Otherwise, the relationship entry is not a target relationship entry that matches the multiple target attribute features of the abnormal area.

[0017] Optionally, in a specific implementation, for each abnormal area, traversing each relationship entry in the preset correspondence between the attribute feature and the defect type includes:

[0018] For each abnormal area, traverse each relationship entry in the preset correspondence between attribute features and defect types in descending order of priority of the defect types included in each relationship entry;

[0019] The method further comprises:

[0020] If satisfied, stop traversal.

[0021] Optionally, in a specific implementation, each relationship entry in the corresponding relationship further includes: at least one control condition corresponding to the defect type included in the relationship entry and a control instruction corresponding to each control condition; and the method further includes:

[0022] For each abnormal area, if there is a target relationship entry matching multiple target attribute features of the abnormal area in the corresponding relationship, it is determined whether there is a specified control condition matching the detection condition of the defect type of the abnormal area in the target relationship entry; wherein the detection condition includes at least one of: whether it is detected, the cumulative number of detections, and the continuous number of detections;

[0023] If it exists, the control instruction corresponding to the specified control condition is output.

[0024] Optionally, in a specific implementation, the method further includes:

[0025] Output the defect detection result of the workpiece to be inspected; wherein the defect detection result includes: the defect type of each abnormal area and multiple target attribute features.

[0026] In a second aspect, an embodiment of the present application provides a defect detection device, the device comprising:

[0027] An image acquisition module, used to acquire a target image of a workpiece to be inspected;

[0028] A feature extraction module, used to detect abnormal regions of the target image and extract multiple target attribute features of each detected abnormal region;

[0029] An entry retrieval module is used to retrieve, for each abnormal area, whether there is a target relationship entry matching multiple target attribute features of the abnormal area in the preset corresponding relationship between the attribute feature and the defect type;

[0030] A first determination module, configured to determine the defect type of the abnormal area as: the defect type included in the target relationship entry, if any;

[0031] The second determination module is used to determine the defect type of the abnormal area as a specified defect type, and determine the attribute characteristics of the specified defect type according to multiple target attribute characteristics of the abnormal area.

[0032] Optionally, in a specific implementation, the entry retrieval module is specifically used to:

[0033] For each abnormal area, traverse each relationship entry in the preset correspondence between the attribute feature and the defect type, and when traversing each relationship entry, determine, from multiple target attribute features of the abnormal area, a target attribute feature of the same attribute feature type as that included in the relationship entry as the designated attribute feature;

[0034] Determine whether the characteristic value of the specified attribute feature satisfies the characteristic value interval of the attribute feature included in the relationship entry;

[0035] If satisfied, the relationship entry is a target relationship entry that matches multiple target attribute features of the abnormal area;

[0036] Otherwise, the relationship entry is not a target relationship entry that matches the multiple target attribute features of the abnormal area.

[0037] Optionally, in a specific implementation, the entry retrieval module is specifically used to:

[0038] For each abnormal area, traverse each relationship entry in the preset correspondence between attribute features and defect types in descending order of priority of the defect types included in each relationship entry;

[0039] The device also includes:

[0040] The traversal stop module is used to stop the traversal if it is satisfied.

[0041] Optionally, in a specific implementation, each relationship entry in the corresponding relationship further includes: at least one control condition corresponding to the defect type included in the relationship entry and a control instruction corresponding to each control condition; and the device further includes:

[0042] A condition determination module is used for, for each abnormal area, if there is a target relationship entry matching multiple target attribute features of the abnormal area in the corresponding relationship, determining whether there is a specified control condition matching the detection condition of the defect type of the abnormal area in the target relationship entry; wherein the detection condition includes at least one of: whether it is detected, the cumulative number of detections, and the number of consecutive detections;

[0043] The instruction output module is used to output the control instruction corresponding to the specified control condition if it exists.

[0044] Optionally, in a specific implementation, the device further includes:

[0045] The result output module is used to output the defect detection result of the workpiece to be detected; wherein the defect detection result includes: the defect type of each abnormal area and multiple target attribute features.

[0046] In a third aspect, an embodiment of the present application provides an electronic device, including:

[0047] Memory, used to store computer programs;

[0048] The processor is used to implement any of the above-mentioned defect detection methods when executing the program stored in the memory.

[0049] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any of the above-mentioned defect detection methods is implemented.

[0050] An embodiment of the present application also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any of the above-mentioned defect detection methods.

[0051] Beneficial effects of the embodiments of the present application:

[0052] It can be seen from the above that, by applying the solution provided by the embodiment of the present application, when performing defect detection on the workpiece to be inspected, a target image of the workpiece to be inspected can be first obtained, and then abnormal area detection can be performed on the target image, and multiple target attribute features of each detected abnormal area can be extracted; then, for each abnormal area, in the preset correspondence between the attribute feature and the defect type, it can be retrieved whether there is a relationship entry that matches the multiple target attribute features of the abnormal area; if so, the defect type of the abnormal area can be determined as: the defect type included in the above relationship entry; otherwise, the defect type of the abnormal area can be determined as: a specified defect type, and the target attribute features of the specified defect type are determined based on the multiple target attribute features of the abnormal area.

[0053] Based on this, each abnormal area in the target image of the workpiece to be inspected and the defect type of each abnormal area can be determined by image detection and attribute feature extraction, thereby realizing automatic defect detection of the workpiece to be inspected. Therefore, compared with defect detection of workpieces by manual observation and manual measurement, the solution provided by the embodiment of the present application can improve the efficiency and accuracy of defect detection of workpieces in industrial production.

[0054] Furthermore, the specified defect type may be a new defect type that arises due to a change in the production process of the workpiece. Therefore, by determining the attribute characteristics of the specified defect type based on multiple target attribute characteristics of the abnormal area of ​​the specified defect type, it is possible to automatically determine the attribute characteristics of the new defect type, thereby improving the efficiency of determining the attribute characteristics of the new defect type, thereby enabling the defect detection method provided in the embodiment of the present application to adapt to changes in the production process more quickly.

[0055] Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.

[0057] Figure 1 A schematic diagram of a process flow of a defect detection method provided in an embodiment of the present application;

[0058] Figure 2 Another schematic diagram of a defect detection method provided in an embodiment of the present application;

[0059] Figure 3 A schematic diagram of a corresponding relationship setting interface provided in an embodiment of the present application;

[0060] Figure 4 A schematic diagram of a relationship entry adding interface provided in an embodiment of the present application;

[0061] Figure 5 A schematic diagram of the structure of a defect detection device provided in an embodiment of the present application;

[0062] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0063] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.

[0064] In the related art, the defect detection of workpieces mainly relies on human visual observation and simple measurement. For example, the battery pole piece is detected by human visual observation to see if there are defects such as leaking foil, dark marks, white spots, etc.; the pole piece is measured by a measuring instrument to determine whether the size specification of the battery pole piece exceeds the limit, etc. However, in the above-mentioned related art, the efficiency of defect detection of workpieces by manual observation and manual measurement is low, and the accuracy is easily affected by the subjective factors of the inspector.

[0065] In order to solve the above problems, an embodiment of the present application provides a defect detection method.

[0066] The method is applicable to various scenarios of defect detection of workpieces, for example, defect detection of battery pole pieces, defect detection of glass substrates, etc. The application scenarios of the embodiments of the present application are not specifically limited.

[0067] Furthermore, the execution subject of the method may be various electronic devices that can acquire image data and process the data. The electronic device may be an image acquisition device with data processing function, or various devices that can process data and have a communication connection with the image acquisition device, such as a mobile phone, a laptop computer, a desktop computer, etc. Furthermore, the electronic device may be an independent electronic device, or a device cluster composed of multiple electronic devices. In this regard, the embodiments of the present application do not make specific limitations, and are hereinafter referred to as electronic devices.

[0068] A defect detection method provided in an embodiment of the present application may include the following steps:

[0069] Acquire a target image of the workpiece to be inspected;

[0070] Performing abnormal region detection on the target image, and extracting a plurality of target attribute features of each detected abnormal region;

[0071] For each abnormal area, in the preset correspondence between the attribute feature and the defect type, searching whether there is a target relationship entry matching multiple target attribute features of the abnormal area;

[0072] If so, the defect type of the abnormal area is determined as: the defect type included in the target relationship entry;

[0073] Otherwise, the defect type of the abnormal area is determined as: a specified defect type, and the attribute characteristics of the specified defect type are determined according to the multiple target attribute characteristics of the abnormal area.

[0074] It can be seen from the above that, by applying the solution provided by the embodiment of the present application, when performing defect detection on a workpiece to be inspected, a target image of the workpiece to be inspected can be first obtained, and then abnormal area detection can be performed on the target image, and multiple target attribute features of each detected abnormal area can be extracted; then, for each abnormal area, in the preset correspondence between the attribute feature and the defect type, it can be retrieved whether there is a relationship entry that matches the multiple target attribute features of the abnormal area; if so, the defect type of the abnormal area can be determined as: the defect type included in the above relationship entry; otherwise, the defect type of the abnormal area can be determined as: the specified defect type.

[0075] Based on this, each abnormal area in the target image of the workpiece to be inspected and the defect type of each abnormal area can be determined by image detection and attribute feature extraction, thereby realizing automatic defect detection of the workpiece to be inspected. Therefore, compared with defect detection of workpieces by manual observation and manual measurement, the solution provided by the embodiment of the present application can improve the efficiency and accuracy of defect detection of workpieces in industrial production.

[0076] Furthermore, the specified defect type may be a new defect type that arises due to a change in the production process of the workpiece. Therefore, by determining the attribute characteristics of the specified defect type based on multiple target attribute characteristics of the abnormal area of ​​the specified defect type, it is possible to automatically determine the attribute characteristics of the new defect type, thereby improving the efficiency of determining the attribute characteristics of the new defect type, thereby enabling the defect detection method provided in the embodiment of the present application to adapt to changes in the production process more quickly.

[0077] Below, in conjunction with the accompanying drawings, a defect detection method provided in an embodiment of the present application is described in detail.

[0078] Figure 1 A schematic diagram of a defect detection method provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the method may include the following steps S101-S105.

[0079] S101: Acquire a target image of a workpiece to be inspected.

[0080] The image acquisition device can acquire a target image of the workpiece to be inspected. There can be a communication connection between the electronic device and the image acquisition device. When performing defect detection on the workpiece to be inspected, the electronic device can obtain the target image of the workpiece to be inspected acquired by the image acquisition device.

[0081] The image acquisition device may be a linear array camera, an area array camera or any other device with image acquisition function.

[0082] Optionally, in some possible implementations, the defect detection of the workpiece to be inspected can be performed while the workpiece to be inspected is moving with a moving mechanism such as a conveyor belt. Furthermore, in this case, in order to make the acquired target image of the workpiece to be inspected clearer, the target image of the workpiece to be inspected can be captured by a line array camera when the workpiece to be inspected moves to a specified position with the moving mechanism.

[0083] S102: Detect abnormal regions of the target image and extract multiple target attribute features of each detected abnormal region.

[0084] After acquiring a target image of the workpiece to be detected, abnormal region detection may be performed on the target image to obtain various abnormal regions in the target image, and multiple target attribute features of each detected abnormal region may be extracted.

[0085] Optionally, an initial model for abnormal region detection can be built in advance, and multiple workpiece images with abnormal regions and multiple workpiece images without abnormal regions are used as training samples to train the initial model, thereby obtaining an abnormal region detection model. Furthermore, after obtaining a target image of the workpiece to be detected, the target image can be input into the abnormal region detection model, thereby obtaining each abnormal region in the target image.

[0086] Optionally, multiple target attribute features of each detected abnormal area may be extracted based on a preset attribute feature extraction model.

[0087] The target attribute features of each abnormal region may include but are not limited to: the area, position, aspect ratio, average grayscale, grayscale extreme value, rectangularity, roundness and polarity of the abnormal region.

[0088] Among them, rectangularity refers to the degree to which an object fills its circumscribed rectangle, which can reflect the similarity between an object and a rectangle. It is a rectangle fitting factor; roundness refers to the degree to which an object fills its circumscribed circle, which can reflect the similarity between an object and a circle. It is a circle fitting factor; polarity refers to the grayscale transition polarity, from black to white, and from white to black.

[0089] S103: For each abnormal region, in the preset correspondence between attribute features and defect types, searching whether there is a target relationship entry that matches multiple target attribute features of the abnormal region.

[0090] If it exists, execute step S104; if it does not exist, execute step S105.

[0091] S104: Determine the defect type of the abnormal area as the defect type included in the target relationship entry.

[0092] S105: Determine the defect type of the abnormal area as a specified defect type, and determine the attribute characteristics of the specified defect type according to a plurality of target attribute characteristics of the abnormal area.

[0093] Those skilled in the art can determine the correspondence between the attribute characteristics of the abnormal area and the defect type of the abnormal area based on actual production experience and relevant theoretical knowledge. For example, when the workpiece to be inspected is a battery pole piece, those skilled in the art can summarize and determine the correspondence between the attribute characteristics of the abnormal area in the image of the battery pole piece and the defect type of the abnormal area based on various defects that may exist in the battery pole piece and the attribute characteristics of the abnormal area corresponding to each defect in the image of the battery pole piece.

[0094] The corresponding relationship may include multiple relationship entries, each of which may include a defect type and the attribute features corresponding to the defect type. Furthermore, after determining the various abnormal regions in the target image of the workpiece to be inspected and the multiple target attribute features of each abnormal region, for each abnormal region, in the preset corresponding relationship between the attribute feature and the defect type, it can be retrieved whether there is a target relationship entry that matches the multiple target attribute features of the abnormal region. If so, the defect type of the abnormal region can be determined as: the defect type included in the target relationship entry; if not, the defect type of the abnormal region can be determined as: a specified defect type, and the attribute features of the specified defect type are determined based on the multiple target attribute features of the abnormal region.

[0095] Optionally, in a specific implementation, the above step S103, for each abnormal area, searches for a target relationship entry matching multiple target attribute features of the abnormal area in the preset correspondence between the attribute feature and the defect type, and may include the following steps 11-12.

[0096] Step 11: For each abnormal area, traverse each relationship entry in the preset correspondence between attribute features and defect types, and when traversing each relationship entry, determine the target attribute feature of the same attribute feature type as that included in the relationship entry among multiple target attribute features of the abnormal area as the designated attribute feature.

[0097] The preset correspondence between attribute features and defect types may include multiple relationship entries. For each abnormal area, each relationship entry in the above preset correspondence can be traversed, and when traversing each relationship entry, among the multiple target attribute features of the abnormal area, the target attribute feature of the same type as the attribute feature included in the relationship entry is determined as the designated attribute feature.

[0098] For example, if the types of attribute features included in the relationship entry M are B and C respectively, and the types of target attribute features of the abnormal area Q are A, B, C and D respectively, then for the abnormal area Q, when traversing to the relationship entry M in the corresponding relationship, the target attribute features of type B and type C among the multiple target attribute features of the abnormal area Q can be determined as designated attribute features.

[0099] Step 12: Determine whether the feature value of the specified attribute feature satisfies the feature value interval of the attribute feature included in the relationship entry; if so, the relationship entry is a target relationship entry that matches multiple target attribute features of the abnormal area; otherwise, the relationship entry is not a target relationship entry that matches multiple target attribute features of the abnormal area.

[0100] For each attribute feature included in each relationship entry in the above correspondence, there may be a feature value interval. After determining the specified attribute feature, it may be determined whether the feature value of the specified attribute feature satisfies the feature value interval of the attribute feature included in the relationship entry; if satisfied, it means that the relationship entry is a target relationship entry that matches multiple target attribute features of the abnormal area, and then it can be determined that in the above correspondence, there is a target relationship entry that matches multiple target attribute features of the abnormal area; if not satisfied, it means that the relationship entry is not a target relationship entry that matches multiple target attribute features of the abnormal area, and then, after traversing each relationship entry in the above correspondence, if each traversed relationship entry is not a relationship entry that matches multiple target attribute features of the abnormal area, it can be determined that in the above correspondence, there is no target relationship entry that matches multiple target attribute features of the abnormal area.

[0101] However, in some cases, an abnormal area may correspond to multiple defect types. For example, the attribute characteristics of black spot defects and bubble defects may include area, diameter and grayscale, and the area intervals of black spot defects and bubble defects may both be the first interval, the diameter intervals of black spot defects and bubble defects may both be the second interval, the grayscale interval of black spot defects may be [20, 50], and the grayscale interval of bubble defects may be [40, 70]. Furthermore, when the area of ​​a certain abnormal area is within the first interval, the diameter is within the second interval, and the grayscale is within the interval [40, 50], the abnormal area may correspond to both black spot defects and bubble defects. For another example, a certain type of large defect corresponding to an abnormal area may contain other types of small defects. Therefore, optionally, in a specific implementation method, in the above step 11, for each abnormal area, traversing each relationship entry in the preset correspondence between the attribute characteristics and the defect type may include the following step 21.

[0102] Step 21: For each abnormal area, traverse each relationship entry in the preset correspondence between attribute features and defect types in descending order of priority of the defect types included in each relationship entry.

[0103] Correspondingly, a defect detection method provided in an embodiment of the present application may further include the following step 22.

[0104] Step 22: If satisfied, stop traversal.

[0105] Each defect type included in each relationship entry in the corresponding relationship may have a priority. For each abnormal area, when traversing each relationship entry in the preset corresponding relationship between attribute characteristics and defect types, each relationship entry may be traversed in order of the priority of the defect type included in each relationship entry from high to low.

[0106] When traversing to each relationship entry, the target attribute feature of the same type as the attribute feature included in the relationship entry can be determined from the multiple target attribute features of the abnormal area as the designated attribute feature; then it is determined whether the feature value of the designated attribute feature satisfies the interval to which the feature value of the attribute feature included in the relationship entry belongs; if so, it means that the relationship entry is a target relationship entry that matches the multiple target attribute features of the abnormal area, and then the traversal can be stopped, and the defect type of the abnormal area can be determined as: the defect type included in the relationship entry.

[0107] Among them, the above priorities can be set by skilled and technical personnel according to actual application conditions, and the embodiments of the present application do not specifically limit them.

[0108] Based on this, by applying this specific implementation method, each relationship entry can be traversed according to the priority of the defect type included in the relationship entry, and the traversal can be stopped when the target relationship entry is traversed. Furthermore, when a certain abnormal area corresponds to multiple defect types, the defect type with the highest priority among the multiple defect types can be determined as the defect type of the abnormal area.

[0109] Optionally, in a specific implementation, a defect detection method provided in an embodiment of the present application may further include the following step 31.

[0110] Step 31: Output the defect detection result of the workpiece to be inspected.

[0111] The above defect detection results may include: the defect type of each abnormal area and multiple target attribute features.

[0112] That is to say, after determining the defect types of each abnormal area of ​​the target image of the workpiece to be inspected, the defect type of each abnormal area and multiple target attribute features in the abnormal area can be determined as the defect detection result of the workpiece to be inspected, and the defect detection result of the workpiece to be inspected can be output.

[0113] Optionally, the above defect detection result may also include the position of each abnormal area in each abnormal area.

[0114] Optionally, different defect types may correspond to different colors. When outputting the defect detection result of the workpiece to be detected, each abnormal area in the target image of the workpiece to be detected may be rendered into the color of the defect type corresponding to the abnormal area.

[0115] Based on this, each abnormal area in the target image of the workpiece to be inspected and the defect type of each abnormal area can be determined by image detection and attribute feature extraction, thereby realizing automatic defect detection of the workpiece to be inspected. Therefore, compared with defect detection of workpieces by manual observation and manual measurement, the solution provided by the embodiment of the present application can improve the efficiency and accuracy of defect detection of workpieces in industrial production.

[0116] Furthermore, the specified defect type may be a new defect type that arises due to a change in the production process of the workpiece. Therefore, by determining the attribute characteristics of the specified defect type based on multiple target attribute characteristics of the abnormal area of ​​the specified defect type, it is possible to automatically determine the attribute characteristics of the new defect type, thereby improving the efficiency of determining the attribute characteristics of the new defect type, thereby enabling the defect detection method provided in the embodiment of the present application to adapt to changes in the production process more quickly.

[0117] When performing defect detection on the workpiece to be inspected, control instructions can also be output according to the detection of each defect type, so that relevant staff or designated production equipment can perform corresponding operations according to the output control instructions. Therefore, optionally, in a specific implementation, each relationship item in the above correspondence can also include: at least one control condition corresponding to the defect type included in the relationship item and a control instruction corresponding to each control condition; further, Figure 2 As shown, a defect detection method provided in an embodiment of the present application may also include the following steps S201-S202.

[0118] S201: For each abnormal area, if there is a target relationship entry in the corresponding relationship that matches multiple target attribute features of the abnormal area, determine whether there is a specified control condition in the target relationship entry that matches the detection situation of the defect type of the abnormal area.

[0119] If so, execute step S202.

[0120] S202: Output a control instruction corresponding to the specified control condition.

[0121] That is, for each abnormal area, if there is a target relationship entry matching multiple target attribute features of the abnormal area in the preset corresponding relationship, it can be determined whether there is a specified control condition matching the defect type detection situation of the abnormal area in the target relationship entry. If so, step S202 can be executed to output a control instruction corresponding to the specified control condition.

[0122] The above detection conditions may include at least one of: whether it is detected, the cumulative number of detections, and the number of consecutive detections. It is worth noting that the above detection conditions, the above control conditions, and the control instructions corresponding to each control condition can be set by those skilled in the art according to specific application conditions, and the embodiments of this application do not specifically limit them.

[0123] Exemplarily, the above detection conditions may include: whether it is detected and the number of consecutive detections; the defect type included in the relationship item A is defect U, the control condition 1 corresponding to the defect U is: detected and the number of consecutive detections is not less than 3 times, and the control instruction corresponding to the control condition 1 is instruction 2 for controlling the shutdown of the device T. Furthermore, for the abnormal area P, if there is a relationship item A in the corresponding relationship that matches multiple target attribute features of the abnormal area, and the detection condition of the defect U included in the relationship item A is: detected and the number of consecutive detections is 3 times, the instruction 2 for controlling the shutdown of the device T can be output.

[0124] Based on this, by applying this specific implementation method, when performing defect detection on the workpiece to be inspected, control instructions can be output according to the detection conditions of each defect type, so that relevant staff or designated production equipment can perform corresponding operations according to the output control instructions, thereby improving the degree of automation and production efficiency of the workpiece production process.

[0125] Optionally, since the production process of industrial production is constantly developing and changing, the types of defects that may exist in the workpiece are also constantly changing. Therefore, in some specific implementations, the user can add, delete or modify the relationship items in the above corresponding relationship according to actual production needs. Thus, the defect detection method provided in the embodiment of the present application can adapt to the needs of industrial production development.

[0126] Optionally, the user may also add a relationship entry including the specified defect type in the above correspondence according to the attribute characteristics of the specified defect type determined in the above step S105.

[0127] For example, the user can Figure 3 The corresponding relationship setting interface shown and Figure 4 The relationship entry adding interface shown in the figure changes the relationship entry in the above corresponding relationship. Figure 3As shown, the corresponding relationship may include multiple relationship entries, each relationship entry may include defect type, attribute characteristics, control conditions and control instructions, and each relationship entry may include a defect type, attribute characteristics corresponding to the defect type, at least one control condition corresponding to the defect type and control instructions corresponding to each control condition. The user can modify the interval to which the attribute value of the attribute characteristic in the relationship entry belongs by modifying the interval to which the attribute value of each attribute in the attribute characteristic column belongs, modify the control condition in the relationship entry by modifying each control condition in the control condition column, and modify the control instruction in the relationship entry by checking the control instruction. The user can also modify the control condition in the relationship entry by clicking Figure 3 The add button indicated by the label 301 in the figure enters Figure 4 The relationship entry adding interface shown in the figure can be used to add Figure 4 Add a relationship entry in the interface shown.

[0128] When entering Figure 4 After entering the interface shown, the user can enter the defect type included in the relationship entry to be added, such as defect A, in the text input box indicated by label 401. Then, the user can expand the attribute feature list indicated by label 402 by clicking the black triangle in the lower right corner of the input box under "Attribute features", and then add the attribute features of defect A by selecting the attribute features in the attribute feature list. After adding the attribute features, the user can enter the upper and lower limits of the interval to which the feature value of the attribute feature belongs in the two input boxes under "Feature value interval (lower limit - upper limit)". Then, the user can also add the "and" logical content button indicated by label 403. Figure 4 In the interface shown, a new row of input boxes for attribute features is added (including the input box below "attribute features" and the two input boxes below "feature value interval (lower limit - upper limit)") to add the next attribute feature of defect A.

[0129] Furthermore, the user may also input the control condition of defect A in the input box below “Control Condition” and add an input box below “Control Condition” by clicking the Add Control Condition button indicated by number 404 .

[0130] Corresponding to a defect detection method provided in the above-mentioned embodiment of the present application, the embodiment of the present application also provides a defect detection device.

[0131] Figure 5 A structural diagram of a defect detection device provided in an embodiment of the present application is shown in FIG. Figure 5 As shown, the defect detection device may include the following modules:

[0132] An image acquisition module 501 is used to acquire a target image of a workpiece to be inspected;

[0133] A feature extraction module 502 is used to detect abnormal regions of the target image and extract multiple target attribute features of each detected abnormal region;

[0134] An entry retrieval module 503 is used to retrieve, for each abnormal region, whether there is a target relationship entry matching multiple target attribute features of the abnormal region in the preset corresponding relationship between the attribute feature and the defect type;

[0135] A first determination module 504 is used to determine the defect type of the abnormal area as: the defect type included in the target relationship entry if it exists;

[0136] The second determination module 505 is used to determine the defect type of the abnormal area as a specified defect type, and determine the attribute characteristics of the specified defect type according to multiple target attribute characteristics of the abnormal area.

[0137] Based on this, each abnormal area in the target image of the workpiece to be inspected and the defect type of each abnormal area can be determined by image detection and attribute feature extraction, thereby realizing automatic defect detection of the workpiece to be inspected. Therefore, compared with defect detection of workpieces by manual observation and manual measurement, the solution provided by the embodiment of the present application can improve the efficiency and accuracy of defect detection of workpieces in industrial production.

[0138] Furthermore, the specified defect type may be a new defect type that arises due to a change in the production process of the workpiece. Therefore, by determining the attribute characteristics of the specified defect type based on multiple target attribute characteristics of the abnormal area of ​​the specified defect type, it is possible to automatically determine the attribute characteristics of the new defect type, thereby improving the efficiency of determining the attribute characteristics of the new defect type, thereby enabling the defect detection method provided in the embodiment of the present application to adapt to changes in the production process more quickly.

[0139] Optionally, in a specific implementation, the entry retrieval module is specifically used to:

[0140] For each abnormal area, traverse each relationship entry in the preset correspondence between the attribute feature and the defect type, and when traversing each relationship entry, determine, from multiple target attribute features of the abnormal area, a target attribute feature of the same attribute feature type as that included in the relationship entry as the designated attribute feature;

[0141] Determine whether the characteristic value of the specified attribute feature satisfies the characteristic value interval of the attribute feature included in the relationship entry;

[0142] If satisfied, the relationship entry is a target relationship entry that matches multiple target attribute features of the abnormal area;

[0143] Otherwise, the relationship entry is not a target relationship entry that matches the multiple target attribute features of the abnormal area.

[0144] Optionally, in a specific implementation, the entry retrieval module is specifically used to:

[0145] For each abnormal area, traverse each relationship entry in the preset correspondence between attribute features and defect types in descending order of priority of the defect types included in each relationship entry;

[0146] The device also includes:

[0147] The traversal stop module is used to stop the traversal if it is satisfied.

[0148] Optionally, in a specific implementation, each relationship entry in the corresponding relationship further includes: at least one control condition corresponding to the defect type included in the relationship entry and a control instruction corresponding to each control condition; and the device further includes:

[0149] A condition determination module is used for, for each abnormal area, if there is a target relationship entry matching multiple target attribute features of the abnormal area in the corresponding relationship, determining whether there is a specified control condition matching the detection condition of the defect type of the abnormal area in the target relationship entry; wherein the detection condition includes at least one of: whether it is detected, the cumulative number of detections, and the number of consecutive detections;

[0150] The instruction output module is used to output the control instruction corresponding to the specified control condition if it exists.

[0151] Optionally, in a specific implementation, the device further includes:

[0152] The result output module is used to output the defect detection result of the workpiece to be detected; wherein the defect detection result includes: the defect type of each abnormal area and multiple target attribute features.

[0153] The present application also provides an electronic device, such as Figure 6 As shown, including:

[0154] Memory 601, used for storing computer programs;

[0155] The processor 602 is used to implement any defect detection method provided in the embodiments of the present application when executing the program stored in the memory 601.

[0156] Furthermore, the electronic device may further include a communication bus and / or a communication interface, and the processor 602, the communication interface, and the memory 601 communicate with each other via the communication bus.

[0157] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0158] The communication interface is used for communication between the above electronic device and other devices.

[0159] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0160] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0161] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned defect detection methods are implemented.

[0162] In another embodiment provided in the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any defect detection method in the above embodiments.

[0163] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a solid-state hard disk (SSD), etc.

[0164] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0165] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, electronic device embodiment, computer-readable storage medium embodiment, and computer program product embodiment, since they are basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0166] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims

1. A defect detection method, characterized in that: The method comprises: Acquire a target image of the workpiece to be inspected; Performing abnormal region detection on the target image, and extracting a plurality of target attribute features of each detected abnormal region; For each abnormal area, in the preset correspondence between the attribute feature and the defect type, searching whether there is a target relationship entry matching multiple target attribute features of the abnormal area; If so, the defect type of the abnormal area is determined as: the defect type included in the target relationship entry; Otherwise, the defect type of the abnormal area is determined as: a specified defect type, and the attribute characteristics of the specified defect type are determined according to the multiple target attribute characteristics of the abnormal area.

2. The method according to claim 1, characterized in that For each abnormal area, searching for a target relationship entry matching multiple target attribute features of the abnormal area in the preset corresponding relationship between the attribute feature and the defect type includes: For each abnormal area, traverse each relationship entry in the preset correspondence between the attribute feature and the defect type, and when traversing each relationship entry, determine, from multiple target attribute features of the abnormal area, a target attribute feature of the same attribute feature type as that included in the relationship entry as the designated attribute feature; Determine whether the characteristic value of the specified attribute feature satisfies the characteristic value interval of the attribute feature included in the relationship entry; If satisfied, the relationship entry is a target relationship entry that matches multiple target attribute features of the abnormal area; Otherwise, the relationship entry is not a target relationship entry that matches the multiple target attribute features of the abnormal area.

3. The method according to claim 2, characterized in that For each abnormal area, traversing each relationship entry in the preset correspondence between the attribute feature and the defect type includes: For each abnormal area, traverse each relationship entry in the preset correspondence between attribute features and defect types in descending order of priority of the defect types included in each relationship entry; The method further comprises: If satisfied, stop traversal.

4. The method according to claim 1, characterized in that: Each relationship entry in the corresponding relationship further includes: at least one control condition corresponding to the defect type included in the relationship entry and a control instruction corresponding to each control condition; the method further includes: For each abnormal area, if there is a target relationship entry matching multiple target attribute features of the abnormal area in the corresponding relationship, it is determined whether there is a specified control condition matching the detection condition of the defect type of the abnormal area in the target relationship entry; wherein the detection condition includes at least one of: whether it is detected, the cumulative number of detections, and the continuous number of detections; If it exists, the control instruction corresponding to the specified control condition is output.

5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: Output the defect detection result of the workpiece to be detected; wherein the defect detection result includes: the defect type of each abnormal area and multiple target attribute features.

6. A defect detection device, characterized in that: The device comprises: An image acquisition module, used to acquire a target image of a workpiece to be inspected; A feature extraction module, used to detect abnormal regions of the target image and extract multiple target attribute features of each detected abnormal region; An entry retrieval module is used to retrieve, for each abnormal area, whether there is a target relationship entry matching multiple target attribute features of the abnormal area in the preset corresponding relationship between the attribute feature and the defect type; A first determination module, configured to determine the defect type of the abnormal area as: the defect type included in the target relationship entry, if any; The second determination module is used to determine the defect type of the abnormal area as a specified defect type, and determine the attribute characteristics of the specified defect type according to multiple target attribute characteristics of the abnormal area.

7. The device according to claim 6, characterized in that The entry retrieval module is specifically used for: For each abnormal area, traverse each relationship entry in the preset correspondence between the attribute feature and the defect type, and when traversing each relationship entry, determine, from multiple target attribute features of the abnormal area, a target attribute feature of the same attribute feature type as that included in the relationship entry as the designated attribute feature; Determine whether the characteristic value of the specified attribute feature satisfies the characteristic value interval of the attribute feature included in the relationship entry; If satisfied, the relationship entry is a target relationship entry that matches multiple target attribute features of the abnormal area; Otherwise, the relationship entry is not a target relationship entry that matches the multiple target attribute features of the abnormal area.

8. The device according to claim 7, characterized in that The entry retrieval module is specifically used for: For each abnormal area, traverse each relationship entry in the preset correspondence between attribute features and defect types in descending order of priority of the defect types included in each relationship entry; The device also includes: The traversal stop module is used to stop the traversal if it is satisfied.

9. The device according to claim 6, characterized in that Each relationship entry in the corresponding relationship further includes: at least one control condition corresponding to the defect type included in the relationship entry and a control instruction corresponding to each control condition; the device further includes: A condition determination module is used for, for each abnormal area, if there is a target relationship entry matching multiple target attribute features of the abnormal area in the corresponding relationship, determining whether there is a specified control condition matching the detection condition of the defect type of the abnormal area in the target relationship entry; wherein the detection condition includes at least one of: whether it is detected, the cumulative number of detections, and the number of consecutive detections; The instruction output module is used to output the control instruction corresponding to the specified control condition if it exists.

10. The device according to any one of claims 6 to 9, characterized in that: The device also includes: The result output module is used to output the defect detection result of the workpiece to be detected; wherein the defect detection result includes: the defect type of each abnormal area and multiple target attribute features.

11. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-5 when executing a program stored in a memory.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.