Circuit board defect generation and repair model construction method and system and medium

By combining DCGAN with a diffusion model of 3D point cloud clipping, diverse solder joint defect point cloud samples are generated and end-to-end optimized. This solves the problems of data scarcity and insufficient accuracy in the detection and repair of 3D point cloud defects of solder joints on DIP integrated circuit boards, and improves the intelligence level and adaptability of the system.

CN120997158APending Publication Date: 2025-11-21SHENZHEN KAIPULE TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511097253.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-06
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

Existing technologies for the detection and repair of 3D point cloud defects in solder joints of DIP integrated circuit boards suffer from problems such as scarce defect data, insufficient repair accuracy, and poor method universality. They are difficult to generate diverse and realistic defect point cloud data, lack joint modeling and end-to-end optimization mechanisms, and are difficult to adapt to diverse production needs.

Method used

A deep convolutional generative adversarial network (DCGAN) is used to generate diverse solder joint defect point cloud samples. Real geometric features are constructed through a 3D point cloud cropping method. Combined with a diffusion model, defect regions are progressively modeled and reconstructed to achieve end-to-end joint optimization.

Benefits of technology

It improves the intelligence level of 3D point cloud defect repair of DIP circuit board solder joints, enhances the accuracy and adaptability of defect identification and repair, and meets the quality control requirements of high precision and high reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120997158A_ABST
    Figure CN120997158A_ABST
Patent Text Reader

Abstract

The invention discloses a circuit board defect generation and repair model construction method and system and a medium, and the method comprises the following steps: generating a diversified welding spot defect point cloud sample with a real structure through employing the adversarial learning capability of a deep convolution generative adversarial network and a three-dimensional point cloud cutting method; a diffusion model is introduced to carry out step-by-step modeling and reconstruction on a defect area, geometric details and spatial continuity of point cloud are fully recovered, and welding spot defects are repaired. The intelligent level and the industrial practical value of DI P circuit board welding spot three-dimensional point cloud defect repair are improved, the defect reconstruction capability and the image quality evaluation effect in a real industrial environment are improved, and the quality control requirement in the manufacturing process of high-precision and high-reliability electronic products can be met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of computer vision and industrial automation defect detection and repair technology, and in particular to a method, system and medium for constructing a defect generation and repair model for DIP dual in-line package circuit boards. Background Technology

[0002] In the fields of computer vision and industrial automation defect detection and repair, existing technologies still have many problems in point cloud data generation and defect repair for monitoring and repairing solder joint defects on DIP (Dual In-line Package) integrated circuit boards:

[0003] 1. Difficulty in Obtaining Defect Data: In real-world industrial scenarios, weld defect samples are scarce, especially 3D point cloud data with clear labels. Due to the complexity of defect types, low probability of occurrence, and high cost of manual annotation, existing datasets often have limited sample sizes and uneven distribution. This makes it difficult for deep learning models to be adequately trained, resulting in insufficient generalization ability. Although some studies have introduced Deep Convolutional Generative Adversarial Networks (DCGANs) to synthesize 2D image defect data, in the 3D point cloud domain, the stability and spatial structure modeling capabilities of DCGANs still face challenges, making it difficult to generate realistic and diverse defect point cloud data, thus affecting the applicability of the model in real-world environments.

[0004] 2. Insufficient Accuracy of Point Cloud Repair Methods: For defective regions in 3D point clouds of weld joints, traditional repair methods such as geometric interpolation and symmetry assumptions rely on manually set rules or repetitive local structures, making it difficult to handle complex and irregular defect morphologies. In recent years, some studies have attempted to use deep learning for point cloud completion, but the repair accuracy remains limited. Diffusion models, as an emerging generative method, theoretically possess the ability to progressively model point cloud distributions and restore high-quality details; however, current diffusion models applied to point cloud repair are still in their early stages, with room for optimization in data representation, computational efficiency, and detail preservation.

[0005] 3. Lack of joint modeling and end-to-end optimization mechanisms: Existing methods typically treat defect generation and defect repair as two independent stages, lacking a collaborative optimization mechanism. The lack of consistency between the generated data and the repair model may lead to decreased repair performance. Furthermore, most methods fail to establish an end-to-end training framework, failing to fully utilize the correlation information between data distribution, defect features, and spatial geometry, thus limiting the overall intelligence level and practical application effectiveness of the system.

[0006] 4. Difficulty in adapting to diverse production needs: Industrial environments contain various models of DIP circuit boards with significant differences in solder joint arrangement, size, and manufacturing process. Existing point cloud processing methods generally lack versatility and adaptability. When faced with new product models or changes in production conditions, they often require extensive parameter readjustment and model fine-tuning, resulting in low deployment efficiency and high application costs. Summary of the Invention

