A defect detection method, system and medium based on multi-level matching and AI re-inspection
Through multi-level matching and AI re-inspection methods, the deficiencies in efficiency, accuracy and misjudgment rate of existing PCB inspection technology are solved, achieving efficient and accurate defect detection and reducing labor costs.
Patent Information
- Application Number
- CN202410527838.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-29
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-04-29
AI Technical Summary
Existing PCB detection technology has shortcomings in detection efficiency, false positive rate, missed detection rate and detection accuracy, and requires manual re-inspection, which increases the workload and cost.
Adopting a defect detection method based on multi-level matching and AI re-inspection, through image collection and processing in a multi-PC architecture configuration, combined with efficient processors and AI models, image fragment collection, hierarchical matching and misjudgment detection are achieved to reduce misjudgments. Rate.
It improves detection efficiency and image alignment accuracy, reduces misjudgment rates and labor costs, and improves the accuracy and operability of the detection process.
Smart Images

Figure CN118169144B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of automatic optical detection technology. Specifically, the present invention is applied to the field of PCB detection, and in particular to a defect detection method, system and medium based on multi-level matching and AI re-inspection. Background Art
[0002] At present, in the process of producing PCB boards, it is necessary to perform defect detection on the PCB boards to ensure the quality and quality of the PCB boards.
[0003] Existing PCB bare board detection methods include:
[0004] 1. Manual visual inspection: Use a microscope to check whether the PCB board has any quality problems.
[0005] (ii) Contact testing: Such as electrical testing, using a bed of needles to perform contact electrical testing on the PCB.
[0006] (III) Non-contact detection: such as AOI detection technology based on machine vision; this method has high flexibility, fast detection speed, small detection damage, and strong reliability, and has become the main detection technology;
[0007] Specifically, the AOI inspection system usually consists of several important modules: image acquisition system, optical system, motion control system and image processing system;
[0008] Among them, the image acquisition system, optical system and motion control system are combined to build a machine vision imaging system, which is used to collect the image of the bare PCB to be inspected (more specifically, the motion control system transfers the PCB to the field of view of the acquisition camera, and the optical system module illuminates it to scan and obtain high-quality PCB images);
[0009] Among them, the image processing system uses image processing technology to analyze, extract and process the collected images, and detect the defective areas in the image; in the image analysis process, the PCB detection algorithms used include direct detection analysis method and reference comparison method; the direct detection analysis method mainly achieves the detection effect through boundary analysis, primitive extraction, and combined with mathematical morphology processing; the reference comparison method is based on the model
[0010] The board matching algorithm aligns the template image with the actual image, then compares the difference between the two images, extracts the difference part for analysis, and realizes the extraction of PCB board defects; however, no matter which algorithm is used at present, there are deficiencies in detection efficiency, false positive rate, missed detection rate and detection accuracy, which need to be continuously improved and enhanced.
[0011] In addition, on current production lines, defective PCBs are usually manually re-inspected after inspection. This method undoubtedly increases the workload of the inspection station, increases labor costs, and reduces production efficiency. Summary of the invention
[0012] The object of the present invention is to provide a defect detection method, system and medium based on multi-level matching and AI re-inspection, thereby solving all or one of the above-mentioned problems existing in the prior art.
[0013] In order to solve the above technical problems, the specific technical solutions of the present invention are as follows:
[0014] In one aspect, the present invention provides a defect detection method based on multi-level matching and AI re-inspection, comprising the following steps:
[0015] Initialization steps:
[0016] Based on the multi-PC architecture, the acquisition end, the processing end and the central control end are configured, the working logic of the acquisition end and the central control end is initialized, and an efficient processor is selected at the processing end;
[0017] Image acquisition steps:
[0018] Calling the acquisition end and the central control end to perform segmented acquisition of the incoming PCB image in a parallel operation mode, and transmitting the acquired incoming PCB image segmented to the high-efficiency processor;
[0019] Image processing steps:
[0020] The efficient processor is called to perform unitized hierarchical analysis and processing on the received incoming PCB image; the unitized hierarchical analysis and processing includes: performing image registration on the incoming PCB image based on a preset template file and a hierarchical matching strategy, performing defect classification analysis according to the registered image to obtain a classified defect result; and performing misjudgment detection on the classified defect result based on an AI model.
[0021] As an improved solution, the working logic initialization of the acquisition end and the central control end includes: setting the central control end to trigger the acquisition and storage action of the acquisition end based on the incoming material start signal and the incoming material stop signal; setting the acquisition end to perform image segment acquisition before the central control end receives the incoming material start signal, and discard the acquired image;
[0022] The selecting of the efficient processor at the processing end includes: calling the central control end to monitor the processing progress of the processing end; in response to the central control end receiving the incoming material start signal, calculating the processing time of the processing end for the incoming PCB according to the processing progress of the processing end and the idle state of the processing end; selecting the processing end with the smallest processing time as the efficient processor; calling the central control end to generate an address signal according to the serial number of the incoming PCB and the processor number of the efficient processor, and sending the address signal to the acquisition end.
[0023] As an improved solution, the image acquisition step further includes:
[0024] Calling the acquisition end to scan the incoming PCB;
[0025] In response to the scanning process, the acquisition end is called to output a partial image of the incoming PCB at every first interval parameter, and the acquisition end is called to store the acquired partial image into the cache segment according to the address signal;
[0026] In response to the scanning process, whenever the partial image exists in the cache segment, the partial image is sent to the high-efficiency processor;
[0027] In response to the completion of scanning of a piece of the incoming PCB, the central control end is called to send a stop signal to the acquisition end; when the acquisition end receives the stop signal, it stops placing the acquired image into the cache segment, and calls the high-efficiency processor to splice all the partial images into the incoming PCB image.
[0028] As an improved solution, before the image registration of the incoming PCB image is performed based on the preset template file and the hierarchical matching strategy, it includes: setting a template image corresponding to the incoming PCB, dividing a number of imposition areas and a number of unit detection areas in the template image, and using the divided template image as the preset template file;
[0029] The image registration of the incoming PCB image based on the preset template file and the hierarchical matching strategy includes: dividing the incoming PCB image according to a plurality of the imposition areas and a plurality of the unit detection areas, and performing hierarchical registration of the divided incoming PCB image with the imposition areas and the unit detection areas;
[0030] The defect analysis is performed according to the registered image to obtain the classified defect result, including: performing defect analysis on the registered image according to material area, defect element type, color standard and size standard to obtain a first defect result, a second defect result and a third defect result as the classified defect result;
[0031] Before performing misjudgment detection on the classified defect results based on the AI model, it includes: configuring a training data set, and training the AI detection model based on the training data set and a stochastic gradient descent algorithm.
[0032] As an improved solution, the template image is divided into a plurality of imposition areas and a plurality of unit detection areas, including:
[0033] Dividing the template image into a plurality of the panel areas according to the drawing information of the PCB;
[0034] Performing feature point adjustment based on contour feature point traversal on each of the imposition areas;
[0035] In each of the imposition areas after the feature points are adjusted, a plurality of the unit detection areas are divided;
[0036] Setting the upper limit of the size of a single unit detection area and the requirement on the number of feature points;
[0037] The sizes and numbers of the unit detection areas in each of the imposition areas are adjusted according to the size upper limit and the requirement on the number of feature points.
[0038] As an improved solution, the incoming PCB image is divided according to the plurality of the imposition areas and the plurality of the unit detection areas, and the incoming PCB image after the division is graded and registered with the imposition areas and the unit detection areas, including:
[0039] Based on the features of the incoming PCB, the incoming PCB image is preliminarily aligned with the template image, so that the plurality of panel areas in the template image after the preliminarily alignment are respectively a plurality of first panel areas, and the plurality of unit detection areas in the first panel areas are respectively a plurality of first unit detection areas;
[0040] The incoming PCB image is divided into a plurality of second imposition areas according to the plurality of first imposition areas, and a unit alignment operation is performed on each of the second imposition areas in turn, the unit alignment operation comprising: aligning the second imposition area with the first imposition area according to the mark information of the first imposition area corresponding to the second imposition area; after the alignment, dividing the second imposition area into a plurality of second unit detection areas according to the division method of the plurality of first unit detection areas in the first imposition area; and aligning the plurality of second unit detection areas with the plurality of first unit detection areas one by one.
[0041] As an improved solution, the defect analysis of the registered image is performed according to the material area, defect element type, color standard and size standard to obtain the first defect result, the second defect result and the third defect result, including:
[0042] Setting a first color range, extracting the copper material portion in the registered image according to the first color range, generating a first binary image, and performing a difference between the first binary image and the template image to obtain a first difference result image;
[0043] Setting a second color range, extracting a substrate portion in the registered image according to the second color range, generating a second binary image, and performing a subtraction between the second binary image and the template image to obtain a second difference result image;
[0044] Merging the first difference result graph and the second difference result graph to obtain a third difference result graph;
[0045] Confirm the defect position in the third difference result image, and determine whether the defect position meets the standard according to the element type corresponding to the defect position, to obtain the first defect result;
[0046] Performing a color compliance analysis on the copper material portion to obtain the second defect result;
[0047] A size compliance analysis is performed on the hole area and the ring area in the registered image to obtain the third defect result.
[0048] As an improved solution, the AI model-based misjudgment detection of the classified defect results includes:
[0049] According to the first defect result, the second defect result and the third defect result, cropping defect images at corresponding positions in the incoming PCB image;
[0050] The cropped defect image is input into the AI detection model for analysis, and the correctness of the first defect result, the second defect result and the third defect result is judged according to the determination result output by the AI detection model.
[0051] On the other hand, the present invention also provides a defect detection system based on multi-level matching and AI re-inspection, comprising:
[0052] An initialization module is used to: configure an acquisition terminal, a processing terminal and a central control terminal based on a multi-PC architecture, initialize the working logic of the acquisition terminal and the central control terminal, and select an efficient processor at the processing terminal;
[0053] The image acquisition module is used to call the acquisition end and the central control end to perform segmented acquisition of the incoming PCB image in a parallel operation mode, and transmit the acquired incoming PCB image segmented to the high-efficiency processor;
[0054] The image processing module is used to call the high-efficiency processor to perform unitized hierarchical analysis and processing on the received incoming PCB image; the unitized hierarchical analysis and processing includes: performing image registration on the incoming PCB image based on a preset template file and a hierarchical matching strategy, performing defect classification analysis based on the registered image to obtain a classified defect result; and performing misjudgment detection on the classified defect result based on an AI model.
[0055] On the other hand, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the defect detection method based on multi-level matching and AI re-inspection are implemented.
[0056] The beneficial effects of the technical solution of the present invention are:
[0057] The defect detection method based on multi-level matching and AI re-inspection described in the present invention can realize efficient transmission scheduling and improve detection efficiency based on the regulation and coordination of multiple working equipment; based on the multi-level matching scheme and the adaptive area division scheme, it can improve the image alignment accuracy; based on the AI network to verify the detection results, it can reduce the product's misjudgment rate and the labor cost of operation, and has high application value and a wide range of applications.
[0058] The defect detection system based on multi-level matching and AI re-inspection described in the present invention can achieve efficient transmission scheduling and improve detection efficiency through the mutual cooperation of the initialization module, the image acquisition module and the image processing module, and then based on the regulation and coordination of multiple working devices; based on the multi-level matching scheme and the adaptive area division scheme, the image alignment accuracy is improved; based on the AI network to verify the detection results, the product's misjudgment rate and the labor cost of operation are reduced, and it has high application value and a wide range of applications.
[0059] The computer-readable storage medium described in the present invention can realize the coordination among the guiding initialization module, the image acquisition module and the image processing module, thereby realizing the defect detection method based on multi-level matching and AI re-inspection described in the present invention, and the computer-readable storage medium described in the present invention also effectively improves the operability of the defect detection method based on multi-level matching and AI re-inspection. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0061] Figure 1 It is a flowchart of the defect detection method based on multi-level matching and AI re-inspection described in Example 1 of the present invention;
[0062] Figure 2 This is a schematic diagram of the workflow of the central control terminal in the defect detection method based on multi-level matching and AI re-inspection described in Example 1 of the present invention:
[0063] Figure 3 This is a schematic diagram of the workflow of the acquisition end in the defect detection method based on multi-level matching and AI re-inspection described in Example 1 of the present invention:
[0064] Figure 4 This is a flow chart of the defect detection method based on multi-level matching and AI re-inspection described in Example 1 of the present invention when performing incoming PCB image detection processing:
[0065] Figure 5 This is a schematic diagram of the network structure of the AI model in the defect detection method based on multi-level matching and AI re-inspection described in Example 1 of the present invention:
[0066] Figure 6 Schematic diagram of the architecture of the defect detection system based on multi-level matching and AI re-inspection according to Embodiment 2 of the present invention;
[0067] Figure 7 is a schematic diagram of the structure of the computer device described in Example 4 of the present invention;
[0068] The symbols in the accompanying drawings are explained as follows:
[0069] 1501, processor; 1502, communication interface; 1503, memory; 1504, communication bus. DETAILED DESCRIPTION
[0070] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings so that the advantages and features of the present invention can be more easily understood by those skilled in the art, thereby making a clearer and more definite definition of the protection scope of the present invention.
[0071] In the description of the present invention, it should be noted that the embodiments described in the present invention are only part of the embodiments of the present invention, rather than all of the embodiments; based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present invention.
[0072] The terms "first", "second", etc. in the specification and claims of this article and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of this article described here can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, device, product or equipment that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0073] In the description of the present invention, it should be noted that the existing PCB quality inspection process mainly includes: detecting whether the circuit of the PCB board has open circuit, short circuit, gap, thin line and incomplete etching; detecting whether the PCB board has missing holes and offset; detecting whether the size of the PCB board pad meets the requirements; detecting whether the copper surface of the PCB board has scratches, damage, indentations and dirt.
[0074] In the description of the present invention, it should be noted that the size of the PCB bare board is generally large, which makes the image data volume of the entire PCB board particularly large. If all of them are placed on one machine for processing, the processing speed will not keep up with the production capacity of the production line. The detection of the PCB bare board can be completed by multiple groups of machines in cooperation; therefore, how to arrange and allocate the tasks of each machine and how to transmit the image data stream to perform the most efficient detection based on limited machines is a problem we need to solve; among the commonly used detection methods, the direct detection and analysis method is to analyze and detect each module on the PCB board through boundary analysis and primitive extraction. This method is more limited by the type of PCB board. When the PC When the elements of the B plate are numerous and complex, the amount of calculation will increase significantly, and because they need to be analyzed separately, the complexity of the algorithm and the complexity of the operation will increase; the reference comparison method is detected through template matching and image comparison. The accuracy of image registration will directly affect the detection result. When the detection image is transformed after template matching, if the image area is relatively large, the accuracy of image alignment is even more difficult to guarantee. If the selected image area is too small, on the one hand, the amount of calculation will increase, and on the other hand, there are fewer feature points in the area, which is not conducive to the template matching algorithm; in addition, the specification standards of each area are not completely consistent, and judging only by comparing the differences will introduce some unnecessary misjudgments.
[0075] In the description of the present invention, it should be noted that the alignment accuracy between the template image and the actual image has a great influence on the final detection result. If the division of the unit detection area is inappropriate, and the template matching scheme and algorithm accuracy cannot meet the requirements, the accuracy of the alignment between the template image and the actual image will be reduced, resulting in poor detection results. Choosing a suitable template matching scheme and dividing the appropriate unit detection area are issues that many people will overlook but are very important.
[0076] In the description of the present invention, it should be noted that the inspection specifications of the circuit, copper sheet and hole ring are different. After the difference is compared with the template image, if the difference parts are extracted and analyzed uniformly, misjudgment will be introduced. How to classify and analyze the extracted difference parts is a key issue to improve the PCB inspection performance.
[0077] In the description of the present invention, it should be noted that PCB (Printed Circuit Board) is a printed circuit board. Example 1
[0078] This embodiment provides a defect detection method based on multi-level matching and AI re-inspection, such as Figure 1~Figure 5 As shown, the following steps are included:
[0079] The core function of this method is to design multi-device parallel processing of image acquisition, transmission and processing tasks, thereby improving work efficiency; based on the hierarchical positioning and matching strategy, the accuracy of image alignment and the correctness of identification of difference defects are improved; finally, the verification of the detection results is performed based on the AI model to prevent misjudgment of detection, improve the accuracy of the entire detection process, eliminate the need for manual re-inspection, and reduce the cost of use. The specific steps are as follows:
[0080] S100, initialization step:
[0081] In this step, the configuration of the equipment required in this method and the setting of various control logics are performed, as follows:
[0082] In one implementation, the configuration of the scanning device and the processing device is performed as follows:
[0083] Among them, 4+4 16K color line scan cameras are used as PCB acquisition devices of this method to realize the acquisition of PCB board scanning images;
[0084] Among them, 2+1+4 PCs are used as the control center of this method to realize the collection, transmission and processing of PCB boards; since the image data volume of a single PCB board is very large, the above design can effectively improve the processing efficiency and performance;
[0085] Among them, the two PCs in the control center are used to control the acquisition work of the line scan camera, which is defined as the acquisition end in this implementation;
[0086] Among them, the four PCs in the control center are used for detection and processing of the acquired images, which are defined as the kernel end (i.e., the processing end) in this implementation;
[0087] Among them, one PC in the control center is used for core control, which is defined as the central control terminal in this implementation.
[0088] In one implementation, the central control terminal is initialized, and the working logic of the line scan camera and the processing logic of the central control terminal for the image collected during the initialization process are set as follows:
[0089] Among them, in response to the movement process of the machine, the start signal and stop signal of the PCB incoming material are sent to the central control end through the sensor;
[0090] Among them, the line scan camera is initialized, and the line scan camera is controlled to continuously acquire images and output an image every 2k;
[0091] In order to prevent the occupation of computing resources and storage resources during the initialization process, the images collected by the line scan camera are directly discarded before the central control end receives the incoming material start signal, without occupying the disk and transmission channel space.
[0092] In one implementation, in order to improve work efficiency, it is necessary to calculate the incoming material image processing time of the kernel-side processor when the material is received, and select the processor with the shortest processing waiting time to process the incoming PCB image, as follows:
[0093] Among them, the central control end is called to monitor the processing progress of the kernel end in real time;
[0094] In response to the central control end receiving the incoming material start signal sent by the sensor, the SN number is automatically generated, and the time required for each kernel processor to process the incoming PCB board is calculated;
[0095] The calculation formula for the time required for any kernel processor to process the incoming PCB board is as follows:
[0096] ;
[0097] In this formula, , is the average processing time of the last 10 PCBs of this type processed by the kernel processor; The time spent on the product being processed by the kernel processor; , is the number of products in the cache sequence waiting to be processed by the kernel processor;
[0098] Among them, according to the calculated time result, the kernel processor number with the shortest required time is selected; based on this number, an address signal is generated, that is, a signal of SN+Start+kernel number; this address signal is sent to the acquisition end, and the acquisition end transmits the corresponding acquired image according to this signal.
[0099] S200, image acquisition steps:
[0100] In this step, the acquisition end and the central control end cooperate with each other to efficiently acquire images according to the aforementioned address signals and parallel operation and processing methods, as follows:
[0101] In one implementation, the acquisition end performs segmented acquisition processing on the incoming PCB. Each acquired segmented image will be stored in a cache segment according to the aforementioned address signal. The cache segment will transmit the stored image to the corresponding kernel processor in real time according to the address signal. The above acquisition and transmission processes are processed in parallel, which greatly improves the processing efficiency, as follows:
[0102] Among them, considering that waiting for a complete product to be scanned before generating an image for transmission will face huge data transmission and processing problems, which will greatly reduce the processing time efficiency; therefore, the line scan camera is set to export an image every 2k (i.e. the first interval parameter);
[0103] In response to the acquisition end receiving the incoming signal, each image data segment (16K*2K) acquired by the line scan camera is sequentially placed into the cache segment according to the SN number obtained above;
[0104] In response to the data appearing in the cache segment, the SN+image+serial number is directly sent to the corresponding kernel processor; when sending, the corresponding data also needs to be packaged and backed up to the local disk;
[0105] In response to the completion of scanning a complete product, the central control terminal sends an SN+End signal (i.e., a stop signal) to the acquisition terminal; when the acquisition terminal receives the End signal, it indicates that the current PCB does not need to perform image acquisition any more, so the currently acquired image is directly discarded and no longer put into the cache segment;
[0106] When the collection end receives the material start signal for the next product, the above operation is repeated.
[0107] S300, image processing steps:
[0108] In this step, the kernel processor with the shortest processing time is used to receive each image of the incoming PCB sent by the cache segment, and each image is spliced according to the calibration result to form an image of a whole incoming PCB. In the process, in order to process the image more finely, increase the alignment accuracy between the template image and the actual image, and achieve more accurate and high-quality detection results, when the kernel processor is processing, the kernel processor performs adaptive regional comparison of the incoming PCB image according to the preset template file and the hierarchical positioning matching strategy; after comparison, the difference is located on the original drawing, and targeted analysis is performed according to the attributes of different differences to realize classified defect judgment and determine whether the production process is met; finally, error screening is performed based on AI technology to complete the entire processing process of the incoming PCB image, as follows:
[0109] S301. Configure a template file for hierarchical positioning as follows:
[0110] First, the imposition area is extracted based on the template image:
[0111] Export the template image according to the ODB++ file, extract the Step area in the template image according to the drawing information, and define the Step area as the layout area;
[0112] Among them, the characteristic points of the imposition area are adjusted:
[0113] Extract the contours in the imposition area image, and calculate the first-order derivative and the second-order derivative of each contour segment by segment; adjust the feature points according to the calculated first-order derivative and the second-order derivative according to the preset feature point adjustment strategy;
[0114] Specifically, the feature point adjustment strategy is as follows:
[0115] 1. All points on the extracted contour whose second-order derivatives are not 0 are extracted as feature points;
[0116] 2. Take any point on the contour as the starting point, traverse the feature points along the contour direction, calculate the distance between the feature points, and judge based on the distance:
[0117] 3. If the distance between the current feature point and the next feature point Greater than , then along the contour line every Insert a point as a feature point, this insertion point is a point on the contour line;
[0118] 4. If the distance between the current feature point and the next feature point Less than , then calculate the distance between the current feature point and the next feature point; if the distance is still less than , then delete the feature point in the middle of the three points, and continue to calculate the distance between the current feature point and the next feature point; repeat this process until Greater than Time deadline;
[0119] 5. Taking the above starting point as the reference point, traverse the other feature points on the contour line in turn, and delete and adjust the feature points on the contour line according to the above strategy until all feature points have been traversed.
[0120] Among them, the unit detection area size is calculated for the imposition area image after the feature points are adjusted:
[0121] In order to improve processing efficiency and alignment accuracy, according to the hierarchical positioning and matching strategy, this method needs to divide the imposition area image into multiple unit detection areas for one-to-one alignment detection between incoming PCB images; due to the limitations of matching algorithms in the image processing process, the image of the unit test area should not be too large; but if the number of feature points in the unit detection area is too small, the effect of image alignment will be reduced, so it is necessary to calculate the appropriate unit detection area;
[0122] Specifically, the upper limit of the size of the unit detection area is assumed to be M*N, and the number of feature points in a single unit detection area shall not be less than S; therefore, the imposition area image is evenly divided into m*n parts, as follows:
[0123] ;
[0124] ;
[0125] After division, the size of the unit detection area is: , ;
[0126] In the above formula, the size of a single mosaic area image is X*Y; the upper limit size of the image size of the unit detection area is M*N; the overlap size of the image is L;
[0127] After the above dimensions are calculated, the detection area of each unit is corrected:
[0128] 1. Calculate the number of feature points in each unit detection area;
[0129] 2. According to the number, filter out the area where the number of feature points is less than S;
[0130] 3. The screened areas are regarded as areas that do not meet the requirements and simple clustering is performed;
[0131] 4. In simple clustering, the distance between the three regions is considered as one category;
[0132] 5. Calculate the circumscribed rectangular area of each category;
[0133] 6. Expand one area in each of the four directions of the circumscribed rectangle to form a new plate area, which is a*b areas;
[0134] 7. Re-divide the plate area into (a+1)*(b+1) sub-areas, where the size of each sub-area is: ;
[0135] 8. Repeat the above operation until all unit detection areas meet the requirement of the number of feature points or the number of iterations exceeds 5 times; if the requirements are not met in both cases, the operator needs to perform manual division;
[0136] There are multiple imposition areas in each template image, and the above-mentioned division of unit detection areas is performed for each imposition area; finally, several imposition area images each divided into several unit detection areas are used as the final template file.
[0137] S302, using the image of the template file to align with the received incoming PCB image, as follows:
[0138] Among them, the incoming PCB image and the template file image are initially aligned according to the outer edge contour of the incoming PCB board (or the attribute characteristics of the edge area of the board), and the template file image and the actually collected incoming PCB image are preliminarily aligned;
[0139] Among them, after the primary alignment, the actually collected incoming PCB image is divided into edge area + several layout areas (i.e., the second layout area) according to the drawing information of the template file image;
[0140] Among them, according to the mark information of the imposition area on the drawing, the imposition area image divided in the incoming PCB image and the imposition area of the template file image are secondarily aligned;
[0141] After the layout area is aligned, the corresponding layout area of the incoming PCB image is divided into several unit detection areas according to the unit detection area division method of the single layout area;
[0142] Among them, the incoming PCB image and the single unit detection area in the template file image are accurately aligned one by one to complete the alignment.
[0143] S303: Based on the aligned image, perform defect classification, positioning and matching detection as follows:
[0144] Among them, the copper area is tested:
[0145] According to the preset color range (RGB or HSV, i.e., the first color range), all the copper parts in the alignment area are extracted to generate a corresponding single binary image (i.e., the first binary image), and the image is subtracted from the template image to generate a first difference result image;
[0146] Among them, the detection of the substrate area is carried out:
[0147] According to a preset color range (RGB or HSV, i.e., a second color range), all the substrate parts in the alignment area are extracted to generate a corresponding single binary image (i.e., a second binary image), and this image is subtracted from the template image to generate a second difference result image;
[0148] Among them, defect location and classification judgment are carried out:
[0149] The first difference result graph and the second difference result graph are combined to obtain a result graph, namely, a third difference result graph;
[0150] Analyze the difference parts in the third difference result map one by one, and determine the location of the defect according to the template file image and known information; confirm the corresponding element area specification standard according to the element type corresponding to the defect location; and classify and judge whether the location of the defect of the corresponding type meets the index requirements according to the confirmed specification standard;
[0151] Among them, the defects in the copper area are judged specifically by color:
[0152] Perform color analysis on the copper material area extracted according to the color range;
[0153] Detection is performed based on the relationship between color channels, such as: the ratio of the R channel to the G channel is between 1-2; the ratio of the R channel to the B channel is between 1.2-1.8, etc.;
[0154] Preset color difference; select a channel or grayscale value in a fixed window, calculate the average value and variance in the area, and detect the parts that do not meet the requirements based on the color difference;
[0155] As an optional implementation, when the region is extracted according to the color range, it includes but is not limited to: extracting the color of RGB and the corresponding HSV space changes; for example, it can also be extracted according to the color space of 0.3r+0.5g+0.6b (or independently taking the intersection of xH+yS+zV as the color region); the extraction method in this method is not limited to other similar methods mentioned above;
[0156] Among them, the defects in the hole area and the ring area are judged specifically:
[0157] Locate all hole / ring areas according to drawings;
[0158] Extract each ring and calculate whether the radius of the ring meets the corresponding requirements;
[0159] Check whether the deviation of the hole ring (outer ring width) meets the requirements.
[0160] Among them, in the above steps, a total of three defect detection results are obtained, namely, defect result one (i.e., the first defect result) generated based on the fused third difference result map, defect result two (i.e., the second defect result) for judging the copper area by color, and defect result three (i.e., the third defect result) for judging the hole / ring area.
[0161] S304, perform AI error screening on the above results, as follows:
[0162] First, you need to prepare a data set for training the AI model:
[0163] Collect pictures of different defect types and pictures without any defects;
[0164] When collecting images, try to keep the number of images of different defect types consistent to achieve sample balance, improve training results and model accuracy;
[0165] Label the collected data, distinguish different defective and non-defective images, divide the above images into training set, verification set and test set; integrate the above sets as the training data set of the model;
[0166] Among them, the stochastic gradient descent algorithm is used to train the AI model until the model converges;
[0167] After the model is trained, it is exported as an onnx model, and then TensorRT is used for serialization and GPU acceleration;
[0168] Among them, the network structure of the AI model includes:
[0169] Shallow feature extraction module, used to extract local features of the image, consisting of L1 and L2 convolution blocks;
[0170] L1, consisting of a convolutional layer with a kernel size of 3 (3x3Conv), a batch normalization layer (BN), and an activation layer (Relu);
[0171] L2, consisting of a convolutional layer with a kernel size of 1 (1x1Conv), a batch normalization layer (BN), and an activation layer (Relu);
[0172] The deep feature extraction module is used to extract the global features and deep semantic information of the image. The construction of this module is the same as L1 in the shallow feature extraction module;
[0173] Defect category classification module, used to distinguish defect types, which consists of a fully connected layer (FC) and a softmax classifier;
[0174] Among them, according to defect result one, defect result two and defect result three, the defect images at the corresponding positions are cropped out; the corresponding defect images are input into the AI model; based on the judgment results output by the AI model, it is judged whether the above defect result one, defect result two and defect result three are the real defect parts, so as to realize the re-judgment and screening of the detection results. Example 2
[0175] This embodiment is based on the same inventive concept as the defect detection method based on multi-level matching and AI re-inspection described in Embodiment 1, and provides a defect detection system based on multi-level matching and AI re-inspection, such as Figure 6 As shown, including:
[0176] An initialization module is used to: configure an acquisition terminal, a processing terminal and a central control terminal based on a multi-PC architecture, initialize the working logic of the acquisition terminal and the central control terminal, and select an efficient processor at the processing terminal;
[0177] In this system, the initialization module includes: a logic initialization unit and a processor selection unit;
[0178] In this system, the logic initialization unit is used to: set the central control end to trigger the acquisition and storage action of the acquisition end based on the incoming material start signal and the incoming material stop signal; set the acquisition end to perform image segment acquisition before the central control end receives the incoming material start signal, and discard the acquired image;
[0179] In this system, the processor selection unit is used to: call the central control end to monitor the processing progress of the processing end; in response to the central control end receiving the incoming material start signal, calculate the processing time of the processing end for the incoming PCB according to the processing progress of the processing end and the idle situation of the processing end; select the processing end with the smallest processing time as the efficient processor; call the central control end to generate an address signal according to the serial number of the incoming PCB and the processor number of the efficient processor, and send the address signal to the acquisition end.
[0180] The image acquisition module is used to call the acquisition end and the central control end to perform segmented acquisition of the incoming PCB image in a parallel operation mode, and transmit the acquired incoming PCB image segmented to the high-efficiency processor;
[0181] In the present system, the image acquisition module calls the acquisition end to scan the incoming PCB; in response to the scanning process, the image acquisition module calls the acquisition end to output a partial image of the incoming PCB at intervals of a first interval parameter, and calls the acquisition end to store the acquired partial image into a cache segment according to the address signal; in response to the scanning process, the image acquisition module sends the partial image to the high-efficiency processor whenever the partial image exists in the cache segment; in response to the scanning of a piece of the incoming PCB being finished, the image acquisition module calls the central control end to send a stop signal to the acquisition end; when the acquisition end receives the stop signal, it stops placing the acquired image into the cache segment, and calls the high-efficiency processor to splice all the partial images into the image of the incoming PCB.
[0182] The image processing module is used to: call the efficient processor to perform unitized hierarchical analysis and processing on the received incoming PCB image; the unitized hierarchical analysis and processing includes: performing image registration on the incoming PCB image based on a preset template file and a hierarchical matching strategy, performing defect classification analysis based on the registered image to obtain a classified defect result; and performing misjudgment detection on the classified defect result based on an AI model;
[0183] In this system, the image processing module includes: a template file configuration unit (a region division unit is provided in the template file configuration unit), a region division unit, a hierarchical registration unit, a defect classification and recognition unit, a model training unit and a model calling unit;
[0184] In this system, the template file configuration unit is used to: set a template image corresponding to the incoming PCB, divide the template image into a number of imposition areas and a number of unit detection areas, and use the divided template image as the preset template file;
[0185] Specifically, the template file configuration unit calls the area division unit to divide the several imposition areas in the template image according to the drawing information of the PCB; the template file configuration unit calls the area division unit to adjust the feature points of each imposition area based on the contour feature point traversal; the template file configuration unit calls the area division unit to divide the several unit detection areas in each imposition area after the feature point adjustment; the template file configuration unit calls the area division unit to set the size upper limit and the feature point number requirement of a single unit detection area; the template file configuration unit calls the area division unit to adjust the size and number of several unit detection areas in each imposition area according to the size upper limit and the feature point number requirement.
[0186] In this system, the hierarchical registration unit is used to: divide the incoming PCB image according to the plurality of the imposition areas and the plurality of the unit detection areas, and perform hierarchical registration according to the divided incoming PCB image, the imposition areas and the unit detection areas;
[0187] Specifically, the graded registration unit performs primary alignment on the image of the incoming PCB and the template image based on the features of the incoming PCB, so that the several imposition areas in the template image after the primary alignment are respectively several first imposition areas, and the several unit detection areas in the first imposition areas are respectively several first unit detection areas; the graded registration unit divides the incoming PCB image into several second imposition areas according to the several first imposition areas, and performs a unit alignment operation on each of the second imposition areas in turn, and the unit alignment operation includes: the graded registration unit aligns the second imposition area with the first imposition area according to the mark information of the first imposition area corresponding to the second imposition area; after the alignment, the graded registration unit divides the second imposition area into several second unit detection areas according to the division method of the several first unit detection areas in the first imposition area; the graded registration unit aligns the several second unit detection areas with the several first unit detection areas one by one.
[0188] In the system, the defect classification and identification unit is used to: perform defect analysis on the registered image according to the material area, defect element type, color standard and size standard to obtain a first defect result, a second defect result and a third defect result as the classified defect result;
[0189] Specifically, the defect classification and recognition unit sets a first color range, extracts the copper material part in the registered image according to the first color range, generates a first binary image, and subtracts the first binary image from the template image to obtain a first difference result image; the defect classification and recognition unit sets a second color range, extracts the substrate part in the registered image according to the second color range, generates a second binary image, and subtracts the second binary image from the template image to obtain a second difference result image; the defect classification and recognition unit merges the first difference result image and the second difference result image to obtain a third difference result image; the defect classification and recognition unit confirms the defect position in the third difference result image, and determines whether the defect position meets the standard according to the element type corresponding to the defect position, to obtain the first defect result; the defect classification and recognition unit performs a color compliance analysis on the copper material part to obtain the second defect result; the defect classification and recognition unit performs a size compliance analysis on the hole area and the ring area in the registered image to obtain the third defect result.
[0190] In this system, the model training unit is used to: configure a training data set, and train an AI detection model based on the training data set and a stochastic gradient descent algorithm;
[0191] In the present system, the model calling unit is used to: crop the defect image at the corresponding position in the incoming PCB image according to the first defect result, the second defect result and the third defect result; input the cropped defect image into the AI detection model for analysis, and judge the correctness of the first defect result, the second defect result and the third defect result according to the judgment result output by the AI detection model. Example 3
[0192] This embodiment provides a computer-readable storage medium, including:
[0193] The storage medium is used to store computer software instructions used to implement the defect detection method based on multi-level matching and AI review described in the above-mentioned Example 1, which includes a program for executing the above-mentioned program set for the defect detection method based on multi-level matching and AI review; specifically, the executable program can be built into the defect detection system based on multi-level matching and AI review described in Example 2, so that the defect detection system based on multi-level matching and AI review can implement the defect detection method based on multi-level matching and AI review described in Example 1 by executing the built-in executable program.
[0194] In addition, the computer-readable storage medium of this embodiment may adopt any combination of one or more computer-readable storage media, wherein the computer-readable storage medium includes electrical, optical, electromagnetic, infrared or semiconductor systems, devices or components, or any combination thereof.
[0195] As an embodiment of the present invention, the above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0196] Different from the existing technology, the defect detection method, system, equipment and medium based on multi-level matching and AI re-inspection of the present application can realize efficient transmission scheduling and improve detection efficiency based on the regulation and coordination of multiple working equipment; based on the multi-level matching scheme and adaptive area division scheme, the image alignment accuracy is improved; based on the AI network to verify the detection results, the product's misjudgment rate and the labor cost of operation are reduced, and it has high application value and a wide range of applications.
[0197] It should be understood that in the various embodiments of this document, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this document.
[0198] It should also be understood that in the embodiments of this article, the term "and / or" is only a description of the association relationship of the associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0199] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this article.
[0200] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0201] In the several embodiments provided herein, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, or can be electrical, mechanical or other forms of connection.
[0202] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of this article.
[0203] In addition, each functional unit in each embodiment of this invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional unit.
[0204] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this article is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of this article. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0205] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A defect detection method based on multi-level matching and AI re-inspection, It is characterized in that The following steps are involved: Initialization steps: Based on the multi-PC architecture, the acquisition end, the processing end and the central control end are configured, the working logic of the acquisition end and the central control end is initialized, and an efficient processor is selected at the processing end; Image acquisition steps: Calling the acquisition end and the central control end to perform segmented acquisition of the incoming PCB image in a parallel operation mode, and transmitting the acquired incoming PCB image segmented to the high-efficiency processor; Image processing steps: Calling the high-efficiency processor to perform unitized hierarchical analysis and processing on the received incoming PCB image; The unitized hierarchical analysis and processing includes: performing image registration on the incoming PCB image based on a preset template file and a hierarchical matching strategy, performing defect classification analysis on the registered image to obtain a classified defect result; and performing misjudgment detection on the classified defect result based on an AI model; Before the image registration of the incoming PCB image is performed based on the preset template file and the hierarchical matching strategy, the method includes: setting a template image corresponding to the incoming PCB, dividing a plurality of paneling areas and a plurality of unit detection areas in the template image, and using the divided template image as the preset template file; The image registration of the incoming PCB image based on the preset template file and the hierarchical matching strategy includes: dividing the incoming PCB image according to a plurality of the imposition areas and a plurality of the unit detection areas, and performing hierarchical registration of the divided incoming PCB image with the imposition areas and the unit detection areas; The defect analysis is performed according to the registered image to obtain the classified defect result, including: performing defect analysis on the registered image according to material area, defect element type, color standard and size standard to obtain a first defect result, a second defect result and a third defect result as the classified defect result; The step of dividing the incoming PCB image according to the plurality of the imposition areas and the plurality of the unit detection areas, and performing hierarchical registration of the divided incoming PCB image with the imposition areas and the unit detection areas comprises: performing primary alignment of the incoming PCB image with the template image based on the features of the incoming PCB, making the plurality of the imposition areas in the template image after the primary alignment respectively be a plurality of first imposition areas, and making the plurality of the unit detection areas in the first imposition areas respectively be a plurality of first unit detection areas; dividing the incoming PCB image into a plurality of second imposition areas according to the plurality of the first imposition areas, and performing a unit alignment operation on each of the second imposition areas in turn; The defect analysis of the registered image according to the material area, defect element type, color standard and size standard to obtain the first defect result, the second defect result and the third defect result includes: setting a first color range, extracting the copper material part in the registered image according to the first color range, generating a first binary image, subtracting the first binary image from the template image, and obtaining a first difference result image; setting a second color range, extracting the substrate part in the registered image according to the second color range, generating a second binary image, subtracting the second binary image from the template image, and obtaining a second difference result image; merging the first difference result image and the second difference result image to obtain a third difference result image; confirming the defect position in the third difference result image, and judging whether the defect position meets the standard according to the element type corresponding to the defect position, and obtaining the first defect result; performing color compliance analysis on the copper material part to obtain the second defect result; performing size compliance analysis on the hole area and the ring area in the registered image to obtain the third defect result.
2. According to claim 1, the defect detection method based on multi-level matching and AI re-inspection, Features: The initialization of the working logic of the acquisition end and the central control end includes: setting the central control end to trigger the acquisition and storage action of the acquisition end based on the incoming material start signal and the incoming material stop signal; setting the acquisition end to perform image segment acquisition before the central control end receives the incoming material start signal, and discard the acquired image; The selecting of the efficient processor at the processing end includes: calling the central control end to monitor the processing progress of the processing end; in response to the central control end receiving the incoming material start signal, calculating the processing time of the processing end for the incoming PCB according to the processing progress of the processing end and the idle state of the processing end; selecting the processing end with the smallest processing time as the efficient processor; calling the central control end to generate an address signal according to the serial number of the incoming PCB and the processor number of the efficient processor, and sending the address signal to the acquisition end.
3. The defect detection method based on multi-level matching and AI re-inspection according to claim 2, Features: The image acquisition step further comprises: Calling the acquisition end to scan the incoming PCB; In response to the scanning process, the acquisition end is called to output a partial image of the incoming PCB at every first interval parameter, and the acquisition end is called to store the acquired partial image into the cache segment according to the address signal; In response to the scanning process, whenever the partial image exists in the cache segment, the partial image is sent to the high-efficiency processor; In response to the completion of scanning of a piece of the incoming PCB, the central control end is called to send a stop signal to the acquisition end; when the acquisition end receives the stop signal, it stops placing the acquired image into the cache segment, and calls the high-efficiency processor to splice all the partial images into the incoming PCB image.
4. The defect detection method based on multi-level matching and AI re-inspection according to claim 1, Features: Before performing misjudgment detection on the classified defect results based on the AI model, it includes: configuring a training data set, and training the AI detection model based on the training data set and a stochastic gradient descent algorithm.
5. The defect detection method based on multi-level matching and AI re-inspection according to claim 4, Features: The dividing of the template image into a plurality of imposition areas and a plurality of unit detection areas comprises: Dividing the template image into a plurality of the panel areas according to the drawing information of the PCB; Performing feature point adjustment based on contour feature point traversal on each of the imposition areas; In each of the imposition areas after the feature points are adjusted, a plurality of the unit detection areas are divided; Setting the upper limit of the size of a single unit detection area and the requirement on the number of feature points; The sizes and numbers of the unit detection areas in each of the imposition areas are adjusted according to the size upper limit and the requirement on the number of feature points.
6. The defect detection method based on multi-level matching and AI re-inspection according to claim 4, Features: The unit alignment operation includes: aligning the second imposition area with the first imposition area according to the mark information of the first imposition area corresponding to the second imposition area; after the alignment, dividing a number of second unit detection areas in the second imposition area according to the division method of the first unit detection areas in the first imposition area; and aligning the second unit detection areas with the first unit detection areas one by one.
7. The defect detection method based on multi-level matching and AI re-inspection according to claim 4, Features: The AI model-based misjudgment detection of the classified defect results includes: According to the first defect result, the second defect result and the third defect result, cropping defect images at corresponding positions in the incoming PCB image; The cropped defect image is input into the AI detection model for analysis, and the correctness of the first defect result, the second defect result and the third defect result is judged according to the determination result output by the AI detection model.
8. A defect detection system based on multi-level matching and AI re-inspection, It is characterized in that include: An initialization module is used to: configure an acquisition terminal, a processing terminal and a central control terminal based on a multi-PC architecture, initialize the working logic of the acquisition terminal and the central control terminal, and select an efficient processor at the processing terminal; The image acquisition module is used to call the acquisition end and the central control end to perform segmented acquisition of the incoming PCB image in a parallel operation mode, and transmit the acquired incoming PCB image segmented to the high-efficiency processor; The image processing module is used to call the high-efficiency processor to perform unitized hierarchical analysis on the received incoming PCB image; The unitized hierarchical analysis and processing includes: performing image registration on the incoming PCB image based on a preset template file and a hierarchical matching strategy, performing defect classification analysis on the registered image to obtain a classified defect result; performing misjudgment detection on the classified defect result based on an AI model; before performing image registration on the incoming PCB image based on a preset template file and a hierarchical matching strategy, it includes: setting a template image corresponding to the incoming PCB, dividing a number of panel areas and a number of unit detection areas in the template image, and using the divided template image as the preset template file; performing image registration on the incoming PCB image based on a preset template file and a hierarchical matching strategy, it includes: performing misjudgment detection on the classified defect result based on the AI model; The method further comprises: dividing the incoming PCB image according to the plurality of the imposition areas and the plurality of the unit detection areas, and performing hierarchical registration according to the divided incoming PCB image, the imposition area and the unit detection area; performing defect classification analysis according to the registered image to obtain a classified defect result, including: performing defect analysis on the registered image according to the material area, defect element type, color standard and size standard to obtain a first defect result, a second defect result and a third defect result as the classified defect result; dividing the incoming PCB image according to the plurality of the imposition areas and the plurality of the unit detection areas, and performing hierarchical registration according to the divided incoming PCB image, the imposition area and the unit detection area, including :Based on the characteristics of the incoming PCB, the incoming PCB image is preliminarily aligned with the template image, so that the several panel areas in the template image after the preliminarily alignment are respectively several first panel areas, and the several unit detection areas in the first panel areas are respectively several first unit detection areas; the incoming PCB image is divided into several second panel areas according to the several first panel areas, and the unit alignment operation is performed on each of the second panel areas in turn; the defect analysis of the registered image is performed according to the material area, defect element type, color standard and size standard to obtain the first defect result, the second defect result and the third defect result, including: setting a first color range, according to the Extract the copper material part in the registered image in the first color range to generate a first binary image, and subtract the first binary image from the template image to obtain a first difference result image; set a second color range, extract the substrate part in the registered image according to the second color range to generate a second binary image, and subtract the second binary image from the template image to obtain a second difference result image; merge the first difference result image and the second difference result image to obtain a third difference result image; confirm the defect position in the third difference result image, and determine whether the defect position meets the standard according to the element type corresponding to the defect position to obtain the first defect result; perform color compliance analysis on the copper material part to obtain the second defect result;Performing size compliance analysis on the hole area and the ring area in the registered image to obtain the third defect result. ; 9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the defect detection method based on multi-level matching and AI re-inspection described in any one of claims 1 to 7 are implemented.
