Artificial intelligence-based PCB detection method, terminal equipment and storage medium
Through the PCB detection method based on artificial intelligence, combined with external appearance diagram and internal thermal imaging diagram, the external defect and internal fault detection models are used for automated detection, which solves the problem of inefficient complex fault diagnosis in traditional methods, and achieves more efficient and accurate fault detection.
Patent Information
- Application Number
- CN202411237770.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-09-05
AI Technical Summary
Traditional PCB fault diagnosis methods are complex in operation, have high misjudgment rate, and are difficult to detect internal faults, resulting in low efficiency and low accuracy.
Using an artificial intelligence-based PCB detection method, combining external appearance diagrams and internal thermal imaging diagrams, an external defect detection model and internal fault detection model are used for automated comprehensive detection, and the detection model is continuously improved through iterative training.
It improves the accuracy and efficiency of PCB fault detection, and can more comprehensively analyze the PCB status, reduce manual intervention, and reduce manufacturing costs.
Smart Images

Figure CN118781097B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of circuit board detection, and in particular to an artificial intelligence-based PCB detection method, terminal equipment and computer-readable storage medium. Background Art
[0002] As we all know, in the electronic manufacturing process, PCB (Printed Circuit Board) board fault diagnosis and location is an important and complex task. Traditional fault diagnosis methods usually rely on the operator's professional knowledge and experience, and are carried out through visual inspection, instrument testing, etc. However, the traditional fault diagnosis methods currently used by industries or enterprises generally have the following three core pain points:
[0003] (1) Complex operation and long debugging time: Traditional fault diagnosis methods are complex to operate and take a long time to debug, and require high proficiency of operators. Once personnel turnover occurs, it is difficult to continue the equipment detection effect, thus affecting production efficiency.
[0004] (2) High misjudgment rate: Traditional fault diagnosis algorithms are difficult to accommodate the multi-morphological features of solder joints, resulting in a high misjudgment rate. This greatly increases the workload of operators for re-judgment, thereby accelerating operator fatigue and increasing the risk of missed detection.
[0005] (3) Difficulty in detecting internal faults: When detecting damage to SMT (Surface Mount Technology) components (such as chips, integrated circuits, connectors, etc.), it is necessary to detect faults or damage inside the PCB board. These internal faults or damage may not show obvious appearance characteristics on the outer surface of the PCB, making it difficult to predict the appearance of the faulty or damaged parts.
[0006] It can be seen that traditional fault diagnosis methods are inefficient and difficult to accurately diagnose complex fault modes. Therefore, developing an artificial intelligence-based PCB board fault diagnosis and location method is of great significance for improving production efficiency and reducing manufacturing costs. Summary of the invention
[0007] In view of this, the present invention proposes a PCB detection method, terminal device and computer-readable storage medium based on artificial intelligence, aiming to solve the current problem of low efficiency and low accuracy in PCB board defect fault detection.
[0008] In order to solve the above problems, the present invention adopts the following technical solutions:
[0009] In a first aspect, the present invention proposes a PCB detection method based on artificial intelligence, comprising:
[0010] Acquire an image of the PCB to be inspected, and input the image into a trained inspection model; wherein the image includes an external appearance image of the PCB and a thermal image of the inside of the PCB, and the inspection model includes an external defect detection model and an internal fault detection model;
[0011] Obtaining a detection result of the PCB through the detection model;
[0012] The detection result and the repair result corresponding to the detection result are input into the detection model for iterative training so as to correct the detection model.
[0013] Furthermore, when the image is an external appearance diagram of the PCB, and the detection model is an external defect detection model, the PCB detection method includes:
[0014] Obtaining an outline drawing of the PCB to be inspected, preprocessing the outline drawing, and inputting the preprocessed outline drawing into a trained external defect detection model;
[0015] Obtaining an external defect detection result of the PCB through the external defect detection model;
[0016] Inputting the external defect detection result and the repair result corresponding to the external defect detection result into the external defect detection model for iterative training, so as to correct the external defect detection model;
[0017] The training step of the external defect detection model includes:
[0018] Collecting an outline drawing of a PCB and preprocessing the outline drawing;
[0019] Compare the preprocessed appearance drawing with the preset normal appearance drawing, mark the defect state on the appearance drawing, and save the defect marking data to build a first training database; wherein the defect state includes a missing hole state, a mouse bite state, an open circuit state, a short circuit state, a stray state, and a pseudo copper state;
[0020] The defect annotation data of the first training database is input into a preset external defect detection model, and trained using a preset external defect algorithm, so that the external defect detection model can distinguish external defects based on the normal appearance image.
[0021] Further, the obtaining of the external defect detection result of the PCB includes:
[0022] Obtaining external defects of the PCB and acquiring coordinate information of the PCB surface;
[0023] In combination with the coordinate information, the defect position where the external defect exists is located to obtain the external defect detection result.
[0024] Furthermore, when the image is a thermal image of the inside of the PCB, and the detection model is an internal fault detection model, the PCB detection method includes:
[0025] Obtaining a thermal image of the PCB to be inspected, preprocessing the thermal image, and inputting the preprocessed thermal image into a trained internal fault detection model;
[0026] Obtaining an internal fault detection result of the PCB through the internal fault detection model;
[0027] Inputting the internal fault detection result and the repair result corresponding to the internal fault detection result into the internal fault detection model for iterative training, so as to correct the internal fault detection model;
[0028] The training step of the internal fault detection model includes:
[0029] Collecting a thermal image of the PCB and preprocessing the thermal image;
[0030] Compare the preprocessed thermal image with the preset normal thermal image, mark the fault state on the thermal image, and save the fault marking data to build a second training database; wherein the fault state includes a component bad state, a component short circuit state, a component open circuit state, and a component poor contact state;
[0031] The fault annotation data of the second training database is input into a preset internal fault detection model, and trained using a preset internal fault algorithm, so that the internal fault detection model can distinguish internal faults based on the normal thermal imaging image.
[0032] Further, the obtaining of the internal fault trap detection result of the PCB includes:
[0033] Obtaining internal faults of the PCB and acquiring location information of components of the PCB;
[0034] In combination with the position information, the component with the internal fault is located to obtain the internal fault detection result.
[0035] Furthermore, obtaining the internal fault detection result of the PCB through the internal fault detection model includes:
[0036] The preset normal thermal image of the internal fault detection model is recorded as img1.jpg, and the thermal image of the PCB to be detected is recorded as img2.jpg;
[0037] Use the image reading function imread of the OpenCV module to read img1.jpg and img2.jpg, and use the absdiff difference algorithm of the OpenCV module to calculate the difference between img1.jpg and img2.jpg to obtain a difference map of img1.jpg and img2.jpg; wherein the pixel value of the difference map represents the degree of difference between the corresponding pixels of img1.jpg and img2.jpg;
[0038] Use the cvtColor function to convert the difference image from the BGR color space to a grayscale space to obtain a grayscale difference image, and record the grayscale difference image as img3.jpg;
[0039] By comparing the magnitudes of the grayscale differences, the position where the grayscale difference exceeds the preset grayscale difference threshold is found in the img3.jpg, and the position where the temperature difference exceeds the preset temperature difference threshold is determined based on the position and the preset linear relationship between the grayscale and the temperature;
[0040] The internal fault detection model is used to determine the internal fault existing at the position, so as to obtain the internal fault detection result of the PCB.
[0041] Furthermore, the preset linear relationship between grayscale and temperature includes:
[0042] ;
[0043] Among them, S is the grayscale value of the image pixel in the grayscale difference image, T is the temperature value of the image pixel in the thermal imaging image, Tmin is the lowest temperature in the temperature range displayed in the thermal imaging image, Tmax is the highest temperature in the temperature range displayed in the thermal imaging image, and N is the number of grayscales in the grayscale difference image.
[0044] Furthermore, obtaining the internal fault detection result of the PCB through the internal fault detection model includes:
[0045] The preset normal thermal image of the internal fault detection model is recorded as img1.jpg, and the thermal image of the PCB to be detected is recorded as img2.jpg;
[0046] Use the image reading function imread of the OpenCV module to read img1.jpg and img2.jpg, and use the absdiff difference algorithm of the OpenCV module to calculate the difference between img1.jpg and img2.jpg to obtain a difference map of img1.jpg and img2.jpg; wherein the pixel value of the difference map represents the degree of difference between the corresponding pixels of img1.jpg and img2.jpg;
[0047] Use the cvtColor function to convert the difference image from the BGR color space to a grayscale space to obtain a grayscale difference image, and record the grayscale difference image as img3.jpg;
[0048] Use the findContours function of the OpenCV module to find the contours in the img3.jpg whose grayscale difference exceeds the preset grayscale difference threshold, and use the drawContours function to draw the contours to determine the areas in the img3.jpg whose grayscale difference exceeds the preset grayscale difference threshold;
[0049] Determine, according to the region and a preset grayscale-temperature relationship model, a region where the temperature difference exceeds a preset temperature difference threshold;
[0050] The internal fault detection model is used to determine the internal fault existing in the area, so as to obtain the internal fault detection result of the PCB.
[0051] In a second aspect, the present invention further provides a terminal device, comprising:
[0052] a memory for storing program instructions; and
[0053] A processor is used to execute the program instructions to implement the steps of the PCB detection method based on artificial intelligence as described above.
[0054] In a third aspect, the present invention further proposes a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the steps of the artificial intelligence-based PCB detection method as described above are implemented.
[0055] Compared with the prior art, the beneficial effects of the present invention are: a PCB detection method based on artificial intelligence, a terminal device and a computer-readable storage medium, comprising: obtaining an image of a PCB to be detected, and inputting the image into a trained detection model; obtaining the detection result of the PCB through the detection model; inputting the detection result and the repair result corresponding to the detection result into the detection model for iterative training, so as to correct the detection model. Wherein, the image includes an external appearance image of the PCB and a thermal image of the inside of the PCB, and the detection model includes an external defect detection model and an internal fault detection model. It can be seen that the PCB detection method based on artificial intelligence, the terminal device and the computer-readable storage medium, combined with the external appearance image of the PCB and the internal thermal image, use the external defect detection model and the internal fault detection model to perform automated comprehensive detection, which can more comprehensively analyze the state of the PCB and accurately diagnose complex PCB fault modes. At the same time, using the detection model that has been trained and learned through a large amount of data to perform PCB detection, it is possible to more accurately identify various defects and faults of the PCB, thereby improving detection efficiency and accuracy. In addition, by continuously iterating training, the detection results and repair results are input into the detection model for training, and errors can be gradually learned and corrected, further improving the accuracy of PCB detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0057] Figure 1 It is a flow chart of the first embodiment of the artificial intelligence-based PCB detection method of the present invention;
[0058] Figure 2 It is a schematic diagram of the principle of the first embodiment of the PCB detection method based on artificial intelligence of the present invention;
[0059] Figure 3 It is a flow chart of the second embodiment of the PCB detection method based on artificial intelligence of the present invention;
[0060] Figure 4 It is a flow chart of a third embodiment of the PCB detection method based on artificial intelligence of the present invention;
[0061] Figure 5 It is a flow chart of a fourth embodiment of the PCB detection method based on artificial intelligence of the present invention;
[0062] Figure 6 It is a flow chart of a fifth embodiment of the PCB detection method based on artificial intelligence of the present invention;
[0063] Figure 7 It is a schematic diagram of the structure of a terminal device in a hardware operating environment involved in an embodiment of the present invention. DETAILED DESCRIPTION
[0064] The scheme in the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is only a part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0065] It should be noted that if the embodiments of the present invention involve directional indications (such as up, down, left, right, front, back, etc.), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0066] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present invention, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0067] See also Figure 1 As shown, it is a flow chart of the first embodiment of the artificial intelligence-based PCB detection method of the present invention.
[0068] In this embodiment, the artificial intelligence-based PCB detection method includes:
[0069] Step S100: Acquire an image of the PCB to be inspected, and input the image into a trained inspection model.
[0070] The image includes an external appearance image of the PCB and a thermal imaging image of the inside of the PCB, and the detection model includes an external defect detection model and an internal fault detection model.
[0071] Specifically, the external appearance of the PCB is captured by an industrial camera. When collecting the appearance, it is necessary to ensure that the ambient light, background, focal length, shutter and other data of the real business scene captured in the detection phase and the simulated scene collected in the training phase are as consistent as possible, and cover various possible situations. Analysis of the appearance helps to identify defects on the outside of the PCB. The thermal image of the inside of the PCB is captured by an infrared thermal imager. When collecting thermal images, it is necessary to maintain an appropriate distance and angle to ensure that the thermal imager can accurately capture the temperature distribution inside the PCB. Analysis of thermal images helps to obtain the heat distribution inside the PCB and identify potential thermal problems or faulty components.
[0072] Specifically, the external defect detection model is mainly used to identify and locate defects or damage on the surface of the PCB. It is generally based on image processing and machine learning technology, and detects surface defects by analyzing the PCB appearance diagram. The external defect detection model uses feature extraction, pattern recognition and classification algorithms to identify different types of defects and generate corresponding inspection reports. The internal fault detection model is mainly used to detect faults or problems inside the PCB. It is generally based on infrared thermal imaging technology and image processing technology. By analyzing the thermal imaging map of the PCB, the temperature distribution inside the PCB is obtained, and then the thermal abnormality area inside the PCB is determined. Combined with data analysis and pattern recognition technology, through the analysis and comparison of a large amount of data, the internal fault mode and characteristics of the PCB are identified, and corresponding repair suggestions are provided. The external defect detection model mainly focuses on the detection of PCB surface defects, while the internal fault detection model focuses on the diagnosis of internal faults of the PCB. The combination of the two can comprehensively improve the detection accuracy and precision of the PCB.
[0073] Specifically, there are many ways to train external defect detection models and internal fault detection models. The process generally includes data preparation, model training, and model evaluation distribution, which can be implemented using zero-code or handwritten code.
[0074] Step S200: obtaining the detection result of the PCB through the detection model.
[0075] Specifically, the inspection results of PCB include two types of inspection results: external defects and internal faults of PCB. The collected images of the PCB to be inspected are input into the inspection model for analysis and processing. After the inspection model analyzes the image data, it will generate an inspection result report. The inspection result report will describe the detected external defects and internal faults in detail, including information such as location, type, severity, etc., and sometimes also include recommended repair measures, fault cause analysis, risk assessment, etc., which provide important reference for subsequent maintenance, repair and improvement work, thereby improving the quality and performance of PCB products.
[0076] See also Figure 2 As shown, it is a schematic diagram of the principle of the first embodiment of the artificial intelligence-based PCB detection method of the present invention.
[0077] Specifically, Figure 2 The full process of the PCB inspection method based on artificial intelligence is presented in the figure, including training and updating the inspection model by building a production database and a training database, from image data acquisition to generating inspection results, and inputting the inspection results and the repair results corresponding to the inspection results into the inspection model for iterative training to achieve accurate defect and fault detection, positioning, and providing repair suggestions. The figure shows multiple key components and their interactions, as well as the data processing and application process at each stage. Specifically, it includes:
[0078] Data collection: Data collection is the starting point of the entire process, which involves the collection and preprocessing of image data to provide necessary information for subsequent fault diagnosis and repair suggestions.
[0079] Data to be tested: The collected image data includes original data and data to be tested. The original data is used to build the production database, and the data to be tested is used for PCB testing. Repair results are generated based on the test results to update the production database.
[0080] Training database: The training database stores historical defects, failure cases, and corresponding solutions, which can serve as the basis for training detection models.
[0081] Prediction Engine: Based on the data in the training database, the prediction engine can make preliminary defect and failure predictions for newly input image data.
[0082] Detection model: The detection model can further determine the specific location and cause of defects and failures based on the output of the prediction engine.
[0083] Training engine: The training engine is responsible for inputting training data into the prediction engine and detection model to achieve iterative updates of the detection model.
[0084] Production database: The production database stores the latest training results and detection model parameters for easy reference.
[0085] Iterative training process triggering: When a defect or fault is detected, especially a new defect or fault, the iterative training process will be triggered to achieve continuous learning and improvement of the detection model.
[0086] Repair results: The repair results are the end point of the entire process, involving the actual repair operations for defects and faults. The repair results corresponding to the repair measures taken for defects and faults are input into the detection model for iterative training, so as to carry out long-term accurate diagnosis and positioning and trend analysis.
[0087] The entire process embodies a closed-loop learning mechanism. Through continuous image data collection, analysis and feedback, the detection model can learn autonomously, continuously improve the ability to judge defects and faults, and achieve continuous optimization and self-improvement of the detection model. This structure helps to improve the accuracy and efficiency of PCB defect and fault detection.
[0088] Specifically, common defect detection technologies for PCB circuit boards include automatic optical detection technology, computer vision detection technology, etc. Factory workshop operators need to use electron microscopes or magnifying glasses and determine the pass rate of PCB boards based on subjective experience and visual measurement. This traditional detection method has low accuracy, low defect detection efficiency, and difficulty in data set analysis. With the help of the artificial intelligence-based PCB detection method of the embodiment of the present invention, the production line can complete the diagnosis and positioning tasks more consistently, more reliably and faster. The detection model used in the artificial intelligence-based PCB detection method has been deeply learned, and in the long-term detection process, it can also learn autonomously, continuously improve the ability to judge defects, and realize non-contact detection of PCB board defects and faults, which is efficient and accurate, and has strong real-time monitoring and data analysis optimization capabilities.
[0089] Step S300: input the detection result and the repair result corresponding to the detection result into the detection model for iterative training, so as to correct the detection model.
[0090] Specifically, by inputting the detection results and repair results into the detection model for iterative training, the detection model can be continuously improved to improve the accuracy of PCB diagnosis and positioning, and enable it to better respond to detection and repair needs in different situations, thereby improving the efficiency and effectiveness of PCB detection and maintenance.
[0091] Compared with the prior art, the artificial intelligence-based PCB detection method of the embodiment of the present invention combines the external appearance diagram of the PCB and the internal thermal imaging diagram, and uses the external defect detection model and the internal fault detection model for automated comprehensive detection. The external defect detection model and the internal fault detection model have been trained and learned with a large amount of data, and can accurately identify various defects and fault modes. By comprehensively utilizing external and internal information, the state of the PCB can be comprehensively analyzed to improve the accuracy of detection. In addition, the PCB detection method adopts an iterative training method, and the detection results and the repair results are input into the detection model for training together to continuously correct the errors of the detection model. Through continuous iterative training, the detection model can continuously learn and gradually correct errors, further improving the accuracy of detection. It can be seen that the artificial intelligence-based PCB detection method realizes an automated detection process, reduces the need for manual intervention, improves the production efficiency of PCBs and reduces manufacturing costs.
[0092] See also Figure 3 As shown, it is a flow chart of the second embodiment of the artificial intelligence-based PCB detection method of the present invention.
[0093] Compared with other embodiments of the artificial intelligence-based PCB detection method, this embodiment describes in detail the steps of defect detection on the outside of the PCB and the training steps of the external defect detection model.
[0094] In this embodiment, when the image is an external appearance diagram of the PCB, and the detection model is an external defect detection model, the PCB detection method includes:
[0095] Step S110: obtaining an appearance drawing of the PCB to be inspected, preprocessing the appearance drawing, and inputting the preprocessed appearance drawing into a trained external defect detection model.
[0096] Specifically, the preprocessing of the shape drawing is to extract and prepare the image data of the shape drawing for subsequent analysis and processing. The steps of preprocessing the shape drawing usually include denoising (using denoising algorithms to remove noise in the image and improve image quality and clarity), image enhancement (enhancing the image, such as contrast enhancement, brightness adjustment, etc., to improve the details of the image), image segmentation (segmenting the image into different areas or objects, which helps to extract the target area) and size standardization (adjusting the image to a uniform size and ratio to ensure the consistency and accuracy of subsequent processing). Through the above preprocessing steps, the image data of the shape drawing can be made more suitable for subsequent analysis and processing, and the efficiency and accuracy of image processing can be improved. Of course, different application scenarios may require different preprocessing steps, and the specific preprocessing steps can be adjusted and optimized according to actual needs.
[0097] Step S211: Obtaining the external defects of the PCB through the external defect detection model, and acquiring coordinate information of the PCB surface.
[0098] Specifically, the coordinate information of the PCB surface can help determine the exact location of external defects and provide basic data for subsequent defect location and repair.
[0099] Step S212: locating the defect position where the external defect exists in combination with the coordinate information to obtain the external defect detection result.
[0100] Specifically, by matching the defect position coordinates of the detected external defects with the actual PCB surface, the specific location of the external defects on the PCB board can be accurately located. The specific method is: coordinate calibration to ensure that the detected defect position coordinates are consistent with the coordinate system of the actual PCB surface, and convert the detected defect position coordinates into the coordinate system on the actual PCB surface, so that the defect position can be accurately located, and finally the converted defect position coordinates can be displayed or marked on the PCB surface, so that the operator can intuitively see the defect position, help the operator quickly and accurately find the defect problem, and provide guidance for subsequent repair work.
[0101] Step S310: inputting the external defect detection result and the repair result corresponding to the external defect detection result into the external defect detection model for iterative training, so as to correct the external defect detection model.
[0102] Specifically, by inputting the external defect detection results and repair results into the external defect detection model for iterative training, the external defect detection model can be continuously improved to improve the accuracy of PCB external defect diagnosis and positioning, and enable it to better respond to identification and positioning needs in different situations, thereby improving the efficiency and effectiveness of PCB inspection and maintenance, and further improving customer satisfaction.
[0103] The training step of the external defect detection model includes:
[0104] Step 11: Collect the appearance drawing of the PCB and pre-process the appearance drawing.
[0105] Specifically, the process of preprocessing the appearance image in step 11 is the same as the process of preprocessing the appearance image in step S110, and will not be described in detail here.
[0106] Step 12: Compare the preprocessed appearance drawing with the preset normal appearance drawing, mark the defect status on the appearance drawing, and save the defect marking data to construct a first training database.
[0107] Among them, the defect states include missing hole state, mouse bite state, open circuit state, short circuit state, stray state and pseudo copper state.
[0108] Specifically, the preset normal appearance diagram is an appearance diagram of the pre-processed PCB in a normal state. By comparing the pre-processed appearance diagram with the preset normal appearance diagram, the differences between the appearance diagram and the normal appearance diagram, that is, the potential defective parts, can be found. By marking the defect state on the appearance diagram, the specific type and location of each defect can be clarified, providing accurate data for subsequent external defect detection model training and identification. The defect state data is saved to build a first training database. These data will be used as input for training the external defect detection model to help the external defect detection model learn the characteristics and distinction methods of various defect states, thereby improving the detection ability of the external defect detection model. Through this step, a first training database containing various defect states can be established, providing a basis for subsequent external defect detection model training and optimization. By training the external defect detection model to identify and mark different types of defect states, the intelligence and reliability of the PCB detection method based on artificial intelligence can be improved.
[0109] Step 13: Input the defect annotation data of the first training database into a preset external defect detection model, and use a preset external defect algorithm for training, so that the external defect detection model can distinguish external defects based on the normal appearance image.
[0110] Specifically, the defect annotation data in the first training database is input into the preset external defect detection model, and the external defect detection model is trained by using the preset external defect algorithm. During the training process, the external defect detection model learns how to identify different types of defect states based on the input appearance diagram and defect annotation data through the preset external defect algorithm, and marks these defects in the appearance diagram, so as to further improve the detection accuracy and generalization ability of the external defect detection model, thereby helping operators to quickly and accurately find and deal with problems. The preset external defect detection model generally includes a convolutional neural network (CNN) and a convolutional neural network combined with a recurrent neural network (CNN-RNN). Among them, CNN is a deep learning model that is widely used in image recognition and classification tasks. In the process of external defect detection, CNN can be used to extract appearance image features and identify different types of defects. The CNN-RNN model combining CNN and RNN is more effective in processing sequence data. In external defect detection, CNN can be used to extract appearance image features, and then RNN is used for sequence modeling to identify complex defect patterns. The preset external defect algorithm generally includes a support vector machine (SVM) and feature extraction and traditional machine learning algorithms. Among them, SVM is a supervised learning algorithm, which is often used for pattern recognition and classification tasks. In external defect detection, SVM can be used to distinguish between normal appearance images and appearance images with defects, thereby realizing defect detection and classification. Feature extraction and traditional machine learning algorithms In addition to deep learning models, traditional feature extraction methods (such as HOG, SIFT, etc.) can also be used in combination with traditional machine learning algorithms (such as random forests, etc.) for external defect detection.
[0111] The technical solution of this embodiment describes in detail the steps of external defect detection of PCB and the training process of external defect detection model. That is, the PCB is photographed by an industrial camera, the photographed appearance image is input into the external defect detection model, and the defect category is identified and the location of the defect is located by the external defect detection model. The details are as follows:
[0112] 1) Collect / collect data
[0113] Collect the appearance of the PCB. When collecting the appearance during the inspection phase, it is necessary to ensure that the data of the real business scene collected / photographed and the simulated scene when collecting the appearance during the training phase (including ambient light, background, focal length, shutter) are consistent as much as possible, and cover all possible situations.
[0114] 2) Labeling Data
[0115] The collected appearance drawings are annotated and organized according to the conditions of missing holes, mouse bites, open circuits, short circuits, strays and pseudo copper.
[0116] 3) Training the model
[0117] The existing defect annotation data is input into the determined external defect detection model, and an algorithm (i.e., external defect detection algorithm) is selected for training.
[0118] 4) Defect Identification
[0119] The appearance image to be inspected is input into the trained external defect detection model to identify external defects of the PCB.
[0120] The artificial intelligence-based PCB detection method of the embodiment of the present invention can timely discover external defects of the PCB, realize the automation of external defect detection, improve the accuracy of external defect detection, and improve the product quality and production efficiency of the PCB.
[0121] See also Figure 4 As shown, it is a flow chart of the third embodiment of the artificial intelligence-based PCB detection method of the present invention.
[0122] Compared with other embodiments of the PCB detection method based on artificial intelligence, this embodiment describes in detail the steps of fault detection inside the PCB and the training steps of the internal fault detection model.
[0123] In this embodiment, when the image is a thermal image of the inside of the PCB, and the detection model is an internal fault detection model, the PCB detection method includes:
[0124] Step S120: obtaining a thermal image of the PCB to be inspected, preprocessing the thermal image, and inputting the preprocessed thermal image into a trained internal fault detection model.
[0125] Specifically, the purpose of preprocessing thermal images is to extract and prepare the image data of thermal images for subsequent analysis and processing. The steps of preprocessing thermal images usually include denoising (using denoising algorithms to remove noise in images to reduce noise interference in images), image enhancement (enhancing the contrast and clarity of images through image enhancement techniques such as histogram equalization and contrast enhancement to better display the details in the image), edge detection (detecting edge information in images through edge detection algorithms such as Sobel and Canny operators, which helps to extract the contour and shape characteristics of the target area) and size calibration (sizing images to map pixel values to actual physical sizes for accurate measurement and analysis). Through the above preprocessing steps, the image data of thermal images can be made more suitable for subsequent analysis and processing, and the efficiency and accuracy of image processing can be improved. Of course, different application scenarios may require different preprocessing steps, and the specific preprocessing steps can be adjusted and optimized according to actual needs.
[0126] Step S221: Obtain the internal fault of the PCB through the internal fault detection model, and obtain the location information of the components of the PCB.
[0127] Specifically, in addition to components on the surface of the PCB, there may also be components inside. For components on the surface of the PCB, their position information can usually be expressed by coordinates (such as x, y coordinates) to determine the specific position of the components on the PCB. For components inside the PCB, their position information may refer to the specific position or layout of the components inside the PCB. In this case, the internal position information is no longer a simple two-dimensional coordinate, and it is also necessary to consider the positional relationship of the components in the hierarchical structure of the PCB, including the stacking order of the components, the connection method, etc.
[0128] Step S222: locating the component with the internal fault in combination with the position information to obtain the internal fault detection result.
[0129] Specifically, by combining the detected internal faults with the component position information, the components with internal faults can be accurately located, thereby improving the maintenance efficiency of PCB boards and reducing the production costs of PCB boards.
[0130] Step S320: inputting the internal fault detection result and the repair result corresponding to the internal fault detection result into the internal fault detection model for iterative training, so as to correct the internal fault detection model.
[0131] Specifically, by inputting the internal fault detection results and repair results into the internal fault detection model for iterative training, the internal fault detection model can be continuously improved to improve the accuracy of PCB internal fault diagnosis and positioning, and enable it to better respond to identification and positioning needs in different situations, thereby improving the efficiency and effectiveness of PCB inspection and maintenance, and further improving customer satisfaction.
[0132] The training step of the internal fault detection model includes:
[0133] Step 21: Collect a thermal image of the PCB and pre-process the thermal image.
[0134] Specifically, the process of preprocessing the thermal image in step 21 is consistent with the process of preprocessing the thermal image in step S120, and will not be described again with examples.
[0135] Step 22: Compare the preprocessed thermal image with a preset normal thermal image, mark the fault status on the thermal image, and save the fault marking data to construct a second training database.
[0136] The fault status includes a component failure status, a component short circuit status, a component open circuit status and a component poor contact status.
[0137] Specifically, the preset normal thermal image is a thermal image of the preprocessed PCB in a normal state. By comparing the preprocessed thermal image with the preset normal thermal image, the abnormal area in the thermal image, that is, the potential fault area, can be identified. By marking the fault state in the identified abnormal area, the specific type and location of each fault can be clarified, providing accurate data for subsequent internal fault detection model training and identification. The fault annotation data is saved to build a second training database. The second training database contains a large number of thermal images, each of which is marked with a fault state, providing a basis for subsequent internal fault detection model training and optimization. By training the internal fault detection model to identify and mark different types of fault states, the intelligence and reliability of the artificial intelligence-based PCB detection method can be improved.
[0138] Step 23: Input the fault annotation data of the second training database into a preset internal fault detection model, and use a preset internal fault algorithm for training, so that the internal fault detection model can distinguish internal faults based on the normal thermal imaging image.
[0139] Specifically, the fault annotation data in the second training database is input into the preset internal fault detection model, and the internal fault detection model is trained by using the preset internal fault algorithm. During the training process, the internal fault detection model learns the difference between the normal thermal imaging image and the fault thermal imaging image through the preset internal fault algorithm, so as to accurately identify different types of fault states and mark these faults in the thermal imaging image. The preset internal fault detection model can select a model consistent with the preset external defect detection model. The preset internal fault algorithm can select an algorithm consistent with the preset external defect algorithm, and no further examples are given here. Of course, different application scenarios may require different detection models and algorithms, such as decision tree algorithms (decision tree algorithms are classification algorithms based on tree structures, which can be classified according to different branches of features. In internal fault detection, decision tree algorithms can help determine the fault type in thermal imaging images) and clustering algorithms (clustering algorithms such as K-means algorithms, hierarchical clustering, etc. can be used to cluster faults in thermal imaging images to help discover potential fault modes). In actual applications, they can be adjusted and optimized according to specific needs.
[0140] The technical solution of this embodiment describes in detail the steps of internal fault detection of PCB and the training process of the internal fault detection model. That is, the thermal image of the PCB board to be detected is taken by an infrared thermal imager, and compared with the thermal image of the intact PCB board in the second training database (the preset normal thermal image) to identify the fault locations such as bad components, short circuits, open circuits or poor contact. The internal fault detection model and internal fault algorithm (or AI, AIArtificial Intelligence, artificial intelligence) used in the PCB detection method can automatically analyze infrared thermal images and identify abnormal temperature areas. Through advanced technologies such as deep learning, the temperature characteristics corresponding to various fault modes can be learned and identified. AI can also perform intelligent identification of components on the PCB, combine temperature data with the location information of components, and accurately locate the fault location.
[0141] The artificial intelligence-based PCB detection method of the embodiment of the present invention can timely discover and handle internal faults of the PCB, realize the automation of internal fault detection, improve the accuracy of internal fault detection, and improve the product quality and production efficiency of the PCB.
[0142] See also Figure 5 As shown, it is a flow chart of the fourth embodiment of the artificial intelligence-based PCB detection method of the present invention.
[0143] Compared with other embodiments of the artificial intelligence-based PCB detection method, this embodiment provides a detailed description of a set of steps for obtaining the internal fault detection result of the PCB.
[0144] In this embodiment, obtaining the internal fault detection result of the PCB through the internal fault detection model includes:
[0145] Step S22011: The preset normal thermal image of the internal fault detection model is recorded as img1.jpg, and the thermal image of the PCB to be detected is recorded as img2.jpg.
[0146] Step S22012: Use the image reading function imread of the OpenCV module to read img1.jpg and img2.jpg, and use the absdiff difference algorithm of the OpenCV module to calculate the difference between img1.jpg and img2.jpg to obtain a difference map of img1.jpg and img2.jpg.
[0147] The pixel values of the difference map represent the degree of difference between the corresponding pixels of img1.jpg and img2.jpg.
[0148] Step S22013: Use the cvtColor function to convert the difference map from the BGR color space to the grayscale space to obtain a grayscale difference image, and record the grayscale difference image as img3.jpg.
[0149] Specifically, the above three steps are detailed instructions for using the imread function to read thermal images, using the absdiff difference algorithm to calculate pixel differences and generate difference maps, and obtaining grayscale difference images based on the difference maps. Each pixel value in the difference map represents the degree of difference between the pixel values of the two input thermal images at the corresponding position. The difference map can help analyze the differences and changes between thermal images. Among them, the BGR color space is a color space represented by the combination of the values of the three channels of blue (Blue), green (Green) and red (Red).
[0150] Step S22014: by comparing the grayscale difference, find the position where the grayscale difference exceeds the preset grayscale difference threshold in the img3.jpg, and determine the position where the temperature difference exceeds the preset temperature difference threshold based on the position and the preset linear relationship between grayscale and temperature.
[0151] Specifically, by comparing the size of the grayscale difference, the position where the grayscale difference exceeds the preset grayscale difference threshold can be found in img3.jpg. The grayscale difference indicates the degree of difference between the grayscale values of different areas in the grayscale difference image and the preset grayscale difference threshold. The area exceeding the preset grayscale difference threshold may represent a potential anomaly or change. Based on the position where the grayscale difference exceeds the grayscale difference threshold, combined with the preset linear relationship between grayscale and temperature, the position where the temperature difference exceeds the preset temperature difference threshold can be inferred. Under the preset linear relationship between grayscale and temperature, the change in temperature value can also be inferred based on the change in grayscale value.
[0152] In some embodiments of the present application, the preset linear relationship between grayscale and temperature includes:
[0153] ;
[0154] Among them, S is the grayscale value of the image pixel in the grayscale difference image, T is the temperature value of the image pixel in the thermal imaging image, Tmin is the lowest temperature in the temperature range displayed in the thermal imaging image, Tmax is the highest temperature in the temperature range displayed in the thermal imaging image, and N is the number of grayscales in the grayscale difference image.
[0155] Specifically, infrared thermal imagers generate thermal images by measuring the infrared radiation emitted from the surface of an object. Generally speaking, the infrared radiation intensity measured by an infrared thermal imager can be converted into grayscale values, which can be used to represent the temperature of different areas in the thermal image. In addition, the infrared radiation intensity is proportional to the surface temperature of the object, so there is a linear relationship between the grayscale value and the temperature. In other words, the grayscale value in the thermal image can be regarded as a representation of the corresponding temperature, and the change in the grayscale value reflects the change in the surface temperature of the object. Based on this linear relationship, we can infer the change in the surface temperature of the object by analyzing the change in the grayscale value in the thermal image.
[0156] Step S22015: Determine the internal fault existing at the position through the internal fault detection model to obtain the internal fault detection result of the PCB.
[0157] The technical solution of this embodiment describes in detail a set of steps for obtaining the internal fault detection result of the PCB, and is highly feasible.
[0158] See also Figure 6 As shown, it is a flow chart of the fifth embodiment of the artificial intelligence-based PCB detection method of the present invention.
[0159] Compared with other embodiments of the PCB detection method based on artificial intelligence, this embodiment describes in detail another set of steps for obtaining the internal fault detection result of the PCB.
[0160] In this embodiment, obtaining the internal fault detection result of the PCB through the internal fault detection model includes:
[0161] Step S22021: The preset normal thermal image of the internal fault detection model is recorded as img1.jpg, and the thermal image of the PCB to be detected is recorded as img2.jpg.
[0162] Step S22022: Use the image reading function imread of the OpenCV module to read img1.jpg and img2.jpg, and use the absdiff difference algorithm of the OpenCV module to calculate the difference between img1.jpg and img2.jpg to obtain a difference map of img1.jpg and img2.jpg.
[0163] The pixel values of the difference map represent the degree of difference between the corresponding pixels of img1.jpg and img2.jpg.
[0164] Step S22023: Use the cvtColor function to convert the difference map from the BGR color space to the grayscale space to obtain a grayscale difference image, and record the grayscale difference image as img3.jpg.
[0165] Step S22024: Use the findContours function of the OpenCV module to find contours in the img3.jpg whose grayscale difference exceeds a preset grayscale difference threshold, and use the drawContours function to draw the contours to determine the area in the img3.jpg whose grayscale difference exceeds the preset grayscale difference threshold.
[0166] Specifically, the findContours function is a function in the OpenCV module that is used to find image contours. You can use the findContours function to find contours of areas where the grayscale difference exceeds a preset grayscale difference threshold. Once contours with grayscale differences exceeding a preset grayscale difference threshold are found, you can use the drawContours function to draw these contours on the original grayscale difference image. By drawing contours, you can intuitively display areas with large grayscale differences in the grayscale difference image, which may represent potential anomalies or changes and require further analysis and processing.
[0167] Step S22025: Determine an area where the temperature difference exceeds a preset temperature difference threshold according to the area and a preset grayscale and temperature relationship model.
[0168] Specifically, the preset grayscale and temperature relationship model can be the linear relationship between grayscale and temperature mentioned above, or a polynomial model can be used to fit the grayscale-temperature relationship (such as using quadratic, cubic or higher-order polynomials to describe the nonlinear relationship between grayscale and temperature), or a machine learning algorithm training model can be used to learn the complex relationship between grayscale and temperature (such as using deep learning models such as neural networks to establish an end-to-end grayscale-to-temperature mapping relationship). In actual applications, the most suitable grayscale and temperature relationship model is usually selected based on experimental data and verification results to achieve accurate temperature estimation and thermal imaging analysis.
[0169] Step S22026: Determine the internal fault existing in the area through the internal fault detection model to obtain the internal fault detection result of the PCB.
[0170] The technical solution of this embodiment describes in detail another set of steps for obtaining the internal fault detection result of the PCB, and is highly feasible.
[0171] The artificial intelligence-based PCB detection method of the embodiment of the present invention is an artificial intelligence-based PCB board fault diagnosis and positioning method, which can automatically detect external defects and internal faults of the PCB, improve the accuracy and efficiency of detection, and reduce the time and cost of manual diagnosis. It is of great significance to improve production efficiency and reduce manufacturing costs.
[0172] The following is an embodiment of the terminal device provided by the present invention. The embodiment of the terminal device and the embodiment of the PCB detection method based on artificial intelligence belong to the same concept, and the details not described in detail in the embodiment of the terminal device can refer to the embodiment of the PCB detection method based on artificial intelligence.
[0173] See also Figure 7 , which is a schematic diagram of the structure of a terminal device in a hardware operating environment involved in an embodiment of the present invention.
[0174] In this embodiment, a terminal device includes:
[0175] Memory 1005, used to store program instructions; and
[0176] The processor 1001 is used to execute the program instructions to implement the steps of the PCB detection method based on artificial intelligence as described above.
[0177] The terminal device of the embodiment of the present invention can be a computing device such as a desktop computer, a notebook, a palm computer, and a server. Figure 7 As shown, the terminal device may include: a processor 1001 (such as a CPU), a network interface 1004, a user interface 1003, a memory 1005 and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit, such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0178] Those skilled in the art will understand that Figure 7 The terminal device structure shown in the figure does not constitute a limitation on the terminal device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0179] like Figure 7As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module and a computer program.
[0180] exist Figure 7 In the terminal device shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client (user end) and communicate data with the client; and the processor 1001 can be used to call the computer program stored in the memory 1005. When the computer program is called and executed by the processor 1001, the steps of the above-mentioned artificial intelligence-based PCB detection method are implemented.
[0181] The terminal device provided by the embodiment of the present invention combines the external appearance diagram of the PCB and the internal thermal imaging diagram, and uses the external defect detection model and the internal fault detection model to perform automated comprehensive detection, which can more comprehensively analyze the status of the PCB and accurately diagnose complex PCB fault modes. At the same time, by using the detection model that has been trained and learned through a large amount of data to perform PCB detection, various defects and faults of the PCB can be more accurately identified, thereby improving detection efficiency and accuracy. In addition, by continuously iterating training, the detection results and repair results are input into the detection model for training, and errors can be gradually learned and corrected, further improving the accuracy of PCB detection.
[0182] The following is an embodiment of the computer-readable storage medium provided by the present invention. The embodiment of the computer-readable storage medium and the embodiment of the PCB detection method and terminal device based on artificial intelligence belong to the same concept, and the details not described in detail in the embodiment of the computer-readable storage medium can refer to the embodiment of the PCB detection method and terminal device based on artificial intelligence.
[0183] In this embodiment, a computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the steps of the PCB detection method based on artificial intelligence as described above are implemented.
[0184] Since the terminal device and computer-readable storage medium of the present invention can both implement the steps of the above-mentioned artificial intelligence-based PCB detection method, they at least have all the beneficial effects brought by the technical solution of the above-mentioned artificial intelligence-based PCB detection method step embodiment, which will not be described one by one here.
[0185] The above description is only a partial or preferred embodiment of the present invention. Neither the text nor the drawings can limit the scope of protection of the present invention. All equivalent structural changes made by using the contents of the present invention specification and drawings under the overall concept of the present invention, or direct / indirect application in other related technical fields are included in the scope of protection of the present invention.
[0186] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0187] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0188] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0189] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0190] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A PCB detection method based on artificial intelligence, characterized in that: include: Acquire an image of the PCB to be inspected, and input the image into a trained inspection model; wherein the image includes an external appearance image of the PCB and a thermal image of the inside of the PCB, and the inspection model includes an external defect detection model and an internal fault detection model; Obtaining a detection result of the PCB through the detection model; Inputting the detection result and the repair result corresponding to the detection result into the detection model for iterative training, so as to correct the detection model; Wherein, when the image is a thermal image of the inside of the PCB, and the detection model is an internal fault detection model, the PCB detection method includes: Obtaining a thermal image of the PCB to be inspected, preprocessing the thermal image, and inputting the preprocessed thermal image into a trained internal fault detection model; Obtaining an internal fault detection result of the PCB through the internal fault detection model; Inputting the internal fault detection result and the repair result corresponding to the internal fault detection result into the internal fault detection model for iterative training, so as to correct the internal fault detection model; Wherein, obtaining the internal fault detection result of the PCB through the internal fault detection model includes: The preset normal thermal image of the internal fault detection model is recorded as img1.jpg, and the thermal image of the PCB to be detected is recorded as img2.jpg; Use the image reading function imread of the OpenCV module to read img1.jpg and img2.jpg, and use the absdiff difference algorithm of the OpenCV module to calculate the difference between img1.jpg and img2.jpg to obtain a difference map of img1.jpg and img2.jpg; wherein the pixel value of the difference map represents the degree of difference between the corresponding pixels of img1.jpg and img2.jpg; Use the cvtColor function to convert the difference image from the BGR color space to a grayscale space to obtain a grayscale difference image, and record the grayscale difference image as img3.jpg; Use the findContours function of the OpenCV module to find the contours in the img3.jpg whose grayscale difference exceeds the preset grayscale difference threshold, and use the drawContours function to draw the contours to determine the areas in the img3.jpg whose grayscale difference exceeds the preset grayscale difference threshold; Determine, according to the region and a preset grayscale-temperature relationship model, a region where the temperature difference exceeds a preset temperature difference threshold; The internal fault detection model is used to determine the internal fault existing in the area, so as to obtain the internal fault detection result of the PCB.
2. The artificial intelligence-based PCB detection method according to claim 1, characterized in that: When the image is an external appearance diagram of the PCB, and the detection model is an external defect detection model, the PCB detection method includes: Obtaining an outline drawing of the PCB to be inspected, preprocessing the outline drawing, and inputting the preprocessed outline drawing into a trained external defect detection model; Obtaining an external defect detection result of the PCB through the external defect detection model; Inputting the external defect detection result and the repair result corresponding to the external defect detection result into the external defect detection model for iterative training, so as to correct the external defect detection model; The training step of the external defect detection model includes: Collecting an outline drawing of a PCB and preprocessing the outline drawing; Compare the preprocessed appearance drawing with the preset normal appearance drawing, mark the defect state on the appearance drawing, and save the defect marking data to build a first training database; wherein the defect state includes a missing hole state, a mouse bite state, an open circuit state, a short circuit state, a stray state, and a pseudo copper state; The defect annotation data of the first training database is input into a preset external defect detection model, and trained using a preset external defect algorithm, so that the external defect detection model can distinguish external defects based on the normal appearance image.
3. The artificial intelligence-based PCB detection method according to claim 2, characterized in that: The obtaining of the external defect detection result of the PCB includes: Obtaining external defects of the PCB and acquiring coordinate information of the PCB surface; In combination with the coordinate information, the defect position where the external defect exists is located to obtain the external defect detection result.
4. The artificial intelligence-based PCB detection method according to claim 1, characterized in that: The training step of the internal fault detection model comprises: Collecting a thermal image of the PCB and preprocessing the thermal image; Compare the preprocessed thermal image with the preset normal thermal image, mark the fault state on the thermal image, and save the fault marking data to build a second training database; wherein the fault state includes a component bad state, a component short circuit state, a component open circuit state, and a component poor contact state; The fault annotation data of the second training database is input into a preset internal fault detection model, and trained using a preset internal fault algorithm, so that the internal fault detection model can distinguish internal faults based on the normal thermal imaging image.
5. The PCB detection method based on artificial intelligence according to claim 1 is characterized in that: The obtaining of the internal fault detection result of the PCB includes: Obtaining internal faults of the PCB and acquiring location information of components of the PCB; In combination with the position information, the component with the internal fault is located to obtain the internal fault detection result.
6. The artificial intelligence-based PCB detection method according to claim 1, characterized in that: The step of obtaining an internal fault detection result of the PCB through the internal fault detection model further includes: The preset normal thermal image of the internal fault detection model is recorded as img1.jpg, and the thermal image of the PCB to be detected is recorded as img2.jpg; Use the image reading function imread of the OpenCV module to read img1.jpg and img2.jpg, and use the absdiff difference algorithm of the OpenCV module to calculate the difference between img1.jpg and img2.jpg to obtain a difference map of img1.jpg and img2.jpg; wherein the pixel value of the difference map represents the degree of difference between the corresponding pixels of img1.jpg and img2.jpg; Use the cvtColor function to convert the difference image from the BGR color space to a grayscale space to obtain a grayscale difference image, and record the grayscale difference image as img3.jpg; By comparing the magnitudes of the grayscale differences, the position where the grayscale difference exceeds the preset grayscale difference threshold is found in the img3.jpg, and the position where the temperature difference exceeds the preset temperature difference threshold is determined based on the position and the preset linear relationship between the grayscale and the temperature; The internal fault detection model is used to determine the internal fault existing at the position, so as to obtain the internal fault detection result of the PCB.
7. The artificial intelligence-based PCB detection method according to claim 6, characterized in that: The preset linear relationship between grayscale and temperature includes: ; Among them, S is the grayscale value of the image pixel in the grayscale difference image, T is the temperature value of the image pixel in the thermal imaging image, Tmin is the lowest temperature in the temperature range displayed in the thermal imaging image, Tmax is the highest temperature in the temperature range displayed in the thermal imaging image, and N is the number of grayscales in the grayscale difference image.
8. A terminal device, characterized in that: include: A memory for storing program instructions; as well as A processor, configured to execute the program instructions to implement the steps of the artificial intelligence-based PCB detection method as described in any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the steps of the artificial intelligence-based PCB detection method as described in any one of claims 1 to 7 are implemented.
