WO2024045963A1 - 外观缺陷的检测方法、电子设备和存储介质 - Google Patents

外观缺陷的检测方法、电子设备和存储介质 Download PDF

Info

Publication number
WO2024045963A1
WO2024045963A1 PCT/CN2023/109564 CN2023109564W WO2024045963A1 WO 2024045963 A1 WO2024045963 A1 WO 2024045963A1 CN 2023109564 W CN2023109564 W CN 2023109564W WO 2024045963 A1 WO2024045963 A1 WO 2024045963A1
Authority
WO
WIPO (PCT)
Prior art keywords
appearance
point
defect
image
preset
Prior art date
Application number
PCT/CN2023/109564
Other languages
English (en)
French (fr)
Inventor
冯蓬勃
谢学智
张富强
李会富
Original Assignee
歌尔股份有限公司
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 歌尔股份有限公司 filed Critical 歌尔股份有限公司
Publication of WO2024045963A1 publication Critical patent/WO2024045963A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30168Image quality inspection

Definitions

  • the present disclosure relates to the field of defect detection, specifically to methods for detecting appearance defects, electronic devices and storage media.
  • defect detection has always been an indispensable link in industrial production.
  • the method currently used is still the traditional manual visual inspection. After defects are discovered, unqualified products are manually removed. In this way, the existing quality inspection situation involves visual fatigue, emotional fluctuations and other factors of the quality inspection workers, making the traditional The method inevitably has the problems of poor objectivity of quality standards and slow speed of the detection method.
  • Embodiments of the present disclosure provide an appearance defect detection method, an electronic device, and a storage medium, which can be flexibly applied to a variety of application scenarios.
  • embodiments of the present application provide a method for detecting appearance defects, which includes: for each point of at least one point of a target object, obtaining an appearance image of the point; The appearance image is subjected to a first detection to determine whether there is a preset defect in the appearance of the point; if there is a preset defect in the appearance of the point, the appearance of the target object is determined according to the type of the preset defect. Are there any defects?
  • the appearance image of the point includes multiple appearance images of the point under different brightness lighting conditions.
  • the appearance image of the point is first detected to determine the Whether there is a preset defect in the appearance includes: inputting the appearance image of the point into a pre-trained first detection model, and determining whether there is a preset defect in the appearance of the point through the first detection model.
  • the method before determining whether there is a defect in the appearance of the target object according to the type of the preset defect, the method further includes: performing grayscale processing on the appearance image of the point; and calculating the appearance of the point.
  • the standard deviation of the image matrix of the appearance image retain the appearance image of the point where the standard deviation is greater than or equal to the standard deviation threshold and/or retain the appearance image of the point where the standard deviation is the largest.
  • determining whether there is a defect in the appearance of the target object according to the type of the preset defect includes: there is a linear defect in the point.
  • the diagonal length of the defective part in the appearance image is detected; when the diagonal length is greater than a preset length threshold, it is determined that the appearance of the target object is defective.
  • determining whether there is a defect in the appearance of the target object according to the type of the preset defect includes: there is a flake at the point.
  • a defect the area of the defective part in the appearance image is detected; when the area is greater than a preset area threshold, it is determined that the appearance of the target object is defective.
  • determining whether there is a defect in the appearance of the target object according to the type of the preset defect includes: there is dirt at the point.
  • detect dirty pixels in the defective part of the appearance image detect dirty pixels in the defective part of the appearance image; when the number of dirty pixels in the appearance image is greater than the preset number threshold, determine the location of the target object. The appearance is defective.
  • the detection of dirty pixels in the defective part of the appearance image includes: performing grayscale processing on the defective part of the appearance image; and calculating the standard of the image matrix of the defective part of the appearance image. Difference; determine the first parameter of the defective part of the appearance image according to the standard deviation and a preset function, the preset function is a linear function of the standard deviation and the first parameter; according to the first Parameter, perform binarization processing on the defective part of the appearance image to determine the dirty pixels in the defective part of the appearance image.
  • the method before detecting the dirty pixels of the defective part in the appearance image of the point, the method further includes: obtaining in advance a plurality of sets of correspondences between the standard deviation and the first parameter. relationship as a training set; initialize the fitting function, input the training set into the gradient descent algorithm model, iterate the fitting function, and obtain the preset function.
  • determining whether there is a defect in the appearance of the target object according to the type of the preset defect includes: there is a scratch at the point. In the case of defects, it is directly determined that the appearance of the target object is defective.
  • the method before performing the first inspection on the appearance image of the point to determine whether there is a preset defect in the appearance of the point, the method further includes: inputting the appearance image into a second detection model, and determining The logo part in the appearance image; intercept the logo part in the appearance image as a logo image; input the logo image into a third detection model to determine whether there is an appearance defective part of the target object in the logo image ; In the case where the appearance defective portion exists in the logo image, it is determined that the target object has an appearance defect.
  • the method further includes: obtaining an appearance image of the logo point of the target object; performing a first detection on the appearance image of the logo point to determine whether there is a preset defect in the appearance of the logo point; When there is a preset defect in the appearance of the logo point, it is determined that there is a defect in the appearance of the target object.
  • embodiments of the present application provide an electronic device having a processor and a memory.
  • Computer instructions are stored in the memory.
  • the computer instructions are executed by the processor, any one of the above mentioned first aspects is implemented. Method steps.
  • embodiments of the present application provide a storage medium on which computer instructions are stored. When the computer instructions are executed by a processor, the steps of the method described in any one of the above first aspects are implemented.
  • One beneficial effect of the embodiments of the present disclosure is that by obtaining the appearance image of at least one point of the target object and detecting the appearance image, it can be determined whether there is a preset defect at the point, and whether there is a preset defect at the point. In this case, it is determined whether there is a defect in the appearance of the target object according to the type of defect. In this example, in this way, it is possible to automatically, targeted, and quickly determine whether there are defects in the appearance of the target object based on the type of defect, thereby improving detection efficiency and quality.
  • FIG. 1 shows a flow chart of a method for detecting appearance defects according to an embodiment of the present disclosure.
  • FIG. 2 shows a block diagram of an electronic device according to an embodiment of the present disclosure.
  • any specific values are to be construed as illustrative only and not as limiting. Accordingly, other examples of the exemplary embodiments may have different values.
  • the embodiment of the present application discloses a method for detecting appearance defects. As shown in Figure 1, the method includes steps S11-S13.
  • Step S11 For each point of at least one point of the target object, obtain the appearance image of the point.
  • the target object may be any item whose appearance needs to be detected for defects, such as VR glasses, mobile phones, etc.
  • the point position of the target object can be determined according to the shape of the target object. Specifically, in order to ensure the detection effect, when determining the point position of the target object, all angles of the curved surface part of the target object can be included as much as possible. After determining the point, you can take an image of each point of the target as the target image of that point.
  • the appearance image of the point includes the point under different brightness lights. Multiple appearance images under lighting conditions.
  • the imaging effect is different under different brightness conditions. For example, the imaging effect of dirty defects will be better in a brighter environment, while the imaging effect of bright mark defects will be better in a darker environment. Under the environment, the imaging effect will be better, and due to the curved surface, the imaging effect of some defects such as bright mark defects will be poor. Therefore, for each point, multiple appearance images under different lighting conditions can be obtained. For example, two appearance images of the point can be obtained, including a brighter appearance image of the point and a darker appearance image of the point. Point appearance image.
  • the problem of appearance defect imaging on the target surface can be solved, and a clear and detectable appearance image can be obtained, so that subsequent inspections can be accurately carried out. Determine whether the target object has appearance defects.
  • Step S12 Perform a first inspection on the appearance image of the point to determine whether there is a preset defect in the appearance of the point.
  • the preset defects may include multiple types of defects, such as linear defects, flake defects, scratch defects, dirt defects, etc.
  • linear defects can include hair fibers and linear bright marks.
  • Flake defects can be flaky bright marks, etc.
  • performing a first inspection on the appearance image of the point to determine whether there is a preset defect in the appearance of the point includes: inputting the appearance image of the point into a pre-trained first detection model, Through the first detection model, it is determined whether there is a preset defect in the appearance of the point.
  • the first detection model is a detection model.
  • it can be a YOLOv5 algorithm model.
  • This model can be trained in advance to determine whether there is a preset type of defect in the appearance of the point.
  • a rectangular detection frame can be used to select the image frame of the defective part as the defective part. It can be understood that the defective part mentioned in this example includes not only the image of the defective part, but also the image of the normal part including the frame selection.
  • the image of the defective part can be intercepted from the appearance image of the point.
  • the YOLOv5 model can be used to detect the appearance in the frame.
  • the defective part of the image is cropped out to subsequently determine whether the appearance of the target object exists.
  • the method before determining whether there is a defect in the appearance of the target object according to the preset defect type, the method further includes: performing grayscale processing on the appearance image of the point, and calculating the image of the appearance image of the point.
  • the standard deviation of the matrix retain the appearance image of the point with the standard deviation greater than or equal to the standard deviation threshold and/or retain the appearance image of the point with the largest standard deviation.
  • the appearance image can be grayscaled first, and the standard deviation of the image matrix of the grayscale image can be calculated.
  • the standard deviation is greater than or equal to the preset standard deviation threshold, it represents that the image quality of the appearance image is better.
  • the clearer the image edges therefore, the appearance images with standard deviation greater than or equal to the standard deviation threshold can be retained, and the appearance images with standard deviation less than the standard deviation threshold can be eliminated.
  • the standard deviation of all appearance images at this point is less than the standard deviation threshold. In order to avoid missed detections, the one with the largest standard deviation among the multiple appearance images at this point can be retained. Appearance image.
  • the appearance image is grayscaled and the standard deviation of the matrix of the grayscale image is calculated, which can effectively eliminate the appearance image with poor imaging effect, avoid the impact of the surface and lighting conditions on the appearance image, and reduce the subsequent cost Errors in detecting appearance defects, and since at least one appearance image of the point will be retained, there will be no missed detection.
  • Step S13 When there is a preset defect in the appearance of the point, determine whether there is a defect in the appearance of the target object according to the type of the preset defect.
  • determining whether there is a defect in the appearance of the target object may be determining whether the appearance of the target object meets the requirements.
  • defect types there may be different defect identification standards. Taking linear defects as an example, if the length of the linear bright mark is less than 5mm and the width is less than 0.15mm, then for the linear bright mark, the defect will be considered to be relatively small, and the target object will not be determined to have an appearance defect. .
  • the diagonal length of the defective part in the appearance image is detected. When the diagonal length is greater than the preset length threshold, it is determined that the appearance of the target object is defective.
  • the defects present in the appearance image are linear defects, such as hair fibers or linear bright marks, because their shapes are irregular, accurate values cannot be obtained when measuring their lengths, so it is possible
  • the defective part of the linear defect in the appearance image such as the part selected by the detection frame, calculate the pixel length of its diagonal line, and determine the length of the linear defect based on this pixel length.
  • the preset length threshold can be set according to actual needs. When the length is greater than the threshold, the target object will be considered to have an appearance defect.
  • determining whether there is a defect in the appearance of the target object according to the type of the preset defect includes: when there is a flaky defect in the point, The area of the defective part in the appearance image is detected, and when the area is greater than the preset area threshold, it is determined that there is a defect in the appearance of the target object.
  • the defect present in the appearance image is a flaky defect, such as a flaky bright mark, due to its irregular shape, accurate values cannot be obtained when measuring its size and area, so the appearance can be
  • the pixel area is calculated, and the size of the flaky defect is determined based on the pixel area.
  • the preset area threshold can be set according to actual needs. When the area is greater than the threshold, the target object will be considered to have an appearance defect.
  • the present embodiment when there is a preset defect in the appearance of the point, it is determined whether there is a defect in the appearance of the target object according to the type of the preset defect, including: when there is a dirt defect in the point. , detect the dirty pixels in the defective part of the appearance image, and when the number of dirty pixels is greater than the preset number threshold, it is determined that the appearance of the target object is defective.
  • detecting dirty pixels in the defective part of the appearance image includes: performing grayscale processing on the appearance image at the point, and calculating the standard deviation of the image matrix of the appearance image at the point, According to the standard deviation and the preset function, the first parameter of the defective part of the appearance image of the point is determined.
  • the preset function is a linear function of the standard deviation and the first parameter. According to the first parameter, the defect of the appearance image is determined.
  • the part is binarized to determine the dirty pixels in the defective part of the appearance image.
  • the appearance image can be grayscaled first, and the standard deviation of the processed image matrix can be calculated. Pass this mark The accuracy and preset function determine the first parameter of the appearance image.
  • the first parameter is a parameter used to distinguish whether a pixel is a dirty pixel.
  • the method before detecting dirty pixels in the defective part of the appearance image, the method also includes: pre-obtaining the correspondence between multiple sets of standard deviations and the first parameter as a training set, and initializing the fitting function, And input the training set into the gradient descent algorithm model, iterate the fitting function, and obtain the preset function.
  • the standard deviation std and the first parameter C of m appearance images can be obtained in advance, and the standard deviation and the first parameter C of each appearance image are respectively used as a set of training data (std, C) to obtain m A training set of training data.
  • Update loss function and calculate the partial derivatives Update based on this partial derivative Among them, ⁇ i includes two parameters, ⁇ i0 and ⁇ i1 .
  • the standard deviation can be brought into the preset function to obtain the first parameter of the defective part of the appearance image.
  • the adaptiveThreshold (binarization) function in OpenCV to binarize the defective part.
  • the average value of the grayscale values of all pixels in the preset area centered on the pixel that is, the first average value
  • the preset area may be an area of N*N pixels with the pixel as the core. The specific value of N can be flexibly set according to the actual situation.
  • the threshold value of the pixel point can be obtained by making a difference between the first average value and the first parameter.
  • the gray value of the pixel is compared with the threshold to determine whether the gray value of the pixel is set to 0 or 255.
  • a pixel whose grayscale value changes to 255 can be determined as a dirty pixel.
  • the number of dirty pixels in the defective part can be obtained.
  • the number of dirty pixels is greater than the preset number threshold
  • the defect in the appearance image is a dirt defect, due to its irregular shape and size, and cannot be accurately detected by common methods
  • the defect in the appearance image can be detected by
  • the part is binarized to determine the number of dirty pixels, and the size of the dirty defect is determined by the number of dirty pixels.
  • the preset number threshold can be set according to actual needs. When the number of dirty pixels is greater than the threshold, the target object will be considered to have appearance defects.
  • determining whether there is a defect in the appearance of the target object according to the type of the preset defect includes: when there is a bruise defect in the point, directly determining There is a flaw in the appearance of the target object.
  • the defect in the appearance image is a scratch defect, that is, when the target object is scratched, it can be directly determined that the appearance of the target object is defective.
  • the method before performing the first inspection on the appearance image of the point to determine whether there are preset defects in the appearance of the point, the method further includes: inputting the appearance image into the second detection model, and determining whether the appearance image of the point has a preset defect.
  • the logo (logo) part of the appearance image is intercepted and used as the logo image.
  • the logo image is input into the third detection model to determine whether there is an appearance defective part of the target object in the logo image. If there is an appearance defective part in the logo image, In this case, it is determined that the target object has appearance defects.
  • the second detection model and the first detection model may be the same algorithm model, or they may be different models.
  • the pre-trained model it is determined whether there is a logo part in the appearance image.
  • the logo part of the appearance image is the part of the target object with its logo.
  • the logo image after obtaining the logo image, can be input into a third detection model.
  • the third detection model can be a YOLOv5 algorithm model, which can be based on a defective LOGO image in advance and The corresponding data annotation of the image is trained to Identify whether there are appearance defects in the logo image input to the model.
  • the method further includes: obtaining an appearance image of the logo point of the target object, performing a first detection on the appearance image of the logo point, and determining whether there is a preset defect in the appearance of the logo point. When there is a preset defect in the appearance of the point, it is determined that there is a defect in the appearance of the target object.
  • the points of the target object may include logo points, and the logo points may be points set based on the logo of the target object before acquiring the appearance image of the target object.
  • the appearance image of the logo point is directly obtained, and the logo part is first detected.
  • the specific detection can be to input the logo part into a pre-trained model.
  • the model can be trained in advance based on defective logo images and data annotations corresponding to the images to identify whether there are appearance defects in the logo images input to the model.
  • there is an appearance defective part in the appearance image of the logo point it can be directly determined that the appearance of the target object does not meet the requirements and there is an appearance defect.
  • the model identifies the logo part as a defective part, or ignores the defective part in the logo part, which improves the accuracy of appearance defects. and detection effects.
  • This embodiment provides an electronic device 100, as shown in Figure 2.
  • the electronic device has a processor 101 and a memory 102.
  • the memory 102 stores computer instructions.
  • the computer instructions are executed by the processor, the above-mentioned appearance defect detection is implemented.
  • Each process of the method embodiment can achieve the same technical effect, so to avoid repetition, it will not be described again here.
  • This embodiment provides a computer-readable storage medium, which stores executable commands.
  • the executable commands are executed by a processor, each process of the above embodiment of the method for detecting appearance defects is implemented, and the same can be achieved. To avoid repetition, the technical effects will not be repeated here.
  • Embodiments of the present disclosure may be systems, methods, and/or computer program products.
  • a computer program product may include a computer-readable storage medium having computer-readable program instructions thereon for causing a processor to implement aspects of embodiments of the present disclosure.
  • Computer-readable storage media may be tangible devices that can retain and store instructions for use by an instruction execution device.
  • the computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM) or Flash memory), Static Random Access Memory (SRAM), Compact Disk Read Only Memory (CD-ROM), Digital Versatile Disk (DVD), Memory Stick, Floppy Disk, Mechanical Coding Device, such as a printer with instructions stored on it.
  • RAM random access memory
  • ROM read-only memory
  • EPROM erasable programmable read-only memory
  • Flash memory Static Random Access Memory
  • CD-ROM Compact Disk Read Only Memory
  • DVD Digital Versatile Disk
  • Memory Stick
  • Computer-readable storage media are not to be construed as transient signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or through electrical wires. transmitted electrical signals.
  • Computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to various computing/processing devices, or to an external computer or external storage device over a network, such as the Internet, a local area network, a wide area network, and/or a wireless network.
  • the network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and/or edge servers.
  • Each calculation/ A network adapter card or network interface in the processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage on a computer-readable storage medium in the respective computing/processing device.
  • Computer program instructions for performing operations of embodiments of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or in one or more Source or object code written in any combination of programming languages, including object-oriented programming languages - such as Smalltalk, C++, etc., and conventional procedural programming languages - such as "C" or similar programming languages.
  • the computer-readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server implement.
  • the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as an Internet service provider through the Internet). connect).
  • LAN local area network
  • WAN wide area network
  • an external computer such as an Internet service provider through the Internet. connect
  • an electronic circuit such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA)
  • the electronic circuit can Computer-readable program instructions are executed to implement various aspects of embodiments of the present disclosure.
  • These computer-readable program instructions may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus, thereby producing a machine that, when executed by the processor of the computer or other programmable data processing apparatus, , resulting in an apparatus that implements the functions/actions specified in one or more blocks in the flowchart and/or block diagram.
  • These computer-readable program instructions can also be stored in a computer-readable storage medium. These instructions cause the computer, programmable data processing device and/or other equipment to work in a specific manner. Therefore, the computer-readable medium storing the instructions includes An article of manufacture that includes instructions that implement aspects of the functions/acts specified in one or more blocks of the flowcharts and/or block diagrams.
  • Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other equipment, causing a series of operating steps to be performed on the computer, other programmable data processing apparatus, or other equipment to produce a computer-implemented process , thereby causing instructions executed on a computer, other programmable data processing apparatus, or other equipment to implement the functions/actions specified in one or more blocks in the flowcharts and/or block diagrams.
  • each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions that contains one or more executable functions for implementing the specified logical functions instruction.
  • the functions noted in the block may occur out of the order noted in the figures. For example, two consecutive blocks may actually execute substantially in parallel, or they may sometimes execute in the reverse order, depending on the functionality involved.
  • each block of the block diagram and/or flowchart illustration, and combinations of blocks in the block diagram and/or flowchart illustration can be implemented by special purpose hardware-based systems that perform the specified functions or acts. , or can be implemented using a combination of specialized hardware and computer instructions. It is well known to those skilled in the art that implementation through hardware, implementation through software, and implementation through a combination of software and hardware are all equivalent.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Geometry (AREA)
  • Image Processing (AREA)
  • Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)

Abstract

本公开涉及缺陷检测领域,具体涉及外观缺陷的检测方法、电子设备和存储介质。所述外观缺陷的检测方法,包括:对于目标物的至少一个点位中的每个点位,获取所述点位的外观图像,对所述点位的外观图像进行第一检测,确定所述点位的外观是否存在预设缺陷,在所述点位的外观存在预设缺陷的情况下,根据所述预设缺陷的类型确定所述目标物的外观是否存在缺陷。

Description

外观缺陷的检测方法、电子设备和存储介质 技术领域
本公开涉缺陷检测领域,具体涉及外观缺陷的检测方法、电子设备和存储介质。
背景技术
在精密产品的制造过程中,工艺的不稳定、机械定位精度不够高、以及厂房内的环境因素等经常会导致生产出来的产品具有各种形态的缺陷,这些缺陷不但影响产品外观甚至存在安全隐患,所以缺陷检测一直是工业生产中必不可少的环节。
针对与目前的工业场景,现在采用手段仍是传统的人工目测检测,发现缺陷后,手动剔除不合格产品,这样现有的质量检测状况存在质检工人的视觉疲劳、情绪波动等因素,使得传统方法必然存在质量标准客观性较差,且该检测方法速度慢的问题。
发明内容
本公开实施例提供一种外观缺陷的检测方法、电子设备和存储介质,可以灵活适用于多种应用场景。
第一方面,本申请实施例提供了一种外观缺陷的检测方法,包括:对于目标物的至少一个点位中的每个点位,获取所述点位的外观图像;对所述点位的外观图像进行第一检测,确定所述点位的外观是否存在预设缺陷;在所述点位的外观存在预设缺陷的情况下,根据所述预设缺陷的类型确定所述目标物的外观是否存在缺陷。
可选地,所述点位的外观图像包括所述点位在不同亮度光照条件下的多个外观图像。
可选地,所述对所述点位的外观图像进行第一检测,确定所述点位的 外观是否存在预设缺陷,包括:将所述点位的外观图像输入预先训练好的第一检测模型中,通过所述第一检测模型,确定所述点位的外观是否存在预设缺陷。
可选地,在根据所述预设缺陷的类型确定所述目标物的外观是否存在缺陷之前,所述方法还包括:对所述点位的外观图像进行灰度化处理;计算所述点位的外观图像的图像矩阵的标准差;保留所述标准差大于等于标准差阈值的所述点位的外观图像和/或保留所述标准差最大的所述点位的外观图像。
可选地,所述在所述点位的外观存在预设缺陷的情况下,根据所述预设缺陷的类型确定所述目标物的外观是否存在缺陷,包括:在所述点位存在线状缺陷的情况下,检测所述外观图像中的缺陷部分的对角线长度;在所述对角线长度大于预设长度阈值时,确定所述目标物的外观存在缺陷。
可选地,所述在所述点位的外观存在预设缺陷的情况下,根据所述预设缺陷的类型确定所述目标物的外观是否存在缺陷,包括:在所述点位存在片状缺陷的情况下,检测所述外观图像中的缺陷部分的面积;在所述面积大于预设面积阈值时,确定所述目标物的外观存在缺陷。
可选地,所述在所述点位的外观存在预设缺陷的情况下,根据所述预设缺陷的类型确定所述目标物的外观是否存在缺陷,包括:在所述点位存在脏污缺陷的情况下,检测所述外观图像中的缺陷部分的脏污像素点;在所述外观图像中的脏污像素点的个数大于预设个数阈值的情况下,确定所述目标物的外观存在缺陷。
可选地,所述检测所述外观图像中的缺陷部分的脏污像素点,包括:对所述外观图像的缺陷部分进行灰度化处理;计算所述外观图像的缺陷部分的图像矩阵的标准差;根据所述标准差与预设函数,确定所述外观图像的缺陷部分的第一参数,所述预设函数为所述标准差与所述第一参数的线性函数;根据所述第一参数,对所述外观图像的缺陷部分进行二值化处理,以确定所述外观图像的缺陷部分中的脏污像素点。
可选地,在所述检测所述点位的外观图像中的缺陷部分的脏污像素点之前,所述方法还包括:预先获取多组所述标准差与所述第一参数的对应 关系,作为训练集;初始化拟合函数,并将所述训练集输入梯度下降算法模型中,对所述拟合函数进行迭代,获得预设函数。
可选地,所述在所述点位的外观存在预设缺陷的情况下,根据所述预设缺陷的类型确定所述目标物的外观是否存在缺陷,包括:在所述点位存在磕伤缺陷的情况下,直接确定所述目标物的外观存在缺陷。
可选地,在对所述点位的外观图像进行第一检测,确定所述点位的外观是否存在预设缺陷之前,所述方法还包括:将所述外观图像输入第二检测模型,确定所述外观图像中的logo部分;截取所述外观图像中的logo部分,作为logo图像;将所述logo图像输入第三检测模型,确定所述logo图像中是否存在所述目标物的外观缺陷部分;在所述logo图像中存在所述外观缺陷部分的情况下,确定所述目标物存在外观缺陷。
可选地,所述方法还包括:获取目标物的logo点位的外观图像;对logo点位的外观图像进行第一检测,确定所述logo点位的外观是否存在预设缺陷;在所述logo点位的外观存在预设缺陷的情况下,确定所述目标物的外观存在缺陷。
第二方面,本申请实施例提供了一种电子设备,具有处理器和存储器,所述存储器中存储有计算机指令,所述计算机指令被处理器执行时实现上述第一方面任一项所述的方法的步骤。
第三方面,本申请实施例提供了一种存储介质,其上存储有计算机指令,所述计算机指令被处理器执行时实现上述第一方面任一项所述的方法的步骤。
本公开实施例的一个有益效果在于,可以通过获取目标物的至少一个点位的外观图像,并对外观图像进行检测,确定该点位是否存在预设的缺陷,在该点位存在预设缺陷的情况下,根据缺陷的类型,确定所述目标物的外观是否存在缺陷。在本例中,通过这种方式,可以根据缺陷的类型,自动的、有针对性的、快速的确定目标物的外观是否存在缺陷,提升了检测效率,和检测质量。
通过以下参照附图对本公开的示例性实施例的详细描述,本公开实施例的其它特征及其优点将会变得清楚。
附图说明
被结合在说明书中并构成说明书的一部分的附图示出了本公开的实施例,并且连同其说明一起用于解释本公开实施例的原理。
图1示出了本公开实施例的外观缺陷的检测方法的流程图。
图2示出了本公开实施例的电子设备的框图。
具体实施方式
现在将参照附图来详细描述本公开的各种示例性实施例。应注意到:除非另外具体说明,否则在这些实施例中阐述的部件和步骤的相对布置、数字表达式和数值不限制本发明的范围。
以下对至少一个示例性实施例的描述实际上仅仅是说明性的,决不作为对本发明及其应用或使用的任何限制。
对于相关领域普通技术人员已知的技术、方法和设备可能不作详细讨论,但在适当情况下,所述技术、方法和设备应当被视为说明书的一部分。
在这里示出和讨论的所有例子中,任何具体值应被解释为仅仅是示例性的,而不是作为限制。因此,示例性实施例的其它例子可以具有不同的值。
应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步讨论。
本申请实施例公开了一种外观缺陷的检测方法,如图1所示,该方法包括步骤S11-S13。
步骤S11,对于目标物的至少一个点位中的每个点位,获取点位的外观图像。
在本实施例的一个示例中,目标物可以是任何需要检测外观是否存在缺陷的物品,例如VR眼镜、手机等等。目标物的点位,可以根据目标物的外形进行确定,具体的,为了保证检测效果,在确定目标的点位时,可以尽可能的包含目标物的曲面部分的各个角度。在确定点位后,就可以拍摄目标物的每一个点位的图像,作为该点位的目标图像。
在本实施例的一个示例中,点位的外观图像包括该点位在不同亮度光 照条件下的多个外观图像。
在本实施例的一个示例中,由于不同的外观缺陷,在不同亮度条件下成像效果不同,例如,脏污缺陷在较亮的环境下,成像效果会更好一下,而亮痕缺陷在较暗的环境下,成像效果会好一些,并且由于曲面的原因,一些缺陷如亮痕缺陷的成像效果较差。因此,对于每一个点位,都可以获取不同光照条件下的多个外观图像,例如获取该点位两张外观图像,其中包括一张较亮的该点位外观图像,一张较暗的该点位外观图像。
在本例中,通过获取目标物多个点位的,不同亮度的外观图像,可以解决在目标物曲面的外观缺陷成像问题,获得清晰可进行检测的外观图像,以使得后续通过检测,准确的判断目标物是否存在外观缺陷问题。
步骤S12,对所述点位的外观图像进行第一检测,确定点位的外观是否存在预设缺陷。
在本实施例的一个示例中,预设缺陷可以包括多种类型的缺陷,例如线状缺陷、片状缺陷、磕伤缺陷和脏污缺陷等。具体的,线状缺陷可以包括毛纤和线状亮痕。片状缺陷可以是片状亮痕等。
在本实施例的一个示例中,对点位的外观图像进行第一检测,确定点位的外观是否存在预设缺陷,包括:将点位的外观图像输入预先训练好的第一检测模型中,通过第一检测模型,确定点位的外观是否存在预设缺陷。
在本实施例的一个示例中,第一检测模型为检测模型,具体的,可以是YOLOv5算法模型,该模型可以预先进行训练,以确定点位的外观是否存在预设类型的缺陷。在一个例子中,YOLOv5模型确定外观图像中存在预设类型的缺陷后,可以使用矩形的检测框将缺陷部分的图像框选出来,作为缺陷部分。可以理解的是,本例中所说的缺陷部分,不仅包括缺陷部分的图像,也包括被框选在内的,正常部分的图像。
在本实施例的一个示例中,在该点位的外观存在预设缺陷时,可以从点位的外观图像中截取出缺陷部分的图像,具体的,可以通过YOLOv5模型将其检测框中的外观图像的缺陷部分裁剪出来,以便后续确定目标物的外观是否存在。
在本实施例的一个示例中,在根据预设缺陷的类型确定目标物的外观是否存在缺陷之前,方法还包括:对点位的外观图像进行灰度化处理,计算点位的外观图像的图像矩阵的标准差,保留标准差大于等于标准差阈值的该点位的外观图像和/或保留标准差最大的该点位的外观图像。
在本实施例的一个示例中,由于目标物的表面存在曲面以及不同光照条件下,不同类型的缺陷的成像效果存在差异的原因,目标物某些点位的外观图片可能会存在成像效果较差的图像,因此,可以对外观图像先进行灰度化处理,并计算灰度化图像的图像矩阵的标准差,在该标准差大于等于预设的标准差阈值时,代表外观图像的图像质量越好,图像边缘越清晰,因此,可以保留标准差大于等于标准差阈值的外观图像,将标准差小于标准差阈值的外观图像剔除。在另一个示例中,有可能该点位的所有外观图像的标准差都小于标准差阈值,为了避免出现漏检的情况下,可以保留该点位的多张外观图像中,标准差最大的一个外观图像。
在本例中,通过外观图像进行灰度化,并计算灰度图像的矩阵的标准差,可以有效的剔除成像效果较差的外观图像,避免曲面和光照条件对外观图像产生影响,减少了后续检测外观缺陷的误差,并且,由于会保留该点位的至少一张外观图像,也不会出现漏检的情况。
步骤S13,在点位的外观存在预设缺陷的情况下,根据预设缺陷的类型确定目标物的外观是否存在缺陷。
在本实施例的一个示例中,确定目标物的外观是否存在缺陷,可以是确定该目标物的外观是否满足要求。对于不同的缺陷类型,可能会有不同的缺陷认定标准。以线状缺陷为例,如果线状亮痕的长度小于5mm且宽度小于0.15mm,那么针对于该线状亮痕,就会认为该缺陷在比较微微小,不会确定该目标物存在外观缺陷。
在本实施例的一个示例中,在该点位的外观存在预设缺陷的情况下,根据预设缺陷的类型确定目标物的外观是否存在缺陷,包括:在该点位存在线状缺陷的情况下,检测外观图像中的缺陷部分的对角线长度,在对角线长度大于预设长度阈值时,确定目标物的外观存在缺陷。
在本实施例的一个示例中,如果外观图像中存在的缺陷为线状缺陷,例如毛纤或者线状亮痕时,由于其形状并不规则,测量其长度时不能得到准确的数值,因此可以对外观图像中的线状缺陷的缺陷部分,例如检测框框选的部分,计算其对角线的像素长度,通过该像素长度确定线状缺陷的长度。预设的长度阈值可以根据实际需求设置的,在长度大于该阈值时,就会认为该目标物存在外观缺陷。
在本实施例的一个示例中,在点位的外观存在预设缺陷的情况下,根据预设缺陷的类型确定目标物的外观是否存在缺陷,包括:在点位存在片状缺陷的情况下,检测外观图像中的缺陷部分的面积,在面积大于预设面积阈值时,确定目标物的外观存在缺陷。
在本实施例的一个示例中,如果外观图像中存在的缺陷为片状缺陷,例如片状亮痕时,由于其形状并不规则,测量其大小面积时不能得到准确的数值,因此可以对外观图像中的片状缺陷的缺陷部分,例如检测框框选的部分,计算其的像素面积,通过该像素面积确定片状缺陷的大小。预设的面积阈值可以根据实际需求设置的,在面积大于该阈值时,就会认为该目标物存在外观缺陷。
在本实施例的一个示例中,在该点位的外观存在预设缺陷的情况下,根据预设缺陷的类型确定目标物的外观是否存在缺陷,包括:在点位存在脏污缺陷的情况下,检测外观图像中的缺陷部分的脏污像素点,在脏污像素点的个数大于预设个数阈值时,确定目标物的外观存在缺陷。
在本实施例的一个示例中,检测外观图像中的缺陷部分的脏污像素点,包括:对该点位的外观图像进行灰度化处理,计算点位的外观图像的图像矩阵的标准差,根据标准差与预设函数,确定点位的外观图像的缺陷部分的第一参数,预设函数为标准差与第一参数的线性函数,根据所述第一参数,对所述外观图像的缺陷部分进行二值化处理,以确定所述外观图像的缺陷部分中的脏污像素点。
在本实施例中,如果外观图像中存在脏污缺陷的情况下,可以先对该外观图像进行灰度化处理,并计算处理后的图像矩阵的标准差。通过该标 准差和预设函数,确定该外观图像的第一参数。其中,第一参数是用于区分像素点是否为脏污像素点的参数。
在本实施例的一个示例中,检测外观图像中的缺陷部分的脏污像素点之前,方法还包括:预先获取多组标准差与第一参数的对应关系,作为训练集,初始化拟合函数,并将训练集输入梯度下降算法模型中,对拟合函数进行迭代,获得预设函数。
在本实施例中,可以预先获取m张外观图像的标准差std与第一参数C,将每一张外观图像的标准差与第一参数分别作为一组训练数据(std,C),获得m组训练数据的训练集。
初始化拟合函数hθ(std)=θi0i1×std,初始化参数θi0=θi1=0,初始化学习率α=0.001,初始迭代次数k=0;通过应用梯度下降算法,对所述初始化拟合函数进行迭代。
更新损失函数:并计算偏导数根据该偏导数更新其中θi中包括θi0和θi1两个参数。当迭代次数k满足要求或者函数满足要求时,输出最终的函数:hθ(std)=θk0k1std。作为标准差与所述第一参数的线性函数,即预设函数。
在计算得到灰度化后的外观图像的标准差之后,就可以将该标准差带入预设函数中,获得该外观图像的缺陷部分的第一参数。
在获得第一参数后,可以使用OpenCV中的adaptiveThreshold(二值化)函数对缺陷部分进行二值化。具体的,针对于外观图像的缺陷部分中的每一个像素点,都可以获取该以该像素点为中心的预设区域内所有像素点的灰度值的平均值,即第一平均值。具体的,预设区域可以是以该像素点为核心的取N*N像素的区域。N的具体数值可以根据实际情况灵活设置。
获得该像素点的第一平均值之后,就可以通过第一平均值与第一参数做差,来获得该像素点的阈值。用该像素点的灰度值与阈值进行比对,来确定该像素点的灰度值被设置为0还是255。在一个例子中,可以将灰度值变为255的像素点确定为脏污像素点。
在对缺陷部分进行二值化处理后,就可以获得缺陷部分的脏污像素点的个数。在脏污像素点的个数大于预设个数阈值时,就
在本实施例的一个示例中,如果外观图像中存在的缺陷为脏污缺陷,由于其形状、大小不规则,且通过常用方法不能准确的进行检测,因此,通过,可以对外观图像中的缺陷部分进行二值化处理,确定脏污像素点的个数,通过脏污像素点的个数确定脏污缺陷的大小。预设的个数阈值可以根据实际需求设置的,在脏污像素点的个数大于该阈值时,就会认为该目标物存在外观缺陷。
在本实施例的一个示例中,在点位的外观存在预设缺陷的情况下,根据预设缺陷的类型确定目标物的外观是否存在缺陷,包括:在点位存在磕伤缺陷时,直接确定目标物的外观存在缺陷。
在本实施例的一个示例中,如果外观图像中存在的缺陷为磕伤缺陷,即目标物存在磕伤时,可以直接确定目标物的外观存在缺陷。
在本实施例的一个示例中,在对点位的外观图像进行第一检测,确定点位的外观是否存在预设缺陷之前,方法还包括:将外观图像输入第二检测模型,确定外观图像中的logo(标识)部分,截取外观图像中的logo部分,作为logo图像,将logo图像输入第三检测模型,确定logo图像中是否存在目标物的外观缺陷部分,在logo图像中存在外观缺陷部分的情况下,确定目标物存在外观缺陷。
在本实施例的一个示例中,第二检测模型与第一检测模型可以同一个算法模型,也可以是不同的模型。通过预先训练好的该模型,确定外观图像中是否存在logo部分。外观图像的logo部分就是目标物中带有其标识的部分,在外观图像中存在logo部分时,可以使用矩形的检测框将logo部分的图像框选出来,并截取检测框中的图像作为logo图像。
在本实施例的一个示例中,在获得logo图像后,可以将logo图像输入第三检测模型,具体的,第三检测模型可以是YOLOv5算法模型,该模型可以预先基于带有缺陷的LOGO图像以及该图像的对应的数据标注进行训练,以 识别出输入该模型的logo图像是否存在外观缺陷部分。
在本实施例的一个示例中,在logo图像中存在外观缺陷部分的情况下,就可以直接确定该目标物的外观不满足要求,存在外观缺陷。
在本实施例的一个示例中,方法还包括:获取目标物的logo点位的外观图像,对logo点位的外观图像进行第一检测,确定logo点位的外观是否存在预设缺陷,在logo点位的外观存在预设缺陷的情况下,确定目标物的外观存在缺陷。
在本实施例中,目标物的点位可以包括logo点位,logo点位可以是在获取目标物的外观图像前,基于目标物的logo进行设置的点位。在获取目标物至少一个点位外观图像时,直接对logo点位的外观图像进行获取,并对logo部分,进行第一检测,具体的检测可以是将logo部分输入一个预先训练好的模型中,该模型可以预先基于带有缺陷的logo图像以及该图像对应的数据标注进行训练,以识别出输入该模型的logo图像是否存在外观缺陷部分。在logo点位的外观图像中存在外观缺陷部分的情况下,就可以直接确定该目标物的外观不满足要求,存在外观缺陷。
在本例中,通过这种方式,可以避免对外观图像中的logo部分进行误判,例如模型将logo部分识别为缺陷部分,或者忽略掉logo部分中的缺陷部分,提升了外观缺陷的准确度和检测效果。
本实施例提供了一种电子设备100,如图2所示,该电子设备具有处理器101和存储器102,存储器102中存储有计算机指令,该计算机命令被处理器执行时实现上述外观缺陷的检测方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。
本实施例提供了一种计算机可读存储介质,该存储介质中存储有可执行命令,该可执行命令被处理器执行时实现上述外观缺陷的检测方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。
需要说明的是,本申请中所有获取信号、信息或数据的动作都是在遵照所 在地国家相应的数据保护法规政策的前提下,并获得由相应装置/账户所有者给予授权的情况下进行的。
本公开中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置、设备实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
上述对本公开特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。
本公开的实施例可以是***、方法和/或计算机程序产品。计算机程序产品可以包括计算机可读存储介质,其上载有用于使处理器实现本公开的实施例的各个方面的计算机可读程序指令。
计算机可读存储介质可以是可以保持和存储由指令执行设备使用的指令的有形设备。计算机可读存储介质例如可以是――但不限于――电存储设备、磁存储设备、光存储设备、电磁存储设备、半导体存储设备或者上述的任意合适的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、静态随机存取存储器(SRAM)、便携式压缩盘只读存储器(CD-ROM)、数字多功能盘(DVD)、记忆棒、软盘、机械编码设备、例如其上存储有指令的打孔卡或凹槽内凸起结构、以及上述的任意合适的组合。这里所使用的计算机可读存储介质不被解释为瞬时信号本身,诸如无线电波或者其他自由传播的电磁波、通过波导或其他传输媒介传播的电磁波(例如,通过光纤电缆的光脉冲)、或者通过电线传输的电信号。
这里所描述的计算机可读程序指令可以从计算机可读存储介质下载到各个计算/处理设备,或者通过网络、例如因特网、局域网、广域网和/或无线网下载到外部计算机或外部存储设备。网络可以包括铜传输电缆、光纤传输、无线传输、路由器、防火墙、交换机、网关计算机和/或边缘服务器。每个计算/ 处理设备中的网络适配卡或者网络接口从网络接收计算机可读程序指令,并转发该计算机可读程序指令,以供存储在各个计算/处理设备中的计算机可读存储介质中。
用于执行本公开的实施例操作的计算机程序指令可以是汇编指令、指令集架构(ISA)指令、机器指令、机器相关指令、微代码、固件指令、状态设置数据、或者以一种或多种编程语言的任意组合编写的源代码或目标代码,编程语言包括面向对象的编程语言—诸如Smalltalk、C++等,以及常规的过程式编程语言—诸如“C”语言或类似的编程语言。计算机可读程序指令可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络—包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。在一些实施例中,通过利用计算机可读程序指令的状态信息来个性化定制电子电路,例如可编程逻辑电路、现场可编程门阵列(FPGA)或可编程逻辑阵列(PLA),该电子电路可以执行计算机可读程序指令,从而实现本公开的实施例的各个方面。
这里参照根据本公开的实施例的方法、装置(***)和计算机程序产品的流程图和/或框图描述了本公开的实施例的各个方面。应当理解,流程图和/或框图的每个方框以及流程图和/或框图中各方框的组合,都可以由计算机可读程序指令实现。
这些计算机可读程序指令可以提供给通用计算机、专用计算机或其它可编程数据处理装置的处理器,从而生产出一种机器,使得这些指令在通过计算机或其它可编程数据处理装置的处理器执行时,产生了实现流程图和/或框图中的一个或多个方框中规定的功能/动作的装置。也可以把这些计算机可读程序指令存储在计算机可读存储介质中,这些指令使得计算机、可编程数据处理装置和/或其他设备以特定方式工作,从而,存储有指令的计算机可读介质则包括一个制造品,其包括实现流程图和/或框图中的一个或多个方框中规定的功能/动作的各个方面的指令。
也可以把计算机可读程序指令加载到计算机、其它可编程数据处理装置、或其它设备上,使得在计算机、其它可编程数据处理装置或其它设备上执行一系列操作步骤,以产生计算机实现的过程,从而使得在计算机、其它可编程数据处理装置、或其它设备上执行的指令实现流程图和/或框图中的一个或多个方框中规定的功能/动作。
附图中的流程图和框图显示了根据本公开的多个实施例的***、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或指令的一部分,模块、程序段或指令的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的***来实现,或者可以用专用硬件与计算机指令的组合来实现。对于本领域技术人员来说公知的是,通过硬件方式实现、通过软件方式实现以及通过软件和硬件结合的方式实现都是等价的。
以上已经描述了本公开的各实施例,上述说明是示例性的,并非穷尽性的,并且也不限于所披露的各实施例。在不偏离所说明的各实施例的范围的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。本文中所用术语的选择,旨在最好地解释各实施例的原理、实际应用或对市场中的技术的改进,或者使本技术领域的其它普通技术人员能理解本文披露的各实施例。

