Flexible circuit board defect detection method and related apparatus
By using the YOLOv7 target detection algorithm and template matching technology, the efficiency and stability issues of flexible circuit board inspection have been solved, achieving high-accuracy automated inspection and real-time processing, which is suitable for defect detection of flexible circuit boards.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN SHIZONG AUTOMATION EQUIP CO LTD
- Filing Date
- 2023-04-23
- Publication Date
- 2026-06-02
AI Technical Summary
Existing methods for detecting defects in flexible circuit boards are inefficient and unstable. Manual inspection can damage eyesight, while AOI detection algorithms are sensitive to light sources and mechanical vibrations, leading to a decrease in detection accuracy.
The detection model is trained using the YOLOv7 target detection algorithm, and template matching technology is used to accurately locate and detect defects in circuit board images. The detection results are then processed using a suction cup and inkjet printing device.
It improves the robustness and accuracy of detection, reduces sensitivity to light sources and mechanical vibrations, meets the real-time requirements of production processes, and enables automated defect marking and storage.
Smart Images

Figure CN116664491B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine vision inspection technology, and in particular to a method and related apparatus for detecting defects in flexible circuit boards. Background Technology
[0002] Flexible circuit boards (PCBs) are widely used in the manufacturing of computers, communications, and consumer electronics. They consist of various thin films with different properties: a face film layer, an insulating layer, and a circuit layer. The circuit layer uses a polyester film with excellent electrical properties to manufacture the switching circuits, providing good insulation, heat resistance, and flexural strength. The switching circuit patterns, including the switch connections and leads, are printed using a low-resistance, low-temperature curing conductive coating. The entire PCB possesses a certain degree of flexibility and high resilience, making it suitable not only for use on flat surfaces but also for curved surfaces. Furthermore, it features low production costs and low density, which helps reduce the weight of end electronic products, making them easier to carry, thus leading to its widespread use and high production volume.
[0003] like Figure 1a and Figure 1b As shown, several defects can occur during the printing of flexible circuit boards: 1. Open circuits: These can prevent the circuit or part of the circuit from conducting, ultimately rendering the circuit board unusable; 2. Partially broken circuits: These partial breaks reduce the lifespan of the flexible film and may eventually render the entire circuit board unusable; 3. Burrs: These can cause short circuits, leading to malfunctions in electronic products. In short, these defects can damage or reduce the conductivity of the flexible circuit board, ultimately affecting the functionality of the end product.
[0004] One method for detecting defects in flexible circuit boards is manual visual inspection. This method involves laying the circuit board flat on an inspection platform, using an LED light source directly beneath the platform to transmit light through the flexible film, and then having the inspector carefully observe the circuit for the three main defects mentioned above. This method is inefficient, and prolonged observation can damage the inspector's eyesight. Therefore, some manufacturers use AOI (Automated Optical Inspection) to inspect flexible circuit boards. Automated inspection equipment uses a CCD camera to photograph the flexible film and then transmits the images to machine vision software on a computer for inspection. Compared to manual inspection, AOI is more efficient and does not cause eye damage to workers. However, most AOI algorithms currently require image filtering, binarization, edge detection, and image rotation correction, resulting in numerous parameter settings and unstable processing. Changes in light source conditions or vibrations in the mechanical movement of the circuit board can alter the pixel values of the image, rendering the previously set image processing parameters invalid and reducing the stability and accuracy of the inspection. Summary of the Invention
[0005] This invention aims to at least partially solve one of the technical problems in related technologies. Therefore, the object of this invention is to provide a method and related apparatus for detecting defects in flexible film circuit boards.
[0006] To achieve the above objectives, in a first aspect, a method for detecting defects in a flexible circuit board according to an embodiment of the present invention includes:
[0007] Obtain a defect sample dataset, which contains circuit board sample images with various different defects;
[0008] The YOLOv7 target detection algorithm is used, with a portion of the defect sample dataset as the training set and another portion of the defect sample dataset as the validation set, to train and validate the detection model.
[0009] An image of the circuit board to be inspected is acquired, and each circuit part in the image is accurately located using a template matching method. Then, the detection model is used to detect defects in each circuit.
[0010] According to one embodiment of the present invention, the defect includes one or more of the following: open circuit, partial open circuit, and burr.
[0011] According to one embodiment of the present invention, the step of using the YOLOv7 target detection algorithm, using a portion of the defect sample dataset as the training set and another portion of the defect sample dataset as the validation set, to train and validate the detection model includes:
[0012] The defect sample dataset is divided into a training set and a validation set, and data augmentation methods are used to augment the training set to expand it; both the training set and the validation set contain defect images and annotation files.
[0013] Load the pre-trained model weights and extract common image features from them to initialize the weights of the detection model.
[0014] A model was built using the YOLOv7 object detection algorithm, trained using the training set, and the training results were evaluated using the validation set.
[0015] According to one embodiment of the present invention, the steps of acquiring an image of the circuit board to be inspected, locating each circuit part in the image of the circuit board to be inspected using a template matching method, and then using the detection model for defect detection include:
[0016] Based on prior knowledge, the geometric dimensional relationship between each circuit part on the inspected circuit board image and the center position of the label image template is obtained; the label image template is a pre-made image template with a circuit board label.
[0017] Based on the geometric dimensions, images of each circuit portion on the circuit board image to be inspected are cropped as the inspected images;
[0018] The image to be inspected is transmitted to the inspection model for inspection. When a defect is detected, the position of the defect in the image to be inspected is mapped to the image of the circuit board to be inspected, and its position and defect type are marked on the image of the circuit board to be inspected.
[0019] According to an embodiment of the present invention, obtaining the geometric dimensional relationship between each circuit part on the detected circuit board image and the center position of the label image template based on prior knowledge includes:
[0020] The process begins by cropping from one corner of the image of the circuit board being inspected and ends at a predetermined point to obtain a cropped image containing the circuit board's label.
[0021] The normalized correlation matching method is used to perform template matching between the cropped image and the label image template to obtain the position of the center of the label in the cropped image.
[0022] The center position of the matched label is mapped onto the image of the circuit board to be inspected, and the position of the center position of the label in the image of the circuit board to be inspected is obtained. Then, the geometric dimension relationship between the center position of each circuit part on the image of the circuit board to be inspected and the center position of the label image template is obtained.
[0023] According to one embodiment of the present invention, it further includes:
[0024] After a defect is detected, the defect type and location are marked on the circuit image being inspected, and the image is named with the inspection time and saved to the corresponding folder on the computer; at the same time, a signal is sent to the suction cup device control system, and the suction cup transports the physical circuit board to the defective product storage bin.
[0025] A signal is sent to the inkjet printing equipment control system so that the inkjet printing equipment records defect information and detection time on the physical circuit board being inspected, and the defect information and detection time are associated with the saved electronic image.
[0026] In a second aspect, an apparatus for detecting defects in flexible circuit boards according to an embodiment of the present invention includes:
[0027] An acquisition unit is used to acquire a defect sample dataset, which contains circuit board sample images with various different defects;
[0028] The training unit is used to train and validate the detection model using a target detection algorithm, with a portion of the data in the defect sample dataset as the training set and another portion of the data in the defect sample dataset as the validation set.
[0029] The detection unit is used to acquire an image of the circuit board to be inspected, and to accurately locate each circuit part in the image of the circuit board to be inspected using a template matching method, and then to use the detection model to detect defects in each circuit.
[0030] According to one embodiment of the present invention, the detection unit includes:
[0031] The matching module is used to obtain the geometric dimensional relationship between each circuit part on the circuit board image being inspected and the center position of the label image template based on prior knowledge; the label image template is a pre-made image template with circuit board labels.
[0032] The cropping module is used to crop images of various circuit parts on the circuit board image to be inspected, based on the geometric size relationship, as the inspected image.
[0033] The detection module is used to transmit the image to be inspected to the detection model for inspection. When a defect is detected, the position of the defect in the image to be inspected is mapped to the image of the circuit board to be inspected, and the position and defect type are marked on the image of the circuit board to be inspected. The electronic image is then saved to the corresponding folder on the computer.
[0034] Thirdly, a computer device according to an embodiment of the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the flexible film circuit board defect detection method as described above.
[0035] Fourthly, according to an embodiment of the present invention, a computer storage medium thereon stores a computer program that, when executed by a processor, implements the flexible film circuit board defect detection method as described above.
[0036] The method and apparatus for detecting defects in flexible circuit boards provided in this embodiment of the invention use the YOLOv7 target detection algorithm as the basic detection model. It is not sensitive to changes in image capture caused by vibration of the transmission machine or unstable light source, does not require setting a large number of processing parameters, has strong robustness, and has a higher target recognition accuracy. In addition, it can meet the requirements of the entire flexible circuit board production process in terms of real-time detection. The inkjet printing and suction cup transmission device specially marks the physical circuit boards with detected defects and stores them in the defective product storage warehouse for workers to carry out subsequent processing.
[0037] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the structures shown in these drawings without creative effort.
[0039] Figure 1a This is a schematic diagram of a flexible film circuit board;
[0040] Figure 1b This is a schematic diagram of various defects in flexible film circuit boards;
[0041] Figure 2a This is a schematic diagram of the defect detection method for flexible film circuit boards according to the present invention;
[0042] Figure 2b This is a schematic diagram of the bottom surface of the suction cup device used in the defect detection method for flexible film circuit boards of the present invention;
[0043] Figure 2c This is a flowchart of an embodiment of the flexible film circuit board defect detection method of the present invention;
[0044] Figure 3 This is a flowchart of step S102 in the method for detecting defects in flexible film circuit boards of the present invention;
[0045] Figure 4 This is a flowchart of step S103 in the method for detecting defects in flexible film circuit boards of the present invention;
[0046] Figure 5 This is a schematic diagram of the circuit board label for a flexible film circuit board;
[0047] Figure 6 This is a schematic diagram of the results detected using the flexible film circuit board defect detection method of the present invention;
[0048] Figure 7 This is a schematic diagram of the structure of one embodiment of the flexible film circuit board defect detection device of the present invention;
[0049] Figure 8 This is a schematic diagram of the training unit in the flexible film circuit board defect detection device of the present invention;
[0050] Figure 9 This is a schematic diagram of the detection unit in the flexible film circuit board defect detection device of the present invention.
[0051] Figure 10 This is a schematic diagram of the structure of one embodiment of the computer device of the present invention.
[0052] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0053] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0054] Reference Figure 2a As shown, the entire inspection process is controlled by an industrial computer. First, the computer sends a signal to the suction cup control system. The suction cup transports the flexible circuit board to be inspected to the inspection platform. The inspection platform moves directly above the light source and then sends a signal to the camera to take a picture. The inspection system then performs the inspection. If a defect is detected, the inspection system sends a signal to the suction cup control system, and the suction cup transports the physical circuit board to the defective product storage area. Then, the inkjet printer marks the circuit board. If no defect is detected, the suction cup transports the circuit board to the good product storage area. Specifically, this includes:
[0055] Figure 2b The bottom surface shape and dimensions of the suction cup device are shown. Because the size of the soft membrane being inspected in one operation is relatively large, measuring 500mm × 700mm, and it contains four circuit boards, the suction cup is designed to be 480mm × 680mm. If only one suction hole is made on the bottom of the suction cup, the hole size would be too small to completely hold the circuit boards, and due to the flexibility of the soft membrane, the circuit boards at the edges would sag, affecting the transmission of the circuit boards. However, if the hole size is too large, the soft membrane may be sucked into the hole by the airflow, and the edges of the suction hole may scratch the surface of the soft membrane. Therefore, six appropriately sized circular vent holes are made on the bottom surface of the suction cup to ensure that the soft membrane is completely adsorbed on the suction cup surface while avoiding damage to the circuit surface. In addition, the suction cup can also make the soft membrane lay flat during imaging, avoiding wrinkles, curling, air bubbles, etc., which would affect the image quality and thus reduce the detection accuracy.
[0056] Figure 2c A flowchart of one embodiment of the flexible circuit board defect detection method provided by the present invention is shown. For ease of description, only the parts related to the embodiment of the present invention are shown. Specifically, the flexible circuit board defect detection method can be executed by a computer device and includes:
[0057] S101. Obtain a defect sample dataset, which contains circuit board sample images with various defects.
[0058] The aforementioned defects can include different types of defects such as open circuits, partial open circuits, and burrs, for example... Figure 1b As shown, this defect sample dataset can be created manually or collected from actual production. To ensure the accuracy of the detection model, it is necessary to ensure the diversity and representativeness of the defect sample dataset.
[0059] For example, images of defective circuit boards are collected beforehand; these images are raw images captured by a camera. The defective regions are then cropped from these raw images. Because the raw images are large (e.g., 5472×3648 pixels), while the input size of the detection model is smaller (e.g., 608×608 pixels), the raw images cannot be directly input into the detection model. Therefore, the size of the cropped images is set to 608×608. During the initial training of the model, a large number of images containing defects such as open circuits, half-open circuits, and burrs are cropped. The defects in the images are then labeled using LabelImg software, categorized into three types: broken, half-broken, and rag. In the example of this application, 2280 images with defects are cropped.
[0060] S102. Using the YOLOv7 target detection algorithm, a portion of the data in the defect sample dataset is used as the training set, and another portion of the data in the defect sample dataset is used as the validation set to train and validate the detection model.
[0061] In the method of this application, the YOLOv7 object detection algorithm is used as the basic detection model, and the detection model is trained using training and validation sets. The YOLOv7 algorithm is an object detection algorithm based on convolutional neural networks, which can simultaneously perform object localization and object classification, and exhibits excellent performance in both speed and accuracy. Through training, the detection model can learn the characteristics of different types of defects, thereby accurately detecting defects in the circuit image to be inspected.
[0062] For example, 80% of the images in the dataset can be used as the training set, and 20% as the validation set. The number of training classes is set to 3, and the total number of training epochs is set to 2000. The training batch size is set to 16, where BatchSize is the number of samples selected in one training iteration. The batch size affects the optimization degree and speed of the model; setting a reasonable batch size can improve memory utilization and make the gradient descent direction more accurate. After training the model, the live detection mAP@0.5 on the validation set is 0.907, meeting the requirements of the detection process. In subsequent production processes, new defect samples can be continuously collected and added to the dataset, and the detection model can be retrained every production cycle. As the size and diversity of the dataset continue to increase, the model's recognition accuracy will continue to improve.
[0063] Preferably, the YOLOv7 object detection algorithm can be used as the basic detection model. YOLOv7 is the latest algorithm in the YOLO series, extending the network with an efficient long-range attention network called Extended-ELAN (E-ELAN). E-ELAN performs operations such as expanding, shuffling, and merging cardinality, improving the network's learning ability while avoiding damage to the original gradient path. Therefore, Extended-ELAN can be deployed on a large scale in the backbone network to ultimately improve the model's training accuracy. YOLOv7 also employs a reparameterized convolutional network structure called RepConv, which can fuse Conv+BN (Batch Normalization) layers and different Conv layers into a single convolutional module. Its purpose is to accelerate network computation while ensuring model performance. In addition, YOLOv7 adds an auxiliary head detection function, which extracts the shallow features of the network's head as an auxiliary head, and the deep features, which are the network's final output, as a lead head. The cooperation between the auxiliary head and the lead head improves the accuracy of the loss function.
[0064] S103. Obtain an image of the circuit board to be inspected, use template matching to accurately locate each circuit part in the image of the circuit board to be inspected, and then use the detection model to detect defects in each circuit.
[0065] In practical applications, a suction cup or similar moving device is typically used to pick up the soft film from a fixture containing the film, and then it is moved to a detection platform. The detection platform is surrounded by baffles to limit the imaging range of the circuit board. The platform is then moved directly above the light source for detection. Because the baffles need to leave redundant gaps for the circuit board to ensure it can be placed in the detection platform and completely flattened on its surface, the circuit board cannot always be in the same position on the platform. Therefore, the captured circuit image will not always maintain the same position. Thus, this step uses template matching to precisely locate the circuit in the image, ensuring the detection range covers all circuits. Without template matching, every part of the entire image would need to be detected. While this would completely cover all circuits, gaps without circuits would also need to be input into the model for detection, wasting significant detection time and resulting in low detection efficiency.
[0066] During the inspection process, the detection model trained in step S102 performs multiple convolution and pooling operations on the circuit board image to extract features. Then, a regression algorithm is used to adjust each bounding box, ultimately outputting the confidence score, category information, location, height, and width of each bounding box. Based on the output, the type and location of defects in the circuit board can be determined.
[0067] The flexible circuit board defect detection method provided by the present invention uses the YOLOv7 target detection algorithm as the basic detection model. It is not sensitive to changes caused by vibration of the transmission machine or unstable light source during image capture, does not require setting a large number of processing parameters, has strong robustness, and has a higher target recognition accuracy. In addition, it can meet the requirements of the entire flexible circuit board production process in terms of real-time detection.
[0068] In one example of the invention, it also includes:
[0069] S104. For the soft film circuit boards that are found to be defective, use a suction cup device to transfer them to the defective warehouse and use an inkjet printer to mark them so that workers can carry out subsequent processing.
[0070] Reference Figure 3 As shown, in one embodiment of the present invention, step S102 includes:
[0071] S201. Divide the defect sample dataset into a training set and a validation set, and use data augmentation methods to augment the training set to expand it; both the training set and the validation set contain defect images and annotation files.
[0072] For example, image and annotation file naming: Ensure that the image file and annotation file have the same filename and use the same filename prefix, such as "image_001.jpg" and "image_001.xml". Annotation files typically use a specific format, with each annotation file corresponding to one image file. The annotation file will display information such as the category of each defect target, the coordinates of the top-left and bottom-right vertices of the annotation box, etc.
[0073] Because the model has a large number of parameters, training it with insufficient data will lead to overfitting. Therefore, data augmentation is necessary. Techniques such as flipping (horizontal and vertical flipping of the image), rotation, scaling, cropping, translation, and Gaussian noise (random white and black pixels filling the entire image) can be used to process the dataset.
[0074] S202. Load the pre-trained model weights and extract common image features from them to enable the detection model to obtain better initial weights.
[0075] Despite the use of data augmentation, the amount of data is still very small. Therefore, in this step, a pre-trained model is loaded. Loading a pre-trained model allows the network to obtain better initial weights. These weights have already been trained on a large dataset like COCO and can extract more general image features, helping to identify features such as edges, textures, and shapes. This also reduces a significant amount of training work and, to some extent, solves the problem caused by the small number of images in the training dataset.
[0076] S203. Build a model using the YOLOv7 object detection algorithm, train the model using the training set, and evaluate the training results using the validation set.
[0077] Specifically, training a model requires training data. The training process includes forward propagation, backpropagation, and weight updates. In each training epoch, the model receives the training data for forward propagation, calculating the predicted output. Then, the predicted output is compared to the actual label values, and the model's loss function is calculated. During backpropagation, the model updates the weights based on the gradient information of the loss function, making the predicted output values closer to the actual label values. Through multiple training epochs, the model's weight parameters are gradually optimized, thereby improving the model's accuracy and robustness.
[0078] After model training, it needs to be evaluated to determine metrics such as accuracy and recall. Commonly used evaluation metrics include mAP (malignant pinpoint accuracy). mAP is a commonly used evaluation metric in object detection algorithms, assessing the model's average accuracy at different confidence thresholds. To calculate mAP, validation set data is used to evaluate the model. Specifically, validation set data is input into the model for object detection, yielding the model's predictions. These predictions are then compared to the true labels to obtain the model's mAP. Based on the evaluation results, the model can be adjusted and optimized to improve its performance.
[0079] This embodiment employs the above method, which can significantly improve the accuracy and robustness of the model with a relatively small amount of data, thus meeting the detection requirements for defect detection of flexible circuit boards in industrial production.
[0080] Reference Figure 4 As shown, in some embodiments of the present invention, step S103 includes:
[0081] S301. Based on prior knowledge, obtain the geometric dimensional relationship between each circuit part on the circuit board image being inspected and the center position of the label image template; the label image template is a pre-made image template with circuit board labels.
[0082] The label image template highlights the main shape and features of the circuit board label, such as the label's lines and text. These features help the template matching algorithm accurately locate the circuit board label in each image.
[0083] In some examples, this step may specifically include:
[0084] First, a cropping process is performed starting from a corner of the image of the circuit board to be inspected and ending at a predetermined point to obtain a cropped image containing the circuit board's label. This is because the original image is relatively large (e.g., 5472×3648). If matching is performed directly on the original image, not only is the matching range large and the computation time required, but the labels in the image are also line-shaped and somewhat similar to the circuit, making matching errors more likely.
[0085] Then, the normalized correlation matching method is used to perform template matching between the cropped image and the label image template to obtain the position of the center of the label in the cropped image.
[0086] Finally, the center position of the matched label is mapped onto the image of the circuit board being inspected, so as to obtain the position of the center position of the label in the image of the circuit board being inspected, and thus obtain the geometric dimension relationship between the center position of each circuit part on the image of the circuit board being inspected and the center position of the label image template.
[0087] For example: Starting from the top left corner of the image of the circuit board being inspected at coordinates [430, 470], and ending at [1000, 770], the image is cropped. This cropped portion contains the circuit board's label, such as... Figure 5 As shown. Then, during the detection process for each image, a template matching method called TM_CCORR_NORMED (normalized correlation matching) is used to calculate the correlation coefficient between the template and the image, obtaining the position [x, y] of the label's center in the cropped image. Finally, this position is mapped back to the original image, obtaining the position [x+430, y+470] of the point in the original image. Since the coordinates of the top-left corner of the cropped image are [430, 470], this offset needs to be added to the detected circuit board label position [x, y] to obtain the position [x+430, y+470] of the point in the original image. In this way, the position of the circuit board label can be quickly and accurately detected in each image and mapped back to the original image, providing a cropping reference point for subsequent circuit part detection.
[0088] In this example, by first cropping the image containing the label and then performing template matching, the matching time can be saved and the detection efficiency can be improved.
[0089] S302. Based on the geometric dimensions, images of each circuit portion on the circuit board image to be inspected are cropped as the inspected image. For example, the size of each cropped image is 608×608, that is, the size of the inspected image is 608×608.
[0090] Based on prior knowledge, the geometric dimensional relationship between each circuit part on the image and the center position of the label image template can be obtained. According to this dimensional information, the circuits in the image can be cropped sequentially, thus covering all detection circuits and avoiding cropping the image of gap parts, thereby saving matching time and improving detection efficiency.
[0091] For example, the image capture process may include: first, determining the size and position of each circuit region to be captured based on the dimensional relationships of the circuit components; for each circuit region, capturing a 608×608 pixel image from the inspected circuit board image as the inspected image; recording the position of the top-left corner vertex of each inspected image in the original image; repeating the above steps until the entire inspected circuit board image is covered.
[0092] S303. The image to be inspected is transmitted to the inspection model for inspection. When a defect is detected, the position of the defect in the image to be inspected is mapped to the image of the circuit board to be inspected, and its position and defect type are marked in the image of the circuit board to be inspected.
[0093] In this step, the image to be inspected is transmitted to a trained model for detection. If the detection results show one or more defects, such as... Figure 6 As shown, the defect is marked in the inspected image, and its position is mapped to the original large image (the complete image of the inspected circuit board). It should be noted that each time an image is captured, the position of the top-left corner of the inspected image in the original image is recorded in the program. Then, the position of the detected defect in the inspected image is added to the position of the top-left corner in the original image to obtain the position of the defect in the original image.
[0094] Overall, this embodiment can improve detection efficiency and accuracy. In step S302, based on prior knowledge, the image of the circuit board to be inspected is divided into several images corresponding to each circuit area, avoiding errors when matching in the original image and saving calculation time. In step S303, the location of the detected defect in the image is mapped to the image of the circuit board to be inspected and marked in the image of the circuit board to be inspected. In this way, the location of the defect can be found quickly and accurately.
[0095] In some embodiments of the present invention, the method further includes:
[0096] After a defect is detected, the defect type and location are first marked on the image of the circuit being inspected, and the image is named with the inspection time and saved to the corresponding folder on the computer. During this process, a control signal is output to the suction cup device, which transfers the circuit board to the defective product storage bin. Then, the inkjet printing device is controlled to record defect information and the inspection time on the actual circuit board corresponding to the inspected circuit board image. This defect information and inspection time are associated with the circuit image to facilitate subsequent re-inspection by the inspection worker by comparing it with the defect image saved on the industrial control computer. If no defect is found, a control signal is output to the suction cup device, which transfers the circuit board to the good product storage bin, and then the next circuit board is inspected.
[0097] For example, after a circuit board defect is detected, the electronic image of the inspected circuit board is first named with the inspection time and saved to the corresponding folder on the industrial control computer. If no defect is found, the next circuit board is inspected directly. When a defect is detected, a control signal is output to the suction cup and the inkjet printer, causing the suction cup to transfer the circuit board to the defective storage area, and then the inkjet printer records the defect information on the physical circuit board. This allows the inspection worker to easily compare the defect image saved on the industrial control computer for subsequent processing. When recording defect information, special markers or codes can be used for quick identification and management of defect information. Simultaneously, the recorded defect information needs to be associated with the image of the circuit to be inspected for convenient subsequent operation and management. In subsequent operation and management, the inspection worker can query or search the database to find the defect information associated with the image of the circuit to be inspected. This allows for rapid location and processing of defects, improving production efficiency and quality.
[0098] In short, by automatically recording defect information and associating it with the image of the circuit to be inspected, inspectors can easily refer to the saved defect images for subsequent processing. At the same time, it can improve production efficiency and quality, and reduce manual intervention and error rates.
[0099] Reference Figure 7 As shown, Figure 7 This diagram illustrates a structural schematic of one embodiment of the apparatus for detecting defects in flexible circuit boards provided by the present invention. For ease of description, only the parts relevant to the embodiment of the present invention are shown. Specifically, the apparatus for detecting defects in flexible circuit boards includes:
[0100] The acquisition unit 201 is used to acquire a defect sample dataset, which contains circuit board sample images with various different defects;
[0101] Training unit 202 is used to train and validate a detection model using a target detection algorithm, with a portion of the data in the defect sample dataset as the training set and another portion of the data in the defect sample dataset as the validation set.
[0102] The detection unit 203 is used to acquire an image of the circuit board to be inspected, and to accurately locate each circuit part in the image of the circuit board to be inspected by using a template matching method, and then to use the detection model to detect defects in each circuit.
[0103] Reference Figure 8 As shown, in one embodiment of the present invention, the training unit 202 includes:
[0104] The data processing module 2021 is used to divide the defect sample dataset into a training set and a validation set, and to use data augmentation methods to augment the training set to expand it; both the training set and the validation set contain defect images and annotation files.
[0105] The pre-training module 2022 is used to load pre-trained model weights and extract common image features from them so that the detection model can obtain better initial weights.
[0106] The Training Module 2023 is used to build a model using the YOLOv7 object detection algorithm, train the model using the training set, and evaluate the training model results using the validation set.
[0107] Reference Figure 9 As shown, in one embodiment of the present invention, the detection unit 203 includes:
[0108] The matching module 2031 is used to obtain the geometric dimensional relationship between each circuit part on the circuit board image being detected and the center position of the label image template based on prior knowledge; the label image template is a pre-made image template with circuit board labels.
[0109] The cropping module 2032 is used to crop images of each circuit part on the circuit board image to be inspected as the inspected image according to the geometric size relationship.
[0110] The detection module 2033 is used to transmit the image to be inspected to the detection model for inspection, and when a defect is detected, to map the position of the defect in the image to be inspected to the image of the circuit board to be inspected, and to mark its position and defect type in the image of the circuit board to be inspected.
[0111] In one embodiment of the present invention, the matching module 2031 includes:
[0112] The matching image cropping module is used to crop from a corner point of the detected circuit board image to a predetermined point to obtain a cropped image containing the circuit board label.
[0113] The normalized matching module is used to perform template matching between the cropped image and the label image template using the normalized correlation matching method, so as to obtain the position of the center of the label in the cropped image in the cropped image;
[0114] The mapping module is used to map the center position of the matched label onto the image of the circuit board to be inspected, thereby obtaining the position of the center position of the label in the image of the circuit board to be inspected, and thus obtaining the geometric dimension relationship between the center position of each circuit part on the image of the circuit board to be inspected and the center position of the label image template.
[0115] In some embodiments of the present invention, the device further includes:
[0116] The command output module is used to output control signals to the suction cup and the inkjet printing device after a defect is detected, so that the suction cup device can transfer the circuit board to the defective compartment, and the inkjet printing device can record defect information and detection time on the actual circuit board corresponding to the image of the circuit board to be detected. The defect information and detection time are associated with the image of the circuit board to be detected.
[0117] The flexible circuit board defect detection device provided in this embodiment of the invention uses the YOLOv7 target detection algorithm as the basic detection model. It is not sensitive to changes caused by vibration of the transmission machine or unstable light source during image capture. It does not require setting a large number of processing parameters, has strong robustness, and has a higher target recognition accuracy. In addition, it can meet the requirements of the entire flexible circuit board production process in terms of real-time detection.
[0118] Reference Figure 10 As shown, this embodiment of the invention also provides a computer device 100, including a memory 102, a processor 101, and a computer program 1021 stored in the memory 102 and executable on the processor 101. When the processor 101 executes the computer program 1021, it implements the soft film circuit board defect detection method as described above.
[0119] For example, the computer program 1021 may be divided into one or more modules / units, which are stored in the memory 102 and executed by the processor 101 to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program 1021 in the computer device.
[0120] This invention also provides a computer storage medium storing a computer program 1021, which, when executed by a processor, implements the soft film circuit board defect detection method as described above.
[0121] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For apparatus or system embodiments, since they are basically similar to the method embodiments, the descriptions are relatively simple, and relevant parts can be referred to the descriptions of the method embodiments.
[0122] It should also be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0123] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0124] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for detecting defects in flexible film circuit boards, characterized in that, include: Obtain a defect sample dataset, which contains circuit board sample images with various different defects; The YOLOv7 target detection algorithm is used, with a portion of the defect sample dataset as the training set and another portion of the defect sample dataset as the validation set, to train and validate the detection model. The circuit board image to be inspected is acquired, and each circuit part in the circuit board image is accurately located by template matching. Then, the detection model is used to detect defects in each circuit. The process of acquiring the image of the circuit board to be inspected, locating each circuit part in the image using template matching, and then using the detection model to perform defect detection includes: Based on prior knowledge, the geometric dimensional relationship between each circuit part on the inspected circuit board image and the center position of the label image template is obtained; the label image template is a pre-made image template with a circuit board label. Based on the geometric dimensions, images of each circuit portion on the circuit board image to be inspected are cropped as the inspected images; The image to be inspected is transmitted to the inspection model for inspection. When a defect is detected, the position of the defect in the image to be inspected is mapped back to the image of the circuit board to be inspected, and its position and defect type are marked in the image of the circuit board to be inspected. The step of obtaining the geometric dimensional relationship between each circuit part on the detected circuit board image and the center position of the label image template based on prior knowledge includes: The process begins by cropping from one corner of the image of the circuit board being inspected and ends at a predetermined point to obtain a cropped image containing the circuit board's label. The normalized correlation matching method is used to perform template matching between the cropped image and the label image template to obtain the position of the center of the label in the cropped image. The center position of the matched label is mapped onto the image of the circuit board to be inspected, and the position of the center position of the label in the image of the circuit board to be inspected is obtained. Then, the geometric dimension relationship between the center position of each circuit part on the image of the circuit board to be inspected and the center position of the label image template is obtained.
2. The method for detecting defects in flexible film circuit boards according to claim 1, characterized in that, The defects include one or more of the following: open circuit, partial open circuit, and burrs.
3. The method for detecting defects in flexible film circuit boards according to claim 2, characterized in that, The step of using the YOLOv7 object detection algorithm, with a portion of the defect sample dataset as the training set and another portion as the validation set, to train and validate the detection model includes: The defect sample dataset is divided into a training set and a validation set, and data augmentation methods are used to augment the training set to expand it; both the training set and the validation set contain defect images and annotation files. Load the pre-trained model weights and extract common image features from them to enable the detection model to obtain initialized weights; A model was built using the YOLOv7 object detection algorithm, trained using the training set, and the training results were evaluated using the validation set.
4. The method for detecting defects in flexible film circuit boards according to claim 1, characterized in that, Also includes: After a defect is detected, the defect type and location are marked on the circuit image being inspected, and the image is named with the inspection time and saved to the corresponding folder on the computer; at the same time, a signal is sent to the suction cup device control system, and the suction cup transports the physical circuit board to the defective product storage bin. A signal is sent to the inkjet printing equipment control system so that the inkjet printing equipment records defect information and detection time on the physical circuit board being inspected, and the defect information and detection time are associated with the saved electronic image.
5. A defect detection device for flexible film circuit boards, characterized in that, include: An acquisition unit is used to acquire a defect sample dataset, which contains circuit board sample images with various different defects; The training unit is used to train and validate the detection model using a target detection algorithm, with a portion of the data in the defect sample dataset as the training set and another portion of the data in the defect sample dataset as the validation set. The detection unit is used to acquire an image of the circuit board to be inspected, and to accurately locate each circuit part in the image of the circuit board to be inspected using a template matching method, and then to use the detection model to detect defects in each circuit. The detection unit includes: The matching module is used to obtain the geometric dimensional relationship between each circuit part on the circuit board image being inspected and the center position of the label image template based on prior knowledge; the label image template is a pre-made image template with circuit board labels. The cropping module is used to crop images of various circuit parts on the circuit board image to be inspected, based on the geometric size relationship, as the inspected image. The detection module is used to transmit the image to be inspected to the detection model for inspection, and when a defect is detected, it maps the position of the defect in the image to the image of the circuit board to be inspected, marks its position and defect type in the image of the circuit board to be inspected, and saves the image of the circuit board to the corresponding folder in the computer. The matching module includes: The matching image cropping module is used to crop from a corner point of the detected circuit board image to a predetermined point to obtain a cropped image containing the circuit board label. The normalized matching module is used to perform template matching between the cropped image and the label image template using the normalized correlation matching method, so as to obtain the position of the center of the label in the cropped image in the cropped image; The mapping module is used to map the center position of the matched label onto the image of the circuit board to be inspected, thereby obtaining the position of the center position of the label in the image of the circuit board to be inspected, and thus obtaining the geometric dimension relationship between the center position of each circuit part on the image of the circuit board to be inspected and the center position of the label image template.
6. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method for detecting defects in flexible circuit boards as described in any one of claims 1 to 4.
7. A computer storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method for detecting defects in flexible circuit boards as described in any one of claims 1 to 4.