Defect detection method and system for flexible circuit board based on image recognition model

Through the flexible circuit board defect detection method based on the image recognition model, multi-view image acquisition, light source compensation and advanced feature extraction technology are used to solve the error detection problem caused by deformation and light during the detection process of the flexible circuit board, which significantly improves the detection accuracy and accuracy.

CN120070453AInactive Publication Date: 2025-05-30SHENZHEN CAREFUL ELECTRON CO LTD

Patent Information

Application Number
CN202510551467.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-29
Publication Date
2025-05-30
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

During the detection process, flexible circuit boards are susceptible to mechanical vibration, airflow disturbance and conveyor belt motion inertia, resulting in uneven image imaging, increasing the complexity of the detection algorithm and reducing detection accuracy. Especially when detecting micron-scale line gaps, the optical characteristic changes in the deformation area are highly similar to the imaging performance of real defects.

Method used

The defect detection method based on the image recognition model is adopted to ensure the stability and consistency of image data through multi-view image acquisition and light source compensation. Multi-scale Harris corner point detection and local binary mode descriptor extract feature points, combined with thin plate spline interpolation and least squares optimization, to achieve subpixel-level deformation correction. Directional texture features of line edges are extracted through multi-scale image pyramids and Gabor filter groups, and the expression capabilities of line structure features are enhanced by using a deep residual network encoder.

Benefits of technology

The detection accuracy is significantly improved, especially when detecting micron-scale line gaps, the error detection rate of the deformation area is reduced from above 12% to below 3%, and the detection accuracy is increased from 90% to above 97%. At the same time, through light source compensation and multi-view angle acquisition, the error detection rate caused by light is reduced, ensuring the reliability and consistency of the detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120070453A_ABST
    Figure CN120070453A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image defect detection, in particular to a defect detection method and system for a flexible circuit board based on an image recognition model. The method comprises the following steps: acquiring a multi-view image set of the flexible circuit board; performing light source compensation on the multi-view image set of the flexible circuit board to obtain image data of the flexible circuit board; performing feature point space displacement detection and segmentation on the image data of the flexible circuit board to obtain a circuit board deformation area segmentation map; constructing a circuit board deformation partitioning scheme according to the circuit board deformation region segmentation map; performing sub-pixel resampling on the image data of the flexible circuit board according to the circuit board deformation partitioning scheme to obtain a planar flexible circuit board image; and performing line structure feature extraction on the planar flexible circuit board image to obtain an enhanced line structure feature graph. Through dynamic deformation compensation, the defect detection precision of the flexible circuit board can be remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image defect detection, and particularly to a method and system for defect detection of flexible printed circuit boards based on an image recognition model. Background Art

[0002] In electronic manufacturing technology, due to its characteristics of being thin, flexible, and highly integrated, flexible printed circuit boards have become an indispensable key component in modern electronic devices. However, the manufacturing process of flexible printed circuit boards places extremely high requirements on detection accuracy. Especially in high-precision manufacturing scenarios, micron-level defects (such as circuit notches, short circuits, and broken wires) will directly affect the performance and reliability of products.

[0003] In actual production, when a flexible printed circuit board enters the detection station through a conveyor belt, its non-rigid structure is easily affected by mechanical vibrations, air flow disturbances, and the inertial movement of the conveyor belt, resulting in non-uniform local distortions (such as random deformations within ±0.5 mm) in the imaging process of detection samples of the same batch. Such dynamic deformations not only increase the complexity of the detection algorithm but also lead to inconsistencies in detection results. Especially when detecting micron-level circuit notches (<20 μm), the optical feature changes in the deformed area are highly similar to the imaging performance of real defects, thus posing higher requirements for detection accuracy. Summary of the Invention

[0004] Based on this, it is necessary for the present invention to provide a method and system for defect detection of flexible printed circuit boards based on an image recognition model to solve at least one of the above technical problems.

[0005] To achieve the above object, a method for defect detection of flexible printed circuit boards based on an image recognition model includes the following steps: Step S1: Obtain a multi-view image set of the flexible printed circuit board; perform light source compensation on the multi-view image set of the flexible printed circuit board to obtain flexible printed circuit board image data; Step S2: Perform feature point spatial displacement detection and segmentation on the flexible printed circuit board image data to obtain a circuit board deformed area segmentation map; construct a circuit board deformation partition scheme according to the circuit board deformed area segmentation map; perform sub-pixel resampling on the flexible printed circuit board image data according to the circuit board deformation partition scheme to obtain a planar flexible printed circuit board image; Step S3: Extract line structure features from the planar flexible printed circuit board image to obtain an enhanced line structure feature map; perform spatial transformation compensation on the enhanced line structure feature map to obtain a circuit board multi-level feature map; Step S4: Perform line defect recognition and segmentation on the planar flexible printed circuit board image to obtain a multi-view defect segmentation map set; generate a final line defect boundary map based on the multi-view defect segmentation map set; Step S5: Perform secondary circuit defect identification on the flexible printed circuit board according to the final circuit defect boundary map to obtain a comprehensive circuit defect detection distribution map; generate a final flexible printed circuit board defect detection report based on the comprehensive circuit defect detection distribution map.

[0006] Through the multi-angle imaging system of four industrial cameras in the present invention, combined with light source compensation, the stability and consistency of image data are ensured. The evaluation of light unevenness and pixel-level brightness correction effectively eliminates the problem of false detection caused by changes in lighting conditions, reducing the false detection rate caused by lighting from more than 12% to less than 5%. Through multi-scale Harris corner detection and local binary pattern descriptor extraction, the feature points of the flexible printed circuit board can be accurately identified. Combined with thin plate spline interpolation and least squares optimization, sub-pixel-level deformation correction is achieved. This significantly improves the detection accuracy. Especially when detecting micron-level circuit notches (<20μm), the false detection rate in the deformed area is reduced from more than 12% to less than 3%. Through the combination of multi-scale image pyramids and Gabor filter banks, the directional texture features of the circuit edges are extracted, and the expression ability of the circuit structure features is enhanced by using a deep residual network encoder. Through dilated convolution processing, the receptive field is further expanded, significantly improving the accuracy of defect identification. Through the final circuit defect boundary map generated based on the multi-view defect segmentation atlas, combined with secondary circuit defect identification and super-resolution reconstruction, the reliability of the detection results is significantly improved. Through the secondary identification of low-confidence defect areas by the expert rule engine, the confidence score is increased from 70% to more than 90%. Based on the online update mechanism of the model annotated by manual evaluation, the continuous optimization of the detection system is realized, ensuring long-term detection accuracy and adaptability. Through the visual explanation of model decision-making and the evaluation of defect feature importance, the deformation compensation process is further optimized, providing specific optimization suggestions.

[0007] Preferably, in step S1, obtaining the multi-view image set of the flexible printed circuit board includes: Step S11: Build a four-point surrounding acquisition platform through four industrial cameras to obtain the configuration parameters of the multi-angle imaging system. Among them, the accuracy of the industrial camera is 0.1 m, the positions of the industrial cameras are cross-distributed at 45° on the X-Y plane, and the four camera views are all centered on the preset target detection area. Step S12: Perform conveyor belt path tracking and prediction on the flexible printed circuit board to obtain the circuit board position prediction data. Step S13: Determine the multi-camera synchronous trigger command based on the circuit board position prediction data. Step S14: Perform multi-angle imaging acquisition on the flexible printed circuit board according to the multi-angle imaging system configuration parameters and the multi-camera synchronous triggering instruction to obtain the original multi-angle image dataset. In the multi-angle imaging acquisition, the exposure time of the industrial camera is set to 2 ms, and the global shutter mode is adopted. Each camera captures 25 images per second simultaneously; Step S15: Perform pre-calibration and distortion removal on the original multi-angle image dataset to obtain the multi-view image set of the flexible printed circuit board.

[0008] Through the combination of the multi-angle imaging system and dynamic path tracking, the present invention significantly improves the efficiency and quality of multi-view image acquisition of flexible printed circuit boards. The surrounding layout and synchronous triggering mechanism of the four industrial cameras ensure the consistency of multi-angle image data acquisition, avoiding image deviation caused by asynchronous camera positions and times. By tracking and predicting the conveyor belt path, the camera triggering timing can be adjusted in real time to ensure the accuracy of image acquisition, while reducing the deformation interference caused by the inertial movement of the conveyor belt. The global shutter mode and short exposure time (2 ms) effectively avoid motion blur, ensuring image clarity and detail retention. The geometric accuracy of the image is further improved through pre-calibration and distortion removal processing.

[0009] Preferably, the light source compensation for the multi-view image set of the flexible printed circuit board in step S1 includes: Evaluate the illumination non-uniformity of the multi-view image set of the flexible printed circuit board to obtain the illumination non-uniformity distribution map; Construct an image illumination compensation coefficient table according to the illumination non-uniformity distribution map; Perform pixel-level brightness correction on the multi-view image set of the flexible printed circuit board according to the image illumination compensation coefficient table to obtain the illumination-balanced multi-view image set; Enhance the line features of the illumination-balanced multi-view image set to obtain the enhanced flexible printed circuit board image set; Construct a GPU-accelerated image noise reduction pipeline based on the enhanced flexible printed circuit board image set; use the GPU-accelerated image noise reduction pipeline to suppress high-frequency noise in the enhanced flexible printed circuit board image set to obtain the noise-reduced flexible printed circuit board image set; Perform data format conversion and packaging on the noise-reduced flexible printed circuit board image set to obtain the flexible printed circuit board image data.

[0010] Through uneven illumination evaluation and pixel-level brightness correction, the present invention effectively eliminates brightness non-uniformity caused by changes in illumination conditions, ensures the uniformity and stability of images, and reduces the false detection rate caused by illumination. The key features of the flexible printed circuit board are further highlighted through line feature enhancement technology, making the defect areas more clearly visible and improving the accuracy of defect recognition. The application of GPU acceleration to the image denoising pipeline significantly reduces the impact of high-frequency noise on image quality, while improving the processing efficiency and ensuring the efficient operation of the system under real-time requirements. By converting and packing the data format, the transmission and storage of image data are optimized.

[0011] Preferably, in step S2, detecting and segmenting the spatial displacement of feature points from the flexible printed circuit board image data includes: Performing multi-scale Harris corner detection on the flexible printed circuit board image data to obtain a set of candidate feature points for the image, where the multi-scale Harris corner detection is for corner features from 1 pixel to 5 pixels with a step size of 0.5; Extracting local binary pattern descriptors from the set of candidate feature points for the image to obtain a feature point descriptor database; constructing an image feature point correspondence table based on the feature point descriptor database; Calculating the spatial displacement vector of the feature points according to the image feature point correspondence table to generate an initial displacement vector field; Removing outliers from the initial displacement vector field to obtain an adjusted displacement vector field; constructing a global displacement field of the circuit board deformation based on the adjusted displacement vector field; Dividing the global displacement field of the circuit board deformation to obtain a circuit board deformation region segmentation map.

[0012] Through the detection and segmentation of the spatial displacement of feature points from the flexible printed circuit board image data, the present invention significantly improves the detection accuracy and reliability under dynamic deformation conditions. The multi-scale Harris corner detection can comprehensively capture the corner features on the flexible printed circuit board, ensuring the diversity and accuracy of the feature points. Through the extraction of local binary pattern descriptors and the construction of the feature point correspondence table, a reliable basis is provided for calculating the spatial displacement vector of the feature points. By removing outliers, unreasonable displacement data is effectively filtered, ensuring the accuracy and stability of the displacement vector field. Through the division of the deformation region, the generated circuit board deformation region segmentation map can clearly identify the high-deformation and low-deformation regions. In summary, through the synergistic effect of feature point detection, displacement vector optimization, and deformation region segmentation, the false detection rate caused by dynamic deformation is significantly reduced, especially in the detection of micron-level circuit gaps, improving the accuracy and consistency of the detection results.

[0013] Preferably, in step S2, constructing a circuit board deformation partition scheme according to the circuit board deformation region segmentation map includes: Obtain the global displacement field of the circuit board deformation; construct the circuit board deformation feature map according to the circuit board deformation region segmentation map and the global displacement field of the circuit board deformation; Construct a thin plate spline control point grid based on the circuit board deformation feature map, where the distance between control points in the thin plate spline control point grid ranges from 5 to 20 pixels, and the grid density ranges from 10 to 50 control points per square centimeter; Perform thin plate spline interpolation on the thin plate spline control point grid to obtain the first circuit board deformation spatial interpolation data; Perform local deformation error evaluation on the first circuit board deformation spatial interpolation data to generate a circuit board deformation fitting residual map, where the size range of the evaluation window for local deformation error evaluation is from 3×3 to 15×15 pixels, and the circuit board deformation fitting residual map uses pseudo-color coding to represent the magnitude of the residual value, with the first color representing the low-error region and the second color representing the high-error region, and the first color is different from the second color; Optimize the first circuit board deformation spatial interpolation data by the least squares method according to the circuit board deformation fitting residual map to obtain the second circuit board deformation spatial interpolation data; Calculate the deformation gradient field of the second circuit board deformation spatial interpolation data; Group the deformation gradient field to obtain deformation gradient clustering data; Generate a circuit board deformation partition scheme according to the deformation gradient clustering data, where the circuit board deformation partition scheme includes at least one or more of the high-deformation region and the low-deformation region.

[0014] Through the optimization of the control point spacing (5 to 20 pixels) and grid density (10 to 50 control points per square centimeter) in the present invention, the balance between interpolation accuracy and calculation efficiency is ensured, and the deformation characteristics of the flexible circuit board can be accurately captured. Through the dynamic adjustment of the evaluation window size (3×3 to 15×15 pixels) and the combination with the pseudo-color coded residual map, the low-error and high-error regions are visually identified, facilitating the rapid positioning and optimization of deformation compensation. The accuracy of the interpolation data is further improved by the least squares method optimization, and the false detection rate of the deformation region is reduced. Through the grouping and clustering of the deformation gradient field, the generated circuit board deformation partition scheme can clearly distinguish the high-deformation and low-deformation regions, providing an accurate partition basis for subsequent feature extraction and defect recognition.

[0015] Preferably, in step S2, sub-pixel resampling of the flexible circuit board image data according to the circuit board deformation partition scheme includes: Obtain the second circuit board deformation spatial interpolation data; Perform segmented optimization on the second circuit board deformation spatial interpolation data according to the circuit board deformation partition scheme to obtain the circuit board deformation segmented interpolation data, where the segmented optimization is specifically: For the high-deformation region in the circuit board deformation zoning scheme, a cubic interpolation algorithm is used to perform local interpolation on the corresponding local interpolation coefficients in the second circuit board deformation space interpolation data; For the low-deformation region in the circuit board deformation zoning scheme, simplified interpolation is performed on the global interpolation coefficients in the second circuit board deformation space interpolation data; At the grid boundary between the high-deformation region and the low-deformation region in the second circuit board deformation space interpolation data, first-order continuity constraints are adopted; Based on the circuit board deformation piecewise interpolation data, a pixel-level mapping transformation data table is constructed; According to the pixel-level mapping transformation data table, sub-pixel resampling is performed on the flexible circuit board image data to obtain a planar flexible circuit board image.

[0016] Through the cubic interpolation algorithm for the high-deformation region and the simplified interpolation for the low-deformation region in the present invention, precise processing of regions with different deformation degrees is achieved, ensuring the balance between interpolation accuracy and calculation efficiency. By adopting first-order continuity constraints at the boundary between the high-deformation and low-deformation regions, the interpolation discontinuity at the boundary is effectively avoided, ensuring the overall consistency and smoothness of the image. Through the pixel-level mapping transformation data table constructed based on the piecewise interpolation data, the sub-pixel resampling process can be accurately guided, ensuring the resampling accuracy of each pixel, thereby obtaining a high-quality planar flexible circuit board image. Through sub-pixel-level resampling, the ability to retain image details is significantly improved, especially in the detection of micron-level circuit gaps, effectively reducing the false detection rate caused by deformation. The present invention can adapt to flexible circuit boards with different deformation degrees, improving the versatility and adaptability of the detection system.

[0017] Preferably, step S3 includes the following steps: Step S31: Construct a multi-scale image pyramid; use the multi-scale image pyramid to perform Gaussian pyramid decomposition on the planar flexible circuit board image to obtain an image five-layer resolution feature set; Step S32: Use a preset directional Gabor filter bank to extract line edge directional texture features from the image five-layer resolution feature set to obtain a line texture direction feature map; Step S33: Perform non-linear activation on the line texture direction feature map to obtain a line edge response map; Step S34: Based on the line edge response map, construct a deep residual network encoder; use the deep residual network encoder to perform feature encoding on the line edge response map to obtain line multi-scale feature mapping data; Step S35: Perform dilated convolution processing on the line multi-scale feature mapping data to obtain a line extended receptive field feature map; Step S36: Construct a multi-level feature map of the circuit board based on the line-expanded receptive field feature map and the line multi-scale feature mapping data.

[0018] In the present invention, by constructing a multi-scale image pyramid and Gaussian pyramid decomposition, line features at different resolutions are extracted, ensuring comprehensive coverage of defects at different scales and improving the robustness of detection. By using a directional Gabor filter bank to extract the directional texture features of the line edges, the key details of the line structure are highlighted, enhancing the sensitivity to micro-defects (such as line gaps). Through the feature encoding technology based on the deep residual network encoder, the hierarchy and richness of feature expression are further improved, making the features of complex deformations and micro-defects more prominent. Through dilated convolution processing, the receptive field of the feature map is expanded, enhancing the detection ability for large-area defects while retaining local detail information. By combining the expanded receptive field feature map and multi-scale feature mapping data, the constructed multi-level feature map of the circuit board can comprehensively reflect the structural information of the circuit board, providing rich feature support for subsequent defect recognition. Through the synergistic effect of the above technologies, the detection accuracy is significantly improved. Especially in the detection of micron-level line gaps, the detection accuracy rate is increased from 90% to over 97%, effectively reducing false detections and missed detections.

[0019] Preferably, step S4 includes the following steps: Step S41: Evaluate the uniformity of the cover layer of the planar flexible circuit board image to obtain a cover layer uniformity evaluation index; Step S42: Extract the circuit wiring features of the planar flexible circuit board image to obtain the basic circuit topology structure data; construct circuit grid connectivity constraint rules according to the basic circuit topology structure data; Step S43: Obtain the flexible circuit board design specifications and the flexible circuit board manufacturing tolerances; adjust the constraint rules of the circuit grid connectivity constraint rules according to the flexible circuit board design specifications and the flexible circuit board manufacturing tolerances to obtain adjusted line connectivity constraint rules; Step S44: Construct a multi-directional edge detection operator according to the adjusted line connectivity constraint rules; use the multi-directional edge detection operator to perform multi-directional edge detection on the planar flexible circuit board image to obtain a line edge feature map; Step S45: Collect the thickness of the conductive layer of the flexible circuit board and the number of conductive layers of the flexible circuit board; adjust the parameters of the preset line defect feature recognition model according to the cover layer uniformity evaluation index, the thickness of the conductive layer of the flexible circuit board, and the number of conductive layers of the flexible circuit board to obtain an adaptive line defect feature recognition model; Step S46: Input the line edge feature map into the adaptive line defect feature recognition model for line defect recognition to obtain a preliminary line defect recognition map; Step S47: Perform local line width statistics on the preliminary line defect identification map to obtain local line width characteristic data; construct a line width threshold mapping table based on the local line width characteristic data; perform threshold correction on the preliminary line defect identification map according to the line width threshold mapping table to obtain a corrected line defect identification map; Step S48: Execute Step S41 - Step S47 on the planar flexible circuit board images at various angles to obtain corrected line defect identification maps at various angles, forming a multi-view defect segmentation atlas; Step S49: Generate a final line defect boundary map based on the multi-view defect segmentation atlas.

[0020] Through the evaluation of the cover layer uniformity and the extraction of circuit wiring characteristics, the present invention provides more accurate characteristic information for subsequent defect identification, effectively reducing the false detection rate. By constructing and adjusting the circuit grid connectivity constraint rules, it can better adapt to different manufacturing tolerances and design specifications, improving the flexibility and adaptability of detection. Through the application of multi-directional edge detection operators, the line edge characteristics can be captured more comprehensively, further improving the accuracy of defect identification. By adjusting the parameters of the preset model based on the cover layer uniformity evaluation index, the conductive layer thickness, and the number of layers, the model can more accurately identify defects and reduce misjudgments. Through the local line width statistics and threshold correction steps, the preliminary identification results can be further optimized to ensure the accuracy of the defect boundary. By generating a multi-view defect segmentation atlas and a final line defect boundary map, more comprehensive defect information can be provided.

[0021] Preferably, Step S5 includes the following steps: Step S51: Perform defect category probability inference on the final line defect boundary map to obtain a defect category probability distribution map; construct a defect region uncertainty map based on the defect category probability distribution map; Step S52: Perform defect detection credibility evaluation on the defect region uncertainty map to obtain a defect detection credibility score; perform spatial clustering on the defect detection credibility score to obtain a set of low-credibility defect regions; Step S53: Determine the low-credibility imaging region parameters according to the set of low-credibility defect regions; perform secondary image acquisition on the corresponding regions in the set of low-credibility defect regions in the flexible circuit board based on the low-credibility imaging region parameters to obtain a set of local circuit board images; Step S54: Perform super-resolution reconstruction on the set of local circuit board images to obtain enhanced local circuit board images; use a preset expert rule engine to perform line defect identification on the enhanced local circuit board images to obtain a secondary line defect classification result; Step S55: Generate a final flexible circuit board defect detection report according to the secondary line defect classification result and the final line defect boundary map.

