Defect detection method, device and equipment for rigid-flex circuit board and storage medium

By using differential parameter scanning with a line scan camera and contour matching of CAM drawings, the problem of unclear imaging of rigid-soft integrated circuit boards was solved, achieving high-precision defect detection.

CN121707973APending Publication Date: 2026-03-20SHANGHAI GANTU NETWORK TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-17
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Existing technologies struggle to achieve high-precision scanning of both flexible and rigid areas on a rigid-flex circuit board simultaneously, resulting in unclear imaging and impacting the accuracy and efficiency of defect detection.

Method used

The rigid-soft board is linearly scanned using different target parameters of a line scan camera to obtain the first and second line scan images under the corresponding parameters. Contour matching is performed using CAM files to detect defects in the target contour area and overlapping area, and the results are finally fused.

Benefits of technology

It achieves full-area imaging clarity for rigid-flex circuit boards, improving the accuracy and reliability of defect detection and reducing the false negative and false positive rates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121707973A_ABST
    Figure CN121707973A_ABST
Patent Text Reader

Abstract

The invention discloses a defect detection method and device for a rigid-flex circuit board, equipment and a storage medium, and relates to the field of image detection. Performing linear scanning on the rigid-flex board by using different target parameters of the line scanning camera to obtain line scanning images under the corresponding parameters; performing contour matching on each line scanning image and a CAM drawing file of the rigid-flex board, and determining a target contour area of a flexible board or a rigid board part of the image and a rigid-flex board overlapping area; and performing defect detection on the target contour area and the soft and hard board overlapping area of each line scanning image, fusing detection output of the soft and hard board overlapping area, and outputting a final defect detection result. According to the scheme, different target parameters are adopted to respectively scan the soft board area and the hard board area to obtain the line scanning images, contour matching and regional defect detection are carried out in combination with the CAM drawing file, the problem of imaging blurring caused by the height difference of the soft and hard combined board is solved, the imaging definition of the soft board area and the hard board area can be ensured, and the accuracy and reliability of defect detection are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to image detection, and more particularly to a method, apparatus, device, and storage medium for detecting defects in rigid-flex circuit boards. Background Technology

[0002] A PCB, also known as a printed circuit board, is a carrier for electrical connections between electronic components. Especially in high-precision instruments and equipment such as foldable screens, a combination of flexible and rigid PCBs is used. For example... Figure 2 The schematic diagram shown illustrates a rigid-flex PCB, where the rigid portion is typically slightly thicker than the flexible portion. During PCB manufacturing, due to the complexity of the process and environmental factors, various defects, flaws, and imperfections are inevitably generated.

[0003] Traditional inspection methods primarily rely on manual visual inspection or automated inspection equipment with single optical parameters. However, rigid-flex PCBs face the challenge of varying heights. Line scan cameras cannot simultaneously perform high-precision scanning of both types of PCBs in a single pass, or using single-parameter scanning results in low inspection efficiency and high false negative rates. Currently, cameras with 2.5μm precision have a depth of field of 60μm, and those with 5μm precision have a depth of field of 76μm. When the height difference within the material exceeds this depth of field, it causes unclear imaging, especially with rigid-flex PCBs. The height difference between the flexible and rigid PCB areas can be around 2mm. When adjusting the Z-axis of the mechanism for image acquisition, the rigid PCB area becomes clear, while the flexible PCB area remains blurry. Unclear imaging prevents accurate defect detection, and new machine acceptance specifications require compatible materials. To increase the machine's versatility, different Z-axis parameters need to be used for adjusting the height of the flexible and rigid PCBs and for image acquisition, enabling defect detection of the two PCB layers. Summary of the Invention

[0004] This application provides a method, apparatus, device, and storage medium for defect detection of rigid-flex circuit boards, which has the advantages of simultaneously ensuring the imaging clarity of both flexible and rigid board areas, thereby improving the accuracy and reliability of defect detection.

[0005] On the one hand, this application provides a defect detection method for rigid-flex circuit boards, the method comprising: The rigid-flex PCB is linearly scanned using different target parameters of a line scan camera to obtain the first and second line scan images under the corresponding parameters; different target parameters are used to scan the flexible and rigid PCB areas respectively, corresponding to different camera depths of field; The first line scan image and the second line scan image are respectively matched with the CAM file of the rigid-flex board to determine the target contour area of ​​the image flexible board or rigid board portion and the overlapping area of ​​the flexible-rigid board. Defect detection is performed on the target contour area and the hard-soft board overlap area of ​​the first and second line scan images respectively, and the detection output of the hard-soft board overlap area is fused to output the final defect detection result.

[0006] Specifically, after selecting the target parameters, the rigid-flex board is scanned line by line to obtain a line scan image; for the selected line scan image, the flexible board contour area and the rigid board contour area are determined by aligning and mapping with the corresponding CAM file, and the rigid-flex board overlap area is determined based on the positional relationship between the flexible board contour area and the rigid board contour area. Specifically, a CAM file is used to map a clear rigid board contour area in a line scan image, and another CAM file is used to map a clear flexible board contour area in another line scan image; the rigid board overlap area is determined at the edge of the rigid board contour area based on the coordinates of the clear flexible board contour area, and the flexible board overlap area is determined at the edge of the flexible board contour area based on the coordinates of the clear rigid board contour area.

[0007] Specifically, the rigid board outline area is determined based on the mapping of the rigid board CAM file, and the flexible board outline area is determined based on the mapping of the flexible board CAM file. The rigid board overlapping area simultaneously includes local rigid board outlines and local flexible board outlines, and the local flexible board outlines are captured based on the rigid board scanning parameters. The rigid PCB CAM file contains only the outline of the rigid PCB area, and the flexible PCB CAM file contains only the outline of the flexible PCB area. The overlapping area of ​​the flexible PCBs simultaneously contains both local flexible PCB outlines and local rigid PCB outlines, and the local rigid PCB outlines are captured based on the flexible PCB scanning parameters.