Claims (14)

  1. 一种外观缺陷的检测方法,其特征在于,包括:
    对于目标物的至少一个点位中的每个点位,获取所述点位的外观图像;
    对所述点位的外观图像进行第一检测,确定所述点位的外观是否存在预设缺陷;
    在所述点位的外观存在预设缺陷的情况下,根据所述预设缺陷的类型确定所述目标物的外观是否存在缺陷。
  2. 根据权利要求1所述的方法,其特征在于,所述点位的外观图像包括所述点位在不同亮度光照条件下的多个外观图像。
  3. 根据权利要求1所述的方法,其特征在于,所述对所述点位的外观图像进行第一检测,确定所述点位的外观是否存在预设缺陷,包括:
    将所述点位的外观图像输入预先训练好的第一检测模型中,通过所述第一检测模型,确定所述点位的外观是否存在预设缺陷。
  4. 根据权利要求2所述的方法,其特征在于,在根据所述预设缺陷的类型确定所述目标物的外观是否存在缺陷之前,所述方法还包括:
    对所述点位的外观图像进行灰度化处理;
    计算所述点位的外观图像的图像矩阵的标准差;
    保留所述标准差大于等于标准差阈值的所述点位的外观图像和/或保留所述标准差最大的所述点位的外观图像。
  5. 根据权利要求1所述的方法,其特征在于,所述在所述点位的外观存在预设缺陷的情况下,根据所述预设缺陷的类型确定所述目标物的外观是否存在缺陷,包括:
    在所述点位存在线状缺陷的情况下,检测所述外观图像中的缺陷部 分的对角线长度;
    在所述对角线长度大于预设长度阈值时,确定所述目标物的外观存在缺陷。
  6. 根据权利要求1所述的方法,其特征在于,所述在所述点位的外观存在预设缺陷的情况下,根据所述预设缺陷的类型确定所述目标物的外观是否存在缺陷,包括:
    在所述点位存在片状缺陷的情况下,检测所述外观图像中的缺陷部分的面积;
    在所述面积大于预设面积阈值时,确定所述目标物的外观存在缺陷。
  7. 据权利要求1所述的方法,其特征在于,所述在所述点位的外观存在预设缺陷的情况下,根据所述预设缺陷的类型确定所述目标物的外观是否存在缺陷,包括:
    在所述点位存在脏污缺陷的情况下,检测所述外观图像中的缺陷部分的脏污像素点;
    在所述外观图像中的脏污像素点的个数大于预设个数阈值的情况下,确定所述目标物的外观存在缺陷。
  8. 根据所述权利要求7所述的方法,其特征在于,所述检测所述外观图像中的缺陷部分的脏污像素点,包括:
    对所述外观图像的缺陷部分进行灰度化处理;
    计算所述外观图像的缺陷部分的图像矩阵的标准差;
    根据所述标准差与预设函数,确定所述外观图像的缺陷部分的第一参数,所述预设函数为所述标准差与所述第一参数的线性函数;
    根据所述第一参数,对所述外观图像的缺陷部分进行二值化处理,以确定所述外观图像的缺陷部分中的脏污像素点。
  9. 根据权利要求7所述的方法,其特征在于,在所述检测所述点位 的外观图像中的缺陷部分的脏污像素点之前,所述方法还包括:
    预先获取多组所述标准差与所述第一参数的对应关系,作为训练集;
    初始化拟合函数,并将所述训练集输入梯度下降算法模型中,对所述拟合函数进行迭代,获得预设函数。
  10. 根据权利要求1所述的方法,其特征在于,所述在所述点位的外观存在预设缺陷的情况下,根据所述预设缺陷的类型确定所述目标物的外观是否存在缺陷,包括:
    在所述点位存在磕伤缺陷的情况下,直接确定所述目标物的外观存在缺陷。
  11. 根据权利要求1所述的方法,其特征在于,在对所述点位的外观图像进行第一检测,确定所述点位的外观是否存在预设缺陷之前,所述方法还包括:
    将所述外观图像输入第二检测模型,确定所述外观图像中的logo部分;
    截取所述外观图像中的logo部分,作为logo图像;
    将所述logo图像输入第三检测模型,确定所述logo图像中是否存在所述目标物的外观缺陷部分;
    在所述logo图像中存在所述外观缺陷部分的情况下,确定所述目标物存在外观缺陷。
  12. 根据权利要求1所述的方法,其特征在于,所述方法还包括:获取目标物的logo点位的外观图像;
    对logo点位的外观图像进行第一检测,确定所述logo点位的外观是否存在预设缺陷;
    在所述logo点位的外观存在预设缺陷的情况下,确定所述目标物的外观存在缺陷。
  13. 一种电子设备,其特征在于,具有处理器和存储器,所述存储器中存储有计算机指令,所述计算机指令被处理器执行时实现权利要求1-12任一项所述的方法的步骤。
  14. 一种存储介质,其特征在于,其上存储有计算机指令,所述计算机指令被处理器执行时实现权利要求1-12任一项所述的方法的步骤。
PCT/CN2023/109564 2022-08-29 2023-07-27 外观缺陷的检测方法、电子设备和存储介质 WO2024045963A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211043508.0 2022-08-29
CN202211043508.0A CN115456969A (zh) 2022-08-29 2022-08-29 外观缺陷的检测方法、电子设备和存储介质

Publications (1)

Publication Number Publication Date
WO2024045963A1 true WO2024045963A1 (zh) 2024-03-07

Family

ID=84301262

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/109564 WO2024045963A1 (zh) 2022-08-29 2023-07-27 外观缺陷的检测方法、电子设备和存储介质

Country Status (2)

Country Link
CN (1) CN115456969A (zh)
WO (1) WO2024045963A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115456969A (zh) * 2022-08-29 2022-12-09 歌尔股份有限公司 外观缺陷的检测方法、电子设备和存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109544506A (zh) * 2018-10-17 2019-03-29 潍坊路加精工有限公司 工件外观缺陷的检测方法及装置
CN110018166A (zh) * 2019-03-19 2019-07-16 深圳市派科斯科技有限公司 一种用于产品外观缺陷检测的设备和方法
CN110415214A (zh) * 2019-06-26 2019-11-05 北京迈格威科技有限公司 摄像头模组的外观检测方法、装置、电子设备及存储介质
WO2021079727A1 (ja) * 2019-10-23 2021-04-29 日本電気株式会社 外観検査装置、外観検査方法および外観検査プログラム
CN115456969A (zh) * 2022-08-29 2022-12-09 歌尔股份有限公司 外观缺陷的检测方法、电子设备和存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109544506A (zh) * 2018-10-17 2019-03-29 潍坊路加精工有限公司 工件外观缺陷的检测方法及装置
CN110018166A (zh) * 2019-03-19 2019-07-16 深圳市派科斯科技有限公司 一种用于产品外观缺陷检测的设备和方法
CN110415214A (zh) * 2019-06-26 2019-11-05 北京迈格威科技有限公司 摄像头模组的外观检测方法、装置、电子设备及存储介质
WO2021079727A1 (ja) * 2019-10-23 2021-04-29 日本電気株式会社 外観検査装置、外観検査方法および外観検査プログラム
CN115456969A (zh) * 2022-08-29 2022-12-09 歌尔股份有限公司 外观缺陷的检测方法、电子设备和存储介质

Also Published As

Publication number Publication date
CN115456969A (zh) 2022-12-09

Similar Documents

Publication Publication Date Title
CN111986178B (zh) 产品缺陷检测方法、装置、电子设备和存储介质
JP2022103040A (ja) 画像欠陥検出方法、装置、電子機器、記憶媒体および製品
CN111833303B (zh) 产品的检测方法、装置、电子设备及存储介质
CN110148130B (zh) 用于检测零件缺陷的方法和装置
CN111833306B (zh) 缺陷检测方法和用于缺陷检测的模型训练方法
WO2024045963A1 (zh) 外观缺陷的检测方法、电子设备和存储介质
US8542912B2 (en) Determining the uniqueness of a model for machine vision
CN115641332B (zh) 产品边缘外观缺陷的检测方法及装置、介质、设备
CN111428373A (zh) 产品装配质量检测方法、装置、设备及存储介质
CN110458791B (zh) 质量缺陷检测方法和检测设备
TWI683262B (zh) 工業影像檢測方法、系統與電腦可讀取記錄媒體
WO2021046726A1 (zh) 用于检测机械设备零部件的方法和装置
Tao et al. Rolling surface defect inspection for drum-shaped rollers based on deep learning
CN114419035B (zh) 产品识别方法、模型训练方法、装置和电子设备
CN115597494B (zh) 一种基于点云的预制构件预留孔的精度检测方法、***
CN111179250A (zh) 一种基于多任务学习的工业品缺陷检测***
TW202127372A (zh) 瑕疵等級判定的方法及存儲介質
CN110738644A (zh) 一种基于深度学习的汽车涂装表面缺陷检测方法及***
US8542905B2 (en) Determining the uniqueness of a model for machine vision
CN117392042A (zh) 缺陷检测方法、缺陷检测设备及存储介质
CN114565552A (zh) 光学元件表面缺陷的检测方法、装置及电子设备
CN110930383A (zh) 基于深度学习语义分割和图像分类的注射器缺陷检测方法
WO2024103828A1 (zh) 灰尘检测方法和装置、存储介质
CN112883762A (zh) 一种活体检测方法、装置、***及存储介质
CN115100110A (zh) 一种偏光镜片缺陷检测方法、装置、设备及可读存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23858998

Country of ref document: EP

Kind code of ref document: A1