[0022] Through probabilistic inference and uncertainty analysis of the final circuit defect boundary map, the present invention can accurately identify low-confidence regions that need further verification, reduce unnecessary repeated detections, and improve the detection efficiency. Through secondary image acquisition and super-resolution reconstruction based on the low-confidence regions, the ability to identify complex defects is further enhanced, ensuring the accuracy of the detection results.

[0023] Preferably, the present invention also provides a defect detection system for flexible printed circuit boards based on an image recognition model, which is used to execute the defect detection method for flexible printed circuit boards based on the image recognition model as described above. The defect detection system for flexible printed circuit boards based on the image recognition model includes: An image acquisition module, which is used to obtain a multi-view image set of the flexible printed circuit board; perform light source compensation on the multi-view image set of the flexible printed circuit board to obtain flexible printed circuit board image data; A feature point displacement segmentation module, which is used to perform feature point spatial displacement detection and segmentation on the flexible printed circuit board image data to obtain a circuit board deformation region segmentation map; construct a circuit board deformation partition plan according to the circuit board deformation region segmentation map; perform sub-pixel resampling on the flexible printed circuit board image data according to the circuit board deformation partition plan to obtain a planar flexible printed circuit board image; A deformation compensation module, which is used to extract circuit structure features from the planar flexible printed circuit board image to obtain an enhanced circuit structure feature map; perform spatial transformation compensation on the enhanced circuit structure feature map to obtain a multi-level feature map of the circuit board; A defect recognition module, which is used to perform circuit defect recognition and segmentation on the planar flexible printed circuit board image to obtain a multi-view defect segmentation map set; generate a final circuit defect boundary map based on the multi-view defect segmentation map set; A secondary defect recognition module, which is used to perform secondary circuit defect recognition on the flexible printed circuit board according to the final circuit defect boundary map to obtain a comprehensive distribution map of circuit defect detection; generate a final defect detection report for the flexible printed circuit board based on the comprehensive distribution map of circuit defect detection.

[0024] Through multi - perspective image acquisition and light source compensation, the present invention ensures the stability and consistency of image data. Through the feature point spatial displacement detection and deformation compensation module, dynamic deformation can be accurately corrected, significantly improving the detection accuracy. Especially in the detection of micron - level circuit gaps, the false detection rate is reduced from more than 12% to less than 3%. Through the real - time processing ability, rapid detection on the production line is ensured, meeting the high - throughput requirements of the industrial environment. Through deformation compensation and multi - level feature extraction, it can adapt to flexible printed circuit boards with different degrees of deformation, enhancing the robustness to complex environments and dynamic conditions. Through multi - perspective defect segmentation and secondary recognition mechanism, the reliability and consistency of the detection results are further improved. Based on manual evaluation annotation and model online update, the system can continuously optimize the detection model, adapt to new types of defects and changing detection requirements, ensuring long - term detection accuracy and adaptability. Through model decision visual explanation and deformation compensation optimization suggestions, the system not only provides detection results, but also provides data support for manufacturing process improvement and quality control, enhancing the transparency and interpretability of the detection process. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Other features, objects, and advantages of the present invention will become more apparent by reading the detailed description with reference to the following drawings: Figure 1 The flowchart showing the steps of a method for detecting defects of a flexible printed circuit board based on an image recognition model in an embodiment is shown.

[0026] Figure 2 The detailed flowchart showing the steps of step S3 in an embodiment is shown.

[0027] Figure 3 The detailed flowchart showing the steps of step S5 in an embodiment is shown. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0028] The technical method of the present invention will be clearly and completely described below with reference to the drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of them. All other embodiments obtained by those skilled in the art within the scope of the present invention without creative efforts belong to the scope of protection of the present invention.

[0029] In addition, the drawings are only schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted. Some of the block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. The functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor methods and / or microcontroller methods.

[0030] It should be understood that although terms such as "first", "second", etc. may be used herein to describe various units, these units should not be limited by these terms. These terms are only used to distinguish one unit from another. For example, without departing from the scope of the exemplary embodiments, the first unit may be referred to as the second unit, and similarly the second unit may be referred to as the first unit. The term "and / or" used herein includes any and all combinations of one or more of the listed associated items.

[0031] To achieve the above object, please refer to Figures 1 to 3 , the present invention provides a method for detecting defects of a flexible printed circuit board based on an image recognition model, including the following steps: Step S1: Obtain a multi-view image set of the flexible printed circuit board; perform light source compensation on the multi-view image set of the flexible printed circuit board to obtain flexible printed circuit board image data; Step S2: Perform feature point spatial displacement detection and segmentation on the flexible printed circuit board image data to obtain a circuit board deformation area segmentation map; construct a circuit board deformation partition scheme according to the circuit board deformation area segmentation map; perform sub-pixel resampling on the flexible printed circuit board image data according to the circuit board deformation partition scheme to obtain a planar flexible printed circuit board image; Step S3: Extract line structure features from the planar flexible printed circuit board image to obtain an enhanced line structure feature map; perform spatial transformation compensation on the enhanced line structure feature map to obtain a circuit board multi-level feature map; Step S4: Perform line defect recognition and segmentation on the planar flexible printed circuit board image to obtain a multi-view defect segmentation map set; generate a final line defect boundary map based on the multi-view defect segmentation map set; Step S5: Perform secondary line defect recognition on the flexible printed circuit board according to the final line defect boundary map to obtain a comprehensive distribution map of line defect detection; generate a final defect detection report of the flexible printed circuit board based on the comprehensive distribution map of line defect detection.

[0032] In this embodiment, a four-point surround acquisition platform is built using four Basler ace series industrial cameras. The accuracy of each camera is 0.1 m, and the positions are cross-distributed at 45° on the X-Y plane to ensure that the viewing angles of the four cameras are aligned with the center of the preset target detection area. Camera calibration is performed using a checkerboard calibration board (size: 300 mm × 300 mm, grid size: 10 mm) and the cv2.calibrateCamera function of the OpenCV library. The contrast-limited adaptive histogram equalization (CLAHE) is performed using the cv2.createCLAHE function of the OpenCV library, with the clip limit set to 40 and the grid size set to 8×8. The brightness histogram is calculated through cv2.calcHist to generate a map of illumination non-uniformity. An image illumination compensation coefficient table is constructed based on the map, and pixel-level brightness correction is performed using cv2.multiply to obtain a set of multi-view images with uniform illumination. The multi-scale Harris corner detection is performed using the cv2.cornerHarris function of the OpenCV library, with blockSize = 3, ksize = 5, and k = 0.04. The detection range is from 1 pixel to 5 pixels, with a step size of 0.5. Local binary pattern (LBP) descriptors are extracted for the detected corners, and a feature point descriptor database is constructed using cv2.ORB_create. The spatial displacement vector of the feature points is calculated through cv2.calcOpticalFlowPyrLK to generate an initial displacement vector field, and cv2.RANSAC is used for outlier rejection, finally obtaining a segmentation map of the deformed area of the circuit board. The gradient of the displacement field is calculated using the cv2.Sobel function of the OpenCV library, with ddepth = cv2.CV_64F and ksize = 3. Clustering is performed on the gradient through cv2.kmeans, with the number of cluster centers set to 3, the number of iterations set to 10, and the termination condition being: (cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_MAX_ITER, 10, 1.0) is used to generate the deformation partition scheme of the circuit board. The cv2.remap function of the OpenCV library is used for sub-pixel resampling, and the interpolation method is set to cv2.INTER_CUBIC. The resampling process is guided by the pixel-level mapping transformation data table to obtain the image of the planar flexible circuit board. The cv2.pyrDown and cv2.pyrUp functions of the OpenCV library are used to construct a Gaussian pyramid, and the image is decomposed into a five-layer resolution feature set. The directional texture features of the circuit edges are extracted by a preset directional Gabor filter bank, and filtering is performed using cv2.filter2D to obtain the circuit texture direction feature map. The feature map is feature-encoded using the encoder of the deep residual network (ResNet) in the PyTorch library, with the number of input channels set to 3 and the number of output channels set to 2048. The receptive field is expanded through dilated convolution to obtain the multi-level feature map of the circuit board. The cv2.Canny function of the OpenCV library is used for edge detection, with the thresholds set to 50 and 150. The circuit edge features are extracted by a multi-directional edge detection operator and input into a pre-trained circuit defect feature recognition model for defect recognition to obtain a preliminary circuit defect recognition map. The accuracy of the recognition result is ensured through threshold correction. The cv2.addWeighted function of the OpenCV library is used to perform weighted fusion on the multi-view defect segmentation maps, with the weights set to 0.7 and 0.3 respectively. The final circuit defect boundary map is generated through spatial registration and pixel voting, and sub-pixel level smoothing adjustment is performed. LaTeX is used to generate the final flexible circuit board defect detection report including the detection results, optimization suggestions, and model interpretation diagrams.

[0033] Preferably, in step S1, obtaining the multi-view image set of the flexible circuit board includes: Step S11: A four-point surrounding acquisition platform is built by four industrial cameras to obtain the configuration parameters of the multi-angle imaging system. Among them, the accuracy of the industrial camera is 0.1 mm, the positions of the industrial cameras are cross-distributed at 45° on the X-Y plane, and the four camera views are all centered on the preset target detection area center; Step S12: The conveyor belt path of the flexible circuit board is tracked and predicted to obtain the circuit board position prediction data; Step S13: Determine the multi-camera synchronous trigger command based on the circuit board position prediction data; Step S14: According to the configuration parameters of the multi-angle imaging system and the multi-camera synchronous trigger command, multi-angle imaging acquisition is performed on the flexible circuit board to obtain the original multi-angle image data set. Among them, in the multi-angle imaging acquisition, the exposure time of the industrial camera is set to 2 ms, the global shutter mode is adopted, and each camera captures 25 images per second simultaneously; Step S15: Perform pre-calibration and distortion removal on the original multi-angle image dataset to obtain a multi-view image set of the flexible printed circuit board.

[0034] In this embodiment, four Basler ace series industrial cameras are selected to build a four-point surround acquisition platform. The accuracy of each camera is 0.1 m, the resolution is 2048×2048 pixels, the frame rate is 25 frames per second, and the global shutter mode is supported. The cameras are installed around the flexible printed circuit board conveyor belt and are distributed in a 45° cross pattern. The viewing angles of the four cameras are all aligned with the center of the preset target detection area. A checkerboard calibration board (size: 300 mm×300 mm, grid size: 10 mm) is used to calibrate the cameras. The cv2.calibrateCamera function in the OpenCV library is used in the calibration process to ensure the accurate calibration of the internal parameters (focal length, principal point coordinates) and external parameters (rotation matrix, translation vector) of each camera. After calibration, the imaging system configuration parameters of the four cameras are recorded and saved, including the camera position, viewing angle, focal length, and aperture value. The target tracking function of the OpenCV library is used to track and predict the conveyor belt path of the flexible printed circuit board. The speed of the conveyor belt is 0.5 m / s, the length of the flexible printed circuit board is 20 cm, and the width is 15 cm. First, an infrared sensor is installed at the entrance of the conveyor belt to detect the entry time of the circuit board. When the circuit board enters the conveyor belt, the infrared sensor triggers a signal to obtain the position and speed data of the circuit board in real time, and predicts the movement trajectory of the circuit board on the conveyor belt according to the transportation speed of the conveyor belt. The prediction results include the time and position when the circuit board reaches the detection area, and the data is output in JSON format. The NIPCI-6509 industrial I / O card is used as a multi-camera synchronous trigger controller. According to the predicted circuit board position data, the trigger condition is set: when the center of the circuit board enters the detection area, four industrial cameras are triggered to take synchronous pictures. The specific operation is as follows: The I / O card receives the target position data from OpenCV and writes the trigger logic through the LabVIEW programming environment. When the center coordinates of the circuit board meet the trigger condition (for example, the X coordinate is within the range of 200 mm±10 mm, and the Y coordinate is within the range of 150 mm±10 mm), the I / O card sends a synchronous trigger signal (pulse width: 1 ms) to the four cameras. The trigger signal is transmitted through a BNC coaxial cable to ensure that the four cameras capture images simultaneously and avoid image deviation caused by time difference. Four Basler industrial cameras are used for multi-angle imaging acquisition. The exposure time of each camera is set to 2 ms, and the global shutter mode is adopted. Each camera captures 25 images per second, and the image data is transmitted to the data acquisition server. The ImageJ image processing software is used to preprocess the original multi-angle image dataset. Each image is de-distorted, and the cv2.undistort function in OpenCV is used to correct the lens distortion. The brightness of the corrected image is equalized, and the cv2.equalizeHist function is used to enhance the image contrast. Finally, the processed image data is packaged into an HDF5 format file. Through the above steps, a multi-angle image dataset of the flexible printed circuit board can be obtained.

[0035] Preferably, in step S1, light source compensation is performed on the multi-view image set of the flexible circuit board, including: Evaluating the illumination non-uniformity of the multi-view image set of the flexible circuit board to obtain an illumination non-uniformity distribution map; Constructing an image illumination compensation coefficient table according to the illumination non-uniformity distribution map; Performing pixel-level brightness correction on the multi-view image set of the flexible circuit board according to the image illumination compensation coefficient table to obtain an illumination-balanced multi-view image set; Performing line feature enhancement on the illumination-balanced multi-view image set to obtain an enhanced flexible circuit board image set; Constructing a GPU-accelerated image noise reduction pipeline based on the enhanced flexible circuit board image set; using the GPU-accelerated image noise reduction pipeline to suppress high-frequency noise of the enhanced flexible circuit board image set to obtain a noise-reduced flexible circuit board image set; Performing data format conversion and packaging on the noise-reduced flexible circuit board image set to obtain flexible circuit board image data.

[0036] In this embodiment, the OpenCV library is used to evaluate the illumination non-uniformity of the multi-view image set of the flexible printed circuit board. First, a set of multi-view image data is loaded. These image data are collected by four industrial cameras, and the resolution of each image is 2048×2048 pixels. The cv2.createCLAHE function in OpenCV is used to perform contrast-limited adaptive histogram equalization (CLAHE) to enhance the local contrast of the images. The specific operations are as follows: Apply CLAHE to each image, set the clip limit of CLAHE to 40, and the grid size to 8×8. The processed images can clearly show the regions of illumination non-uniformity. The cv2.calcHist function in OpenCV is used to calculate the brightness histogram of each image and generate a distribution map of illumination non-uniformity. This distribution map is displayed in the form of a heat map, where red represents high-brightness regions and blue represents low-brightness regions. Finally, the distribution map of illumination non-uniformity is saved as a PNG format file. The NumPy library and Matplotlib library in Python are used to construct a table of image illumination compensation coefficients. First, the distribution map of illumination non-uniformity is loaded. This image is a two-dimensional array representing the brightness values of each pixel in the image. The np.histogram2d function in NumPy is used to calculate the two-dimensional histogram of the brightness values to determine the distribution range of the brightness values. The specific operations are as follows: Divide the brightness values into 256 intervals and calculate the number of pixels in each interval. According to the brightness distribution, a table of illumination compensation coefficients is generated using the linear interpolation method. The range of the compensation coefficients is set to 0.5 to 1.5, where the compensation coefficients in the low-brightness regions are higher and those in the high-brightness regions are lower. Finally, the plt.imshow function in Matplotlib is used to visualize the compensation coefficient table and save it as a PNG format file. The OpenCV library and NumPy library are used to perform pixel-level brightness correction on the multi-view image set of the flexible printed circuit board. First, the original multi-view image set and the illumination compensation coefficient table are loaded. The compensation coefficient table is a two-dimensional array representing the brightness compensation coefficients of each pixel. The specific operations are as follows: For each image, the np.multiply function in NumPy is used to multiply the brightness values of the image with the compensation coefficient table pixel by pixel, thereby achieving brightness correction. The corrected brightness values are limited to the range of 0 to 255. The corrected images are saved as PNG format files through the cv2.imwrite function in OpenCV to form a multi-view image set with uniform illumination. The GIMP image processing software is used to enhance the line features of the multi-view image set with uniform illumination. The specific operations are as follows: First, each image in the multi-view image set with uniform illumination is loaded. The "Edge Detection" filter in GIMP (e.g., Sobel filter) is applied to highlight the edge features of the lines. The "Contrast Enhancement" tool is used to further enhance the contrast of the image to make the lines more clearly visible, and the enhanced images are saved as PNG format files to form an enhanced flexible printed circuit board image set.Build a GPU-accelerated image denoising pipeline using the NVIDIA CUDA platform and the cuDNN library. First, load the enhanced flexible printed circuit board image set, where the resolution of these images is 2048×2048 pixels. Use deep learning models provided by cuDNN (e.g., U-Net) for image denoising. The specific operations are as follows: Load the image data into the GPU memory, and use the pre-trained U-Net model to denoise the images. The input of the U-Net model is the enhanced image, and the output is the denoised image. Use the parallel computing ability of CUDA to divide the image data into multiple batches for processing. The processed denoised images are saved as PNG format files through the cudnnSave function of cuDNN, forming a denoised flexible printed circuit board image set. Use the HDF5 library and the h5py library in Python to perform data format conversion and packaging on the denoised flexible printed circuit board image set. The specific operations are as follows: Load each image in the denoised flexible printed circuit board image set. Use the h5py.File function of h5py to create an HDF5 file and store the data of each image as a dataset. Compress the image data into 8-bit grayscale images and use the chunk storage function of HDF5 to divide the data into multiple chunks for storage. Finally, save the packaged dataset as an HDF5 format file.

[0037] Preferably, in step S2, performing feature point spatial displacement detection and segmentation on the flexible printed circuit board image data includes: Performing multi-scale Harris corner detection on the flexible printed circuit board image data to obtain an image candidate feature point set, where the multi-scale Harris corner detection detects corner features from 1 pixel to 5 pixels with a step size of 0.5; Extracting local binary pattern descriptors for the image candidate feature point set to obtain a feature point descriptor database; constructing an image feature point correspondence table based on the feature point descriptor database; Calculating the spatial displacement vector of the feature points according to the image feature point correspondence table to generate an initial displacement vector field; Removing outliers from the initial displacement vector field to obtain an adjusted displacement vector field; constructing a global displacement field of the circuit board deformation based on the adjusted displacement vector field; Dividing the global displacement field of the circuit board deformation to obtain a circuit board deformation region segmentation map.

[0038] In this embodiment, the OpenCV library is used to perform multi-scale Harris corner detection on the image data of the flexible printed circuit board. The image data of the flexible printed circuit board after noise reduction is loaded, and the resolution of these images is 2048×2048 pixels. The multi-scale detection parameters are set as follows: the detection range is from 1 pixel to 5 pixels, and the step size is 0.5 pixels. The specific operations are as follows: Use the cv2.cornerHarris function in OpenCV to perform corner detection, set blockSize to 3, ksize to 5, and the k value to 0.04. By adjusting the blockSize and ksize parameters, the corner features at scales of 1 pixel, 2 pixels, 3 pixels, 4 pixels, and 5 pixels are detected respectively. The detection results are saved as a two-dimensional array, representing the corner response value of each pixel. Finally, use the cv2.dilate function to perform dilation processing on the response values to highlight the corner features. The detected set of corner feature points is saved as a NumPy array file. Use the OpenCV library to extract local binary pattern (LBP) descriptors for the set of candidate feature points in the image. First, load the detected set of corner feature points, which is a two-dimensional array representing the corner response value of each pixel. The specific operations are as follows: Use the cv2.ORB_create function in OpenCV to extract the local binary pattern descriptors of the feature points. Set nfeatures to 500, patchSize to 31, and fastThreshold to 20. The extracted descriptors are saved as a NumPy array file to form a feature point descriptor database. Use the cv2.drawKeypoints function in OpenCV to draw the feature points on the original image and save it as a PNG format file. Use the OpenCV library and the FLANN matcher to construct a correspondence table of image feature points. Load the feature point descriptor database, and these descriptors are extracted by LBP. The specific operations are as follows: Use the cv2.FlannBasedMatcher in OpenCV to create a feature point matcher. Set indexParams to dict(algorithm=1,trees=5), and searchParams to dict(checks=50). The feature point descriptors from different perspectives are matched through the matcher to obtain the correspondence of feature points. The matching results are saved as a NumPy array file, representing the correspondence of each feature point in different perspectives. Use the cv2.drawMatches function in OpenCV to draw the matching results and save it as a PNG format file. Use the OpenCV library and the NumPy library to calculate the spatial displacement vector of the feature points. First, load the correspondence table of feature points, which is a two-dimensional array representing the correspondence of each feature point in different perspectives.The specific operations are as follows: Use the cv2.calcOpticalFlowPyrLK function in OpenCV to calculate the optical flow of feature points, thereby obtaining the spatial displacement vectors of feature points. Set winSize to (15, 15), maxLevel to 2, and criteria to: (cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 10, 0.03). The calculated displacement vectors are saved as a NumPy array file, representing the displacement vectors of each feature point. Map the displacement vectors to each pixel position of the original image to form a two-dimensional vector field. The visualization result of the vector field is saved as a PNG format file. Use the OpenCV library to remove outliers from the initial displacement vector field. First, load the initial displacement vector field, which is a two-dimensional array representing the displacement vectors of each pixel. The specific operations are as follows: Use cv2.RANSAC in OpenCV to perform a robust estimation on the displacement vector field and remove outliers. Set ransacReprojThreshold to 5.0, maxIters to 100, and confidence to 0.99. After RANSAC processing, an adjusted displacement vector field is obtained. Map the adjusted displacement vector field to the entire image plane through the cv2.remap function in OpenCV to form a global displacement field. The visualization result of the global displacement field is saved as a two-dimensional array. Use the OpenCV library and k-means to divide the deformation area of the circuit board global displacement field. First, load the global displacement field, which is a two-dimensional array representing the displacement vectors of each pixel. The specific operations are as follows: Use the cv2.Sobel function in OpenCV to calculate the gradient of the displacement field, set ddepth to cv2.CV_64F, and ksize to 3. Use the cv2.kmeans function in OpenCV to cluster the gradients, set the number of cluster centers to 3, the number of iterations to 10, and the termination condition to: (cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_MAX_ITER, 10, 1.0). The clustering result is saved as a NumPy array file, representing the cluster category to which each pixel belongs. Use the cv2.applyColorMap function in OpenCV to visualize the clustering result as a heat map and save it as a PNG format file to form a circuit board deformation area segmentation map.

[0039] Preferably, in step S2, constructing a circuit board deformation partition scheme according to the circuit board deformation area segmentation map includes: Obtain the global displacement field of the circuit board deformation; construct the circuit board deformation feature map based on the circuit board deformation area segmentation map and the global displacement field of the circuit board deformation; Construct a thin plate spline control point grid based on the circuit board deformation feature map, wherein the distance between control points in the thin plate spline control point grid ranges from 5 to 20 pixels, and the grid density ranges from 10 to 50 control points per square centimeter; Perform thin plate spline interpolation on the thin plate spline control point grid to obtain the first circuit board deformation spatial interpolation data; Perform local deformation error evaluation on the first circuit board deformation spatial interpolation data to generate a circuit board deformation fitting residual map, wherein the size range of the local deformation error evaluation window is from 3×3 to 15×15 pixels, and the circuit board deformation fitting residual map uses pseudo-color coding to represent the size of the residual value, the first color represents the low error area, the second color represents the high error area, and the first color is different from the second color; Optimize the first circuit board deformation spatial interpolation data by the least squares method according to the circuit board deformation fitting residual map to obtain the second circuit board deformation spatial interpolation data; Calculate the deformation gradient field of the second circuit board deformation spatial interpolation data; Group the deformation gradient field to obtain deformation gradient clustering data; Generate a circuit board deformation zoning scheme according to the deformation gradient clustering data, wherein the circuit board deformation zoning scheme includes at least one or more of the high deformation area and the low deformation area.

[0040] In this embodiment, the OpenCV library is used to load the segmentation map of the deformed area of the circuit board and the global displacement field data. Using the cv2.remap function of OpenCV, the global displacement field data is mapped onto the segmentation map to construct the deformed feature map of the circuit board. The cv2.INTER_LINEAR interpolation method is set. The feature map data is saved as a NumPy array file. Using the cv2.sparseToDense function of the OpenCV library, the deformed feature map of the circuit board is converted into a dense control point grid. The control point spacing is set to 10 pixels, and the grid density is 30 control points per square centimeter. By adjusting the control point spacing and grid density, it is ensured that the grid can accurately capture the deformation features. The constructed control point grid is saved as a NumPy array file. Using the scipy.interpolate.Rbf function of the SciPy library, interpolation is performed on the thin plate spline control point grid. The thin plate spline interpolation method (function='thin_plate') is selected, and the smoothing parameter smooth = 0.1 is set. The interpolation result is saved as a NumPy array file to form the first interpolated data of the circuit board deformation space. Using the cv2.Sobel function of the OpenCV library, gradient calculation is performed on the first interpolated data of the circuit board deformation space to obtain the local deformation error. The evaluation window size is set to 7×7 pixels, and the residual values are visualized using pseudo-color coding. The low-error areas are represented in green, and the high-error areas are represented in red. The generated circuit board deformation fitting residual map is saved as a PNG format file. Using the cv2.leastSquares function of the OpenCV library, least squares optimization is performed on the first interpolated data of the circuit board deformation space according to the circuit board deformation fitting residual map. The number of optimization iterations is set to 10, and the error threshold is 0.01. The optimized data is saved as a NumPy array file to form the second interpolated data of the circuit board deformation space, improving the accuracy of deformation compensation. Using the cv2.Sobel function of the OpenCV library, gradient calculation is performed on the second interpolated data of the circuit board deformation space to obtain the deformation gradient field. The depth of gradient calculation is set to cv2.CV_64F, and the kernel size is 3. The calculation result is saved as a NumPy array file. Using the cv2.kmeans function of the OpenCV library, clustering analysis is performed on the deformation gradient field. The number of cluster centers is set to 2, the number of iterations is 10, and the termination condition is cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_MAX_ITER. According to the clustering result, a circuit board deformation partition scheme is generated to clearly identify the high-deformation area and the low-deformation area.

[0041] Preferably, in step S2, sub-pixel resampling of the flexible circuit board image data according to the circuit board deformation partition scheme includes: Obtain the second interpolated data of the circuit board deformation space; Segment-optimize the interpolation data of the deformation space of the second circuit board according to the circuit board deformation zoning scheme to obtain the segmented interpolation data of the circuit board deformation, where the segment-optimization is specifically as follows: For the high-deformation region in the circuit board deformation zoning scheme, use the cubic interpolation algorithm to perform local interpolation on the corresponding local interpolation coefficients in the interpolation data of the deformation space of the second circuit board; For the low-deformation region in the circuit board deformation zoning scheme, simplify the interpolation of the global interpolation coefficients in the interpolation data of the deformation space of the second circuit board; Apply first-order continuity constraints at the grid boundaries between the high-deformation region and the low-deformation region in the interpolation data of the deformation space of the second circuit board; Construct a pixel-level mapping transformation data table based on the segmented interpolation data of the circuit board deformation; Perform sub-pixel resampling on the flexible circuit board image data according to the pixel-level mapping transformation data table to obtain a planar flexible circuit board image.

[0042] In this embodiment, use the NumPy library to load the interpolation data of the deformation space of the second circuit board generated in the previous steps. The data is stored as a.npy format file. Read the data through the numpy.load() function to obtain a three-dimensional array representing the deformation of the circuit board at different positions. Use the OpenCV library to apply the cubic interpolation algorithm to the high-deformation region, set the interpolation kernel size to 5×5 pixels, and use the cv2.resize() function and specify the cv2.INTER_CUBIC interpolation method. For the low-deformation region, use simplified interpolation and the cv2.INTER_LINEAR linear interpolation method to reduce the computational complexity. Through the above steps, obtain the optimized segmented interpolation data of the circuit board deformation. Apply first-order continuity constraints at the boundary between the high-deformation and low-deformation regions. Use the scipy.interpolate module of the SciPy library to process the interpolation data through the RectBivariateSpline function. Set the boundary condition to first-order derivative continuity. The processed data is saved as a new NumPy array file for subsequent pixel-level mapping transformation. Use the cv2.initUndistortRectifyMap function of the OpenCV library to generate a pixel-level mapping transformation data table according to the optimized interpolation data. Set the camera matrix and distortion coefficients to generate a mapping grid. The mapping data table is saved as two NumPy array files corresponding to the mapping coordinates in the x and y directions. Use the cv2.remap function of the OpenCV library to resample the original flexible circuit board image data according to the pixel-level mapping transformation data table. Set the interpolation method to cv2.INTER_CUBIC to ensure sub-pixel-level accuracy. The resampled image is saved as a PNG format file to obtain a planarized flexible circuit board image.

[0043] Preferably, step S3 includes the following steps: Step S31: Construct a multi-scale image pyramid; perform Gaussian pyramid decomposition on the planar flexible printed circuit board image using the multi-scale image pyramid to obtain a five-layer resolution feature set of the image; Step S32: Use a preset directional Gabor filter bank to extract line edge directional texture features from the five-layer resolution feature set of the image to obtain a line texture direction feature map; Step S33: Perform non-linear activation on the line texture direction feature map to obtain a line edge response map; Step S34: Construct a deep residual network encoder based on the line edge response map; use the deep residual network encoder to perform feature encoding on the line edge response map to obtain line multi-scale feature mapping data; Step S35: Perform dilated convolution processing on the line multi-scale feature mapping data to obtain a line extended receptive field feature map; Step S36: Construct a multi-level feature map of the printed circuit board based on the line extended receptive field feature map and the line multi-scale feature mapping data.

[0044] In this embodiment, the OpenCV library is used to construct a multi-scale image pyramid for the planar flexible printed circuit board image. First, load the planar flexible printed circuit board image with a resolution of 2048×2048 pixels. Use the cv2.pyrDown and cv2.pyrUp functions of OpenCV to construct a Gaussian pyramid and decompose the image into a five-layer resolution feature set. The specific operations are as follows: Starting from the original image, apply the cv2.pyrDown function four times in sequence to obtain a five-layer image feature set with different resolutions. The resolution of each layer of the image is 2048×2048, 1024×1024, 512×512, 256×256, and 128×128 pixels in sequence. The decomposed image feature set is saved as a NumPy array file. Use the OpenCV library and a preset directional Gabor filter bank to extract the line edge directional texture features of the five-layer resolution feature set. First, define a set of Gabor filters with a wavelength of 10 pixels, directions of 0°, 45°, 90°, 135°, 180°, and a bandwidth of 1.5. The specific operations are as follows: For each layer of the resolution feature set, apply the Gabor filter bank in sequence. Use the cv2.filter2D function of OpenCV to filter each layer of the image to obtain the line texture direction feature map of each layer of the image. Use the NumPy library to perform non-linear activation processing on the line texture direction feature map. First, load the line texture direction feature map of each layer of the image. The specific operations are as follows: Apply the ReLU activation function to each layer of the feature map, that is, for each pixel value in the feature map, set it to max(0, original value). The processed feature map is saved as a NumPy array file to form a line edge response map. Use the PyTorch library to construct a deep residual network (ResNet) encoder. First, define a ResNet-50 model with an input channel number of 3 and an output channel number of 2048. Load the pre-trained ResNet-50 model and adjust the input layer according to the size of the line edge response map. The specific operations are as follows: Input the line edge response map of each layer into the ResNet-50 model to extract multi-scale feature map data. The output of the model is the multi-scale feature map data of each layer of the image, which is saved as a NumPy array file. Use the PyTorch library to perform dilated convolution processing on the line multi-scale feature map data. First, define a dilated convolution layer with a convolution kernel size of 3×3 and a dilation rate of 2. The specific operations are as follows: Input the multi-scale feature map data of each layer into the dilated convolution layer to obtain an extended receptive field feature map. The feature map after dilated convolution processing is saved as a NumPy array file. Use the NumPy library and the OpenCV library to fuse the line extended receptive field feature map and the line multi-scale feature map data to construct a multi-level feature map of the printed circuit board. The specific operations are as follows: Concatenate the extended receptive field feature map and the multi-scale feature map data in the channel dimension using the numpy.concatenate function.The stitched feature map is normalized using the cv2.normalize function in OpenCV to ensure that the feature values are in the range of 0 to 1. The final multi-level feature map is saved as a NumPy array file.

[0045] Preferably, step S4 includes the following steps: Step S41: Evaluate the uniformity of the cover layer of the planar flexible circuit board image to obtain a cover layer uniformity evaluation index; Step S42: Extract the circuit wiring features of the planar flexible circuit board image to obtain the basic circuit topology structure data; construct circuit grid connectivity constraint rules based on the basic circuit topology structure data; Step S43: Obtain the flexible circuit board design specifications and the manufacturing tolerances of the flexible circuit board; adjust the constraint rules of the circuit grid connectivity constraint rules according to the flexible circuit board design specifications and the manufacturing tolerances of the flexible circuit board to obtain adjusted line connectivity constraint rules; Step S44: Construct a multi-directional edge detection operator according to the adjusted line connectivity constraint rules; use the multi-directional edge detection operator to perform multi-directional edge detection on the planar flexible circuit board image to obtain a line edge feature map; Step S45: Collect the thickness of the conductive layer of the flexible circuit board and the number of conductive layers of the flexible circuit board; adjust the parameters of the preset line defect feature recognition model according to the cover layer uniformity evaluation index, the thickness of the conductive layer of the flexible circuit board, and the number of conductive layers of the flexible circuit board to obtain an adaptive line defect feature recognition model; Step S46: Input the line edge feature map into the adaptive line defect feature recognition model for line defect recognition to obtain a preliminary line defect recognition map; Step S47: Perform local line width statistics on the preliminary line defect recognition map to obtain local line width feature data; construct a line width threshold mapping table based on the local line width feature data; perform threshold correction on the preliminary line defect recognition map according to the line width threshold mapping table to obtain a corrected line defect recognition map; Step S48: Execute steps S41 - S47 on the planar flexible circuit board images at various angles to obtain the corrected line defect recognition maps at various angles, forming a multi-view defect segmentation atlas; Step S49: Generate a final line defect boundary map based on the multi-view defect segmentation atlas.

[0046] Particularly importantly, step S49 further includes the following steps: Step S491: Obtain a pixel-level mapping transformation data table; perform spatial registration on the multi-view defect segmentation atlas according to the pixel-level mapping transformation data table to obtain an aligned defect segmentation atlas; Step S492: Count the number of times each pixel position in each segmentation map in the alignment defect segmentation atlas is marked as a defect to obtain a pixel position defect marking frequency table; Step S493: Based on the pixel position defect marking frequency table, if more than 60% of the perspectives consider the pixel to be a defect, then mark the pixel as a defect, thereby generating a pixel defect voting result; Step S494: Binarize the pixel defect voting result to generate a line fusion defect probability map; Step S495: Generate a line defect boundary map according to the line fusion defect probability map; perform sub-pixel level smoothing adjustment on the line defect boundary map to obtain the final line defect boundary map.

[0047] In this embodiment, the OpenCV library is used to evaluate the uniformity of the cover layer of the planar flexible printed circuit board image. The planar flexible printed circuit board image (with a resolution of 2048×2048 pixels) is loaded. The brightness histogram of the image is calculated through the cv2.calcHist function of OpenCV, and the brightness distribution is statistically analyzed. The NumPy library is used to calculate the standard deviation and mean of the brightness to evaluate the uniformity of the cover layer. The specific operations are as follows: The brightness values are divided into 256 intervals, and the number of pixels in each interval is calculated. According to the variance and mean of the brightness distribution, a cover layer uniformity evaluation index is generated. This index is represented in numerical form, ranging from 0 to 1, and the closer the value is to 1, the more uniform the cover layer is. Finally, the evaluation index is saved as a JSON format file. OpenCV is used to extract the edges of the planar flexible printed circuit board image to obtain the edge feature map of the circuit. The NetworkX library is used to perform topological analysis on the extracted edge features to construct the basic topological structure data of the circuit. The specific operations are as follows: The circuit edges are extracted through Canny detection, and the thresholds are set to 50 and 150. The graph structure of NetworkX is used to store the node and edge information of the circuit, and the connectivity constraint rules of the circuit grid are constructed. The constraint rules include the connectivity of the circuit, the limitations of branch points and terminal points. Finally, the topological structure data and the constraint rules are saved as JSON format files. The manufacturing tolerance parameters of the flexible printed circuit board are obtained from the design specification file provided by the manufacturer, including the line width tolerance (±10μm), the spacing tolerance (±5μm), and the cover layer thickness tolerance (±2μm). The conditional judgment logic of Python is used to adjust the connectivity constraint rules generated in step S42. The specific operations are as follows: According to the tolerance range in the design specification, the thresholds in the connectivity constraint rules are dynamically adjusted. For example, if the design specification requires the line width to be 100μm±10μm, the width threshold in the connectivity constraint rules is adjusted to 90μm to 110μm. The adjusted constraint rules are saved as JSON format files. The Sobel operator of OpenCV is used to construct a multi-directional edge detection operator. The specific operations are as follows: Sobel operators in four directions (0°, 45°, 90°, 135°) are defined, which are used to detect edges in different directions respectively. The planar flexible printed circuit board image is input into each Sobel operator to extract the edge features in four directions. The edge feature maps in four directions are fused to generate a comprehensive circuit edge feature map. Finally, the edge feature map is saved as a PNG format file. A laser thickness gauge is used to collect the thickness (for example, the copper foil thickness is 18μm) and the number of layers (for example, double layer) of the conductive layer of the flexible printed circuit board. Combining the cover layer uniformity evaluation index generated in step S41, the PyTorch library is used to adjust the parameters of the pre-trained circuit defect feature recognition model. The specific operations are as follows: The pre-trained deep learning model (such as ResNet-50) is loaded, and the input parameters of the model are adjusted according to the collected thickness, number of layers, and uniformity index.For example, if the overlay uniformity evaluation index is lower than 0.8, the sensitivity of the model to edge blurring is increased. The adjusted model is saved as a.pt file. Use OpenCV to load the line edge feature map generated in step S44 and input it into the adjusted adaptive line defect feature recognition model in step S45. The specific operations are as follows: Convert the edge feature map to the PyTorch tensor format and input it into the model for inference. The model output is a preliminary line defect recognition map, where each pixel is labeled as defective or non-defective. The recognition result is saved as a PNG format file. Use the morphological operations of OpenCV to perform local line width statistics on the preliminary line defect recognition map. The specific operations are as follows: Extract the width features of the line through morphological dilation and erosion operations. Use the NumPy library to calculate the local width of each pixel and generate a line width threshold mapping table. According to the mapping table, perform threshold correction on the preliminary recognition map to ensure that areas with widths exceeding the tolerance range are labeled as defective. The corrected recognition map is saved as a PNG format file. Perform the operations of steps S41 to S47 on the multi-angle images collected by four industrial cameras respectively. The specific operations are as follows: Perform overlay uniformity evaluation, circuit wiring feature extraction, constraint rule adjustment, edge detection, model parameter adjustment, defect recognition, and threshold correction on the images at each angle in sequence. Save the corrected line defect recognition map at each angle as a PNG format file and package it into a multi-view defect segmentation atlas. Use OpenCV to perform spatial registration and fusion on the multi-view defect segmentation atlas. The specific operations are as follows: Load the pixel-level mapping transformation data table and use the cv2.remap function of OpenCV to perform spatial registration on the multi-view defect segmentation atlas to ensure that the pixel positions of all images are aligned. Count the number of times each pixel position is labeled as defective, and use the NumPy library to generate a pixel position defect label count table. According to the label count table, if more than 60% of the views consider a certain pixel to be defective, then label that pixel as defective to generate a pixel defect voting result. Perform binary processing on the voting result to generate a line fusion defect probability map. Use the contour detection function (cv2.findContours) of OpenCV to generate a line defect boundary map and perform sub-pixel level smoothing adjustment through the SHAP library. Finally, save the defect boundary map as a PNG format file.

[0048] Preferably, step S5 includes the following steps: Step S51: Perform defect category probability inference on the final line defect boundary map to obtain a defect category probability distribution map; construct a defect region uncertainty map based on the defect category probability distribution map; Step S52: Perform defect detection credibility evaluation on the defect region uncertainty map to obtain a defect detection credibility score; perform spatial clustering on the defect detection credibility score to obtain a set of low-credibility defect regions; Step S53: Determine the low-confidence imaging region parameters based on the set of low-confidence defect regions; perform secondary image acquisition on the corresponding regions in the set of low-confidence defect regions in the flexible printed circuit board based on the low-confidence imaging region parameters to obtain a set of local images of the printed circuit board; Step S54: Perform super-resolution reconstruction on the set of local images of the printed circuit board to obtain enhanced local images of the printed circuit board; use a preset expert rule engine to identify circuit defects in the enhanced local images of the printed circuit board to obtain a secondary circuit defect classification result; Step S55: Generate a final flexible printed circuit board defect detection report based on the secondary circuit defect classification result and the final circuit defect boundary map.

[0049] Particularly importantly, Step S55 further includes the following steps: Step S551: Perform weighted fusion on the secondary circuit defect classification result and the final circuit defect boundary map to obtain a comprehensive distribution map of circuit defect detection; Step S552: Perform manual evaluation and annotation on the comprehensive distribution map of circuit defect detection to obtain manually evaluated annotation data; construct a learning data set for the defect recognition model based on the manually evaluated annotation data; Step S553: Perform online update on a preset circuit defect feature recognition model based on the learning data set for the defect recognition model to obtain an iterative defect discrimination model, and use the iterative defect discrimination model for the next circuit defect recognition; Step S554: Perform decision visualization and interpretation on the iterative defect discrimination model to obtain a model decision interpretation diagram; perform importance evaluation of defect features based on the model decision interpretation diagram to obtain key parameters of defect features; Step S555: Optimize and adjust the deformation compensation process of the flexible printed circuit board based on the key parameters of defect features to obtain optimization suggestions for circuit board deformation compensation; generate a final flexible printed circuit board defect detection report based on the optimization suggestions for circuit board deformation compensation and the comprehensive defect detection results.

[0050] In this embodiment, the PyTorch library is used to load a pre-trained circuit defect classification model. The model input is the final circuit defect boundary map with a resolution of 2048×2048 pixels. The torch.load function is used to load the pre-trained circuit defect classification model, ensuring that the model is in the evaluation mode (model.eval()). The torchvision.transforms is used to preprocess the final circuit defect boundary map, including normalization (mean=[0.485,0.456,0.406], std=[0.229,0.224,0.225]) and tensor conversion (transforms.ToTensor()). The preprocessed image tensor is input into the pre-trained circuit defect classification model, and the model output is the probability distribution map of the defect class for each pixel. The shape of the output tensor is [1,num_classes,height,width]. The output tensor is converted to a NumPy array, and torch.argmax is used to obtain the class label for each pixel. The probability distribution map is saved as a.npy file. The cv2.applyColorMap function of OpenCV is used to convert the probability distribution map into a heat map and save it as a PNG format file. The OpenCV library is used to evaluate the credibility of the defect area uncertainty map. The uncertainty map is loaded, and the cv2.threshold function is used to set the credibility threshold to 0.7. Areas below this threshold are regarded as low-credibility areas. The generated uncertainty heat map is loaded using cv2.imread. The cv2.threshold function is used to binarize the image, setting the threshold to 0.7 and the maximum value to 255. Areas below the threshold are marked as low-credibility areas. KMeans of the scikit-learn library is used to cluster the low-credibility areas. The number of cluster centers is set to 5, the number of iterations is set to 100, and the termination condition is tol=0.0001. The clustering results are saved as a NumPy array file to form a set of low-credibility defect areas. According to the set of low-credibility defect areas, the area parameters for secondary acquisition are determined. The OpenCV library is used to perform secondary image acquisition of the flexible circuit board. The bounding box parameters (x_min,y_min,x_max,y_max) of each area are extracted from the set of low-credibility defect areas. The industrial camera parameters are set, including an exposure time of 2ms, global shutter mode, and a resolution of 2048×2048 pixels. The cv2.VideoCapture of OpenCV or the industrial camera SDK is used to perform high-resolution image acquisition for each low-credibility area. The acquired local images are saved as PNG format files. The OpenCV library and the ESRGAN super-resolution model (pre-trained model) are used to perform super-resolution reconstruction on the local images of the circuit board. The local image set is loaded and processed using the ESRGAN model.Load the collected local images using cv2.imread. Perform super-resolution reconstruction using the ESRGAN model. Load the pre-trained ESRGAN model (RRDB_ESRGAN_x4.pth) and load the model weights through torch.load. Input the reconstructed images into a preset expert rule engine, and the rule engine performs defect identification based on parameters such as line width and spacing. Use cv2.Canny in OpenCV to detect edges and cv2.connectedComponents to label connected regions. Save the identification results as a NumPy array file to form the secondary circuit defect classification results. Perform weighted fusion of the secondary circuit defect classification results and the final circuit defect boundary map to obtain a comprehensive distribution map. Use the OpenCV library for weighted fusion, setting the weights to 0.7 (secondary classification results) and 0.3 (boundary map) respectively. Load the secondary circuit defect classification results and the final circuit defect boundary map to ensure they have the same size. Use the cv2.addWeighted function in OpenCV for weighted fusion with weights of 0.7 and 0.3 respectively. Use the LabelImg tool to perform manual evaluation and annotation on the comprehensive distribution map, and save the annotation data as an XML format file. Integrate the annotation data and image data into a defect identification model learning dataset. Use the PyTorch library to perform online update on a preset circuit defect feature identification model. Among them, the specific construction process of the preset circuit defect feature identification model is to clarify the model objectives and tasks, that is, to identify defects such as line gaps, short circuits, and broken lines on flexible printed circuit boards. The input is the circuit board image, and the output is the defect category probability distribution map. Then perform data preparation, including collecting images from manufacturers, public datasets, and industrial cameras, using tools such as LabelImg for annotation, generating label files in XML or JSON format, and adjusting the size, normalizing, and data augmenting the images. Then select a suitable deep learning model architecture, such as ResNet, DenseNet, Inception convolutional neural network, or U-Net, DeepLabv3+ semantic segmentation model. In the model training stage, use PyTorch or TensorFlow to build a training environment, configure model parameters, select loss functions such as cross-entropy loss and optimizers such as Adam or SGD, and input the preprocessed data for training, monitoring the loss and accuracy to prevent overfitting. In the validation and testing stage, evaluate the model performance through the validation set and adjust the hyperparameters. Finally, calculate metrics such as accuracy, recall, and F1 score on an independent test set. After the model training is completed, save it as a.pt or.h5 file and deploy it to an embedded device or server for real-time defect identification. In practical applications, perform online updates regularly according to new data and feedback, continuously monitor the model performance to ensure its accuracy and adaptability.The entire process aims to construct an efficient and accurate line defect feature recognition model to support the defect detection task of flexible printed circuit boards. Load the manually evaluated and annotated data, and use the torch.nn module to update the model parameters. Use torchvision.datasets to load the manually evaluated and annotated data. Define the loss function (such as CrossEntropyLoss) and optimizer (such as Adam) using the torch.nn module to perform online updates of the model. Use the SHAP library to generate model decision explanation diagrams. Load the model and data, calculate the SHAP values using shap.DeepExplainer, and generate the explanation diagrams. Save the explanation diagrams as PNG format files. Optimize the deformation compensation process according to the key parameters of the defect features. Use the OpenCV library to adjust the deformation compensation parameters, such as the control point spacing of thin plate spline interpolation. According to the key parameters of the defect features, adjust the control point spacing of thin plate spline interpolation (such as from 10 pixels to 15 pixels). Use cv2.createThinPlateSplineShapeTransformer in OpenCV for deformation compensation to ensure that the compensated image meets the design specifications. Use LaTeX to generate the final flexible printed circuit board defect detection report. The report content includes the detection results, optimization suggestions, and model explanation diagrams, and is saved as a PDF format file.

[0051] Preferably, the present invention also provides a defect detection system for flexible printed circuit boards based on an image recognition model, which is used to execute the defect detection method for flexible printed circuit boards based on an image recognition model as described above. The defect detection system for flexible printed circuit boards based on an image recognition model includes: An image acquisition module, which is used to obtain a multi-view image set of the flexible printed circuit board; perform light source compensation on the multi-view image set of the flexible printed circuit board to obtain flexible printed circuit board image data; A feature point displacement segmentation module, which is used to perform feature point spatial displacement detection and segmentation on the flexible printed circuit board image data to obtain a circuit board deformation area segmentation map; construct a circuit board deformation partition scheme according to the circuit board deformation area segmentation map; perform sub-pixel resampling on the flexible printed circuit board image data according to the circuit board deformation partition scheme to obtain a planar flexible printed circuit board image; A deformation compensation module, which is used to extract line structure features from the planar flexible printed circuit board image to obtain an enhanced line structure feature map; perform spatial transformation compensation on the enhanced line structure feature map to obtain a multi-level feature map of the circuit board; A defect recognition module, which is used to perform line defect recognition and segmentation on the planar flexible printed circuit board image to obtain a multi-view defect segmentation map set; generate a final line defect boundary map based on the multi-view defect segmentation map set; The secondary defect recognition module is used to perform secondary circuit defect recognition on the flexible printed circuit board according to the final circuit defect boundary map to obtain a comprehensive distribution map of circuit defect detection; and generate a final defect detection report for the flexible printed circuit board based on the comprehensive distribution map of circuit defect detection.

[0052] Therefore, from any perspective, the embodiments should be regarded as exemplary and non-limiting. The scope of the present invention is defined by the appended claims rather than the above description. Therefore, all changes falling within the meaning and scope of the equivalent elements of the application documents are intended to be encompassed within the present invention.

[0053] The above are only specific embodiments of the present invention, enabling those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be obvious to those skilled in the art. The general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to these embodiments shown herein, but rather to the broadest scope consistent with the principles and novel features disclosed herein.

Claims

1. A defect detection method for a flexible circuit board based on an image recognition model, characterized in that: The following steps are involved: Step S1: Acquire a multi-view image set of a flexible circuit board; Performing light source compensation on the flexible circuit board multi-view image set to obtain flexible circuit board image data; Step S2: performing feature point spatial displacement detection and segmentation on the flexible circuit board image data to obtain a circuit board deformation area segmentation map; constructing a circuit board deformation partitioning scheme according to the circuit board deformation area segmentation map; performing sub-pixel resampling on the flexible circuit board image data according to the circuit board deformation partitioning scheme to obtain a planar flexible circuit board image; Step S3: extracting circuit structure features from the planar flexible circuit board image to obtain an enhanced circuit structure feature map; performing spatial transformation compensation on the enhanced circuit structure feature map to obtain a multi-level feature map of the circuit board; Step S4: identifying and segmenting the circuit defects of the planar flexible circuit board image to obtain a multi-view defect segmentation atlas; and generating a final circuit defect boundary map based on the multi-view defect segmentation atlas; Step S5: performing secondary circuit defect recognition on the flexible circuit board according to the final circuit defect boundary map to obtain a comprehensive distribution map of circuit defect detection; Generate the final flexible circuit board defect detection report based on the comprehensive distribution map of circuit defect detection.

2. The defect detection method of a flexible circuit board based on an image recognition model according to claim 1 is characterized in that: Acquiring a multi-view image set of a flexible circuit board in step S1 includes: Step S11: Build a four-point surround acquisition platform using four industrial cameras to obtain the configuration parameters of the multi-angle imaging system. The accuracy of the industrial camera is 0.1 m, the positions of industrial cameras are distributed crosswise at 45° on the XY plane, and the four camera viewing angles are aligned with the preset target detection area center; Step S12: Tracking and predicting the conveyor path of the flexible circuit board to obtain circuit board position prediction data; Step S13: determining a multi-camera synchronization trigger instruction based on the circuit board position prediction data; Step S14: performing multi-angle imaging acquisition on the flexible circuit board according to the multi-angle imaging system configuration parameters and the multi-camera synchronization trigger instruction to obtain an original multi-angle image data set, wherein the exposure time of the industrial camera is set to 2ms in the multi-angle imaging acquisition, and the global shutter mode is adopted, and each camera simultaneously captures 25 images per second; Step S15: pre-calibrate and dedistort the original multi-angle image data set to obtain a multi-view image set of the flexible circuit board.

3. The defect detection method for a flexible circuit board based on an image recognition model according to claim 1, characterized in that: In step S1, light source compensation is performed on the flexible circuit board multi-view image set, including: Perform illumination non-uniformity evaluation on the multi-view image set of the flexible circuit board to obtain an illumination non-uniformity distribution map; Construct an image illumination compensation coefficient table according to the illumination non-uniformity distribution map; Perform pixel-level brightness correction on the multi-view image set of the flexible circuit board according to the image illumination compensation coefficient table to obtain a multi-view image set with balanced illumination; Performing circuit feature enhancement on the illumination-balanced multi-view image set to obtain an enhanced flexible circuit board image set; A GPU-accelerated image denoising pipeline is constructed based on the enhanced flexible circuit board image set; the GPU-accelerated image denoising pipeline is used to suppress high-frequency noise in the enhanced flexible circuit board image set to obtain a denoised flexible circuit board image set; The data format of the noise-reduced flexible circuit board image set is converted and packaged to obtain flexible circuit board image data.

4. The defect detection method for a flexible circuit board based on an image recognition model according to claim 1, characterized in that: In step S2, feature point spatial displacement detection and segmentation are performed on the flexible circuit board image data, including: Perform multi-scale Harris corner point detection on the flexible circuit board image data to obtain a set of candidate feature points of the image, where the multi-scale Harris corner point detection detects corner point features from 1 pixel to 5 pixels with a step size of 0.5; Extracting local binary pattern descriptors from the candidate feature point set of the image to obtain a feature point descriptor database; constructing an image feature point correspondence table based on the feature point descriptor database; Calculate the spatial displacement vector of the feature point according to the image feature point correspondence table to generate an initial displacement vector field; Outliers are removed from the initial displacement vector field to obtain an adjusted displacement vector field; a global displacement field of the circuit board deformation is constructed based on the adjusted displacement vector field; The global displacement field of the circuit board deformation is divided into deformation areas to obtain a circuit board deformation area segmentation map.

5. The defect detection method for a flexible circuit board based on an image recognition model according to claim 1, characterized in that: In step S2, a circuit board deformation partitioning scheme is constructed according to the circuit board deformation area segmentation map, including: Obtaining a global displacement field of circuit board deformation; constructing a circuit board deformation feature map according to the circuit board deformation region segmentation map and the circuit board deformation global displacement field; Constructing a thin plate spline control point grid based on the circuit board deformation feature map, wherein the control point spacing in the thin plate spline control point grid ranges from 5 to 20 pixels, and the grid density ranges from 10 to 50 control points per square centimeter; Performing thin plate spline interpolation on the thin plate spline control point grid to obtain first circuit board deformation space interpolation data; Performing a local deformation error evaluation on the first circuit board deformation space interpolation data to generate a circuit board deformation fitting residual map, wherein the local deformation error evaluation window size ranges from 3×3 to 15×15 pixels, and the circuit board deformation fitting residual map uses pseudo color coding to represent the size of the residual value, wherein the first color represents a low error area, and the second color represents a high error area, and the first color is different from the second color; Performing least square optimization on the first circuit board deformation space interpolation data according to the circuit board deformation fitting residual graph to obtain second circuit board deformation space interpolation data; Calculating a deformation gradient field of the second circuit board deformation space interpolation data; Group the deformation gradient field to obtain deformation gradient clustering data; A circuit board deformation partitioning scheme is generated according to the deformation gradient clustering data, wherein the circuit board deformation partitioning scheme includes at least any one or more of a high deformation area and a low deformation area.

6. The defect detection method of a flexible circuit board based on an image recognition model according to claim 1, characterized in that: In step S2, sub-pixel resampling of the flexible circuit board image data is performed according to the circuit board deformation partitioning scheme, including: Acquire the second circuit board deformation space interpolation data; The second circuit board deformation space interpolation data is segmentedly optimized according to the circuit board deformation partitioning scheme to obtain the circuit board deformation segmented interpolation data, wherein the segmented optimization is specifically as follows: For the high deformation area in the circuit board deformation partitioning scheme, a cubic interpolation algorithm is used to locally interpolate the corresponding local interpolation coefficients in the second circuit board deformation space interpolation data; For the low deformation area in the circuit board deformation partitioning scheme, simplifying interpolation is performed on the global interpolation coefficients in the second circuit board deformation space interpolation data; Adopting a first-order continuity constraint at a mesh boundary between a high deformation region in the second circuit board deformation space interpolation data and a low deformation region in the second circuit board deformation space interpolation data; Constructing a pixel-level mapping transformation data table based on the circuit board deformation segment interpolation data; Sub-pixel resampling is performed on the flexible circuit board image data according to the pixel-level mapping transformation data table to obtain a planar flexible circuit board image.

7. The defect detection method of a flexible circuit board based on an image recognition model according to claim 1, characterized in that: Step S3 includes the following steps: Step S31: construct a multi-scale image pyramid; use the multi-scale image pyramid to perform Gaussian pyramid decomposition on the planar flexible circuit board image to obtain a five-layer resolution feature set of the image; Step S32: using a preset directional Gabor filter group to extract line edge directional texture features from the five-layer resolution feature set of the image to obtain a line texture directional feature map; Step S33: performing nonlinear activation on the line texture direction feature map to obtain a line edge response map; Step S34: constructing a deep residual network encoder based on the line edge response map; using the deep residual network encoder to perform feature encoding on the line edge response map to obtain line multi-scale feature mapping data; Step S35: performing a dilated convolution process on the line multi-scale feature mapping data to obtain a line extended receptive field feature map; Step S36: construct a multi-level feature map of the circuit board based on the line extended receptive field feature map and the line multi-scale feature mapping data.

8. The defect detection method for a flexible circuit board based on an image recognition model according to claim 1, characterized in that: Step S4 includes the following steps: Step S41: performing a uniformity evaluation of the covering layer on the planar flexible circuit board image to obtain a uniformity evaluation index of the covering layer; Step S42: extracting circuit wiring features from the planar flexible circuit board image to obtain basic circuit topology data; constructing circuit grid connectivity constraint rules based on the basic circuit topology data; Step S43: obtaining the flexible circuit board design specification and the flexible circuit board manufacturing tolerance; adjusting the circuit grid connectivity constraint rule according to the flexible circuit board design specification and the flexible circuit board manufacturing tolerance to obtain the adjusted circuit connectivity constraint rule; Step S44: constructing a multi-directional edge detection operator according to the adjusted line connectivity constraint rule; performing multi-directional edge detection on the planar flexible circuit board image using the multi-directional edge detection operator to obtain a line edge feature map; Step S45: collecting the thickness of the conductive layer of the flexible circuit board and the number of conductive layers of the flexible circuit board; adjusting the parameters of the preset line defect feature recognition model according to the uniformity evaluation index of the covering layer, the thickness of the conductive layer of the flexible circuit board and the number of conductive layers of the flexible circuit board to obtain an adaptive line defect feature recognition model; Step S46: inputting the line edge feature map into the adaptive line defect feature recognition model to perform line defect recognition to obtain a preliminary line defect recognition map; Step S47: performing local line width statistics on the preliminary line defect recognition map to obtain local line width feature data; constructing a line width threshold mapping table according to the local line width feature data; performing threshold correction on the preliminary line defect recognition map according to the line width threshold mapping table to obtain a corrected line defect recognition map; Step S48: executing steps S41 to S47 on the planar flexible circuit board images at various angles to obtain the corrected circuit defect identification images at various angles, thereby forming a multi-view defect segmentation atlas; Step S49: Generate a final line defect boundary map based on the multi-view defect segmentation atlas.

9. The defect detection method of a flexible circuit board based on an image recognition model according to claim 1, characterized in that: Step S5 includes the following steps: Step S51: perform defect category probability inference on the final line defect boundary map to obtain a defect category probability distribution map; and construct a defect area uncertainty map based on the defect category probability distribution map; Step S52: performing defect detection credibility evaluation on the defect region uncertainty map to obtain a defect detection credibility score; performing spatial clustering on the defect detection credibility score to obtain a low credibility defect region set; Step S53: determining low-confidence imaging region parameters according to the low-confidence defect region set; performing secondary image acquisition on corresponding regions in the low-confidence defect region set in the flexible circuit board based on the low-confidence imaging region parameters to obtain a circuit board local image set; Step S54: super-resolution reconstruction is performed on the local image set of the circuit board to obtain an enhanced local image of the circuit board; circuit defect recognition is performed on the enhanced local image of the circuit board using a preset expert rule engine to obtain a secondary circuit defect classification result; Step S55: generating a final flexible circuit board defect detection report according to the secondary circuit defect classification result and the final circuit defect boundary map.

10. A defect detection system for a flexible circuit board based on an image recognition model, characterized in that: For executing the defect detection method of the flexible circuit board based on the image recognition model as claimed in claim 1, the defect detection system of the flexible circuit board based on the image recognition model comprises: An image acquisition module is used to obtain a multi-view image set of a flexible circuit board; perform light source compensation on the multi-view image set of the flexible circuit board to obtain image data of the flexible circuit board; The feature point displacement segmentation module is used to detect and segment the feature point spatial displacement of the flexible circuit board image data to obtain a circuit board deformation area segmentation map; construct a circuit board deformation partitioning scheme according to the circuit board deformation area segmentation map; perform sub-pixel resampling on the flexible circuit board image data according to the circuit board deformation partitioning scheme to obtain a planar flexible circuit board image; The deformation compensation module is used to extract the circuit structure features of the planar flexible circuit board image to obtain an enhanced circuit structure feature map; perform spatial transformation compensation on the enhanced circuit structure feature map to obtain a multi-level feature map of the circuit board; The defect recognition module is used to identify and segment the circuit defects of the planar flexible circuit board image to obtain a multi-view defect segmentation atlas; and generate a final circuit defect boundary map based on the multi-view defect segmentation atlas; The secondary defect recognition module is used to perform secondary line defect recognition on the flexible circuit board according to the final line defect boundary map to obtain a comprehensive distribution map of line defect detection; and generate a final flexible circuit board defect detection report based on the comprehensive distribution map of line defect detection.

Citation Information

Patent Citations

  • Deep neural network framework for processing OCT images to predict treatment intensity

    CN115039122A

  • PCB defect detection method based on computer vision

    CN119151939A

  • Training method and system based on circuit board defect detection model

    CN119579593A

  • Photoelectric product detection method and system based on image processing

    CN119850602A

  • Image magnification / reduction method and image deformation method

    JP1997259265A

Cited By

  • Gamma camera resolution imaging data processing method and system

    CN120563327A

  • Defect detection method and system for gantry machine tool workbench casting part

    CN120927812A

  • Railway contact line surface defect detection method and system

    CN121120645A

  • A method and system for detecting surface defects of a railway contact wire

    CN121120645B

  • Intelligent detection method, device and equipment for field wiring scheme

    CN121280432A