CN115861315A - Defect detection method and device - Google Patents
Defect detection method and device Download PDFInfo
- Publication number
- CN115861315A CN115861315A CN202310166317.1A CN202310166317A CN115861315A CN 115861315 A CN115861315 A CN 115861315A CN 202310166317 A CN202310166317 A CN 202310166317A CN 115861315 A CN115861315 A CN 115861315A
- 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.)
- Granted
Links
Images
Classifications
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing 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 defect detection device, wherein the defect detection method comprises the following steps: shooting a workpiece to be detected to obtain a first detection image; segmenting an optical surface in the first detection image to obtain a binary image of the optical surface; acquiring edge points of the binary image, and calculating circumscribed rectangles of the edge points; 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; performing defect detection on the second detection image by using a defect detection model to obtain a defect set existing in the second detection image; and judging whether each target defect in the defect set is an out-of-specification defect, and outputting a corresponding first defect list and a second defect list according to a judgment result. Therefore, the time and the video memory which are consumed are greatly reduced, and the cost is low.
Description
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 a workpiece to be detected, the defect is over-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 can realize the defect detection of only the optical surface by positioning the optical surface, thereby effectively solving the problem of over-killing of the defects of the non-optical surface, and judging whether the defects are out-of-specification defects or not after the defect detection of the optical surface is carried out, thereby effectively avoiding the over-killing of suspected defects, greatly reducing the consumed time and display memory and lowering the cost.
The technical scheme adopted by the invention is as follows:
a method of defect detection, comprising the steps of: shooting a workpiece to be detected to obtain a first detection image; segmenting an optical surface in the first detection image to obtain a binary image of the optical surface; acquiring edge points of the binarized image, and calculating a circumscribed rectangle of the edge points; 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; performing defect detection on the second detection image by using a defect detection model to obtain a defect set existing in the second detection image; and judging whether each target defect in the defect set is an out-of-specification defect, and outputting a corresponding first defect list and a second defect list according to a judgment result.
In one embodiment of the present invention, segmenting an optical surface in the first detection image to obtain a binarized image of the optical surface includes: and adopting an Ostu algorithm to segment the optical surface from the first detection image so as to obtain the binary image.
In an embodiment of the present invention, determining whether each target defect in the defect set is an out-of-specification defect includes: taking the ith target defect central 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 two-classification network to obtain a score of the ith target defect as a real defect; judging whether the score is less than or equal to a preset score or not; and if the score is less than or equal to the preset score, judging the ith target defect to be the out-of-specification defect, and storing the ith target defect in the first defect list.
In an 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 larger than the preset score, acquiring a first size according to the size of the ith target defect; taking the ith target defect central 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 that the ith target defect is the real defect, and storing the ith target defect in the second defect list.
In an embodiment of the invention, the defect detecting method further includes: calculating the defect number of the target regular outer defects 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 or not; if the defect number is larger than or equal to the preset number, outputting the first defect list and the second defect list; and if the defect number is smaller than the preset number, removing the target out-of-rule defects 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; a second obtaining module, configured to segment an optical surface in the first detection image to obtain a binarized image of the optical surface; the calculation module is used for acquiring edge points of the binarized image and calculating a circumscribed rectangle of the edge points; a third obtaining module, configured to respectively capture a first ROI image and a second ROI image from the binarized image and the first detected image according to the circumscribed rectangle, and obtain a second detected image according to the first ROI image and the second ROI image; a fourth obtaining module, 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; and 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 second defect list according to a judgment result.
In an embodiment of the present invention, the second obtaining module is specifically configured to: and adopting an Ostu algorithm to segment the optical surface from the first detection image so as to obtain the binary image.
In an embodiment of the present invention, the determining module is specifically configured to: taking the ith target defect central 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 two-classification network to obtain a score of the ith target defect as a real defect; judging whether the score is less than or equal to a preset score; and if the score is less than or equal to the preset score, judging the ith target defect to be the out-of-specification defect, and storing the ith target defect in the first defect list.
In an embodiment of the present invention, the determining module is further specifically configured to: if the score is larger than the preset score, acquiring a first size according to the size of the ith target defect; taking the ith target defect central 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 that the ith target defect is the real defect, and storing the ith target defect in the second defect list.
In an embodiment of the present invention, the determining module is further specifically configured to: calculating the defect number of the target regular outer defects 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 or not; if the defect number is larger than or equal to the preset number, outputting the first defect list and the second defect list; and if the defect number is smaller than the preset number, removing the target out-of-rule defects 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 optical surface is positioned to realize the defect detection only on the optical surface, so that the problem of over-killing of the defect 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 is carried out on the optical surface, so that the suspected over-killing of the defect is effectively avoided, the consumed time and the memory are greatly reduced, and the cost is low.
Drawings
FIG. 1 is a flowchart of a defect detection method according to an embodiment of the invention;
FIG. 2 is a block diagram of a defect detection apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
FIG. 1 is a flow chart of a defect detection method according to an embodiment of the invention.
As shown in fig. 1, the defect detection method of the embodiment of the invention may include the following steps:
s1, shooting a workpiece to be detected to acquire a first detection image.
Wherein, a workpiece to be detected can be shot by a shooting device (for example, an industrial camera) to obtain a corresponding detection image, namely a first detection image.
And S2, segmenting the optical surface in the first detection image to obtain a binary image of the optical surface.
In one embodiment of the present invention, an Ostu (maximum between 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 value may be set, and a point having a pixel value larger than the pixel threshold value may be segmented from the first detection image to acquire a binarized image of the optical surface.
And S3, obtaining the edge points of the binary image, and calculating the circumscribed rectangle of the edge points.
The edge points of the binary image can be obtained by adopting traditional vision, and the coordinates of the edge points are calculated, so that the circumscribed rectangle of the edge points can be obtained according to the coordinates of the edge points.
And S4, 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.
Specifically, after the circumscribed rectangle of the edge point is obtained, the circumscribed rectangle may be used as an ROI (Region of Interest) Region, a first ROI image is captured on the binarized image, and a second ROI image is captured on the first detected image. However, the first ROI image and the second ROI image are subjected to an and operation to acquire a second inspection image, wherein the second inspection image includes only the optical surface.
And S5, adopting a defect detection model to carry out defect detection on the second detection image so as to obtain a defect set existing in the second detection image.
Specifically, the defect detection model trained in advance can be directly called to perform defect detection on the second detection image so as to obtain the target defects in the second detection image, and all the target defects in the second detection image form a defect set. The defect detection model can be a model in the prior art, such as a YOLO-V5, YOLO-V7, yolox, nanoDet, picoDet, cascadeMask-rcnn model.
And 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 second defect list according to a judgment result.
In one embodiment of the present invention, whether each target defect is an out-of-specification defect may be determined 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 cut out on the second inspection image with the ith target defect center point as the center and the first preset pixel value (e.g., 224 pixel values) 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 two-class network to obtain a score that the ith target defect is a real defect, wherein the two-class network is a pre-trained network and can be directly called, and the two-class network is a network in the prior art, for example, a network such as Resnet, densnet, mobileNet, shuffleNet, and the like. It is determined whether the score is less than or equal to a preset score (e.g., 0.5), and if the score is less than or equal to the preset score, it is determined that the ith target defect is an out-of-specification defect, and the ith target defect is stored in the first defect list.
Further, if the score is larger 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, a first size is acquired 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 to obtain a new size, i.e. the first size. Then, with the ith target defect central point as the center, a second target defect image is intercepted on the second detection image according to the first size, the second target defect image is input into a segmentation network to obtain a third target defect image, and the defect area of the ith target defect is calculated according to the third target defect image. The split network is a pre-trained network and can be called directly, and the split network is a network in the prior art, for example, FCN (full Convolutional Networks), unet, DFANet, biSeNetv2, fast-SCNN, and the like. Judging whether the defect area is smaller than or equal to a 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; and 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 there may be a case where the number of defects is small in the first defect list, and when defect detection is performed, the result does not need to be output for the type of defect, so after the first defect list is obtained, further judgment can be performed on the out-of-specification defect according to the defect density of the out-of-target-rule defect 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 a unit area of the target out-of-rule defect in the first defect list, and determine whether the number of defects is greater than or equal to a predetermined number. If the number of the defects is larger than or equal to the preset number, outputting a first defect list and a second defect list; and if the number of the defects is less than the preset number, removing the target out-of-rule defects in the first defect list to obtain a third defect list, and outputting the third defect list and the second defect list.
Therefore, the image recognition method accurately obtains the optical surface of the image through the traditional vision, reduces the non-optical surface, thereby reducing the memory consumption, improving the reasoning speed and reducing the over-killing of the non-optical surface, and simultaneously ensures the recall (recall rate) of the model as far as possible while reducing the over-killing of suspected defects through independently adding the classification network; and calculating the defect area and the defect density number through the traditional vision, and judging the out-of-specification defects. The same detection rate is ensured, and meanwhile, the over-detection rate of the whole project is reduced, so that the factory cost is saved.
In summary, according to the defect detection method of the embodiment of the invention, a workpiece to be detected is photographed to obtain a first detected image, an optical surface in the first detected image is segmented to obtain a binarized image of the optical surface, edge points of the binarized image are obtained, circumscribed rectangles of the edge points are calculated, the edge points of the binarized image are obtained according to the circumscribed rectangles, a second detected image of the circumscribed rectangles of the edge points is calculated, a defect detection model is used for performing defect detection on the second detected image to obtain a defect set existing in the second detected image, whether each target defect in the defect set is an out-of-specification defect is judged, and a corresponding first defect list and a corresponding second defect list are output according to a judgment result. Therefore, the optical surface is positioned to realize defect detection only on the optical surface, so that the problem of over-killing of defects of a non-optical surface is effectively solved, and whether the defects are out-of-specification defects or not is judged after the defects of the optical surface are detected, so that the condition of over-killing of suspected defects is effectively avoided, the consumed time and the display memory are greatly reduced, and the cost is low.
Corresponding to the embodiment, the invention further provides a defect detection device.
As shown in fig. 2, the defect detecting apparatus according to the embodiment of the present invention may include: a first obtaining module 100, a second obtaining module 200, a calculating module 300, a third obtaining module 400, a fourth obtaining module 500 and a judging module 600.
The first acquisition module 100 is configured to shoot a workpiece to be detected to acquire a first detection image; the second obtaining module 200 is configured to segment the optical surface in the first detected image to obtain a binarized image of the optical surface; the calculation module 300 is configured to obtain edge points of the binarized image and calculate a circumscribed rectangle of the edge points; the third obtaining module 400 is configured to respectively intercept the first ROI image and the second ROI image from the binarized image and the first detected image according to the circumscribed rectangle, and obtain a second detected 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 detected image by using a defect detection model to obtain a defect set existing in the second detected 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 second defect list according to a judgment result.
According to an embodiment of the present invention, the second obtaining module 200 is specifically configured to: and adopting an Ostu algorithm to segment the optical surface from the first detection image to obtain a binary image.
According to an embodiment of the present invention, the determining module 600 is specifically configured to: taking the ith target defect central 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 more than or equal to 1 and less than or equal to the total number of target defects in a defect set; inputting the first target defect image into a two-classification network to obtain a score of the ith target defect as a real defect; judging whether the score is less than or equal to a preset score; and if the score is less than or equal to the preset score, judging the ith target defect as 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 determining module 600 is further specifically configured to: if the score is larger than the preset score, acquiring a first size according to the size of the ith target defect; taking the ith target defect central 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; and 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 determining module 600 is further specifically configured to: calculating the defect number of the target regular outer defects in the first defect list in a unit area by adopting a density algorithm; judging whether the number of the defects is larger than or equal to a preset number or not; if the defect number is larger than or equal to the preset number, outputting a first defect list and a second defect list; and if the number of the defects is less than the preset number, removing the target out-of-rule defects 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 a more specific implementation of the defect detection apparatus according to the embodiment of the present invention, reference may be made to the above-mentioned embodiment of the defect detection method, which is not described herein again.
According to the defect detection device provided by the embodiment of the invention, a workpiece to be detected is shot through a first acquisition module to acquire a first detection image, an optical surface in the first detection image is segmented through a second acquisition module to acquire a binary image of the optical surface, edge points of the binary image are acquired through a calculation module, circumscribed rectangles of the edge points are calculated, a third acquisition module is used for respectively cutting out a first ROI image and a second ROI image from the binary image and the first detection image according to the circumscribed rectangles, a second detection image is acquired according to the first ROI image and the second ROI image, a fourth acquisition module is used for carrying out defect detection on the second detection image by adopting a defect detection model to acquire a defect set existing 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 corresponding second defect list are output according to a judgment result. Therefore, the optical surface is positioned to realize defect detection only on the optical surface, so that the problem of over-killing of defects of a non-optical surface is effectively solved, and whether the defects are out-of-specification defects or not is judged after the defects of the optical surface are detected, so that the condition of over-killing of suspected defects is effectively avoided, the consumed time and the display memory are greatly reduced, and the cost is low.
Corresponding to the above embodiment, the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the defect detection method is implemented.
According to the computer equipment provided by the embodiment of the invention, the defect detection is only carried out on the optical surface by positioning the optical surface, so that the problem of over-killing of the defect 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 is carried out on the optical surface, so that the condition of over-killing of a suspected defect is effectively avoided, further, the consumed time and the display memory are greatly reduced, and the cost is lower.
In correspondence with 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 provided by the embodiment of the invention, the defect detection is carried out on the optical surface only by positioning the optical surface, so that the problem of over-killing of the defect of the non-optical surface is effectively solved, and whether the defect is an out-of-specification defect is judged after the defect detection is carried out on the optical surface, so that the suspected over-killing of the defect is effectively avoided, the consumed time and the display memory are greatly reduced, and the cost is low.
In the description of the present invention, the terms "first" and "second" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. The meaning of "plurality" is two or more unless specifically limited otherwise.
In the present invention, unless otherwise explicitly stated or limited, the terms "mounted," "connected," "fixed," and the like are to be construed broadly, e.g., as being permanently connected, detachably connected, or integral; can be mechanically or electrically connected; either directly or indirectly through intervening media, either internally or in any other relationship. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
In the present invention, unless otherwise expressly stated or limited, the first feature "on" or "under" the second feature may be directly contacting the first and second features or indirectly contacting the first and second features through an intermediate. Also, a first feature "on," "above," and "over" a second feature may be directly on or obliquely above the second feature, or simply mean that the first feature is at a higher level than the second feature. A first feature "under," "beneath," and "under" a second feature may be directly under or obliquely under the second feature, or may simply mean that the first feature is at a lesser elevation than the second feature.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean 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 invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to 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, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one 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 alternate 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.
The logic and/or steps represented in the flowcharts or otherwise described herein, such as an ordered listing of executable instructions that can be considered to implement 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 could even be paper or another suitable medium upon which the program is printed, as the program can 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 should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware that is related to instructions of a program, and the program may be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a separate product, may also be stored in a computer-readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc. Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.
Claims (10)
1. A method of defect detection, comprising the steps of:
shooting a workpiece to be detected to obtain a first detection image;
segmenting an optical surface in the first detection image to obtain a binary image of the optical surface;
acquiring edge points of the binarized image, and calculating a circumscribed rectangle of the edge points;
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;
performing defect detection on the second detection image by using a defect detection model to obtain a defect set existing in the second detection image;
and judging whether each target defect in the defect set is an out-of-specification defect, and outputting a corresponding first defect list and a second defect list according to a judgment result.
2. The defect detection method according to claim 1, wherein segmenting the optical surface in the first detection image to obtain a binarized image of the optical surface, comprises:
and adopting an Ostu algorithm to segment the optical surface from the first detection image so as to obtain the binary image.
3. The method of claim 2, wherein determining whether each target defect in the set of defects is an out-of-specification defect comprises:
taking the ith target defect central 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 two-classification network to obtain a score of the ith target defect as a real defect;
judging whether the score is less than or equal to a preset score;
and if the score is less than or equal to the preset score, judging the ith target defect to be the out-of-specification defect, and storing the ith target defect in the first defect list.
4. The method of claim 3, wherein determining whether each target defect in the set of defects is an out-of-specification defect further comprises:
if the score is larger than the preset score, acquiring a first size according to the size of the ith target defect;
taking the ith target defect central 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 that the ith target defect is the real defect, and storing the ith target defect in the second defect list.
5. The defect detection method of claim 4, further comprising:
calculating the defect number of the target regular outer defects 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 or not;
if the defect number is larger than or equal to the preset number, outputting the first defect list and the second defect list;
and if the defect number is smaller than the preset number, removing the target out-of-rule defects in the first defect list to obtain a third defect list, and outputting the third defect list and the second defect list.
6. A defect detection apparatus, comprising:
the first acquisition module is used for shooting a workpiece to be detected to acquire a first detection image;
a second obtaining module, configured to segment an optical surface in the first detection image to obtain a binarized image of the optical surface;
the calculation module is used for acquiring edge points of the binary image and calculating a circumscribed rectangle of the edge points;
a third obtaining module, configured to respectively capture a first ROI image and a second ROI image from the binarized image and the first detected image according to the circumscribed rectangle, and obtain a second detected image according to the first ROI image and the second ROI image;
a fourth obtaining module, 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;
and 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 second defect list according to a judgment result.
7. The defect detection device of claim 6, wherein the second obtaining module is specifically configured to:
and adopting an Ostu algorithm to segment the optical surface from the first detection image so as to obtain the binary image.
8. The defect detection device of claim 7, wherein the determining module is specifically configured to:
taking the ith target defect central 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 two-classification network to obtain a score of the ith target defect as a real defect;
judging whether the score is less than or equal to a preset score;
and if the score is less 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.
9. The defect detection device of claim 8, wherein the determining module is further configured to:
if the score is larger than the preset score, acquiring a first size according to the size of the ith target defect;
taking the ith target defect central 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 that the ith target defect is the real defect, and storing the ith target defect in the second defect list.
10. The defect detection apparatus of claim 9, wherein the determining module is further configured to:
calculating the defect number of the target regular outer defects in the unit area in the first defect list by adopting a density algorithm;
judging whether the defect number is larger than or equal to a preset number or not;
if the defect number is larger than or equal to the preset number, outputting the first defect list and the second defect list;
and if the defect number is smaller than the preset number, removing the target out-of-rule defects in the first defect list to obtain a third defect list, and outputting the third defect list and the second defect list.
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 true CN115861315A (en) | 2023-03-28 |
CN115861315B 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) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116721098A (en) * | 2023-08-09 | 2023-09-08 | 常州微亿智造科技有限公司 | Defect detection method and defect detection device in industrial detection |
Citations (15)
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 |
CN103499590A (en) * | 2013-10-17 | 2014-01-08 | 福州大学 | Method and system for detecting and screening end defects in circular parts |
CN109636772A (en) * | 2018-10-25 | 2019-04-16 | 同济大学 | The defect inspection method on the irregular shape intermetallic composite coating surface based on deep learning |
CN109934811A (en) * | 2019-03-08 | 2019-06-25 | 中国科学院光电技术研究所 | A kind of optical element surface defect inspection 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 |
CN111951237A (en) * | 2020-08-04 | 2020-11-17 | 上海微亿智造科技有限公司 | 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 |
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 |
CN115311247A (en) * | 2022-08-25 | 2022-11-08 | 常州微亿智造科技有限公司 | Defect classification correction method and application of workpiece appearance detection thereof |
-
2023
- 2023-02-27 CN CN202310166317.1A patent/CN115861315B/en active Active
Patent Citations (15)
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 |
CN103499590A (en) * | 2013-10-17 | 2014-01-08 | 福州大学 | Method and system for detecting and screening end defects in circular parts |
CN109636772A (en) * | 2018-10-25 | 2019-04-16 | 同济大学 | The defect inspection method on the irregular shape intermetallic composite coating surface based on deep learning |
CN109934811A (en) * | 2019-03-08 | 2019-06-25 | 中国科学院光电技术研究所 | A kind of optical element surface defect inspection 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 |
CN111951237A (en) * | 2020-08-04 | 2020-11-17 | 上海微亿智造科技有限公司 | 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 |
CN115018790A (en) * | 2022-06-07 | 2022-09-06 | 华北电力大学 | Workpiece surface defect detection method based on anomaly detection |
CN115311247A (en) * | 2022-08-25 | 2022-11-08 | 常州微亿智造科技有限公司 | Defect classification correction method and application of workpiece appearance detection thereof |
CN115272340A (en) * | 2022-09-29 | 2022-11-01 | 江苏智云天工科技有限公司 | Industrial product defect detection method and device |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116721098A (en) * | 2023-08-09 | 2023-09-08 | 常州微亿智造科技有限公司 | Defect detection method and defect detection device in industrial detection |
CN116721098B (en) * | 2023-08-09 | 2023-11-14 | 常州微亿智造科技有限公司 | Defect detection method and defect detection device in industrial detection |
Also Published As
Publication number | Publication date |
---|---|
CN115861315B (en) | 2023-05-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109613002B (en) | Glass defect detection method and device and storage medium | |
CN113109368B (en) | Glass crack detection method, device, equipment and medium | |
US7215829B2 (en) | Method and system for object recognition using fractal map | |
CN109671078B (en) | Method and device for detecting product surface image abnormity | |
CN110599484B (en) | Defect detection method, device and storage medium | |
CN113096130B (en) | Method and device for detecting object defects | |
US6778694B1 (en) | Method for examining doubtful zones on the surface of an unwinding strip by image segmentation | |
CN113724257A (en) | Carbon plate gray stain detection method, computer equipment and storage medium | |
CN113820333B (en) | Battery pole piece abnormality detection method, device, upper computer and detection system | |
CN112070751A (en) | Wood floor defect detection method and device | |
CN115861315B (en) | Defect detection method and device | |
CN112508950B (en) | Anomaly detection method and device | |
CN112927247A (en) | Graph cutting method based on target detection, graph cutting device and storage medium | |
CN116416268B (en) | Method and device for detecting edge position of lithium battery pole piece based on recursion dichotomy | |
CN112184772B (en) | Target tracking method and device | |
CN112597846A (en) | Lane line detection method, lane line detection device, computer device, and storage medium | |
CN113012157A (en) | Visual detection method and system for equipment defects | |
CN113837204A (en) | Hole shape recognition method, computer equipment and storage medium | |
CN112070750A (en) | Leather product defect detection method and device | |
KR102470422B1 (en) | Method of automatically detecting sewing stitch based on CNN feature map and system for the same | |
US6697516B1 (en) | Method for inspecting the surface of a moving strip by prior classification of the detected surface irregularity | |
CN114581446A (en) | Battery core abnormity detection method and system of laminated battery | |
CN117611619A (en) | Linear fitting method, linear fitting system, electronic equipment and storage medium | |
CN111929328A (en) | Zipper defect detection method and device | |
CN114913112A (en) | Method, device and equipment for detecting double edges of wafer |
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 |