[0007] The main objective of this invention is to propose a method, system, and medium for generating and repairing defect models of DIP (Dual In-line Package) circuit boards. This aims to overcome the problems of scarce defect data, insufficient repair accuracy, and poor method versatility in existing technologies for detecting and repairing 3D point cloud defects in solder joints of DIP integrated circuit boards. The invention also aims to improve the intelligence level and industrial practical value of 3D point cloud defect repair for DIP circuit board solder joints, enhance defect reconstruction capabilities and image quality assessment effects in real industrial environments, and meet the quality control requirements of high-precision, high-reliability electronic product manufacturing processes.

[0008] To achieve the above objectives, the present invention provides a method for constructing a circuit board defect generation and repair model, the method comprising the following steps:

[0009] Step S10: Utilize the adversarial learning capability of deep convolutional generative adversarial networks and the 3D point cloud cropping method to generate diverse and structurally realistic weld point defect point cloud samples.

[0010] Step S20: Introduce a diffusion model to gradually model and reconstruct the defect area, fully restore the geometric details and spatial continuity of the point cloud, and repair the weld defects.

[0011] A further technical solution of the present invention is that step S10 includes:

[0012] Step S101: Generate realistic defect images from the latent space using a deep convolutional generative adversarial network;

[0013] Step S102 introduces a three-dimensional point defect modeling and planar cutting method to construct a defect with real geometric features from three-dimensional space;

[0014] Step S103: Generate a defect image by two-dimensional projection cropping.

[0015] A further technical solution of the present invention is that step S101 includes:

[0016] Step S1011: After extracting latent features from the normal images acquired in the actual project using an encoder, a noise vector is introduced and fused with the 3D point cloud features.

[0017] Step S1012: A defect image is synthesized using a generator, and a discriminator is used to distinguish the simulated defect image generated by the adversarial network from the acquired real defect image, thus achieving adversarial training; wherein, the basic adversarial function of the adversarial network is:

[0018]

[0019] Where G is the generator, D is the discriminator, and x ~ p d ata(x) represents a sample from the true data distribution, z ~ p z (z) represents the noise distribution, D(x) represents the probability estimate of the discriminator that the real sample is true, and D(G(z)) represents the probability estimate of the discriminator that the generated sample is true.

[0020] The generator objective formula is:

[0021]

[0022] The discriminator target formula is:

[0023]

[0024] A further technical solution of the present invention is that step S102 includes:

[0025] Step S1021: Perform 3D modeling and point cloud sampling to construct a high-precision point cloud model;

[0026]

[0027] Where P represents the three-dimensional point cloud set of the circuit structure, (x i ,y i ,z i () represents the three-dimensional coordinates of each point, and N is the number of points;

[0028] Step S1022: Introduce local deformation disturbances in a specific area, and simulate them in the following manner:

[0029] P′={(x i ,y i ,z i +δ i )};

[0030] in, It is a Gaussian perturbation, where μ<0 indicates a depression and μ>0 indicates a convexity;

[0031] Step S1023: Select any projection plane and project the point cloud to form an image;

[0032] The projection plane is represented as:

[0033] Π:ax+by+cz+d=0;

[0034] Where a, b, c, d are parameters of the projection plane;

[0035] The orthogonal projection diagram I(u,v) is represented as:

[0036]

[0037] The depth map I(u,v) is represented as:

[0038]

[0039] in, Represents the projection operator. The depth mapping function from a point to the projection plane;

[0040] Step S1024: Normalize the projected image to a uniform size of 256×256, consistent with the size of the image generated by the adversarial network, and perform edge enhancement, blur adjustment, and contrast enhancement processing to improve visual realism.

[0041] A further technical solution of the present invention is that step S20 includes:

[0042] Step S201: Mask the defective area and construct repair conditions. The specific formula is as follows:

[0043]

[0044] Where, x t The image at the current moment, For the input image, To initialize Gaussian noise, M∈{0,1} H×W This is a binary defect mask, where ⊙ represents element-wise multiplication;

[0045] Step S202: Use the trained diffusion model to backsample from the noise step by step. Perform backsampling at each time step t to gradually recover the original image.

[0046]

[0047] Where, x t-1 For the image from the previous step, ∈ θ It is a trained neural network. For standard normal noise, β t For time-step noise scheduling parameters, σ t It is the noise amplitude of the backsampled sample; a linear noise scheduling strategy is adopted, and β is set. t From 10 -4The value was increased uniformly to 0.02 over a total of 1000 time steps to ensure smooth and stable noise injection.

[0048] In the process of progressively backsampling from noise, the formula for the forward process of the diffusion model is:

[0049] x t =sqrt(alpha) b ar t )*x0+sqrt(1-alpha b ar t )*∈;

[0050] Where x0 is the original image, alpha b ar t The noise figure represents the forward diffusion. To add a noise term;

[0051] The denoising loss function for the reverse denoising process is:

[0052]

[0053] Where ∈ represents actual noise, ∈ θ For model prediction parameters;

[0054] Step S203: After completing the defect region reconstruction, a mask is used to fuse the image repaired by the diffusion model with the acquired defect image and the simulated defect image generated by the dual path, to obtain the final restored image.

[0055]

[0056] in To repair the resulting image, For the original image, For the final fused image; then, edge convolution or Gaussian filtering is used to further smooth the edges of the mask.

[0057] Step S204: Gaussian filtering is introduced during the fusion process for edge smoothing. A gradual transition method is used in the defect edge region to make the repair result more natural. The structural similarity index (SSIM) is introduced for image quality measurement, and the SSIM confidence of the defect region is defined as:

[0058]

[0059] Wherein, SSIM is the structural similarity index, Conf SSIM(x) represents the uncertainty score. The lower the SSIM, the greater the difference between the restored image and the original image, and the higher the confidence level; conversely, it indicates that the defect may not exist.

[0060] To achieve the above objectives, the present invention also proposes a circuit board defect generation and repair model construction system, the system including a memory, a processor, and a circuit board defect generation and repair model construction program stored on the processor, wherein the circuit board defect generation and repair model construction program is executed by the processor to perform the steps of the method described above.

[0061] To achieve the above objectives, the present invention also proposes a computer-readable storage medium storing a circuit board defect generation and repair model building program, wherein the circuit board defect generation and repair model building program is executed by a processor to perform the steps of the method described above.

[0062] The beneficial effects of the circuit board defect generation and repair model construction method, system, and medium of this invention are:

[0063] This invention proposes a defect sample generation method based on DCGAN and 3D point cloud cropping, and integrates a DIP integrated circuit board defect detection and repair system with a diffusion model repair mechanism. Utilizing deep learning algorithms, it addresses the complex defect repair field of DIP circuit boards, achieving efficient generation, semantic-level repair, and efficient repair of defect samples. A large number of diverse defect samples are generated using DCGAN and a 3D point cloud-based planar cropping method. Further, a diffusion model is used for image repair and quality screening to construct a high-quality synthetic dataset, solving the problems of insufficient actual defect samples and uniform defect morphology. Furthermore, a diffusion model-based repair network is integrated, enabling real-time detection and edge repair modeling of DIP circuit board images on actual production lines. Attached Figure Description

[0064] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the structures shown in these drawings without creative effort.

[0065] Figure 1 This is a flowchart illustrating a preferred embodiment of the circuit board defect generation and repair model construction method of the present invention;

[0066] Figure 2 This is a detailed flowchart of step S10;

[0067] Figure 3 This is a detailed flowchart of step S101;

[0068] Figure 4 This is a detailed flowchart of step S102;

[0069] Figure 5 This is a detailed flowchart of step S20;

[0070] Figure 6 This is a system architecture diagram of a preferred embodiment of the circuit board defect generation and repair model construction method of the present invention;

[0071] Figure 7 This is a flowchart of the dual-path source defect generation process;

[0072] Figure 8 This is an architecture diagram of the circuit board defect generation and repair model construction system of the present invention.

[0073] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0074] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.

[0075] To overcome the problems of scarce defect data, insufficient repair accuracy, and poor method versatility in the detection and repair of 3D point cloud defects in solder joints of DIP (Dual In-line Package) integrated circuit boards, this invention proposes a method for generating and constructing a defect model for DIP circuit boards. Specifically, it employs a dual-path simulation defect generation method (point cloud defect generation based on 3D planar clipping and DCGAN) and a 3D point cloud defect repair method based on a diffusion model. The technical solution mainly utilizes the adversarial learning capability of Deep Convolutional Generative Adversarial Networks (DCGAN) and the 3D point cloud clipping method to generate diverse and structurally realistic solder joint defect point cloud samples to enhance model training and improve the generalization ability of the defect identification and repair algorithm. A diffusion model is introduced to progressively model and reconstruct the defect region, fully restoring the geometric details and spatial continuity of the point cloud, achieving more natural and accurate solder joint defect repair. The defect generation and defect repair processes are integrated into a unified workflow, achieving end-to-end joint modeling and optimization, improving the overall intelligence level and application efficiency of the system. This enhances the intelligence level and industrial practical value of 3D point cloud defect repair for DIP circuit board solder joints, meeting the quality control requirements in the manufacturing process of high-precision and high-reliability electronic products.

[0076] Specifically, such as Figure 1 As shown, the circuit board defect generation and repair model construction method of the present invention includes the following steps:

[0077] Step S10: Utilize the adversarial learning capabilities of deep convolutional generative adversarial networks and 3D point cloud cropping methods to generate diverse and structurally realistic weld point defect point cloud samples.

[0078] Step S20: Introduce a diffusion model to gradually model and reconstruct the defect area, fully restore the geometric details and spatial continuity of the point cloud, and repair the weld defects.

[0079] Among them, such as Figure 2 As shown, step S10 includes:

[0080] Step S101: Generate realistic defect images from the latent space using a deep convolutional generative adversarial network;

[0081] Step S102 introduces a three-dimensional point defect modeling and planar cutting method to construct a defect with real geometric features from three-dimensional space;

[0082] Step S103: Generate a defect image by two-dimensional projection cropping.

[0083] like Figure 3 As shown, step S101 specifically includes:

[0084] Step S1011: After extracting latent features from the normal images acquired in the actual project using an encoder, a noise vector is introduced and fused with the 3D point cloud features.

[0085] Step S1012: A defect image is synthesized using a generator, and a discriminator is used to distinguish the simulated defect image generated by the adversarial network from the acquired real defect image, thus achieving adversarial training; wherein, the basic adversarial function of the adversarial network is:

[0086]

[0087] Where G is the generator, D is the discriminator, and x ~ p d ata(x) represents a sample from the true data distribution, z ~ p z (z) represents the noise distribution, D(x) represents the probability estimate of the discriminator that the real sample is true, and D(G(z)) represents the probability estimate of the discriminator that the generated sample is true.

[0088] The generator objective formula is:

[0089]

[0090] The discriminator target formula is:

[0091]

[0092] like Figure 4 As shown, step S102 specifically includes:

[0093] Step S1021: Perform 3D modeling and point cloud sampling to construct a high-precision point cloud model;

[0094]

[0095] Where P represents the three-dimensional point cloud set of the circuit structure, (x i ,y i ,z i () represents the three-dimensional coordinates of each point, and N is the number of points;

[0096] Step S1022: Introduce local deformation disturbances in a specific area, and simulate them in the following manner:

[0097] P′={(x i ,y i ,z i +δ i )};

[0098] in, It is a Gaussian perturbation, where μ<0 indicates a depression and μ>0 indicates a convexity;

[0099] Step S1023: Select any projection plane and project the point cloud to form an image;

[0100] The projection plane is represented as:

[0101] Π:ax+by+cz+d=0;

[0102] Where a, b, c, d are parameters of the projection plane;

[0103] The orthogonal projection diagram i(u,v) is represented as:

[0104]

[0105] The depth map I(u,v) is represented as:

[0106]

[0107] in, Represents the projection operator. The depth mapping function from a point to the projection plane;

[0108] Step S1024: Normalize the projected image to a uniform size of 256×256, consistent with the size of the image generated by the adversarial network, and perform edge enhancement, blur adjustment, and contrast enhancement processing to improve visual realism.

[0109] like Figure 5 As shown, step S20 specifically includes:

[0110] Step S201: Mask the defective area and construct repair conditions. The specific formula is as follows:

[0111]

[0112] Where, x t The image at the current moment, For the input image, To initialize Gaussian noise, M∈{0,1} H×W This is a binary defect mask, where ⊙ represents element-wise multiplication;

[0113] Step S202: Use the trained diffusion model to backsample from the noise step by step. Perform backsampling at each time step t to gradually recover the original image.

[0114]

[0115] Where, x t-1 For the image from the previous step, ∈ θ It is a trained neural network. For standard normal noise, β t For time-step noise scheduling parameters, σ t It is the noise amplitude of the backsampled sample; a linear noise scheduling strategy is adopted, and β is set. t From 10 -4 The value was increased uniformly to 0.02 over a total of 1000 time steps to ensure smooth and stable noise injection.

[0116] In the process of progressively backsampling from noise, the formula for the forward process of the diffusion model is:

[0117] x t =sqrt(alpha) b ar t )*x0+sqrt(1-alpha b ar t )*∈;

[0118] Where x0 is the original image, alpha b ar t The noise figure represents the forward diffusion. To add a noise term;

[0119] The denoising loss function for the reverse denoising process is:

[0120]

[0121] Where ∈ represents actual noise, ∈ θ For model prediction parameters;

[0122] Step S203: After completing the defect region reconstruction, a mask is used to fuse the image repaired by the diffusion model with the acquired defect image and the simulated defect image generated by the dual path, to obtain the final restored image.

[0123]

[0124] in To repair the resulting image, For the original image, For the final fused image; then, edge convolution or Gaussian filtering is used to further smooth the edges of the mask.

[0125] Step S204: Gaussian filtering is introduced during the fusion process for edge smoothing. A gradual transition method is used in the defect edge region to make the repair result more natural. The structural similarity index (SSIM) is introduced for image quality measurement, and the SSIM confidence of the defect region is defined as:

[0126]

[0127] Wherein, SSIM is the structural similarity index, Conf SSIM (x) represents the uncertainty score. The lower the SSIM, the greater the difference between the restored image and the original image, and the higher the confidence level; conversely, it indicates that the defect may not exist.

[0128] The following combination Figures 1 to 7 The present invention will be described in further detail below.

[0129] This invention addresses the defect detection and repair task of DIP integrated circuit boards by constructing a framework for image inpainting based on a dual-path defect generation and diffusion model using Generative Adversarial Networks (DCGAN) and 3D point cloud cropping. The aim is to improve defect reconstruction capabilities and image quality assessment in real industrial environments. This invention comprises two core modules: a defect sample generation module and a diffusion model-based defect repair module, upon which a complete model training pipeline is built. The modules collaborate and jointly optimize to improve the accuracy of defect recovery and the overall structural consistency of the image. The following is a detailed description of each module:

[0130] 1. Defect Sample Generation Module (Point Cloud Defect Generation Based on 3D Plane Clipping and DCGAN)

[0131] To enhance the diversity of defect images and improve the realistic representation of datasets, this invention designs a dual-path defect sample generation strategy: on the one hand, it uses a deep convolutional generative adversarial network (DCGAN) to generate realistic defect images from the latent space; on the other hand, it innovatively introduces a three-dimensional point cloud defect modeling and planar cropping method to construct defects with realistic geometric features from three-dimensional space, and then generates defect images through two-dimensional projection cropping, thereby improving the model's ability to model structural defects.

[0132] Path 1: Image-level Defect Generation Based on DCGAN

[0133] To address the issues of scarce and unevenly distributed DIP defect data, this invention designs a defect image synthesis module based on a Deep Convolutional Generative Adversarial Network (DCGAN). The DCGAN consists of a generator G and a discriminator D. This module is trained using real defect images collected from actual engineering projects. After learning their latent distribution, it can synthesize realistic and diverse defect images during the generation stage, improving data diversity and training robustness. The steps are as follows:

[0134] ① After extracting latent features from normal images acquired in actual engineering using an encoder, a noise vector is introduced and fused with the 3D point cloud features;

[0135] ② Defect images are synthesized using a generator, and a discriminator is used to distinguish between the simulated defect images generated by DCGAN and the acquired real defect images, thus achieving adversarial training. The basic adversarial function of DCGAN is:

[0136]

[0137] Where G is the generator, D is the discriminator, and x ~ p d ata(x) represents a sample from the true data distribution, z ~ p z (z) represents the noise distribution, D(x) represents the probability estimate of the discriminator that the real sample is true, and D(G(z)) represents the probability estimate of the discriminator that the generated sample is true.

[0138] The generator objective formula is:

[0139]

[0140] The discriminator target formula is:

[0141]

[0142] This invention employs adversarial collaborative optimization between the generator and discriminator. It not only generates defect regions but also maintains the realism and structural consistency of the background regions, effectively enhancing the quality of the training set. To enhance the discriminator's ability to recognize local textures, this invention uses a PatchGAN structure as the discriminator skeleton. The latent vector dimension is set to 100, and the generated image size is uniformly 256×256, ensuring rich image details and meeting the resolution requirements of industrial inspection images.

[0143] In the data preprocessing process of image-level defect generation based on DCGAN, this invention collects normal (defect-free) and defective images of DIP circuit board solder joints in actual engineering projects, with a uniform size of 256×256 pixels, and normalizes the pixel values ​​to the range of [-1,1] to construct a training dataset.

[0144] The network architecture setup process is as follows:

[0145] Generator G: Employs multiple transposed convolutional layers, combined with Batch Normalization and ReLU activation functions, with the latent vector dimension set to 100. The output layer uses the Tanh activation function to generate images.

[0146] Discriminator D: It adopts the PatchGAN structure, which consists of multiple convolutional layers, Batch Normalization and LeakyReLU activation function, with an output dimension of 1, and is used to judge the authenticity of the image.

[0147] The process of combat training:

[0148] Input real defect images x~p d ata(x) and noise vector z ~ p z The generator G(z) outputs a synthesized defect image.

[0149] Discriminator D distinguishes between real image D(x) and synthetic image D(G(z)), and optimizes the parameters of both sides through adversarial loss function V(D,G). The training iterations are 50,000 rounds.

[0150] Data augmentation applications: During the training process, preprocessing operations such as edge enhancement, blur adjustment, and contrast enhancement are randomly applied to the generated defective images to improve image diversity and realism.

[0151] Path 2: Defect Image Generation Based on 3D Point Cloud Cropping

[0152] This invention constructs a point cloud model of electronic components and circuit structures in three-dimensional space to simulate physical structural defects (such as warping, dents, and damage), and then generates defect images by cropping and projecting from different angles, thereby improving the geometric realism and spatial consistency of training samples.

[0153] First, 3D modeling and point cloud sampling are performed. CAD software is used to construct a 3D geometric model of the solder joints on the DIP circuit board, including normal solder joints and common defect types (such as warping, dents, and breakage). A 3D point cloud set containing N points is generated through uniform sampling to construct a high-precision point cloud model.

[0154]

[0155] Where P represents the three-dimensional point cloud set of the circuit structure, (x i ,y i ,z i ) represents the three-dimensional coordinates of each point, N is the number of points, N≥10^4.

[0156] Local deformation disturbances, such as depressions or protrusions, are introduced into specific areas for simulation. The simulation is conducted using the following method:

[0157] P′={(x i ,y i ,z i +δ i )}

[0158] in, It is a Gaussian perturbation, where μ<0 indicates a depression and μ>0 indicates a convexity.

[0159] This invention introduces Gaussian perturbations into specific regions of a point cloud model. μ<0 simulates a depression, μ>0 simulates a bulge, and the disturbance intensity σ 2 Dynamically adjust according to defect type (e.g., dent σ) 2 ∈[0.01,0.1], convex σ 2 ∈[0.05,0.2]), generate the deformed point cloud P′.

[0160] Projected Image and Generation: Select any projection plane, where a, b, c, and d are the parameters of the projection plane.

[0161] Π:ax+by+cz+d=0

[0162] Project the point cloud to form an image:

[0163] Orthogonal projection diagram I(u,v):

[0164]

[0165] Depth map I(u,v):

[0166]

[0167] in, Represents the projection operator. This represents the depth mapping function from a point to the projection plane.

[0168] This invention selects the orthogonal projection plane Π: ax + by + cz + d = 0, and uses the projection operator... Map the point cloud P′ to an orthogonal projection image. Simultaneously generate depth map Record the depth information of the point cloud onto the projection plane.

[0169] Post-processing: Finally, the projected image is normalized to a uniform size of 256×256 to match the size of the image generated by DCGAN, and edge enhancement, blur adjustment, contrast enhancement and other processing are performed to improve visual realism. Edge sharpening algorithm and histogram equalization are applied to enhance image contrast and detail features.

[0170] 2. Defect Repair Module Based on Diffusion Model

[0171] To address the issues of false alarms and false negatives in the detection phase, this invention introduces a Diffusion Probabilistic Model (DPM) to progressively reconstruct the defect region during the defect repair stage. The DPM model transforms the acquired defect image and the simulated defect image generated through dual paths into pure noise samples through a forward noise addition process. During backsampling, it learns how to recover the original image structure from the noise, thus possessing powerful data generation and completion capabilities. The DPM model has significant advantages in reconstructing image texture details, generating more natural and detailed repair areas to aid in determining whether a defect is genuine. Its function is to generate a corresponding defect-free reference image after locating the defect region, used to assist in defect confirmation and classification. The main process and implementation formulas are as follows:

[0172] ① Apply a mask to the defective area to create repair conditions. The specific formula is as follows:

[0173]

[0174] x t The image at the current moment, The input image is the union of the acquired defect image and the simulated defect image generated through dual paths. To initialize Gaussian noise, M∈{0,1} H×W This is a binary defect mask (1 represents the defect area, 0 represents the normal area), and ⊙ represents element-wise multiplication.

[0175] The defect region masking process of this invention includes: locating the solder joint defect region and generating a binary defect mask M∈{0,1}. H×W Where H = 256, W = 256. The original image... With Gaussian noise The defect image is obtained by fusing the images according to the mask M. in

[0176] ②: Diffusion model backsampling repair:

[0177] Backsampling process: Using a trained diffusion model, backsampling is performed progressively from the noise. Backsampling is executed at each time step t, starting from t=1000 and iterating progressively towards t=0, gradually recovering the original image. The formula for each time step is:

[0178]

[0179] x t-1 For the image from the previous step, ∈ θ It is a trained neural network. For standard normal noise, β t For time-step noise scheduling parameters, σ t It is the noise amplitude of the reverse sampling, which is dynamically adjusted through learning.

[0180] Noise scheduling parameter settings: This invention adopts a linear noise scheduling strategy, setting β t From 10 -4 The value was increased uniformly to 0.02 over 1000 time steps, and the calculation was performed. To ensure smooth and stable noise injection.

[0181] In the process of progressively backsampling from noise, the formula for the forward process of the diffusion model is:

[0182] x t =sqrt(alpha) b ar t )*x0+sqrt(1-alpha b ar t )*∈

[0183] Where x0 is the original image, alpha b ar t The noise figure represents the forward diffusion. This is to add a noise term.

[0184] The denoising loss function for the reverse denoising process is:

[0185]

[0186] Where ∈ represents actual noise, ∈ θThese are the parameters for model prediction.

[0187] ③ Image restoration, fusion, and smoothing: After reconstructing the defective region, a mask M is used to restore the image after the diffusion model. Compared with the original defect images acquired The image is then fused with the simulated defect image generated through dual paths to obtain the final restored image.

[0188]

[0189] in To repair the resulting image, For the original image, For the final merged image.

[0190] Then, edge convolution or Gaussian filtering (kernel size 3×3, standard deviation σ=1.0) is used to smooth the edges of the mask, achieving a smooth transition and reducing visual abrupt changes.

[0191] ④ Repair Quality Assessment: To avoid visual abrupt changes in the edge areas, Gaussian filtering is introduced during the fusion process for edge smoothing. This strategy employs a gradual transition in the defect edge areas, resulting in a more natural repair outcome.

[0192] To assess the reliability of the repair results, a structural similarity index (SSIM) is introduced to measure image quality. The SSIM confidence score for the defective region is defined as:

[0193]

[0194] Wherein, SSIM is the structural similarity index, Conf SSIM (x) represents the uncertainty score. A lower SSIM indicates a greater difference between the repaired image and the original image, and a higher confidence level; conversely, a higher SSIM suggests the defect may not exist. This scoring mechanism can be used to assist in automatically distinguishing between "false defects" and "real defects," thereby reducing the false positive rate. A threshold τ = 0.5 is set. If Conf... SSIM If (x)>τ, it is determined to be a real defect; otherwise, it is a false defect, which helps to reduce the false judgment rate.

[0195] 3. Model Training and Validation Module

[0196] This system designs a complete joint training framework for DCGAN and the diffusion model. First, DCGAN is pre-trained on a large-scale unlabeled image to expand defective samples. Then, the diffusion model is trained under supervision on defective / normal image pairs to achieve conditional image generation. Finally, the parameters of both are jointly optimized to construct a closed-loop learning mechanism of data augmentation-detection-repair, which improves the overall detection accuracy and robustness.

[0197] DCGAN pre-training: On a large-scale unlabeled DIP board image dataset, the Adam optimizer was used (learning rate lr = 2 × 10⁻⁶). -4 The DCGAN is pre-trained, with the generator and discriminator being optimized alternately. The generator is updated once and the discriminator is updated twice in each iteration. The pre-training period is 100 epochs.

[0198] Supervised training of diffusion model: Image pairs {(x) are formed by combining defective samples generated by DCGAN with normal images. defect ,x normal The input diffusion model is used for conditional generation training. The loss function is... ∈ represents actual noise, ∈ θ Set the batch size for training the model prediction parameters to 64 and the training period to 200 epochs.

[0199] Joint optimization phase: DCGAN is concatenated with the diffusion model to construct a "generation-repair" closed loop. During training, defective samples are first generated by DCGAN, then input into the diffusion model for repair. The DCGAN generator parameters are adjusted based on the SSIM confidence feedback of the repair results, achieving end-to-end joint optimization. The total training period is 50 epochs.

[0200] The beneficial effects of the circuit board defect generation and repair model construction method of the present invention are:

[0201] This invention proposes a defect sample generation method based on DCGAN and 3D point cloud cropping, and integrates a DIP integrated circuit board defect detection and repair system with a diffusion model repair mechanism. Utilizing deep learning algorithms, it addresses the complex defect repair field of DIP circuit boards, achieving efficient generation, semantic-level repair, and efficient repair of defect samples. A large number of diverse defect samples are generated using DCGAN and a 3D point cloud-based planar cropping method. Further, a diffusion model is used for image repair and quality screening to construct a high-quality synthetic dataset, solving the problems of insufficient actual defect samples and uniform defect morphology. Furthermore, a diffusion model-based repair network is integrated, enabling real-time detection and edge repair modeling of DIP circuit board images on actual production lines.

[0202] To achieve the above objectives, this invention also proposes a circuit board defect generation and repair model construction system, such as... Figure 8As shown, the system includes a processor 1001, a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002, and a circuit board defect generation and repair model building program stored on the processor. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard. Optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be a high-speed RAM or a non-volatile memory, such as a disk drive. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0203] Those skilled in the art will understand that Figure 8 The system structure shown does not constitute a limitation on the system and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0204] like Figure 8 As shown, the memory 1005, which serves as a computer storage medium, may include an operating device, a network communication module, a user interface module, and a circuit board defect generation and repair model construction program.

[0205] exist Figure 8 In the system shown, the network interface 1004 is mainly used to connect to the network server and communicate with the network server; the user interface 1003 is mainly used to interact with the user terminal and receive user input instructions; and the processor 1001 can be used to call the circuit board defect generation and repair model construction program stored in the memory 1005.

[0206] The above description is only a preferred embodiment of the present invention and does not limit the patent scope of the present invention. All equivalent structural transformations made under the concept of the present invention using the contents of the present invention specification and drawings, or direct / indirect applications in other related technical fields, are included within the patent protection scope of the present invention.

Claims

1. A method for constructing a circuit board defect generation and repair model, characterized in that, The method includes the following steps: Step S10: Utilize the adversarial learning capability of deep convolutional generative adversarial networks and the 3D point cloud cropping method to generate diverse and structurally realistic weld point defect point cloud samples. Step S20: Introduce a diffusion model to gradually model and reconstruct the defect area, fully restore the geometric details and spatial continuity of the point cloud, and repair the weld defects.

2. The method for constructing a circuit board defect generation and repair model according to claim 1, characterized in that, Step S10 includes: Step S101: Generate realistic defect images from the latent space using a deep convolutional generative adversarial network; Step S102 introduces a three-dimensional point defect modeling and planar cutting method to construct a defect with real geometric features from three-dimensional space; Step S103: Generate a defect image by two-dimensional projection cropping.

3. The method for constructing a circuit board defect generation and repair model according to claim 2, characterized in that, Step S101 includes: Step S1011: After extracting latent features from the normal images acquired in the actual project using an encoder, a noise vector is introduced and fused with the 3D point cloud features. Step S1012: A defect image is synthesized using a generator, and a discriminator is used to distinguish the simulated defect image generated by the adversarial network from the acquired real defect image, thus achieving adversarial training; wherein, the basic adversarial function of the adversarial network is: Where G is the generator, D is the discriminator, and x ~ p d ata(x) represents a sample from the true data distribution, z ~ p z (z) represents the noise distribution, D(x) represents the probability estimate of the discriminator that the real sample is true, and D(G(z)) represents the probability estimate of the discriminator that the generated sample is true. The generator objective formula is: The discriminator target formula is:

4. The method for constructing a circuit board defect generation and repair model according to claim 3, characterized in that, Step S102 includes: Step S1021: Perform 3D modeling and point cloud sampling to construct a high-precision point cloud model; Where P represents the three-dimensional point cloud set of the circuit structure, (x i ,y i ,z i () represents the three-dimensional coordinates of each point, and N is the number of points; Step S1022: Introduce local deformation disturbances in a specific area, and simulate them in the following manner: P′={(x i ,y i ,z i +δ i )}? in, It is a Gaussian perturbation, where μ<0 indicates a depression and μ>0 indicates a convexity; Step S1023: Select any projection plane and project the point cloud to form an image; The projection plane is represented as: Π:ax+by+cz+d=0; Where a, b, c, d are parameters of the projection plane; The orthogonal projection diagram I(u,v) is represented as: The depth map I(u,v) is represented as: in, Represents the projection operator. The depth mapping function from a point to the projection plane; Step S1024: Normalize the projected image to a uniform size of 256×256, consistent with the size of the image generated by the adversarial network, and perform edge enhancement, blur adjustment, and contrast enhancement processing to improve visual realism.

5. The method for constructing a circuit board defect generation and repair model according to claim 4, characterized in that, Step S20 includes: Step S201: Mask the defective area and construct repair conditions. The specific formula is as follows: Where, x t The image at the current moment, For the input image, To initialize Gaussian noise, M∈{0,1} H×W This is a binary defect mask, where ⊙ represents element-wise multiplication; Step S202: Use the trained diffusion model to backsample from the noise step by step. Perform backsampling at each time step t to gradually recover the original image. Where, x t-1 For the image from the previous step, ∈ θ It is a trained neural network. For standard normal noise, β t For time-step noise scheduling parameters, σ t It is the noise amplitude of the backsampled sample; a linear noise scheduling strategy is adopted, and β is set. t From 10 -4 The value was increased uniformly to 0.02 over a total of 1000 time steps to ensure smooth and stable noise injection. In the process of progressively backsampling from noise, the formula for the forward process of the diffusion model is: x t =sqrt(alpha b ar t )*x0+sqrt(1-alpha b ar t )*∈; Where x0 is the original image, alpha b ar t The noise figure represents the forward diffusion. To add a noise term; The denoising loss function for the reverse denoising process is: Where ∈ represents actual noise, ∈ θ For model prediction parameters; Step S203: After completing the defect region reconstruction, a mask is used to fuse the image repaired by the diffusion model with the acquired defect image and the simulated defect image generated by the dual path, to obtain the final restored image. in To repair the resulting image, For the original image, For the final fused image; then, edge convolution or Gaussian filtering is used to further smooth the edges of the mask. Step S204: Gaussian filtering is introduced during the fusion process for edge smoothing. A gradual transition method is used in the defect edge region to make the repair result more natural. The structural similarity index (SSIM) is introduced for image quality measurement, and the SSIM confidence of the defect region is defined as: Wherein, SSIM is the structural similarity index, Conf SSIM (x) represents the uncertainty score. The lower the SSIM, the greater the difference between the restored image and the original image, and the higher the confidence level; conversely, it indicates that the defect may not exist.

6. A circuit board defect generation and repair model construction system, characterized in that, The system includes a memory, a processor, and a circuit board defect generation and repair model building program stored on the processor, wherein the circuit board defect generation and repair model building program is executed by the processor to perform the steps of the method as described in any one of claims 1 to 5.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a circuit board defect generation and repair model building program, which, when run by a processor, performs the steps of the method as described in any one of claims 1 to 5.