[0008] Specifically, the defect detection of the target contour area and the hard-soft board overlap area in the first and second line scan images includes: CV defect detection is performed on the rigid board contour image extracted from the first-line scan image to obtain the rigid board area defect detection result; AI defect detection is performed on the extracted rigid board overlapping image to obtain the rigid board overlapping area detection result. CV defect detection is performed on the flexible circuit board contour image extracted from another line scan image to obtain the flexible circuit board area detection result; AI defect detection is performed on the extracted flexible circuit board overlap image to obtain the flexible circuit board overlap area detection result.

[0009] Specifically, the fusion of the detection outputs from the two overlapping regions to output the final defect detection result includes: The detection results of the hard board overlapping area and the soft board overlapping area are incrementally fused based on the defect coordinates and defect labels, and the final defect detection result is output by combining the defect detection results of the hard board area and the soft board area.

[0010] Specifically, after selecting the target parameters of the scanning board, multi-channel scanning is performed on each selected pixel row to obtain line scan images under different pixel channels; After aligning the line scan images for each pixel channel, use the flexible PCB CAM file to perform contour matching and determine the corresponding flexible PCB contour area and the flexible PCB overlapping area. Defect detection is performed on the line scan images under different pixel channels by region, and the defects detected under multiple channels are incrementally fused according to the defect coordinates and defect labels to output the flexible board fusion result. After selecting the target parameters of the scanning hardboard, perform multi-channel scanning on each selected pixel row to obtain line scan images under different pixel channels; After aligning the line scan image for each pixel channel, use the rigid board CAM file to perform contour matching to determine the corresponding rigid board contour area and the rigid board overlapping area. The line scan images under different pixel channels are divided into regions for defect detection. The defects detected under multiple channels are incrementally fused according to the defect coordinates and defect labels, and the hard board fusion result is output.

[0011] Specifically, the target parameters for scanning the flexible and rigid board areas are confirmed based on the following steps: Scan the pixel rows of the rigid-flex PCB, extract the valid pixels, and determine the ratio of rigid PCB pixels to flexible PCB pixels among the valid pixels. Based on the effective pixels and the ratio of rigid board pixels to flexible board pixels, filter at least one set of effective pixel rows; The effective pixel rows are matched with the target pixel row outlines of the CAM file, and the camera parameters are adjusted according to the matching results to determine the camera parameters used for scanning the flexible and rigid board areas respectively.

[0012] On the other hand, this application provides a defect detection device for rigid-flex circuit boards, the device comprising: The image scanning module is used to perform linear scanning of the rigid-flex board using different target parameters of the line scan camera, and to acquire the first line scan image and the second line scan image under the corresponding parameters; different target parameters are used to scan the flexible board and rigid board areas respectively, corresponding to different camera depths of field; The image recognition module is used to perform contour matching between the first line scan image and the second line scan image and the CAM file of the rigid-flex board, respectively, to determine the target contour area of ​​the image flexible board or rigid board portion and the overlapping area of ​​the flexible-rigid board. The defect detection module is used to perform defect detection on the target contour area and the hard-soft board overlap area of ​​the first line scan image and the second line scan image respectively, and to fuse the detection output of the hard-soft board overlap area to output the final defect detection result.

[0013] In another aspect, this application provides a computer device including a processor and a memory, wherein the memory stores at least one instruction, at least one program, code set or instruction set, wherein the at least one instruction, the at least one program, the code set or instruction set is loaded and executed by the processor to implement the defect detection method for the rigid-flex circuit board described above.

[0014] In another aspect, this application provides a computer-readable storage medium storing at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the defect detection method for the rigid-flex circuit board described above.

[0015] The beneficial effects of the technical solution provided in this application include at least the following: This method, by adapting scanning parameters to different height regions, completely solves the imaging blurring problem caused by height differences exceeding the depth of field of a single scan, avoiding the defect of unclear imaging in some areas during traditional single-parameter scanning. The contour matching mechanism utilizes the precise design information of the CAM file to achieve accurate division of the target contour area and overlapping area, significantly reducing the risk of misjudgment. The fusion processing of the detection results of the rigid-flex PCB overlapping area integrates complementary information, eliminating blind spots from a single scanning perspective, thereby ensuring the integrity and reliability of full-area defect detection, and ultimately outputting high-precision defect detection results. Attached Figure Description

[0016] Figure 1 This is a flowchart of a defect detection method for a rigid-flex circuit board provided in an embodiment of this application; Figure 2 A line scan image of a rigid-flex PCB in one possible form is shown; Figure 3 This is a schematic diagram of line scan image acquisition by progressive scanning under different target parameters; Figure 4 This diagram illustrates the mapping of the target region and overlapping region in a local line scan image under two target parameters. Figure 5 This is a schematic diagram of incremental fusion of defect detection results from two line scan images; Figure 6 This is a schematic diagram illustrating the principle of a defect detection fusion scheme based on multi-channel scanning; Figure 7 A structural block diagram of a defect detection device for rigid-flex circuit boards is shown. Figure 8 A structural block diagram of a computer device provided in an exemplary embodiment of this application is shown. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0018] In this article, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0019] In the defect detection process of rigid-flex circuit boards, the height difference between the flexible and rigid board areas exceeds the depth of field range of the line scan camera, making it impossible to obtain clear images of both areas simultaneously in a single scan. This height difference-induced image blurring directly affects the accuracy of defect detection, increasing the likelihood of missed and false detections, and consequently reducing the reliability and efficiency of the detection system.

[0020] For example, on the printed circuit board production line for foldable mobile devices, rigid-flex boards are used to connect the flexible display area and the rigid circuitry. When a line scan camera scans with fixed parameters, adjusting the Z-axis position only results in a clear image of the rigid board area, while the flexible board area appears blurry due to its lower height; conversely, when the flexible board area is adjusted to be clear, the rigid board area becomes blurry. This problem is particularly pronounced in the overlapping areas of the rigid-flex boards, causing the system to be unable to reliably identify defect features in this area, thus affecting the completeness of defect detection across the entire region.

[0021] If the above problems are not addressed, the defect detection process will be unable to accurately identify flaws in the circuit board, and potential defects may go undetected. Therefore, in the production of high-precision electronic equipment, undetected defects can lead to product malfunctions, adversely affecting the reliability and performance of the equipment.

[0022] Figure 1 This is a flowchart of a defect detection method for rigid-flex circuit boards provided in this application embodiment, including the following steps: S1. Use different target parameters of the line scan camera to perform linear scanning on the rigid-soft board respectively, and obtain the first line scan image and the second line scan image under the corresponding parameters. During the manufacturing process of rigid-flex circuit boards, the height difference between the flexible and rigid board areas often exceeds the depth of field range of a single scan by a line scan camera, resulting in unclear imaging and affecting the accuracy of defect detection. This application uses different target parameters of a line scan camera to perform linear scans on the rigid-flex board, acquiring a first line scan image and a second line scan image under the corresponding parameters. For example, the first target parameter is the optimal parameter for scanning the flexible board area (corresponding to the first line scan image), and the second target parameter is the optimal parameter for scanning the rigid board area (corresponding to the second line scan image). The camera depth of field differs between the two sets of parameters. Typically, the rigid board area is thicker than the flexible board area (e.g., circuit boards for foldable screens or hinge functions), so the depth of field of the first target parameter is smaller than that of the second target parameter.

[0023] In addition, in practical applications, different target parameters can be understood as a combination of camera optical parameters set for the height characteristics of flexible and rigid board areas. This can be achieved by manually setting the focal length or automatically adjusting the aperture size. For example, scanning parameters can be manually input based on pre-stored flexible board height data, or the exposure time can be dynamically adjusted through an external control system. The main purpose is to ensure that the first line scan image is clear when scanning the flexible board area and the second line scan image is clear when scanning the rigid board area.

[0024] S2. Perform contour matching between the first line scan image and the second line scan image and the CAM file of the rigid-flex board, respectively, to determine the target contour area of ​​the image's flexible board or rigid board portion and the overlapping area of ​​the flexible-flex board and rigid board. Specifically, this step involves performing contour matching between the first and second line scan images and the CAM drawing of the rigid-flex PCB, respectively, to determine the target contour area of ​​the flexible or rigid PCB portion of the image and the overlapping area of ​​the flexible and rigid PCBs. Contour matching refers to the geometric alignment process between the image and the design drawing. It can be achieved using edge feature-based matching algorithms or template matching techniques. For example, the image contour can be extracted using a Canny edge detector and then compared with the drawing for similarity calculation, or the correspondence between the image and the drawing can be determined through SIFT feature point matching. Its main purpose is to accurately delineate the target contour area of ​​the flexible or rigid PCB portion and the boundary of the overlapping area of ​​the flexible and rigid PCBs.

[0025] Figure 2The image shows a line scan of a rigid-flex PCB in one possible form, which may contain one or more sets of PCS particles or strip boards. The circled area in the upper left corner represents the flexible PCB region, while the remaining PCB area can be classified as the rigid PCB region. Defects or flaws in the flexible and rigid PCB regions require separate defect detection models. For conventional rigid and flexible PCB regions, which are scanned / captured with optimal parameters, the corresponding defect detection models can be used directly. However, for the overlapping areas of the flexible and rigid PCBs (where there is a natural adhesion transition zone, not a strict boundary), the image quality naturally differs due to differences in thickness and depth of field (areas with non-optimal parameters have relatively poor image quality). To avoid uncertainty in defect detection, a separate rigid or flexible PCB defect detection model cannot be used directly. Instead, the image of this region is extracted separately, and a specially designed and trained model is used for individual detection to improve accuracy. This step requires precise division of different regions. This application uses a CAM image mapping method to divide the regions.

[0026] CAM files are the core data package for PCB manufacturing, containing Gerber photoplot files, drilling data, and process parameters (such as impedance control and panel design) to guide the production process. The template outline is a reference image used for visual inspection, identifying defects by comparing the actual circuit board with the standard outline. In addition, it can be combined with various AI models to adapt to various scenarios and types of defects.

[0027] S3. Perform defect detection on the target contour area and the hard-soft board overlap area of ​​the first line scan image and the second line scan image respectively, and fuse the detection output of the hard-soft board overlap area to output the final defect detection result.

[0028] After dividing the image into different regions using CAM mapping, defect detection is performed on the target contour areas (hard board area, soft board area) and the hard and soft board overlap areas of the first and second line scan images, respectively. The detection outputs of the hard and soft board overlap areas are then fused to output the final defect detection result.

[0029] The detection output fusion can be understood as integrating defect information from different scan results. This can be achieved using spatial coordinate-based fusion strategies or confidence-based decision fusion methods. For example, the defect coordinates of overlapping areas in two sets of scans can be mapped to a unified coordinate system and then merged, or the results can be weighted and averaged based on the output probability of the defect detection algorithm. The main purpose is to eliminate blind spots in overlapping areas caused by differences in scanning parameters. Therefore, this application ensures clear imaging of both rigid and flexible board regions through a differentiated scanning strategy, accurately identifies region boundaries using contour matching, and effectively overcomes the impact of height differences on image quality by combining the fusion processing of overlapping area detection results, thus achieving complete defect detection.

[0030] This defect detection method effectively addresses the height difference between the flexible and rigid board areas in a rigid-flex circuit board by employing a differentiated scanning strategy. Specifically, the line scan camera uses different target parameters to perform linear scans on the rigid-flex board. The first target parameter is adapted to the lower height characteristics of the flexible board area, corresponding to a smaller camera depth of field, thereby acquiring the first line scan image and ensuring clear imaging of the flexible board portion. The second target parameter is adapted to the higher height characteristics of the rigid board area, corresponding to a larger camera depth of field, thereby acquiring the second line scan image and ensuring clear imaging of the rigid board area.

[0031] Subsequently, the first line scan image is contour matched with the CAM file of the rigid-flex PCB to determine the target contour area of ​​the flexible PCB portion and the overlapping area of ​​the rigid-flex PCB portion in the image; the second line scan image is also contour matched using the CAM file to determine the target contour area of ​​the rigid PCB portion and the overlapping area of ​​the rigid-flex PCB portion in the image.

[0032] Furthermore, defect detection is performed on the target contour region of the first line scan image to identify defects in the flexible board region, and defect detection is performed on the target contour region of the second line scan image to identify defects in the rigid board region. Defect detection is also performed on the overlapping areas of the flexible and rigid boards in both images. Finally, the detection results of the overlapping areas are fused based on defect coordinates and defect labels to generate the final defect detection output.

[0033] In practical applications, as one possible implementation, the depth-of-field parameters of a line scan camera can be differentiated by adjusting the Z-axis position and aperture setting. For example, when scanning a flexible circuit board area, the Z-axis position is set to a lower value to adapt to the thin structure of the flexible circuit board, and a smaller aperture is used to obtain a high-resolution first line scan image; when scanning a rigid circuit board area, the Z-axis position is adjusted to a higher value to adapt to the thickness of the rigid circuit board, and a larger aperture is used to obtain a clear second line scan image.

[0034] During contour matching, the geometric contour information from the CAM file is used to accurately locate the boundaries of each region. The overlapping area between the flexible and rigid boards is dynamically determined by analyzing the positional relationship between the flexible and rigid board contour areas; this area is defined as a transition zone with abrupt height changes. In the defect detection stage, traditional computer vision algorithms are used for defect identification in the target contour area, while artificial intelligence models are applied to the overlapping area between the flexible and rigid boards to ensure defect capture in complex areas.

[0035] In summary, this method, by adapting scanning parameters to different height regions, completely solves the imaging blurring problem caused by height differences exceeding the depth of field of a single scan, avoiding the defect of unclear imaging in some areas in traditional single-parameter scanning. The contour matching mechanism utilizes the precise design information of the CAM file to achieve accurate division of the target contour area and overlapping area, significantly reducing the risk of area misjudgment. The fusion processing of the detection results of the rigid-flex PCB overlapping area integrates complementary information, eliminating blind spots from a single scanning perspective, thereby ensuring the integrity and reliability of full-area defect detection, and ultimately outputting high-precision defect detection results.

[0036] Considering the height difference between different material regions in a rigid-flex PCB, the imaging of either the flexible or rigid PCB area may be unclear under a single scanning parameter, resulting in inaccurate contour matching and blurred boundary definitions in the overlapping area. Assuming two line scan images are mapped using the same CAM file, manual intervention or an additional classification model is required to distinguish the contour lines of different regions in the CAM file. Otherwise, the contour lines may be confused, leading to blurred mapping boundaries and affecting the accuracy of defect detection.

[0037] Therefore, after selecting a certain target parameter, this application obtains a line scan image by scanning and stitching the rigid-flex PCB line by line. Figure 3 This is a schematic diagram of line scan image acquisition under different target parameters. Line scan stitching involves continuously acquiring single-line image data along the scanning direction of the rigid-flex plate and combining multiple lines of images into a complete two-dimensional image through an image stitching algorithm. It can be implemented using stitching methods based on feature point matching or displacement sensor feedback. The purpose is to ensure the optimization of imaging quality in the corresponding area under the selected target parameters, and to provide a reliable image basis for subsequent contour matching.

[0038] For a selected line scan image, the flexible board contour area and the rigid board contour area are determined by aligning and mapping with the corresponding CAM file, and the overlapping area of ​​the flexible and rigid boards is determined based on the positional relationship between the two contour areas. Specifically, one CAM file can be used to map a clear rigid board contour area in a line scan image, and another CAM file can be used to map a clear flexible board contour area in another line scan image.

[0039] Furthermore, the hardboard overlap area is determined at the edge of the hardboard outline area based on the coordinates of the clear hardboard outline area, and the softboard overlap area is determined at the edge of the softboard outline area based on the coordinates of the clear hardboard outline area.

[0040] In one possible embodiment, the rigid board outline area is determined based on the mapping of the rigid board CAM file, the flexible board outline area is determined based on the mapping of the flexible board CAM file, and the rigid board overlap area simultaneously includes both local rigid board outlines and local flexible board outlines, with the local flexible board outline captured based on the rigid board scanning parameters. Correspondingly, the rigid board CAM file only contains the rigid board area outline (a Gerber file containing copper foil trace information of the rigid board area), the flexible board CAM file only contains the flexible board area outline (an ODB++ file containing circuit information of the flexible board area), and the flexible board overlap area simultaneously includes both local flexible board outlines and local rigid board outlines, with the local rigid board outline captured based on the flexible board scanning parameters.

[0041] By combining a separate CAM image design with a local contour extraction mechanism for overlapping areas, the rigid board CAM image in the rigid board scan image is matched only for the contour of the rigid board region, eliminating redundant information interference from the flexible board region. This allows for accurate determination of the rigid board contour region under clear imaging conditions with optimized rigid board scanning parameters. Simultaneously, in images captured based on rigid board scanning parameters, the flexible board edges adjacent to the rigid board in the overlapping area are less affected by height differences. Combined with the positioning of the rigid board CAM image, local flexible board contours can be extracted to define the boundary of the rigid board overlapping area. In the flexible board scan image, the flexible board C... AM images only match the contours of the flexible circuit board area, avoiding the noise effects of blurred images in the rigid circuit board area. This allows for accurate determination of the flexible circuit board contour area under clear imaging conditions with optimized flexible circuit board scanning parameters. Meanwhile, in images captured based on the flexible circuit board scanning parameters, the rigid circuit board edges adjacent to the overlapping area are less affected by height differences. Combined with the positioning capabilities of the flexible circuit board CAM images, local rigid circuit board contours can be extracted to define the boundaries of the flexible circuit board overlapping area. Thus, the boundary delineation of the rigid circuit board overlapping area and the flexible circuit board overlapping area are both based on image conditions with optimized scanning parameters, achieving accurate separation and matching of the overlapping area contours.

[0042] Figure 4 This diagram illustrates the mapping of target regions and overlapping areas between local line scan images under two target parameters. It can be understood as follows: In the left-side line scan image with a hardboard CAM file, the hardboard region is mapped using a hardboard CAM file, resulting in a clear hardboard outline (i.e., region 1 on the left). In the right-side line scan image with a flexible board CAM file, the flexible board region is mapped using a flexible board CAM file, resulting in a clear flexible board outline (i.e., region 1 on the right). The use of CAM files in each case aims to avoid mismatches in blurred areas. For the hardboard line scan image, a clear hardboard outline (i.e., region 1 on the left) is mapped, while the flexible board region in this image is blurred due to the height difference. For the flexible board line scan image, a clear flexible board outline (i.e., region 1 on the right) is mapped, while the hardboard region in this image is blurred due to the height difference.

[0043] Subsequently, based on the clear coordinates of the flexible board outline area in the right-side flexible board scan image (or the outline coordinates defined in the CAM file), the hardboard overlap area (i.e., region 2 on the left, which is a transition area extending from the edge of the hardboard outline area towards the flexible board) is determined at the edge of the hardboard outline area in the hardboard scan image. Similarly, based on the clear coordinates of the hardboard outline area in the hardboard scan image (or the outline coordinates defined in the CAM file), the flexible board overlap area (i.e., region 2 on the right, which is a transition area extending from the edge of the flexible board outline area towards the hardboard) is determined at the edge of the flexible board outline area in the flexible board scan image. This method, by using the precise coordinates of a clear area in one image to define the boundary of a blurred area in another image, achieves precise cross-image positioning of the overlap area boundary, thus solving the problem of boundary blurring in a single image due to height differences. This improves the accuracy of defect detection region segmentation and the reliability of detection results.

[0044] Special note: The dimensions of the clearly defined soft board outline area and hard board outline area are usually not strictly close to the overlapping area to avoid exceeding the defect identification range. The dimensions of the soft board overlapping area and the hard board overlapping area are determined by the model accuracy and are not completely symmetrical or equal.

[0045] The following scheme can be used to perform defect detection on the target contour area and the overlapping area of ​​the rigid and soft plates in the first and second line scan images: CV defect detection is performed on the rigid board contour image extracted from the first-line scan image to obtain the rigid board area defect detection result; AI defect detection is performed on the extracted rigid board overlapping image to obtain the rigid board overlapping area detection result. CV defect detection is performed on the flexible circuit board contour image extracted from another line scan image to obtain the flexible circuit board area detection result; AI defect detection is performed on the extracted flexible circuit board overlap image to obtain the flexible circuit board overlap area detection result.

[0046] Among them, CV defect detection is a defect recognition method based on traditional image processing algorithms. It can be implemented using techniques such as edge detection, morphological operations, or CAM image template matching. Its purpose is to efficiently process the geometric features of clear areas in the image and avoid computational redundancy caused by complex models. AI defect detection, on the other hand, is a defect recognition method based on machine learning models. It can be implemented using convolutional neural networks or deep learning architectures. Its purpose is to extract nonlinear features from blurred images and adapt to imaging uncertainties.

[0047] For the first line scan image, the CV1 model (input hardboard contour image) and the AI1 model (input hardboard overlapping image) are used for recognition respectively to obtain the hardboard area defect detection results and the hardboard overlapping area detection results.

[0048] For the second line scan image, the CV2 model (input flexible board contour image) and the AI2 model (input flexible board overlapping image) are used for recognition respectively to obtain the detection results of the flexible board area defects and the detection results of the flexible board overlapping area.

[0049] As a specific implementation method, the solution of this application is implemented as follows: After acquiring the first line scan image, the rigid board contour image is extracted by matching the rigid board CAM image file, and edge detection is performed using the Sobel operator to complete CV defect detection; simultaneously, for the rigid board overlapping image, a pre-trained ResNet model is called to perform AI defect detection; after acquiring the second line scan image, the flexible board contour image is extracted by matching the flexible board CAM image file, and morphological opening operation is used for CV defect detection; simultaneously, for the flexible board overlapping image, the U-Net network structure is applied to complete AI defect detection. In the above embodiments, the CV defect detection module can be integrated into the image processing unit of the industrial control computer, and the AI ​​defect detection module is deployed on a separate GPU-accelerated server. The two achieve real-time transmission of detection results through a data interface.

[0050] Through the above technical solution, this application effectively solves the problem of detection accuracy caused by unclear imaging in the overlapping area of ​​the rigid-soft board, significantly improves the detection efficiency of the contour area and reduces the missed detection rate in the overlapping area, and achieves synergistic optimization of defect detection accuracy and efficiency. Based on the separate processing and output results of the two line scan images, the detection outputs of the two overlapping regions are fused to output the final defect detection result. The specific process is as follows: The detection results of the hard board overlapping area and the soft board overlapping area are incrementally fused based on the defect coordinates and defect labels, and the final defect detection result is output by combining the defect detection results of the hard board area and the soft board area.

[0051] Figure 5 This diagram illustrates the incremental fusion of defect detection results from two line scan images. Defect coordinates represent the spatial location of the defect in the image, which can be quantified using pixel coordinates or physical coordinates. Specifically, image registration algorithms can map coordinates under different scanning parameters to a unified reference system, ensuring precise alignment of defect location information. Defect labels can be understood as type identification information for defects, defined using classification codes or semantic labels, such as categories like scratches, holes, or short circuits. This can be achieved through classification results output by machine learning models, aiming to clarify the nature and severity of the defect.

[0052] Incremental fusion is a fusion mechanism that dynamically supplements new information based on existing detection data. It can be achieved by constructing a defect feature database and performing incremental data merging operations. For example, a coordinate mapping algorithm is used to eliminate geometric deviations caused by differences in scanning parameters. Simultaneously, semantic consistency checks are performed on similar defects based on defect labels, filtering out conflicting or redundant detection entries. The incremental fusion mechanism dynamically integrates complementary information from two overlapping areas, supplementing missing details in overlapping regions based on existing rigid or flexible board area detection results, forming a complete defect distribution map. Finally, the final defect detection result is output by combining the rigid board area defect detection results and the flexible board area detection results. The detection results of the rigid and flexible board areas serve as baseline data, ensuring that highly reliable detection information in non-overlapping areas is fully preserved, while the fusion results of overlapping areas fill the detection gaps in boundary areas, thus constructing a seamless defect detection system covering the entire rigid-flex board.

[0053] Specifically, a defect database can be established, recording all defects detected in the rigid board overlap area (e.g., defect A: type "open circuit", coordinates (X1, Y1), confidence level 0.9) and all defects detected in the flexible board overlap area (e.g., defect B: type "open circuit", coordinates (X1+2, Y1+1), confidence level 0.8) one by one. During the recording process, the system can set a spatial threshold (e.g., 5 pixels). If a newly recorded defect is less than the coordinate distance of an existing defect in the database and has the same defect label (e.g., "open circuit"), the system can determine that it is the same defect. At this point, fusion can be performed according to preset rules, such as retaining the detection result with higher confidence, or merging the information of the two results (e.g., updating the average coordinates, maximum size, etc. of the defect), thereby avoiding duplicate reporting. For example, defect A and defect B can be merged into a single defect C with coordinates (X1+1, Y1+0.5), type "open circuit", and confidence level 0.9. After incremental fusion of the overlapping areas, the final defect detection results can be composed of the fused overlapping area defect C, as well as the rigid board area defect detection results (e.g., defect D: type "short circuit", coordinates (X2, Y2)) and the flexible board area detection results (e.g., defect E: type "foreign object", coordinates (X3, Y3)). These results can be integrated into a unified report file, such as an XML file containing detailed information on all defects, or annotated with different colors or symbols on the digital model of the circuit board on a graphical user interface for operator review and confirmation.

[0054] Through the above solution, this application achieves accurate integration of defect detection results in the interface area of ​​rigid-flex circuit boards, effectively solves the problem of defect coordinate offset and label conflict caused by different scanning parameters, avoids repeated detection or information omission, and ensures that the final output defect detection results maintain logical consistency in spatial location and type identification, thereby providing a reliable technical guarantee for high-precision quality inspection of rigid-flex circuit boards. For some special materials or special functional scenarios, in the defect detection process of rigid-flex boards, single-channel scanning may result in limited image information, which cannot effectively cope with noise interference, lighting changes and local imaging defects, resulting in insufficient defect detection rate in both flexible and rigid board areas. In particular, due to the imaging blurring caused by the height difference in the overlapping area of ​​flexible and rigid boards, single-channel data is difficult to support high-precision defect identification.

[0055] Therefore, this application also provides a defect detection fusion scheme based on multi-channel scanning. Figure 6 This is a schematic diagram of the corresponding principle, which can be described in detail as follows: 1. After selecting the target parameters of the scanning board, perform multi-channel scanning on each selected pixel row to obtain line scan images under different pixel channels; 2. After aligning the line scan images under each pixel channel, use the flexible PCB CAM file to perform contour matching to determine the corresponding flexible PCB contour area and the overlapping area of ​​the flexible PCB. 3. Perform defect detection on line scan images of different pixel channels by region; 4. Incrementally fuse the defects detected in multiple channels based on the defect coordinates and defect labels, and output the PCB fusion result; 5. After selecting the target parameters of the scanning hardboard, perform multi-channel scanning on each selected pixel row to obtain line scan images under different pixel channels; 6. After aligning the line scan images under each pixel channel, use the rigid board CAM file to perform contour matching to determine the corresponding rigid board contour area and the rigid board overlap area. 7. Perform defect detection on line scan images of different pixel channels by region; 8. Incrementally fuse the defects detected in multiple channels based on the defect coordinates and defect labels, and output the hard board fusion result; 9. Combine the output flexible board fusion results with the rigid board fusion results to output the final result.

[0056] Multi-channel scanning involves acquiring data multiple times for the same pixel row under different spectral response characteristics or imaging conditions. This can be achieved using RGB three-channel imaging, a combination of near-infrared and visible light dual channels, or multiple exposure sequences with different exposure times. The aim is to obtain complementary image information to overcome the noise sensitivity and illumination adaptability limitations of a single channel. Line scan image alignment refers to mapping multi-channel images to a unified coordinate system through feature point matching or geometric transformation. This can be achieved using affine transformation based on SIFT features or non-rigid registration algorithms based on grids. The goal is to eliminate mechanical jitter or positional offset during the scanning process and ensure the consistency of the spatial reference for subsequent contour matching. Incremental fusion integrates multi-source data based on the spatial coordinates and semantic labels of defects. This can be achieved using weighted voting mechanisms or confidence threshold filtering. The goal is to eliminate false alarms from single channels through cross-validation of redundant information and improve the confidence of defect identification.

[0057] Specifically, the solution of this application performs multi-channel scanning on each pixel row after selecting the target parameters of the scanned flexible circuit board to obtain a sequence of line scan images with differentiated imaging characteristics. After spatial alignment processing, these images are matched with the CAM file of the flexible circuit board to accurately delineate the boundaries of the flexible circuit board contour area and the overlapping area. Subsequently, regional defect detection is performed on each channel image. Finally, the defects detected by the multi-channel are incrementally fused according to the coordinate mapping relationship and the label consistency, thereby forming a high-confidence fusion result in the flexible circuit board area. Similarly, a symmetrical process is used to generate the hard board fusion result in the hard board area to ensure that the detection data of the flexible and hard board overlapping area are seamlessly connected through the association of coordinates and labels, forming a complete defect detection output system.

[0058] As a specific implementation method, the solution of this application is implemented as follows: When scanning the flexible circuit board area, pixel-by-pixel scanning is performed using three channels: red, green, and blue. After the images of each channel are aligned by affine transformation based on feature points, the flexible circuit board CAM file is called to determine the scope of the flexible circuit board contour area and overlapping area. Edge detection and texture analysis are performed on the images of each channel to identify defects. The detected defects are then fused through coordinate normalization and label consistency verification. When scanning the rigid circuit board area, a combination of near-infrared and visible light channels is used. After grid registration and alignment, the rigid circuit board CAM file is called to divide the area. Defect detection is performed through morphological analysis and deep learning models. Finally, the multi-channel defect data is integrated and output.

[0059] Through the above scheme, this application effectively improves the robustness of defect detection of rigid-flex PCBs. In particular, in the overlapping area of ​​rigid-flex PCBs, it can overcome the noise sensitivity and local blurring problems of single-channel imaging. By complementarity of multi-channel data and incremental fusion mechanism, it significantly enhances the reliability of defect identification and reduces the phenomenon of missed detection and false detection caused by changes in illumination or imaging defects. In some embodiments described above, different target parameters are proposed to scan the flexible and rigid board regions separately to address the imaging problem caused by height differences. However, a key challenge in its implementation is how to automatically and accurately determine these parameters to accommodate the height differences of the flexible and rigid board, ensuring that both the flexible and rigid board regions can obtain clear images. Therefore, this application provides a method for determining the target parameters for scanning the flexible and rigid board regions, based on the following steps: 1. Scan the pixel rows of the rigid-flex PCB, extract the valid pixels, and determine the ratio of rigid PCB pixels to flexible PCB pixels among the valid pixels. 2. Based on the effective pixels and the ratio of rigid board pixels to flexible board pixels, filter at least one set of effective pixel rows; 3. Match the effective pixel rows with the target pixel row outlines of the CAM file, adjust the camera parameters according to the matching results, and determine the camera parameters used for scanning the flexible and rigid board areas respectively.

[0060] In the above scheme, effective pixels refer to the set of pixels that can clearly characterize the features of the circuit board area. These can be identified using pixels based on grayscale thresholding or edge detection algorithms, aiming to eliminate background noise and interference from non-circuit board areas, providing a reliable basis for area classification. Selecting effective pixel rows refers to choosing pixel rows with clear regional characteristics. This can be achieved using a quantitative analysis method that sets a threshold for the ratio of flexible to rigid board pixels. For example, when the proportion of effective pixels in a pixel row reaches a preset range, the area is divided according to the dominant proportion of flexible or rigid board pixels, ensuring that the selected pixel rows fully represent the imaging characteristics of the flexible or rigid board area. The target pixel row contour line in the CAM drawing refers to the theoretical geometric boundary of the flexible or rigid board area defined in the CAM drawing. This can be achieved using vector contour lines generated from CAD data, aiming to provide a standard reference for pixel-level matching and calibration with the actual image.

[0061] Specifically, this solution achieves automatic adaptation of camera parameters through a step-by-step confirmation mechanism: First, based on the changes in imaging characteristics caused by the difference in the height of the rigid and flexible boards, the pixel rows are scanned and effective pixels and their proportional distribution are extracted to accurately identify the boundary features of the region. Secondly, by quantitatively analyzing the proportional distribution, pixel rows with clear regional characteristics are selected, eliminating blurry areas and noise interference; Finally, the selection results are dynamically matched with the theoretical contour lines of the CAM files. By adjusting the camera parameters, the actual image and the theoretical contour are made to achieve the best match, thereby determining the appropriate depth-of-field parameters for the flexible and rigid plate areas respectively.

[0062] This process forms a complete parameter confirmation chain, enabling the rigid and flexible circuit boards to acquire clear images in their respective optimal focusing states, fundamentally avoiding the problem of regional blurring caused by height differences when scanning a single set of parameters.

[0063] The above technical solution enables automatic and accurate confirmation of camera parameters in the inspection of rigid-flex circuit boards, ensuring that clear images are obtained in both flexible and rigid board areas under their optimal focusing conditions. This effectively avoids the problem of single-area blurring caused by height differences and provides a reliable image basis for subsequent defect detection. Figure 7 This is a structural block diagram of a defect detection device for rigid-flex circuit boards provided in an embodiment of this application. The device includes: The image scanning module 710 is used to perform linear scanning of the rigid-flex board using different target parameters of the line scan camera, and to acquire the first line scan image and the second line scan image under the corresponding parameters; the different target parameters are used to scan the flexible board and rigid board areas respectively, corresponding to different camera depths of field. Image recognition module 720 is used to perform contour matching between the first line scan image and the second line scan image and the CAM drawing of the rigid-flex board, respectively, to determine the target contour area of ​​the image flexible board or rigid board portion and the overlapping area of ​​the rigid-flex board. The defect detection module 730 is used to perform defect detection on the target contour area and the hard-soft board overlap area of ​​the first line scan image and the second line scan image respectively, and to fuse the detection output of the hard-soft board overlap area to output the final defect detection result.

[0064] It should be noted that the defect detection device for rigid-flex circuit boards provided in this embodiment is only illustrated by the above-described division of functional modules / units. In practical applications, the above functions can be assigned to different functional modules / units as needed, that is, the internal structure of the defect detection device for rigid-flex circuit boards can be divided into different functional modules / units to complete all or part of the functions described above. Furthermore, the implementation method of the defect detection method for rigid-flex circuit boards provided in the above method embodiments and the implementation method of the defect detection device for rigid-flex circuit boards provided in this embodiment belong to the same concept. The specific implementation process of the defect detection device for rigid-flex circuit boards provided in this embodiment is detailed in the above method embodiments and will not be repeated here.

[0065] Figure 8This application provides a structural block diagram of a computer device according to an exemplary embodiment. The computer device can be a desktop computer, laptop computer, handheld computer, or cloud server, etc. The computer device may include, but is not limited to, a processor and memory. The processor and memory can be connected via a bus or other means. The processor can be a central processing unit (CPU) or other general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a graphics processing unit (GPU), an embedded neural network processor (NPU) or other dedicated deep learning coprocessor, discrete gate or transistor logic devices, discrete hardware components, or combinations of the above types of chips.

[0066] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the methods in the above embodiments of this application. The processor executes various functional applications and data processing by running the non-transitory software programs, instructions, and modules stored in the memory, thereby implementing the methods in the above embodiments. The memory may include a program storage area and a data storage area, wherein the program storage area may store the operating system and at least one application program required for a function; the data storage area may store data created by the processor, etc. Furthermore, the memory may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0067] Those skilled in the art will understand that the structure shown in this embodiment does not constitute a limitation on the computer device, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.

[0068] This application also discloses a computer-readable storage medium. Specifically, the computer-readable storage medium is used to store a computer program, which, when executed by a processor, implements the methods described in the above-described method embodiments. Those skilled in the art will understand that implementing all or part of the processes in the methods described above can be accomplished by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments described above. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk (HDD), or solid-state drive (SSD), etc.; the storage medium can also include combinations of the above types of memory.

[0069] This specific embodiment is merely an explanation of the present invention and is not intended to limit the invention. After reading this specification, those skilled in the art can make modifications to this embodiment without contributing any inventive step, but such modifications are protected by patent law as long as they are within the scope of the claims of the present invention.

Claims

1. A defect detection method for rigid-flex circuit boards, characterized in that, The method includes: The rigid-flex PCB is linearly scanned using different target parameters of a line scan camera to obtain the first and second line scan images under the corresponding parameters; different target parameters are used to scan the flexible and rigid PCB areas respectively, corresponding to different camera depths of field; The first line scan image and the second line scan image are respectively matched with the CAM file of the rigid-flex board to determine the target contour area of ​​the image flexible board or rigid board portion and the overlapping area of ​​the flexible-rigid board. Defect detection is performed on the target contour area and the hard-soft board overlap area of ​​the first and second line scan images respectively, and the detection output of the hard-soft board overlap area is fused to output the final defect detection result.

2. The method according to claim 1, characterized in that, After selecting the target parameters, the rigid-flex board is scanned line by line to obtain a line scan image; for the selected line scan image, the flexible board contour area and the rigid board contour area are determined by aligning and mapping with the corresponding CAM file, and the rigid-flex board overlap area is determined based on the positional relationship between the flexible board contour area and the rigid board contour area. Specifically, a CAM file is used to map a clear rigid board contour area in a line scan image, and another CAM file is used to map a clear flexible board contour area in another line scan image; the rigid board overlap area is determined at the edge of the rigid board contour area based on the coordinates of the clear flexible board contour area, and the flexible board overlap area is determined at the edge of the flexible board contour area based on the coordinates of the clear rigid board contour area.

3. The method according to claim 1, characterized in that, The rigid board outline area is determined based on the mapping of the rigid board CAM file, and the flexible board outline area is determined based on the mapping of the flexible board CAM file. The rigid board overlapping area simultaneously includes local rigid board outlines and local flexible board outlines, and the local flexible board outlines are captured based on the rigid board scanning parameters. The rigid PCB CAM file contains only the outline of the rigid PCB area, and the flexible PCB CAM file contains only the outline of the flexible PCB area. The overlapping area of ​​the flexible PCBs simultaneously contains both local flexible PCB outlines and local rigid PCB outlines, and the local rigid PCB outlines are captured based on the flexible PCB scanning parameters.

4. The method according to claim 1, characterized in that, The defect detection of the target contour area and the hard-soft board overlap area in the first and second line scan images includes: CV defect detection is performed on the rigid board contour image extracted from the first-line scan image to obtain the rigid board area defect detection result; AI defect detection is performed on the extracted rigid board overlapping image to obtain the rigid board overlapping area detection result. CV defect detection is performed on the flexible circuit board contour image extracted from another line scan image to obtain the flexible circuit board area detection result; AI defect detection is performed on the extracted flexible circuit board overlap image to obtain the flexible circuit board overlap area detection result.

5. The method according to any one of claims 4, characterized in that, The process of fusing the detection outputs of the two overlapping regions to output the final defect detection result includes: The detection results of the hard board overlapping area and the soft board overlapping area are incrementally fused based on the defect coordinates and defect labels, and the final defect detection result is output by combining the defect detection results of the hard board area and the soft board area.

6. The method according to any one of claims 1-5, characterized in that, After selecting the target parameters of the scanning board, perform multi-channel scanning on each selected pixel row to obtain line scan images under different pixel channels; After aligning the line scan images for each pixel channel, use the flexible PCB CAM file to perform contour matching and determine the corresponding flexible PCB contour area and the flexible PCB overlapping area. Defect detection is performed on the line scan images under different pixel channels by region, and the defects detected under multiple channels are incrementally fused according to the defect coordinates and defect labels to output the flexible board fusion result. After selecting the target parameters of the scanning hardboard, perform multi-channel scanning on each selected pixel row to obtain line scan images under different pixel channels; After aligning the line scan image for each pixel channel, use the rigid board CAM file to perform contour matching to determine the corresponding rigid board contour area and the rigid board overlapping area. The line scan images under different pixel channels are divided into regions for defect detection. The defects detected under multiple channels are incrementally fused according to the defect coordinates and defect labels, and the hard board fusion result is output.

7. The method according to claim 1, characterized in that, The target parameters for scanning the flexible and rigid PCB areas are confirmed based on the following steps: Scan the pixel rows of the rigid-flex PCB, extract the valid pixels, and determine the ratio of rigid PCB pixels to flexible PCB pixels among the valid pixels. Based on the effective pixels and the ratio of rigid board pixels to flexible board pixels, filter at least one set of effective pixel rows; The effective pixel rows are matched with the target pixel row outlines of the CAM file, and the camera parameters are adjusted according to the matching results to determine the camera parameters used for scanning the flexible and rigid board areas respectively.

8. A defect detection device for rigid-flex circuit boards, characterized in that, The device includes: The image scanning module is used to perform linear scanning of the rigid-flex board using different target parameters of the line scan camera, and to acquire the first line scan image and the second line scan image under the corresponding parameters; different target parameters are used to scan the flexible board and rigid board areas respectively, corresponding to different camera depths of field; The image recognition module is used to perform contour matching between the first line scan image and the second line scan image and the CAM file of the rigid-flex board, respectively, to determine the target contour area of ​​the image flexible board or rigid board portion and the overlapping area of ​​the flexible-rigid board. The defect detection module is used to perform defect detection on the target contour area and the hard-soft board overlap area of ​​the first line scan image and the second line scan image respectively, and to fuse the detection output of the hard-soft board overlap area to output the final defect detection result.

9. A computer device, characterized in that, The computer device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set, or an instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the defect detection method for a rigid-flex circuit board as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The readable storage medium stores at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the defect detection method for a rigid-flex circuit board as described in any one of claims 1 to 7.