[go: up one dir, main page]

CN114581415A - Method and device for detecting defects of PCB, computer equipment and storage medium - Google Patents

Method and device for detecting defects of PCB, computer equipment and storage medium Download PDF

Info

Publication number
CN114581415A
CN114581415A CN202210219122.4A CN202210219122A CN114581415A CN 114581415 A CN114581415 A CN 114581415A CN 202210219122 A CN202210219122 A CN 202210219122A CN 114581415 A CN114581415 A CN 114581415A
Authority
CN
China
Prior art keywords
defect
target
picture
pcb
actual size
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.)
Pending
Application number
CN202210219122.4A
Other languages
Chinese (zh)
Inventor
不公告发明人
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Shuzhilian Technology Co Ltd
Original Assignee
Chengdu Shuzhilian Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Shuzhilian Technology Co Ltd filed Critical Chengdu Shuzhilian Technology Co Ltd
Priority to CN202210219122.4A priority Critical patent/CN114581415A/en
Publication of CN114581415A publication Critical patent/CN114581415A/en
Pending legal-status Critical Current

Links

Images

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
    • G06T7/0006Industrial image inspection using a design-rule based approach
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/95Investigating the presence of flaws or contamination characterised by the material or shape of the object to be examined
    • G01N21/956Inspecting patterns on the surface of objects
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/95Investigating the presence of flaws or contamination characterised by the material or shape of the object to be examined
    • G01N21/956Inspecting patterns on the surface of objects
    • G01N21/95607Inspecting patterns on the surface of objects using a comparative method
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/95Investigating the presence of flaws or contamination characterised by the material or shape of the object to be examined
    • G01N21/956Inspecting patterns on the surface of objects
    • G01N21/95607Inspecting patterns on the surface of objects using a comparative method
    • G01N2021/95615Inspecting patterns on the surface of objects using a comparative method with stored comparision signal
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/95Investigating the presence of flaws or contamination characterised by the material or shape of the object to be examined
    • G01N21/956Inspecting patterns on the surface of objects
    • G01N2021/95638Inspecting patterns on the surface of objects for PCB's
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]
    • 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/30108Industrial image inspection
    • G06T2207/30148Semiconductor; IC; Wafer
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Theoretical Computer Science (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Chemical & Material Sciences (AREA)
  • Analytical Chemistry (AREA)
  • Biochemistry (AREA)
  • General Health & Medical Sciences (AREA)
  • Immunology (AREA)
  • Pathology (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)

Abstract

The application provides a method and a device for detecting PCB defects, computer equipment and a storage medium, and relates to the technical field of image processing. The method includes the steps of detecting an original picture through a defect detection model to obtain pixel characteristics of a target defect frame corresponding to estimated defects in the picture, intercepting the target picture containing the target defect frame, extracting an edge contour of the target defect frame and calculating the actual size of the edge contour, judging whether the actual size of the edge contour is larger than or equal to a preset defect standard value or not, judging that PCB defects exist in the original picture if the actual size is larger than or equal to the defect standard value, and judging that PCB defects do not exist in the original picture if the actual size is smaller than the defect standard value. The invention can realize accurate positioning and quantitative evaluation of the PCB defects and improve the accuracy and the automation degree of PCB detection.

Description

Method and device for detecting defects of PCB, computer equipment and storage medium
Technical Field
The present application relates to the field of image processing technologies, and in particular, to a method and an apparatus for detecting a PCB defect, a computer device, and a storage medium.
Background
The Printed Circuit Board (PCB) manufacturing process flow is composed of a plurality of segments, and various product defects, such as free copper defects, are easily introduced in a complicated and tedious manufacturing process. The influence degrees of the defects on the product are different, and the manufacturer can also classify the defects into qualified and unqualified categories according to the defect type, the defect size, the defect proportion and other information when evaluating the defects, so that the yield of a production line is improved while the fact that the finished products have no major defects is ensured, and therefore accurate classification and quantitative evaluation of the defects on the printed circuit board are necessary. Aiming at the detection of the defects in the PCB industry, the traditional scheme adopts a visual inspection mode of personnel for judgment, so that the method has great subjectivity, easily causes defect over-inspection and defect omission, and cannot ensure the detection quality.
Disclosure of Invention
In order to solve the above technical problem, embodiments of the present application provide a method and an apparatus for detecting a PCB defect, a computer device, and a storage medium.
In a first aspect, an embodiment of the present application provides a method for detecting a PCB defect, where the method includes:
detecting an original picture to be detected through a defect detection model to obtain pixel characteristics of a target defect frame corresponding to the estimated defects in the original picture;
intercepting a target picture containing the target defect frame from the original picture according to the pixel characteristics of the target defect frame;
extracting an edge contour corresponding to the target defect frame in the target picture, and calculating the actual size of the edge contour;
judging whether the actual size of the edge profile is larger than or equal to a preset defect standard value or not;
if the actual size of the edge contour is larger than or equal to a preset defect standard value, judging that the original picture has PCB defects;
and if the actual size of the edge profile is smaller than a preset defect standard value, judging that the original picture has no PCB defect.
According to one embodiment of the present disclosure, the step of calculating the actual size of the edge profile includes:
determining a minimum bounding rectangle of the edge outline of the target defect frame;
calculating the actual width and the actual height of the edge contour according to the pixel width and the pixel height of the minimum circumscribed rectangle of the edge contour;
taking the maximum value of the actual width and the actual height as the actual size of the edge profile.
According to a specific embodiment of the present disclosure, the step of calculating the actual height and the actual width of the edge profile according to the pixel height and the pixel width of the minimum bounding rectangle of the edge profile includes:
counting the picture pixel quantity corresponding to the original picture and the actual size corresponding to the original picture;
calculating the proportional relation between the pixel unit and the actual size according to the picture pixel quantity corresponding to the original picture and the actual size corresponding to the original picture;
taking the product of the pixel width and the proportional relationship as the actual width of the edge profile, and taking the product of the pixel height and the proportional relationship as the actual height of the edge profile.
According to a specific embodiment disclosed in the present application, the pixel characteristics of the target defect frame include the coordinate data of the first vertex angle and the coordinate data of the second vertex angle of the target defect frame, and the first vertex angle and the second vertex angle enclose the pixel characteristics of all the pixels within the synthetic rectangular range, wherein the first vertex angle and the second vertex angle are two mutually non-adjacent vertex angles of the rectangular target defect frame.
According to a specific embodiment disclosed in the present application, before the step of detecting an original picture to be detected by a defect detection model to obtain pixel characteristics of a target defect frame corresponding to an estimated defect in the original picture, the method further includes:
collecting a first type sample picture containing PCB defects and a second type sample picture not containing PCB defects;
inputting the first type sample picture containing the PCB defect and the second type sample picture not containing the PCB defect into a neural network and training by adopting a Faster RCNN algorithm to obtain the defect detection model.
According to a specific embodiment disclosed in the present application, the step of extracting the edge contour corresponding to the target defect frame in the target picture includes:
carrying out graying and binarization processing on the target picture;
and sequentially connecting the pixels with the gray values larger than or equal to the gray threshold value to form the edge outline of the target defect frame.
In a second aspect, an embodiment of the present application provides an apparatus for detecting a PCB defect, where the apparatus includes:
the detection module is used for detecting an original picture to be detected through a defect detection model to obtain pixel characteristics of a target defect frame corresponding to the estimated defects in the original picture;
the intercepting module is used for intercepting a target picture containing the target defect frame from the original picture according to the pixel characteristics of the target defect frame;
the extraction module is used for extracting the edge contour corresponding to the target defect frame in the target picture and calculating the actual size of the edge contour;
the judging module is used for judging whether the actual size of the edge contour is larger than or equal to a preset defect standard value or not;
if the actual size of the edge contour is larger than or equal to a preset defect standard value, judging that the original picture has PCB defects;
and if the actual size of the edge profile is smaller than a preset defect standard value, judging that the original picture has no PCB defect.
According to a specific embodiment disclosed in the present application, the extraction module is specifically configured to:
extracting an edge contour corresponding to the target defect frame in the target picture, and calculating the edge contour;
carrying out graying and binarization processing on the target picture;
and sequentially connecting the pixels with the grayness being larger than or equal to the grayscale threshold value to form the edge contour of the target defect frame.
In a third aspect, an embodiment of the present application provides a computer device, which includes a memory and a processor, where the memory is used to store a computer program, and when the processor runs, the computer program performs the method for detecting a PCB defect provided in any one of the embodiments of the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium, which stores a computer program, and when the computer program runs on a processor, the computer program performs the method for detecting a PCB defect provided in any one of the embodiments of the first aspect.
Compared with the prior art, the method has the following beneficial effects:
the method includes the steps of detecting an original picture through a defect detection model to obtain pixel characteristics of a target defect frame corresponding to a predicted defect in the original picture, intercepting the target picture containing the target defect frame according to the pixel characteristics, extracting an edge contour of the target defect frame in the target picture, calculating the actual size of the edge contour, judging whether the actual size of the edge contour is larger than or equal to a preset defect standard value or not, judging that the original picture has PCB defects if the actual size is larger than or equal to the defect standard value, and judging that the original picture does not have PCB defects if the actual size is smaller than the defect standard value. The method and the device can realize accurate positioning and quantitative evaluation of the PCB defects and improve the accuracy and the automation degree of PCB detection.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings required to be used in the embodiments will be briefly described below, and it should be understood that the following drawings only illustrate some embodiments of the present invention, and therefore should not be considered as limiting the scope of the present invention. Like components are numbered similarly in the various figures.
Fig. 1 is a schematic flowchart of a method for detecting a PCB defect according to an embodiment of the present disclosure;
fig. 2 is a flowchart illustrating an embodiment of a method for detecting a PCB defect according to an embodiment of the present disclosure;
fig. 3 is a second flowchart of an embodiment of a method for detecting a PCB defect provided in the present application;
fig. 4 is a block diagram of a device for detecting a PCB defect according to an embodiment of the present disclosure.
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.
The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
Hereinafter, the terms "including", "having", and their derivatives, which may be used in various embodiments of the present invention, are only intended to indicate specific features, numbers, steps, operations, elements, components, or combinations of the foregoing, and should not be construed as first excluding the existence of, or adding to, one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing.
Furthermore, the terms "first," "second," "third," and the like are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which various embodiments of the present invention belong. The terms (such as those defined in commonly used dictionaries) should be interpreted as having a meaning that is consistent with their contextual meaning in the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein in various embodiments of the present invention.
Some embodiments of the present application will be described in detail below with reference to the accompanying drawings. The embodiments described below and the features of the embodiments can be combined with each other without conflict.
Referring to fig. 1, fig. 1 is a schematic flowchart of a method for detecting a PCB defect according to an embodiment of the present application. As shown in fig. 1, the method includes:
step S101, an original picture to be detected is detected through a defect detection model, and pixel characteristics of a target defect frame corresponding to the estimated defects in the original picture are obtained.
In specific implementation, various product defects such as free copper defects, gaps, rough wires and the like are easily generated in the production process of the PCB due to excessive, complicated and tedious process flows, and the defects may affect the normal use of the printed circuit board, and the defects possibly existing in the printed circuit board need to be detected before the printed circuit board is shipped, and are defined as PCB defects. During specific implementation, for a printed circuit board production line, quick and accurate positioning of defects and quantitative evaluation of the defects are particularly important, positioning and quantitative evaluation of the target defects can be achieved through deep learning target detection and image processing technology, loss caused by missing detection and missing detection is avoided, detection quality and speed are improved, and production efficiency of the production line is improved.
The embodiment provides a method for detecting defects of a PCB (printed circuit board) by combining deep learning with image processing, namely, for the PCB to be detected, pictures of surface electrical components and the like corresponding to the PCB to be detected are collected, the collected pictures are utilized to detect the defects, and the pictures to be detected can be defined as original pictures. The obtaining approach of the original picture may include directly shooting and collecting the to-be-detected circuit board or obtaining a picture of the to-be-detected circuit board sent by another terminal from a network.
Specifically, a neural network with target detection and positioning functions is trained in advance and defined as a defect detection model, and the acquired original picture is input into the neural network model, so that the pixel characteristics of a target defect frame corresponding to the estimated defect can be obtained. The estimated defects are defects which may exist on the printed circuit board estimated by a user, and the target defect frame is a limiting frame generated by a defect detection model for carrying out target detection positioning on the estimated defects.
Specifically, as shown in fig. 2, one of the implementation processes of the method for detecting a PCB defect provided in the embodiment of the present application is shown, wherein the pixel region of the estimated defect in the original picture may be shown as a in fig. 2. Inputting the original picture containing the estimated defect into a defect detection model trained in advance, detecting the estimated defect by the defect detection model, and performing frame selection to obtain a defect frame containing the estimated defect, as shown in fig. 2B. In particular, the target defect frame may be defined as a rectangle that includes all pixel regions that may correspond to the estimated defects.
Before the defect detection provided by the embodiment is specifically performed, a training scheme of a defect detection model can be added. Specifically, before the step of detecting the original picture to be detected through the defect detection model to obtain the pixel characteristics of the target defect frame corresponding to the estimated defect in the original picture, the method may further include:
collecting a first type sample picture containing PCB defects and a second type sample picture not containing PCB defects;
inputting the first type sample picture containing the PCB defect and the second type sample picture not containing the PCB defect into a neural network and training by adopting a Faster RCNN algorithm to obtain the defect detection model.
The method adopts a deep learning method, trains a circuit board defect data set by using a fast RCNN algorithm to obtain a defect detection model, so that the defect detection model can identify a target defect on a newly input original picture and give pixel characteristics of a defect frame of the target defect, and the detection speed of the defect detection model can be greatly improved by adopting the fast RCNN algorithm. In a specific training process, the used samples comprise a first type sample picture and a second type sample picture, the first type sample picture is a picture containing PCB defects, and the second type sample picture is a sample picture not containing PCB defects. The first type sample picture can be obtained by actually acquiring an actual picture of the printed circuit board containing the PCB defect in the historical detection process, and the second type sample picture can be obtained by performing defect elimination or coverage treatment on a pixel area corresponding to the PCB defect in the first type sample picture. Of course, the other way around may be also used, that is, the second type sample picture without the PCB defect is obtained first, and then the pixel characteristics for drawing the PCB defect are added to the second type sample picture to obtain the first type sample picture, etc., without limitation. It should be noted that, in order to train the framing function of the defect detection model, all the pixel regions in the first type sample picture are labeled and framed. Therefore, by summarizing and summarizing the characteristics of the two types of sample pictures, the defect detection model with the functions of defect detection and frame selection can be trained.
And step S102, intercepting a target picture containing the target defect frame from the original picture according to the pixel characteristics of the target defect frame.
In specific implementation, after the pixel characteristics of the target defect frame are obtained, the target defect can be identified, and the picture only containing the target defect frame is intercepted, so that the defect identification of the pixel characteristics of the target defect frame area is conveniently carried out in a subsequent centralized manner, and unnecessary calculation steps are reduced. For the sake of distinction, a cut picture containing only the target defect frame may be defined as a target picture.
The pixel characteristics of the target defect frame comprise coordinate data of a first vertex angle and coordinate data of a second vertex angle of the target defect frame, and pixel characteristics of all pixel points in a rectangular range enclosed by the first vertex angle and the second vertex angle, wherein the first vertex angle and the second vertex angle are two mutually non-adjacent vertex angles of the rectangular target defect frame.
Specifically, according to the first and second vertex angles of the target defect frameIs/are as followsThe coordinate data can be positioned to the position of the target defect frame and a rectangular picture containing the target defect frame is intercepted.
Step S103, extracting an edge contour corresponding to the target defect frame in the target picture, and calculating the actual size of the edge contour.
In specific implementation, the edge contour of the target defect frame can be obtained after the image processing is carried out on the target picture, and the actual size of the edge contour is calculated. The edge contour of the target defect frame is the contour shape occupied by the pixel region of the estimated defect, and the actual size of the edge contour is correspondingly changed according to the type of the defect. For example, the defects include gaps, wire roughness, free copper defects, and the like, and the corresponding actual dimensions also include the length of the edge line, the maximum inner diameter, the maximum diagonal length and width of the circumscribed rectangle or inscribed rectangle, the length or width of the rectangular frame, and the like. When the defect standard value is preset, the same kind of value as the actual size is selected, for example, the values are all edge line lengths or all height and width values.
Preferably, the edge contour of the target defect frame is generally an irregular shape, and in order to determine whether the edge contour meets the production standard, the minimum bounding rectangle of the edge contour is determined to calculate the actual size of the edge contour, and the maximum value of the actual width and the actual height of the minimum bounding rectangle is defined as the actual size of the edge contour. Whether the edge contour is qualified or not can be judged by comparing the actual size of the edge contour with a preset defect standard value.
The step of calculating the actual dimensions of the edge profile comprises:
determining a minimum bounding rectangle of the edge outline of the target defect frame;
calculating the actual width and the actual height of the edge contour according to the pixel width and the pixel height of the minimum circumscribed rectangle of the edge contour;
taking the maximum value of the actual width and the actual height as the actual size of the edge profile.
In specific implementation, referring to fig. 3, fig. 3 is a second specific implementation flowchart of the method for detecting a PCB defect provided in the embodiment of the present application, after performing binarization processing on a target picture by using an OPENCV tool library, automatically calculating to obtain an in-picture pixel value of 255, that is, a white area, and sequentially connecting pixel points to obtain an edge profile of a target defect frame. And obtaining the minimum circumscribed rectangle of the edge outline of the target defect frame after the calculation is finished, and then extracting the size to obtain the defect pixel level width and height. Calculating to obtain the actual width and the actual height of the edge contour, and defining the maximum value of the actual width and the actual height as the actual size of the edge contour.
Calculating the actual height and the actual width of the edge profile according to the pixel height and the pixel width of the minimum bounding rectangle of the edge profile, wherein the step comprises the following steps:
counting the picture pixel quantity corresponding to the original picture and the actual size corresponding to the original picture;
calculating the proportional relation between the pixel unit and the actual size according to the picture pixel quantity corresponding to the original picture and the actual size corresponding to the original picture;
taking the product of the pixel width and the proportional relationship as the actual width of the edge profile, and taking the product of the pixel height and the proportional relationship as the actual height of the edge profile.
During specific implementation, the focal length is set when an original picture is shot, the real size of the visual field coverage area of a real object during shooting is read, and the proportional relation between the pixel unit and the actual size in the original picture can be calculated according to the picture pixel quantity corresponding to the shooting coverage area of the original picture. For example, an original picture has a size of 800 × 800 pixels, and the actual size of the coverage area of the visual field of the real object during shooting is 8 × 8mil, then the ratio of the pixel units in the original picture to the actual size is 1: 0.01. and multiplying the obtained pixel width of the minimum circumscribed rectangle of the edge profile of the target defect frame in the target picture by the proportional relation to obtain the actual width of the edge profile, and multiplying the pixel height of the minimum circumscribed rectangle of the edge profile of the target defect frame in the target picture by the proportional relation to obtain the actual height of the edge profile.
The step of extracting the edge contour corresponding to the target defect frame in the target picture comprises the following steps:
carrying out graying and binarization processing on the target picture;
and sequentially connecting the pixel points of which the gray values are greater than or equal to the gray threshold value to form the edge outline of the target defect frame.
In the image processing, the true color is represented by three RGB components (R: Red, G: Green, B: Blue), that is, three primary colors of Red, Green, and Blue, and the value ranges of the R component, G component, and B component are all 0 to 255, and the graying is to make each pixel in the pixel matrix satisfy R, G, and B, and the value at this time is a gray value. Binarization is to make the gray value of each pixel in the pixel matrix of the image be 0 or 255, the range of the gray value in the grayed image is 0-255, and the range of the gray value in the binarized image is 0 or 255.
Step S104, judging whether the actual size of the edge contour is larger than or equal to a preset defect standard value.
In specific implementation, the standard set for the defect standard value comprises: the setting is performed according to the collected training data, the setting is performed according to the experience data of manual verification and the like, or the setting is performed according to the acceptable standard allowed in the industry. The maximum size of the edge profile can represent the actual size of the edge profile, and whether the edge profile is within the acceptable standard can be judged by comparing the actual size of the edge profile with a preset defect standard value, so that the evaluation of the PCB can be completed, and whether the PCB is a qualified product can be judged.
Step S105, if the actual size of the edge contour is larger than or equal to a preset defect standard value, determining that the original picture has PCB defects.
And S106, if the actual size of the edge contour is smaller than a preset defect standard value, judging that the original picture has no PCB defect.
According to the PCB defect detection method provided by the application, the edge contour of the target defect frame in the target picture is extracted through the defect detection model, the actual size of the edge contour is calculated, and whether the actual size of the edge contour is larger than or equal to a preset defect standard value or not is judged to judge whether the PCB defect exists in the original picture or not. The PCB defect accurate and rapid positioning and accurate quantitative evaluation are realized through the deep learning target detection technology and the image processing technology, the working efficiency of a production line is improved, and the detection quality is ensured.
On the basis of the above embodiment, considering that the free copper defect is the most concerned type of defect among the PCB defects, the defect detection process of the free copper defect will be specifically described below.
The method comprises the steps of collecting an original picture corresponding to a printed circuit board possibly containing free copper defects, detecting the original picture to be detected through a defect detection model to obtain pixel characteristics of a target defect frame corresponding to the free copper defects in the original picture, intercepting the target picture containing the target defect frame from the original picture according to the pixel characteristics of the target defect frame, extracting an edge contour corresponding to the target defect frame in the target picture, calculating the actual size of the edge contour, judging whether the actual size of the edge contour is larger than or equal to a preset defect standard value, judging that the free copper defects exist in the original picture if the actual size of the edge contour is larger than or equal to the preset defect standard value, and judging that the free copper defects do not exist in the original picture if the actual size of the edge contour is smaller than the preset defect standard value.
Corresponding to the above method embodiment, referring to fig. 4, the present application further provides a PCB defect detecting apparatus 400, where the PCB defect detecting apparatus 400 includes:
the detection module 401 is configured to detect an original picture to be detected through a defect detection model, and obtain pixel characteristics of a target defect frame corresponding to an estimated defect in the original picture;
an intercepting module 402, configured to intercept, from the original picture, a target picture including the target defect frame according to a pixel feature of the target defect frame;
an extracting module 403, configured to extract an edge contour of the target image corresponding to the target defect frame, and calculate an actual size of the edge contour;
a determining module 404, configured to determine whether an actual size of the edge profile is greater than or equal to a preset defect standard value;
if the actual size of the edge contour is larger than or equal to a preset defect standard value, judging that the original picture has PCB defects;
and if the actual size of the edge profile is smaller than a preset defect standard value, judging that the original picture has no PCB defect.
Specifically, the extracting module 403 is specifically configured to:
carrying out graying and binarization processing on the target picture;
sequentially connecting the pixels with the gray values larger than or equal to a gray threshold value to form an edge contour of the target defect frame;
determining a minimum bounding rectangle of the edge outline of the target defect frame;
calculating the actual width and the actual height of the edge contour according to the pixel width and the pixel height of the minimum circumscribed rectangle of the edge contour;
taking the maximum value of the actual width and the actual height as the actual size of the edge profile;
counting the picture pixel quantity corresponding to the original picture and the actual size corresponding to the original picture;
calculating the proportional relation between the pixel unit and the actual size according to the picture pixel quantity corresponding to the original picture and the actual size corresponding to the original picture;
taking the product of the pixel width and the proportional relationship as the actual width of the edge profile, and taking the product of the pixel height and the proportional relationship as the actual height of the edge profile.
In addition, an embodiment of the present application further provides a computer device, which includes a processor and a memory, where the memory stores a computer program, and the computer program, when executed on the processor, implements the method for detecting a PCB defect in the foregoing embodiments.
In addition, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed on a processor, the method for detecting a PCB defect in the foregoing embodiments is implemented.
According to the PCB defect detection device, the computer equipment and the storage medium, the edge outline of the target defect frame in the target picture is extracted through the defect detection model, the actual size of the edge outline is calculated, and whether the actual size of the edge outline is larger than or equal to a preset defect standard value or not is judged to judge whether the PCB defect exists in the original picture or not. The PCB defect accurate and rapid positioning and accurate quantitative evaluation are realized through the deep learning target detection technology and the image processing technology, the working efficiency of a production line is improved, and the detection quality is ensured.
The specific implementation processes of the apparatus for detecting a PCB defect, the computer device, and the storage medium provided in the present application may refer to the specific implementation processes of the method for detecting a PCB defect provided in the foregoing embodiments, and are not described in detail herein.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, each functional module or unit in each embodiment of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a smart phone, a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application.

Claims (10)

1. A method for detecting defects of a PCB, the method comprising:
detecting an original picture to be detected through a defect detection model to obtain pixel characteristics of a target defect frame corresponding to the estimated defects in the original picture;
intercepting a target picture containing the target defect frame from the original picture according to the pixel characteristics of the target defect frame;
extracting an edge contour corresponding to the target defect frame in the target picture, and calculating the actual size of the edge contour;
judging whether the actual size of the edge profile is larger than or equal to a preset defect standard value or not;
if the actual size of the edge contour is larger than or equal to a preset defect standard value, judging that the original picture has PCB defects;
and if the actual size of the edge profile is smaller than a preset defect standard value, judging that the original picture has no PCB defect.
2. The method of claim 1, wherein the step of calculating the actual size of the edge profile comprises:
determining a minimum bounding rectangle of the edge outline of the target defect frame;
calculating the actual width and the actual height of the edge contour according to the pixel width and the pixel height of the minimum circumscribed rectangle of the edge contour;
taking the maximum value of the actual width and the actual height as the actual size of the edge profile.
3. The method of claim 2, wherein the step of calculating the actual height and actual width of the edge profile based on the pixel height and pixel width of the minimum bounding rectangle of the edge profile comprises:
counting the picture pixel quantity corresponding to the original picture and the actual size corresponding to the original picture;
calculating the proportional relation between the pixel unit and the actual size according to the picture pixel amount corresponding to the original picture and the actual size corresponding to the original picture;
taking the product of the pixel width and the proportional relationship as the actual width of the edge profile, and taking the product of the pixel height and the proportional relationship as the actual height of the edge profile.
4. The method of claim 1, wherein the pixel characteristics of the target defect frame comprise coordinate data of a first vertex and coordinate data of a second vertex of the target defect frame, and pixel characteristics of all pixels in a rectangular range enclosed by the first vertex and the second vertex, wherein the first vertex and the second vertex are two mutually non-adjacent vertices of the rectangular target defect frame.
5. The method according to claim 1, wherein before the step of detecting the original picture to be detected by the defect detection model to obtain the pixel characteristics of the target defect frame corresponding to the estimated defect in the original picture, the method further comprises:
collecting a first type sample picture containing PCB defects and a second type sample picture not containing PCB defects;
inputting the first type sample picture containing the PCB defect and the second type sample picture not containing the PCB defect into a neural network and training by adopting a Faster RCNN algorithm to obtain the defect detection model.
6. The method according to claim 1, wherein the step of extracting the edge contour of the target picture corresponding to the target defect frame comprises:
carrying out graying and binarization processing on the target picture;
and sequentially connecting the pixels with the gray values larger than or equal to the gray threshold value to form the edge outline of the target defect frame.
7. An apparatus for detecting defects in a PCB, the apparatus comprising:
the detection module is used for detecting an original picture to be detected through a defect detection model to obtain pixel characteristics of a target defect frame corresponding to the estimated defects in the original picture;
the intercepting module is used for intercepting a target picture containing the target defect frame from the original picture according to the pixel characteristics of the target defect frame;
the extraction module is used for extracting the edge contour corresponding to the target defect frame in the target picture and calculating the actual size of the edge contour;
the judging module is used for judging whether the actual size of the edge contour is larger than or equal to a preset defect standard value or not;
if the actual size of the edge contour is larger than or equal to a preset defect standard value, judging that the original picture has PCB defects;
and if the actual size of the edge profile is smaller than a preset defect standard value, judging that the original picture has no PCB defect.
8. The apparatus of claim 7, wherein the extraction module is specifically configured to:
extracting an edge contour corresponding to the target defect frame in the target picture, and calculating the edge contour;
carrying out graying and binarization processing on the target picture;
and sequentially connecting the pixels with the grayness being larger than or equal to the grayscale threshold value to form the edge contour of the target defect frame.
9. A computer device, characterized in that it comprises a processor and a memory, said memory storing a computer program which, when executed on said processor, implements the method of detection of PCB defects of any of claims 1 to 6.
10. A computer storage medium, characterized in that it stores a computer program which, when executed on a processor, implements the method of detection of PCB defects of any of claims 1 to 6.
CN202210219122.4A 2022-03-08 2022-03-08 Method and device for detecting defects of PCB, computer equipment and storage medium Pending CN114581415A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210219122.4A CN114581415A (en) 2022-03-08 2022-03-08 Method and device for detecting defects of PCB, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210219122.4A CN114581415A (en) 2022-03-08 2022-03-08 Method and device for detecting defects of PCB, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114581415A true CN114581415A (en) 2022-06-03

Family

ID=81778133

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210219122.4A Pending CN114581415A (en) 2022-03-08 2022-03-08 Method and device for detecting defects of PCB, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114581415A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114782436A (en) * 2022-06-20 2022-07-22 苏州康代智能科技股份有限公司 PCB defect detection method, circuit board metering measurement method and manufacturing method
CN115035123A (en) * 2022-08-15 2022-09-09 成都三是汇科技有限公司 Method, system and device for detecting hot end of tube bottle and storage medium
CN118097436A (en) * 2024-04-24 2024-05-28 四川省公路规划勘察设计研究院有限公司 Building surface defect detection system and detection method

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102297660A (en) * 2011-05-20 2011-12-28 同济大学 Measuring method of shield tunnel lining segment seam open width and apparatus thereof
CN105092607A (en) * 2015-08-27 2015-11-25 浙江大学 Method for evaluating surface defects of spherical optical components
CN106814083A (en) * 2015-11-30 2017-06-09 宁波舜宇光电信息有限公司 Filter plate defect detecting system and its detection method
CN107356608A (en) * 2017-07-21 2017-11-17 中国工程物理研究院激光聚变研究中心 The quick dark field detection method of heavy caliber fused quartz optical component surface microdefect
CN107389688A (en) * 2017-07-21 2017-11-24 中国工程物理研究院激光聚变研究中心 Heavy caliber fused quartz optical component surface microdefect multistation integrates restorative procedure
CN109507192A (en) * 2018-11-02 2019-03-22 江苏理工学院 A kind of magnetic core detection method of surface flaw based on machine vision
CN110051069A (en) * 2019-03-13 2019-07-26 中山易裁剪网络科技有限公司 Clothing size measuring system and measuring method thereof
CN111311542A (en) * 2020-01-15 2020-06-19 歌尔股份有限公司 Product quality detection method and device
CN114066808A (en) * 2021-10-11 2022-02-18 内蒙古科技大学 Pavement defect detection method and system based on deep learning

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102297660A (en) * 2011-05-20 2011-12-28 同济大学 Measuring method of shield tunnel lining segment seam open width and apparatus thereof
CN105092607A (en) * 2015-08-27 2015-11-25 浙江大学 Method for evaluating surface defects of spherical optical components
CN106814083A (en) * 2015-11-30 2017-06-09 宁波舜宇光电信息有限公司 Filter plate defect detecting system and its detection method
CN107356608A (en) * 2017-07-21 2017-11-17 中国工程物理研究院激光聚变研究中心 The quick dark field detection method of heavy caliber fused quartz optical component surface microdefect
CN107389688A (en) * 2017-07-21 2017-11-24 中国工程物理研究院激光聚变研究中心 Heavy caliber fused quartz optical component surface microdefect multistation integrates restorative procedure
CN109507192A (en) * 2018-11-02 2019-03-22 江苏理工学院 A kind of magnetic core detection method of surface flaw based on machine vision
CN110051069A (en) * 2019-03-13 2019-07-26 中山易裁剪网络科技有限公司 Clothing size measuring system and measuring method thereof
CN111311542A (en) * 2020-01-15 2020-06-19 歌尔股份有限公司 Product quality detection method and device
CN114066808A (en) * 2021-10-11 2022-02-18 内蒙古科技大学 Pavement defect detection method and system based on deep learning

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114782436A (en) * 2022-06-20 2022-07-22 苏州康代智能科技股份有限公司 PCB defect detection method, circuit board metering measurement method and manufacturing method
TWI848618B (en) * 2022-06-20 2024-07-11 大陸商蘇州康代智能科技股份有限公司 Pcb defect detection method, metrological measurement method and manufacture method for circuit board
CN115035123A (en) * 2022-08-15 2022-09-09 成都三是汇科技有限公司 Method, system and device for detecting hot end of tube bottle and storage medium
CN118097436A (en) * 2024-04-24 2024-05-28 四川省公路规划勘察设计研究院有限公司 Building surface defect detection system and detection method
CN118097436B (en) * 2024-04-24 2024-07-12 四川省公路规划勘察设计研究院有限公司 Building surface defect detection system and detection method

Similar Documents

Publication Publication Date Title
CN114581415A (en) Method and device for detecting defects of PCB, computer equipment and storage medium
JP6879431B2 (en) Image processing equipment, image processing method and image processing program
CN105139386B (en) A kind of image processing method of fast automatic detecting electric connector solder joint defective work
CN109444169B (en) A bearing defect detection method and system
CN109472271B (en) Printed circuit board image contour extraction method and device
CN117798087B (en) Visual sorting system and terminal for lithium battery based on appearance defect detection
CN113379680B (en) Defect detection method, defect detection device, electronic device and computer readable storage medium
CN113781396B (en) Screen defect detection method, device, equipment and storage medium
CN111626249B (en) Method and device for identifying geometric figure in topic image and computer storage medium
CN111259891B (en) Method, device, equipment and medium for identifying identity card in natural scene
CN114078109A (en) Image processing method, electronic device, and storage medium
CN115775244A (en) Coil winding detection method and device, electronic equipment and storage medium
CN111223078A (en) Method for determining defect grade and storage medium
CN112581452A (en) Industrial accessory surface defect detection method and system, intelligent device and storage medium
CN114627113B (en) Method, system, device and medium for detecting defects of printed circuit board
CN111507177B (en) Identification method and device for metering turnover cabinet
CN118501177A (en) Appearance defect detection method and system for formed foil
CN116703912B (en) Mini-host network port integrity visual detection method
CN111935480B (en) Detection method for image acquisition device and related device
CN115546145A (en) Defect detection method and device based on machine vision and electronic equipment
CN113344858B (en) Feature detection method, device and computer storage medium
CN113689378A (en) Method and device for judging accurate positioning of test strip, storage medium and terminal
CN118735915B (en) Paint detection method and system based on multidimensional visual analysis
CN119048423A (en) PCBA (printed circuit board assembly) plug-in detection method, system, electronic equipment and medium based on machine vision
CN117911368A (en) Coating surface defect detection method and system based on neural network model

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