CN115861315B - Defect detection method and device - Google Patents

Defect detection method and device Download PDF

Info

Publication number
CN115861315B
CN115861315B CN202310166317.1A CN202310166317A CN115861315B CN 115861315 B CN115861315 B CN 115861315B CN 202310166317 A CN202310166317 A CN 202310166317A CN 115861315 B CN115861315 B CN 115861315B
Authority
CN
China
Prior art keywords
defect
image
target
detection
list
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310166317.1A
Other languages
Chinese (zh)
Other versions
CN115861315A (en
Inventor
王克贤
侯大为
潘正颐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Changzhou Weiyizhi Technology Co Ltd
Original Assignee
Changzhou Weiyizhi Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Changzhou Weiyizhi Technology Co Ltd filed Critical Changzhou Weiyizhi Technology Co Ltd
Priority to CN202310166317.1A priority Critical patent/CN115861315B/en
Publication of CN115861315A publication Critical patent/CN115861315A/en
Application granted granted Critical
Publication of CN115861315B publication Critical patent/CN115861315B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
  • Image Analysis (AREA)

Abstract

The invention provides a defect detection method and a device, wherein the defect detection method comprises the following steps: shooting a workpiece to be detected to obtain a first detection image; dividing an optical surface in the first detection image to obtain a binarized image of the optical surface; acquiring edge points of the binarized image, and calculating an external rectangle of the edge points; a first ROI image and a second ROI image are respectively intercepted from the binarized image and the first detection image according to the circumscribed rectangle, and the second detection image is acquired according to the first ROI image and the second ROI image; performing defect detection on the second detection image by adopting a defect detection model to obtain a defect set existing in the second detection image; judging whether each target defect in the defect set is an out-of-specification defect or not, and outputting a corresponding first defect list and a corresponding second defect list according to a judging result. Thus, the time and the memory consumption can be greatly reduced, and the cost is lower.

Description

Defect detection method and device
Technical Field
The invention relates to the technical field of defect detection, in particular to a defect detection method and a defect detection device.
Background
In the related art, when the defect detection is performed on the workpiece to be detected, the defect is killed, so that a large amount of time and video memory are consumed, and the cost is high.
Disclosure of Invention
The invention provides a defect detection method for solving the technical problems, which is used for realizing defect detection on the optical surface only by positioning the optical surface, so that the defect overdischarge condition of the non-optical surface is effectively solved, and whether the defect is an out-of-specification defect or not is judged after the defect detection on the optical surface, so that the suspected defect overdischarge condition is effectively avoided, the consumed time and the display memory are greatly reduced, and the cost is lower.
The technical scheme adopted by the invention is as follows:
a defect detection method comprising the steps of: shooting a workpiece to be detected to obtain a first detection image; dividing an optical surface in the first detection image to obtain a binarized image of the optical surface; acquiring edge points of the binarized image, and calculating an external rectangle of the edge points; a first ROI image and a second ROI image are respectively cut out from the binarized image and the first detection image according to the circumscribed rectangle, and a second detection image is obtained according to the first ROI image and the second ROI image; performing defect detection on the second detection image by adopting a defect detection model to obtain a defect set existing in the second detection image; judging whether each target defect in the defect set is an out-of-specification defect or not, and outputting a corresponding first defect list and a corresponding second defect list according to a judging result.
In one embodiment of the present invention, segmenting the optical surface in the first detection image to obtain a binarized image of the optical surface includes: and dividing the optical surface from the first detection image by using an Ostu algorithm to acquire the binarized image.
In one embodiment of the present invention, determining whether each target defect in the defect set is an out-of-specification defect includes: taking an ith target defect center point as a center, and taking a first preset pixel value as a diameter to intercept a first target defect image on the second detection image, wherein i is a positive integer which is greater than or equal to 1 and less than or equal to the total number of target defects in the defect set; inputting the first target defect image into a second classification network to obtain a score of the ith target defect as a true defect; judging whether the score is smaller than or equal to a preset score; and if the score is smaller than or equal to the preset score, judging that the ith target defect is the out-of-specification defect, and storing the ith target defect in the first defect list.
In one embodiment of the present invention, determining whether each target defect in the defect set is an out-of-specification defect further includes: if the score is greater than the preset score, acquiring a first size according to the size of the ith target defect; taking the ith target defect center point as a center, and intercepting a second target defect image on the second detection image according to the first size; inputting the second target defect image into a segmentation network to obtain a third target defect image, and calculating the defect area of the ith target defect according to the third target defect image; judging whether the defect area is smaller than or equal to a preset area; if the defect area is smaller than or equal to the preset area, judging that the ith target defect is the out-of-specification defect, and storing the ith target defect in the first defect list; and if the defect area is larger than the preset area, judging the ith target defect as the real defect, and storing the ith target defect in the second defect list.
In one embodiment of the present invention, the defect detection method further includes: calculating the defect number of the external defects of the target rule in the first defect list in a unit area by adopting a density algorithm; judging whether the defect number is larger than or equal to a preset number; outputting the first defect list and the second defect list if the defect number is greater than or equal to the preset number; and if the defect number is smaller than the preset number, removing the defect outside the target rule in the first defect list to obtain a third defect list, and outputting the third defect list and the second defect list.
A defect detection apparatus comprising: the first acquisition module is used for shooting a workpiece to be detected to acquire a first detection image; the second acquisition module is used for dividing the optical surface in the first detection image to acquire a binarized image of the optical surface; the computing module is used for acquiring edge points of the binarized image and computing circumscribed rectangles of the edge points; the third acquisition module is used for respectively intercepting a first ROI image and a second ROI image from the binarized image and the first detection image according to the circumscribed rectangle, and acquiring a second detection image according to the first ROI image and the second ROI image; the fourth acquisition module is used for carrying out defect detection on the second detection image by adopting a defect detection model so as to acquire a defect set existing in the second detection image; the judging module is used for judging whether each target defect in the defect set is an out-of-specification defect or not, and outputting a corresponding first defect list and a corresponding second defect list according to a judging result.
In one embodiment of the present invention, the second obtaining module is specifically configured to: and dividing the optical surface from the first detection image by using an Ostu algorithm to acquire the binarized image.
In one embodiment of the present invention, the judging module is specifically configured to: taking an ith target defect center point as a center, and taking a first preset pixel value as a diameter to intercept a first target defect image on the second detection image, wherein i is a positive integer which is greater than or equal to 1 and less than or equal to the total number of target defects in the defect set; inputting the first target defect image into a second classification network to obtain a score of the ith target defect as a true defect; judging whether the score is smaller than or equal to a preset score; and if the score is smaller than or equal to the preset score, judging that the ith target defect is the out-of-specification defect, and storing the ith target defect in the first defect list.
In one embodiment of the present invention, the judging module is specifically further configured to: if the score is greater than the preset score, acquiring a first size according to the size of the ith target defect; taking the ith target defect center point as a center, and intercepting a second target defect image on the second detection image according to the first size; inputting the second target defect image into a segmentation network to obtain a third target defect image, and calculating the defect area of the ith target defect according to the third target defect image; judging whether the defect area is smaller than or equal to a preset area; if the defect area is smaller than or equal to the preset area, judging that the ith target defect is the out-of-specification defect, and storing the ith target defect in the first defect list; and if the defect area is larger than the preset area, judging the ith target defect as the real defect, and storing the ith target defect in the second defect list.
In one embodiment of the present invention, the judging module is specifically further configured to: calculating the defect number of the external defects of the target rule in the first defect list in a unit area by adopting a density algorithm; judging whether the defect number is larger than or equal to a preset number; outputting the first defect list and the second defect list if the defect number is greater than or equal to the preset number; and if the defect number is smaller than the preset number, removing the defect outside the target rule in the first defect list to obtain a third defect list, and outputting the third defect list and the second defect list.
The invention has the beneficial effects that:
the invention positions the optical surface to realize defect detection only on the optical surface, thereby effectively solving the problem of over-killing of the non-optical surface defect, judging whether the defect is an out-of-specification defect after the defect detection on the optical surface, thereby effectively avoiding the occurrence of the suspected defect over-killing condition, and further greatly reducing the time consumption and the display memory cost.
Drawings
FIG. 1 is a flow chart of a defect detection method according to an embodiment of the present invention;
fig. 2 is a block diagram of a defect detecting apparatus according to an embodiment of the invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Fig. 1 is a flowchart of a defect detection method according to an embodiment of the present invention.
As shown in fig. 1, the defect detection method according to the embodiment of the present invention may include the following steps:
s1, shooting a workpiece to be detected to obtain a first detection image.
Wherein the workpiece to be inspected may be photographed by a photographing device (e.g., an industrial camera) to obtain a corresponding inspection image, i.e., a first inspection image.
S2, dividing the optical surface in the first detection image to obtain a binarized image of the optical surface.
In one embodiment of the present invention, an Ostu (maximum inter-class variance) algorithm may be used to segment the optical surface from the first detected image to obtain a binarized image. Specifically, a pixel threshold may be set, and a point having a pixel value greater than the pixel threshold may be segmented from the first detection image to obtain a binarized image of the optical surface.
S3, obtaining edge points of the binarized image, and calculating circumscribed rectangles of the edge points.
The edge point of the binary image can be obtained by adopting traditional vision, and the coordinates of the edge point are calculated, so that the circumscribed rectangle of the edge point can be obtained according to the coordinates of the edge point.
S4, a first ROI image and a second ROI image are respectively cut out from the binarized image and the first detection image according to the circumscribed rectangle, and the second detection image is obtained according to the first ROI image and the second ROI image.
Specifically, after acquiring the circumscribed rectangle of the edge point, the circumscribed rectangle may be taken as an ROI (Region of Interest ) area, a first ROI image is cut out on the binarized image, and a second ROI image is cut out on the first detection image. However, the first ROI image and the second ROI image are subjected to a phase-inversion operation to obtain a second detection image, wherein the second detection image only contains the optical surface.
And S5, performing defect detection on the second detection image by adopting a defect detection model to obtain a defect set existing in the second detection image.
Specifically, the pre-trained defect detection model can be directly called to detect the defects of the second detection image, so as to obtain target defects in the second detection image, and a defect set is formed by all the target defects in the second detection image. The defect detection model may be a model in the prior art, for example, a YOLO-V5 model, a YOLO-V7 model, or a yolox, nanoDet, picoDet, cascadeMask-rcnn model.
S6, judging whether each target defect in the defect set is an out-of-specification defect, and outputting a corresponding first defect list and a corresponding second defect list according to a judging result.
In one embodiment of the present invention, it may be determined whether each target defect is an out-of-specification defect according to the score of each target defect.
Specifically, for the ith target defect in the defect set, the first target defect image may be first truncated on the second detection image with the ith target defect center point as the center and the first preset pixel value (e.g., 224 pixel value) as the diameter. Wherein i is a positive integer greater than or equal to 1 and less than or equal to the total number of target defects in the defect set. Then, the first target defect image is input into a classification network to obtain a score of the ith target defect as a true defect, wherein the classification network is a pre-trained network and can be directly called, and the classification network is a network in the prior art, for example, a network such as Resnet, densenet, mobileNet, shuffleNet. Judging whether the score is less than or equal to a preset score (e.g., 0.5), if the score is less than or equal to the preset score, judging that the ith target defect is an out-of-specification defect, and storing the ith target defect in the first defect list.
Further, if the score is greater than the preset score, the defect area of the ith target defect is further judged.
Specifically, if the score is greater than the preset score, the first size is obtained according to the size of the ith target defect. Wherein 32 pixels can be added to the width and height of the ith target defect, respectively, to obtain a new size, i.e., a first size. Then, taking the ith target defect center point as a center, intercepting a second target defect image on the second detection image according to the first size, inputting the second target defect image into a segmentation network to obtain a third target defect image, and calculating the defect area of the ith target defect according to the third target defect image. The split network is a pre-trained network, and can be directly called, and the split network is a network in the prior art, for example, a FCN (Fully Convolutional Networks, full convolution network), unet, DFANet, biSeNetv, fast-SCNN, and other networks. Judging whether the defect area is smaller than or equal to the preset area, if so, judging that the ith target defect is an out-of-specification defect, and storing the ith target defect in a first defect list; if the defect area is larger than the preset area, judging the ith target defect as a real defect, and storing the ith target defect in a second defect list.
It should be noted that, when the number of defects in the first defect list is small, the type of defects need not output a result when performing defect detection, so after the first defect list is obtained, the out-of-specification defects can be further determined according to the defect density of the out-of-specification defects in the target rule in the first defect list.
Specifically, in one embodiment of the present invention, a density algorithm may be used to calculate the number of defects in the first defect list that are defects outside the target rule in a unit area, and determine whether the number of defects is greater than or equal to a preset number. Outputting a first defect list and a second defect list if the defect number is greater than or equal to the preset number; and if the defect number is smaller than the preset number, removing the defect outside the target rule in the first defect list to obtain a third defect list, and outputting the third defect list and the second defect list.
Therefore, the invention reduces the non-optical surface by the optical surface of the picture accurately obtained by the traditional vision, thereby reducing the consumption of the video memory, improving the reasoning speed and reducing the over-killing of the non-optical surface, and ensures the recall rate of the model as much as possible while reducing the suspected defect over-killing by independently adding the classification net; and judging the defects outside the specification by calculating the defect area and the defect density number through traditional vision. The over-inspection rate of the whole project is reduced while the same inspection rate is ensured, so that the factory cost is saved.
In summary, according to the defect detection method of the embodiment of the present invention, a workpiece to be detected is photographed to obtain a first detection image, an optical surface in the first detection image is segmented to obtain a binary image of the optical surface, edge points of the binary image are obtained, an external rectangle of the edge points is calculated, edge points of the binary image are obtained according to the external rectangle, an external rectangle second detection image of the edge points is calculated, defect detection is performed on the second detection image by using a defect detection model to obtain a defect set in the second detection image, whether each target defect in the defect set is an out-of-specification defect is determined, and a corresponding first defect list and a corresponding second defect list are output according to a determination result. Therefore, the defect detection is carried out on the optical surface only by positioning the optical surface, so that the defect overdischarge condition of the non-optical surface is effectively solved, whether the defect is an out-of-specification defect or not is judged after the defect detection is carried out on the optical surface, the suspected defect overdischarge condition is effectively avoided, and further the consumed time and the display memory are greatly reduced, and the cost is lower.
Corresponding to the embodiment, the invention also provides a defect detection device.
As shown in fig. 2, the defect detecting apparatus according to the embodiment of the present invention may include: the first acquisition module 100, the second acquisition module 200, the calculation module 300, the third acquisition module 400, the fourth acquisition module 500, and the judgment module 600.
The first obtaining module 100 is configured to photograph a workpiece to be detected to obtain a first detection image; the second obtaining module 200 is configured to segment the optical surface in the first detection image to obtain a binarized image of the optical surface; the computing module 300 is used for acquiring edge points of the binarized image and computing circumscribed rectangles of the edge points; the third obtaining module 400 is configured to intercept a first ROI image and a second ROI image from the binarized image and the first detection image according to the circumscribed rectangle, respectively, and obtain the second detection image according to the first ROI image and the second ROI image; the fourth obtaining module 500 is configured to perform defect detection on the second detection image by using a defect detection model to obtain a defect set existing in the second detection image; the judging module 600 is configured to judge whether each target defect in the defect set is an out-of-specification defect, and output a corresponding first defect list and a corresponding second defect list according to the judging result.
According to one embodiment of the present invention, the second obtaining module 200 is specifically configured to: an Ostu algorithm is used to segment the optical surface from the first detected image to obtain a binarized image.
According to one embodiment of the present invention, the judging module 600 is specifically configured to: taking an ith target defect center point as a center, and taking a first preset pixel value as a diameter to intercept a first target defect image on a second detection image, wherein i is a positive integer which is greater than or equal to 1 and less than or equal to the total number of target defects in the defect set; inputting the first target defect image into a classification network to obtain a score of the ith target defect as a true defect; judging whether the score is smaller than or equal to a preset score; if the score is smaller than or equal to the preset score, judging that the ith target defect is an out-of-specification defect, and storing the ith target defect in a first defect list.
According to an embodiment of the present invention, the judging module 600 is specifically further configured to: if the score is greater than the preset score, acquiring a first size according to the size of the ith target defect; taking the ith target defect center point as a center, and intercepting a second target defect image on a second detection image according to the first size; inputting the second target defect image into a segmentation network to obtain a third target defect image, and calculating the defect area of the ith target defect according to the third target defect image; judging whether the defect area is smaller than or equal to a preset area; if the defect area is smaller than or equal to the preset area, judging that the ith target defect is an out-of-specification defect, and storing the ith target defect in a first defect list; if the defect area is larger than the preset area, judging the ith target defect as a real defect, and storing the ith target defect in a second defect list.
According to an embodiment of the present invention, the judging module 600 is specifically further configured to: calculating the defect number of the defects outside the target rule in the first defect list in a unit area by adopting a density algorithm; judging whether the defect number is larger than or equal to a preset number; outputting a first defect list and a second defect list if the defect number is greater than or equal to a preset number; and if the defect number is smaller than the preset number, removing the defect outside the target rule in the first defect list to obtain a third defect list, and outputting the third defect list and the second defect list.
It should be noted that, for more specific implementation of the defect detection apparatus according to the embodiment of the present invention, reference may be made to the above-mentioned examples of the defect detection method, and details thereof are not repeated herein.
According to the defect detection device of the embodiment of the invention, a first acquisition module is used for shooting a workpiece to be detected to acquire a first detection image, a second acquisition module is used for dividing an optical surface in the first detection image to acquire a binarized image of the optical surface, a calculation module is used for acquiring edge points of the binarized image, calculating circumscribed rectangles of the edge points, a third acquisition module is used for respectively cutting out a first ROI image and a second ROI image from the binarized image and the first detection image according to the circumscribed rectangles, acquiring a second detection image according to the first ROI image and the second ROI image, a fourth acquisition module is used for adopting a defect detection model to detect the second detection image to acquire a defect set in the second detection image, a judgment module is used for judging whether each target defect in the defect set is an out-of-specification defect or not, and a corresponding first defect list and a second defect list are output according to a judgment result. Therefore, the defect detection is carried out on the optical surface only by positioning the optical surface, so that the defect overdischarge condition of the non-optical surface is effectively solved, whether the defect is an out-of-specification defect or not is judged after the defect detection is carried out on the optical surface, the suspected defect overdischarge condition is effectively avoided, and further the consumed time and the display memory are greatly reduced, and the cost is lower.
The present invention also provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor, wherein the processor implements the defect detection method when executing the computer program.
According to the computer equipment provided by the embodiment of the invention, the optical surface is positioned to detect the defects of the optical surface, so that the defect overdischarge condition of the non-optical surface is effectively solved, and whether the defects are out-of-specification defects or not is judged after the defect detection of the optical surface, so that the suspected defect overdischarge condition is effectively avoided, the consumed time and the display memory are greatly reduced, and the cost is lower.
Corresponding to the above-described embodiments, the present invention also proposes a non-transitory computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the above-described defect detection method.
According to the non-transitory computer readable storage medium, the optical surface is positioned to detect the defects, so that the defect overdischarge situation of the non-optical surface is effectively solved, and whether the defects are out-of-specification defects or not is judged after the defect detection is carried out on the optical surface, so that the suspected defect overdischarge situation is effectively avoided, and further the consumed time and the display memory are greatly reduced, and the cost is lower.
In the description of the present invention, the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature. The meaning of "a plurality of" is two or more, unless specifically defined otherwise.
In the present invention, unless explicitly specified and limited otherwise, the terms "mounted," "connected," "secured," and the like are to be construed broadly, and may be, for example, fixedly connected, detachably connected, or integrally formed; can be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium, and can be communicated with the inside of two elements or the interaction relationship of the two elements. The specific meaning of the above terms in the present invention can be understood by those of ordinary skill in the art according to the specific circumstances.
In the present invention, unless expressly stated or limited otherwise, a first feature "up" or "down" a second feature may be the first and second features in direct contact, or the first and second features in indirect contact via an intervening medium. Moreover, a first feature being "above," "over" and "on" a second feature may be a first feature being directly above or obliquely above the second feature, or simply indicating that the first feature is level higher than the second feature. The first feature being "under", "below" and "beneath" the second feature may be the first feature being directly under or obliquely below the second feature, or simply indicating that the first feature is less level than the second feature.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms are not necessarily for the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and further implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
Logic and/or steps represented in the flowcharts or otherwise described herein, e.g., a ordered listing of executable instructions for implementing logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium may even be paper or other suitable medium upon which the program is printed, as the program may be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner, if necessary, and then stored in a computer memory.
It is to be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like.
Those of ordinary skill in the art will appreciate that all or part of the steps carried out in the method of the above-described embodiments may be implemented by a program to instruct related hardware, and the program may be stored in a computer readable storage medium, where the program when executed includes one or a combination of the steps of the method embodiments.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing module, or each unit may exist alone physically, or two or more units may be integrated in one module. The integrated modules may be implemented in hardware or in software functional modules. The integrated modules may also be stored in a computer readable storage medium if implemented as software functional modules and sold or used as a stand-alone product.
The above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, or the like. While embodiments of the present invention have been shown and described above, it will be understood that the above embodiments are illustrative and not to be construed as limiting the invention, and that variations, modifications, alternatives and variations may be made to the above embodiments by one of ordinary skill in the art within the scope of the invention.

Claims (8)

1. A defect detection method, comprising the steps of:
shooting a workpiece to be detected to obtain a first detection image;
dividing an optical surface in the first detection image to obtain a binarized image of the optical surface;
acquiring edge points of the binarized image, and calculating an external rectangle of the edge points;
a first ROI image and a second ROI image are respectively cut out from the binarized image and the first detection image according to the circumscribed rectangle, and a second detection image is obtained according to the first ROI image and the second ROI image;
performing defect detection on the second detection image by adopting a defect detection model to obtain a defect set existing in the second detection image;
judging whether each target defect in the defect set is an out-of-specification defect or not, and outputting a corresponding first defect list and second defect list according to a judging result, wherein judging whether each target defect in the defect set is an out-of-specification defect or not comprises:
taking an ith target defect center point as a center, and taking a first preset pixel value as a diameter to intercept a first target defect image on the second detection image, wherein i is a positive integer which is greater than or equal to 1 and less than or equal to the total number of target defects in the defect set;
inputting the first target defect image into a second classification network to obtain a score of the ith target defect as a true defect;
judging whether the score is smaller than or equal to a preset score;
and if the score is smaller than or equal to the preset score, judging that the ith target defect is the out-of-specification defect, and storing the ith target defect in the first defect list.
2. The defect detection method of claim 1, wherein segmenting the optical surface in the first detection image to obtain a binarized image of the optical surface comprises:
and dividing the optical surface from the first detection image by using an Ostu algorithm to acquire the binarized image.
3. The defect detection method of claim 1, wherein determining whether each target defect in the defect set is an out-of-specification defect further comprises:
if the score is greater than the preset score, acquiring a first size according to the size of the ith target defect;
taking the ith target defect center point as a center, and intercepting a second target defect image on the second detection image according to the first size;
inputting the second target defect image into a segmentation network to obtain a third target defect image, and calculating the defect area of the ith target defect according to the third target defect image;
judging whether the defect area is smaller than or equal to a preset area;
if the defect area is smaller than or equal to the preset area, judging that the ith target defect is the out-of-specification defect, and storing the ith target defect in the first defect list;
and if the defect area is larger than the preset area, judging the ith target defect as the real defect, and storing the ith target defect in the second defect list.
4. The defect detection method of claim 3, further comprising:
calculating the defect number of the external defects of the target rule in the first defect list in a unit area by adopting a density algorithm;
judging whether the defect number is larger than or equal to a preset number;
outputting the first defect list and the second defect list if the defect number is greater than or equal to the preset number;
and if the defect number is smaller than the preset number, removing the defect outside the target rule in the first defect list to obtain a third defect list, and outputting the third defect list and the second defect list.
5. A defect detection apparatus, comprising:
the first acquisition module is used for shooting a workpiece to be detected to acquire a first detection image;
the second acquisition module is used for dividing the optical surface in the first detection image to acquire a binarized image of the optical surface;
the computing module is used for acquiring edge points of the binarized image and computing circumscribed rectangles of the edge points;
the third acquisition module is used for respectively intercepting a first ROI image and a second ROI image from the binarized image and the first detection image according to the circumscribed rectangle, and acquiring a second detection image according to the first ROI image and the second ROI image;
the fourth acquisition module is used for carrying out defect detection on the second detection image by adopting a defect detection model so as to acquire a defect set existing in the second detection image;
the judging module is used for judging whether each target defect in the defect set is an out-of-specification defect or not, and outputting a corresponding first defect list and second defect list according to a judging result, wherein the judging module is specifically used for:
taking an ith target defect center point as a center, and taking a first preset pixel value as a diameter to intercept a first target defect image on the second detection image, wherein i is a positive integer which is greater than or equal to 1 and less than or equal to the total number of target defects in the defect set;
inputting the first target defect image into a second classification network to obtain a score of the ith target defect as a true defect;
judging whether the score is smaller than or equal to a preset score;
and if the score is smaller than or equal to the preset score, judging that the ith target defect is the out-of-specification defect, and storing the ith target defect in the first defect list.
6. The defect detection apparatus of claim 5, wherein the second acquisition module is specifically configured to:
and dividing the optical surface from the first detection image by using an Ostu algorithm to acquire the binarized image.
7. The defect detection apparatus of claim 5, wherein the determination module is further specifically configured to:
if the score is greater than the preset score, acquiring a first size according to the size of the ith target defect;
taking the ith target defect center point as a center, and intercepting a second target defect image on the second detection image according to the first size;
inputting the second target defect image into a segmentation network to obtain a third target defect image, and calculating the defect area of the ith target defect according to the third target defect image;
judging whether the defect area is smaller than or equal to a preset area;
if the defect area is smaller than or equal to the preset area, judging that the ith target defect is the out-of-specification defect, and storing the ith target defect in the first defect list;
and if the defect area is larger than the preset area, judging the ith target defect as the real defect, and storing the ith target defect in the second defect list.
8. The defect detection apparatus of claim 7, wherein the determination module is further specifically configured to:
calculating the defect number of the external defects of the target rule in the first defect list in a unit area by adopting a density algorithm;
judging whether the defect number is larger than or equal to a preset number;
outputting the first defect list and the second defect list if the defect number is greater than or equal to the preset number;
and if the defect number is smaller than the preset number, removing the defect outside the target rule in the first defect list to obtain a third defect list, and outputting the third defect list and the second defect list.
CN202310166317.1A 2023-02-27 2023-02-27 Defect detection method and device Active CN115861315B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310166317.1A CN115861315B (en) 2023-02-27 2023-02-27 Defect detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310166317.1A CN115861315B (en) 2023-02-27 2023-02-27 Defect detection method and device

Publications (2)

Publication Number Publication Date
CN115861315A CN115861315A (en) 2023-03-28
CN115861315B true CN115861315B (en) 2023-05-30

Family

ID=85658973

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310166317.1A Active CN115861315B (en) 2023-02-27 2023-02-27 Defect detection method and device

Country Status (1)

Country Link
CN (1) CN115861315B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116721098B (en) * 2023-08-09 2023-11-14 常州微亿智造科技有限公司 Defect detection method and defect detection device in industrial detection

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109636772A (en) * 2018-10-25 2019-04-16 同济大学 The defect inspection method on the irregular shape intermetallic composite coating surface based on deep learning
CN115018790A (en) * 2022-06-07 2022-09-06 华北电力大学 Workpiece surface defect detection method based on anomaly detection
CN115272340A (en) * 2022-09-29 2022-11-01 江苏智云天工科技有限公司 Industrial product defect detection method and device

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09133639A (en) * 1995-11-13 1997-05-20 Kawasaki Steel Corp Method for detecting surface defect
JP2006266752A (en) * 2005-03-22 2006-10-05 Seiko Epson Corp Defect detection method, defect inspection method, defect detection device, defect inspection device, defect detection program and recording medium for recording program
JP2012173044A (en) * 2011-02-18 2012-09-10 Jfe Steel Corp Surface flaw checkup device for steel sheets
CN103499590B (en) * 2013-10-17 2015-11-18 福州大学 Ring-shaped work pieces end face defect detection and screening technique and system
CN109934811B (en) * 2019-03-08 2022-12-30 中国科学院光电技术研究所 Optical element surface defect detection method based on deep learning
CN110082360A (en) * 2019-05-17 2019-08-02 中国科学院光电技术研究所 A kind of sequence optical element surface on-line detection device of defects and method based on array camera
CN111951238A (en) * 2020-08-04 2020-11-17 上海微亿智造科技有限公司 Product defect detection method
CN111951237B (en) * 2020-08-04 2021-06-08 上海微亿智造科技有限公司 Visual appearance detection method
CN114037682A (en) * 2021-11-08 2022-02-11 中国科学院光电技术研究所 Two-dimensional automatic detection method for optical element surface defects
CN114693610A (en) * 2022-03-15 2022-07-01 中南大学 Welding seam surface defect detection method, equipment and medium based on machine vision
CN114723677A (en) * 2022-03-18 2022-07-08 珠海格力电器股份有限公司 Image defect detection method, image defect detection device, image defect detection equipment and storage medium
CN115311247A (en) * 2022-08-25 2022-11-08 常州微亿智造科技有限公司 Defect classification correction method and application of workpiece appearance detection thereof

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109636772A (en) * 2018-10-25 2019-04-16 同济大学 The defect inspection method on the irregular shape intermetallic composite coating surface based on deep learning
CN115018790A (en) * 2022-06-07 2022-09-06 华北电力大学 Workpiece surface defect detection method based on anomaly detection
CN115272340A (en) * 2022-09-29 2022-11-01 江苏智云天工科技有限公司 Industrial product defect detection method and device

Also Published As

Publication number Publication date
CN115861315A (en) 2023-03-28

Similar Documents

Publication Publication Date Title
CN113109368B (en) Glass crack detection method, device, equipment and medium
JP4601134B2 (en) Method and apparatus for defect detection based on shape features
CN109671078B (en) Method and device for detecting product surface image abnormity
US20130058560A1 (en) Measurement of belt wear through edge detection of a raster image
JP2007093304A (en) Apparatus, method, and program for detecting defect, image sensor device and module, image processing apparatus, digital image-quality tester, computer-readable recording medium
CN115861315B (en) Defect detection method and device
CN112597846B (en) Lane line detection method, lane line detection device, computer device, and storage medium
CN113724257A (en) Carbon plate gray stain detection method, computer equipment and storage medium
CN112508950B (en) Anomaly detection method and device
CN112927247A (en) Graph cutting method based on target detection, graph cutting device and storage medium
CN116468687A (en) Scratch defect detection method and device, storage medium and electronic equipment
CN113781511B (en) Conveyor belt edge wear detection method, conveyor belt edge wear detection device, computer equipment and storage medium
KR102470422B1 (en) Method of automatically detecting sewing stitch based on CNN feature map and system for the same
CN110428411B (en) Backlight plate detection method and system based on secondary exposure
CN112070750A (en) Leather product defect detection method and device
CN114913112A (en) Method, device and equipment for detecting double edges of wafer
CN113837184B (en) Mosquito detection method, device and storage medium
CN110634124A (en) Method and equipment for area detection
CN111929328A (en) Zipper defect detection method and device
KR102556350B1 (en) Method and Apparatus for Calculating Ratio of Lesion Area
CN113516608A (en) Tire defect detection method and device, and tire detection device
CN109117843B (en) Character occlusion detection method and device
CN114494253B (en) Method and device for industrial quality inspection
CN112132139A (en) Character recognition method and device
CN114708277B (en) Automatic retrieval method and device for active area of ultrasonic video image

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant