A method for generating industrial surface defects based on structure-guided Poisson fusion

By using the structure-guided Poisson fusion method, and leveraging photometric alignment and local structure tensors, defect images that conform to the texture structure of the target surface are generated. This solves the problem of poor defect image quality against strong texture backgrounds and improves the robustness and generalization ability of industrial defect detection models.

CN123118441APending Publication Date: 2026-11-17SHANDONG DIEHUI INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610993715.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-06
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing technologies struggle to simultaneously ensure the realism of the defect core, the naturalness of the boundary, the continuity of the texture structure, and the rationality of the generation location against a strong texture background. This results in poor quality of the generated defect images, affecting the robustness and generalization ability of industrial defect detection models.

Method used

By using the structure-guided Poisson fusion method, normal images, defect images, and defect masks are used as inputs to perform photometric alignment and background reconstruction to extract defect residual information. Combined with local structure tensors and anisotropic structure constraints, a defect image that better matches the surface texture structure of the target is generated.

Benefits of technology

The generated defect images can better preserve the shape, color, and texture details of real defects, reduce source background contamination, and improve the performance of the detection model. They are particularly suitable for defect detection and segmentation against strong texture backgrounds.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123118441A_ABST
    Figure CN123118441A_ABST
Patent Text Reader

Abstract

This invention relates to the field of industrial surface defect processing technology, and discloses a method for generating industrial surface defects based on structure-guided Poisson fusion, comprising the following steps: Step 1, defect extraction and mask preprocessing; Step 2, background proxy reconstruction; Step 3, photometric alignment; Step 4, adaptive fusion gradient field construction; Step 5, masked Poisson reconstruction; Step 6, post-calibration and output. This method for generating industrial surface defects based on structure-guided Poisson fusion can generate new defect images and corresponding masks based on a small number of real defect samples and a large number of normal samples, reducing the cost of real defect acquisition and manual annotation, and providing richer training data for defect detection models. Validation on the MVTec AD dataset shows that training detection models using defect samples generated by this invention can effectively improve model performance in both texture and object surface defect detection tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial surface defect treatment technology, and in particular to a method for generating industrial surface defects based on structure-guided Poisson fusion. Background Technology

[0002] Industrial surface defect detection is a crucial link in quality control of intelligent manufacturing. In recent years, with the rapid development of deep learning technology, automated defect detection methods have gradually replaced traditional manual quality inspection and have been widely used in actual industrial scenarios. However, deep learning models usually rely on a large number of high-quality labeled samples for training, while real industrial defect samples often suffer from problems such as scarcity, uneven distribution of categories, high acquisition costs, and difficulty in pixel-level annotation. When there are insufficient defect samples, typical detection models such as YOLO and Faster R-CNN cannot fully learn the morphological, textural, and distribution features of different defects, and their detection performance and generalization ability are easily limited. Therefore, how to generate high-quality defect images based on normal samples and a small number of existing defect samples to alleviate the problem of insufficient industrial defect samples and improve the robustness and generalization ability of detection models has become an important research direction in the field of industrial visual inspection.

[0003] Existing defect generation methods mainly include traditional image enhancement, copy-paste / alpha fusion, Poisson fusion, and deep generation methods. Methods such as CutPaste have demonstrated that simple cut-and-paste pseudo-anomalies can provide effective training signals for anomaly detection, but these methods are prone to problems such as abrupt boundaries, strong patchiness, and contamination of the source background texture. Methods such as NSA further employ Poisson image editing to improve the naturalness of anomaly fusion, but ordinary Poisson fusion easily causes weak defects to be smoothed and weakened, and it can easily disrupt the original texture continuity on strongly textured industrial surfaces. While deep generation methods can achieve high visual quality, they typically rely on training data and computational resources, and the interpretability, controllability, and consistency of the defect mask in the generation process remain insufficient. Therefore, existing methods still struggle to simultaneously ensure the realism of the defect core, the naturalness of the boundaries, the continuity of the texture structure, and the rationality of the generation location against strongly textured backgrounds. Summary of the Invention

[0004] In view of the aforementioned problems that existing technologies still struggle to simultaneously ensure the realism of the defect core, the naturalness of the boundary, the continuity of the texture structure, and the rationality of the generation location in strong texture backgrounds, this invention is proposed.

[0005] Therefore, the purpose of this invention is to provide a method for generating industrial surface defects based on structure-guided Poisson fusion. The method involves: taking a normal image, a defect image, and a defect mask as input; firstly, extracting defect residual information through photometric alignment and background reconstruction to reduce interference from the source background on the target image; then, estimating the principal direction of the texture using the local structure tensor of the normal image, and introducing anisotropic structural constraints during the gradient fusion stage to allow the defect boundary to transition naturally along the target surface texture; finally, combining defect response and data fidelity constraints, completing defect fusion through masked Poisson reconstruction. This method can controllably transfer existing real defects to normal industrial samples without relying on deep model training, generating defect images that better match the target surface texture structure, thereby providing richer, more realistic, and more engineering-controllable training samples for industrial defect detection and segmentation models.

[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution: a method for generating industrial surface defects based on structure-guided Poisson fusion, comprising the following steps: Step 1: Defect extraction and mask preprocessing: Obtain the defect image and its corresponding defect mask, extract the defect region, and perform smoothing and softening processing on the defect mask to obtain a softened mask; Step 2, Background Proxy Reconstruction: The defect image is subjected to texture completion and low-frequency filtering within the defect mask area to reconstruct a low-frequency background proxy image without defect features. The defect residual information is extracted by calculating the difference between the defect image and the background proxy image, and the defect depth response map is calculated. Step 3, Photometric Alignment: Perform channel-level linear matching on the defect image to reduce the imaging difference between the source image and the target image, and inject the defect residual information into the target normal image to obtain the candidate defect image; Step 4: Adaptive fusion gradient field construction: Construct a local structure tensor based on the target normal image, extract local texture direction and coherence, and construct an anisotropic structure guiding matrix; calculate the gradients of the candidate defect image and the target normal image, construct the source defect gradient weights and target background gradient weights based on the defect depth response, softening mask and local variance of the target image, and generate an anisotropic fusion gradient field. Step 5, Shielded Poisson Reconstruction: Within the defect region, guided by the anisotropic fusion gradient field, and combined with data fidelity constraints, the shielded Poisson equation is solved to reconstruct the fused image; Step 6, Post-calibration and output: Perform pixel range cropping and color correction on the reconstruction results, and output the synthesized defect image and its corresponding defect mask.

[0007] As a preferred embodiment of the structure-guided Poisson fusion-based industrial surface defect generation method of the present invention, wherein: the smoothing and softening process in step one is: performing a Gaussian convolution operation on the binary defect mask to obtain a softening mask. : in, The standard deviation is expressed as Gaussian kernel, Indicates the convolution operation. Softening the mask. This is used to describe the transition strength of the defect region from the core to the boundary. Finally, defect features are extracted based on the processed mask to ensure the stability of the defect feature boundary transition.

[0008] As a preferred embodiment of the structure-guided Poisson fusion-based industrial surface defect generation method of the present invention, the background proxy reconstruction in step two specifically involves: using an image inpainting operator to perform texture completion on the defect image within the region defined by the binary defect mask, and combining this with a large-scale Gaussian smoothing kernel to remove high-frequency texture details, thereby reconstructing a low-frequency background proxy image. ;

[0009] in, This indicates an image inpainting operation. Subsequently, the difference between the defect image and the background proxy image is calculated to extract defect residual information that characterizes only the brightness and color abrupt changes of the defect itself. :

[0010] Defect residual information extracted by this method This is used to characterize the brightness, color, and local texture variations of real defects relative to a normal background. Furthermore, to describe the distribution of defect strength, we calculated a defect depth response map in grayscale space. :

[0011] in, Indicates grayscale conversion. This indicates a normalization operation. As a defect depth adjustment factor, This represents pixel-by-pixel multiplication. This step separates the real defect information from the source image background information, reducing the contamination of the target image by differences in source background texture and lighting.

[0012] As a preferred embodiment of the structure-guided Poisson fusion-based industrial surface defect generation method of the present invention, wherein: the photometric alignment in step three is as follows: for each color channel, the mean and standard deviation of the background region in the neighborhood of the defect image and the region to be fused in the target normal image are statistically analyzed, and channel-level linear matching is performed: in, This is the defect image after photometric matching. , These represent the background regions in the neighborhood of the defect image in the channels. The mean and standard deviation of the above. , This indicates the region to be fused in the normal image within the channel. The mean and standard deviation of the above. To prevent division by zero of constants.

[0013] Furthermore, construct defect-enhanced weights. :

[0014] in, This represents a numerical cropping operation. Then, the defect residual information is injected into the target image to obtain candidate defect images.

[0015] in, This is a candidate defect image obtained after initially injecting the defect residual into the normal image; This represents the defect residual gain. To further ensure consistency between the actual defect appearance and the photometric properties of the target background, the photometrically matched defect image and the residual injection result can also be weighted and fused:

[0016] in, , The source matching graph fusion weights.

[0017] As a preferred embodiment of the industrial surface defect generation method based on structure-guided Poisson fusion described in this invention, the method for constructing the anisotropic structure-guided matrix in step four is as follows: converting the target normal image into a grayscale image, calculating the horizontal and vertical gradients, and constructing a structure tensor at a local scale.

[0018] Calculate local texture coherence based on the structure tensor. :

[0019] And calculate the local principal direction angle. :

[0020] This yields the texture normal direction vector. and texture tangential direction vector :

[0021] in, Indicates the main extension direction of the target surface texture. Indicates a direction orthogonal to the texture direction.

[0022] As a preferred embodiment of the structure-guided Poisson fusion-based industrial surface defect generation method of the present invention, the method for constructing the anisotropic fusion gradient field in step four is as follows: The gradients of the candidate defect image and the target normal image in the color channels are calculated respectively; and the source defect gradient weights are constructed based on the defect depth response, the softening mask, and the local variance of the target image. :

[0023]

[0024] in, The gradient weight coefficients of the source defect are... The target background gradient weight coefficients, Minimize the defect retention weight. This is a local variance map of the target image, used to characterize the intensity of the target background texture.

[0025] As a preferred embodiment of the industrial surface defect generation method based on structure-guided Poisson fusion described in this invention, wherein the shielded Poisson equation in step five is:

[0026] in, Indicates color channel The fusion result to be solved above, Represents the Laplace operator. Denotes the divergence operator, This represents the anisotropic fused gradient field obtained from the aforementioned steps. This indicates the data fidelity weight.

[0027] As a preferred embodiment of the structure-guided Poisson fusion-based industrial surface defect generation method of the present invention, the method does not rely on deep generation model training, takes a normal image, a defect image and a defect mask as input, and outputs a synthesized defect image and its corresponding defect mask.

[0028] As a preferred embodiment of the present invention, an industrial surface defect generation system based on structure-guided Poisson fusion is characterized in that it comprises: The defect extraction and mask preprocessing module is used to extract defect areas and smooth and soften the defect mask. The background proxy reconstruction module is used to reconstruct low-frequency background proxy images without defect features and extract defect residual information; The photometric alignment module is used to perform channel-level linear matching on defect images and generate candidate defect images; An adaptive fusion gradient field construction module is used to construct an anisotropic structure guiding matrix based on the local structure tensor and generate a fusion gradient field. The shielded Poisson reconstruction module is used to reconstruct fused images using the shielded Poisson equation with data fidelity constraints. The post-calibration and output module is used to output the synthesized defect image and its corresponding defect mask.

[0029] As a preferred embodiment of the present invention, a computer-readable storage medium storing a computer program thereon is characterized in that, when the program is executed by a processor, it implements the steps of the industrial surface defect generation method based on structure-guided Poisson fusion.

[0030] Compared with the prior art, the present invention has at least the following beneficial effects: 1. This invention can generate new defect images and corresponding masks based on a small number of real defect samples and a large number of normal samples, reducing the cost of real defect collection and manual annotation, and providing richer training data for defect detection models. Validation on the MVTec AD dataset shows that training detection models with defect samples generated by this invention can effectively improve model performance in both texture and object surface defect detection tasks. At the same time, by using background proxy reconstruction and defect residual extraction, the defect ontology information is separated from the source image background information, reducing source background contamination. This allows the generated defects to better preserve the shape, color, and texture details of real defects, avoiding the problem of source background texture contamination of the target image in the traditional Copy-Paste method.

[0031] 2. This invention utilizes structural tensors to extract the local texture direction of the target image and introduces anisotropic structural constraints, enabling the defect boundary to transition naturally along the texture direction of the target surface, reducing the problems of patchiness, abrupt boundaries, and texture breaks. It is especially suitable for generating defects on textured industrial surfaces such as carpet, wood, and grid.

[0032] 3. This invention introduces data fidelity constraints during the Poisson reconstruction process, applying higher fidelity weights to the core defect region, making the reconstruction result closer to the candidate defect image. This effectively avoids the problem of weak defects being over-smoothed or disappearing due to ordinary Poisson fusion. At the same time, the defect samples generated by this invention have good realism, controllability, and texture consistency, and can expand the diversity of defect types, locations, and background combinations, thereby improving the performance of subsequent industrial defect detection and segmentation models in scenarios with few samples and complex textures. It also has good interpretability, controllability, and ease of engineering deployment. Attached Figure Description

[0033] Figure 1 This is a schematic diagram of the steps in the method for generating industrial surface defects based on structure-guided Poisson fusion according to the present invention. Figure 2 This is a comparative schematic diagram of the bottle according to an embodiment of the present invention; Figure 3 This is a comparative diagram of the cable in an embodiment of the present invention; Figure 4 This is a comparative schematic diagram of the capsule in an embodiment of the present invention; Figure 5 This is a comparative schematic diagram of the carpet according to an embodiment of the present invention; Figure 6 This is a comparative schematic diagram of the grid in an embodiment of the present invention; Figure 7 This is a comparative schematic diagram of hazelnut according to an embodiment of the present invention; Figure 8 This is a comparative schematic diagram of the leather according to an embodiment of the present invention; Figure 9 This is a comparative schematic diagram of the metal_nut in an embodiment of the present invention; Figure 10 This is a comparative schematic diagram of the pill in an embodiment of the present invention; Figure 11 This is a comparative schematic diagram of the screw in an embodiment of the present invention; Figure 12 This is a comparative schematic diagram of tiles according to an embodiment of the present invention; Figure 13 This is a comparative schematic diagram of the toothbrush according to an embodiment of the present invention; Figure 14 This is a comparative schematic diagram of the transistor in an embodiment of the present invention; Figure 15 This is a comparative schematic diagram of wood according to an embodiment of the present invention; Figure 16 This is a comparative schematic diagram of the zipper according to an embodiment of the present invention. Detailed Implementation

[0034] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0035] Reference Figures 1-16 As an embodiment of the present invention, this invention proposes a method for generating industrial surface defects based on anisotropic structure tensor-guided and shielded Poisson reconstruction. This method uses input including normal images... Defect images And the corresponding defect mask in the defect image. After background proxy reconstruction, photometric alignment, adaptive fusion gradient field construction, and data fidelity constraint-based shielded Poisson equation, the synthesized defect image is solved to output the image. and its corresponding defect mask This enables the generation of defect samples.

[0036] (a) Defect extraction and mask preprocessing First, based on the defect image and its defect mask Defect regions are extracted. Simultaneously, to improve the continuity and boundary stability of the fused region, the defect mask is softened to obtain a softened mask. : in, The standard deviation is expressed as Gaussian kernel, Indicates the convolution operation. Softening the mask. This is used to describe the transition strength of the defect region from the core to the boundary. Finally, defect features are extracted based on the processed mask to ensure the stability of the defect feature boundary transition.

[0037] (ii) Background Agent Reconstruction

[0038] To prevent the transfer of non-defective background texture information to normal images during defect feature extraction, this invention proposes a background proxy reconstruction method.

[0039] Specifically, the present invention utilizes image inpainting operators on the binary defect mask. Texture restoration is performed on the defective image within a defined region, combined with a large-scale Gaussian smoothing kernel. High-frequency texture details are removed to reconstruct a low-frequency background proxy image free of defect features. ;

[0040] in, This indicates an image inpainting operation. Subsequently, the difference between the defect image and the background proxy image is calculated to extract defect residual information that characterizes only the brightness and color abrupt changes of the defect itself. :

[0041] Defect residual information extracted by this method This is used to characterize the brightness, color, and local texture variations of real defects relative to a normal background. Furthermore, to describe the distribution of defect strength, we calculated a defect depth response map in grayscale space. :

[0042] in, Indicates grayscale conversion. This indicates a normalization operation. As a defect depth adjustment factor, This represents pixel-by-pixel multiplication. This step separates the real defect information from the source image background information, reducing the contamination of the target image by differences in source background texture and lighting.

[0043] (III) Photometric Alignment To reduce fusion inconsistencies between the source and target images caused by differences in imaging environment, light source intensity, camera parameters, or material color, this invention performs photometric alignment on the source defect information. For color channels... The mean and standard deviation of the defect neighborhood background region and the target region to be fused in the source image are statistically analyzed, and channel-level linear matching is performed on the source image. (3) in, This is the defect image after photometric matching. , These represent the background regions in the neighborhood of the defect image in the channels. The mean and standard deviation of the above. , This indicates the region to be fused in the normal image within the channel. The mean and standard deviation of the above. To prevent division by zero of constants.

[0044] Furthermore, construct defect-enhanced weights. :

[0045] in, This represents a numerical cropping operation. Then, the defect residual information is injected into the target image to obtain candidate defect images.

[0046] in, This is a candidate defect image obtained after initially injecting the defect residual into the normal image; This represents the defect residual gain. To further ensure consistency between the actual defect appearance and the photometric properties of the target background, the photometrically matched defect image and the residual injection result can also be weighted and fused:

[0047] in, , The source matching graph fusion weights.

[0048] (iv) Adaptive fusion gradient field construction To address the problem of distinct texture directions and complex local structures in highly textured industrial surfaces, this invention is based on a normal target image. A local texture structure constraint is constructed, and this constraint is used to guide the adaptive fusion of the source defect gradient and the target background gradient. First, the target image is converted into a grayscale image. And calculate its horizontal and vertical gradients:

[0049] Subsequently at the local scale The following constructs the structure tensor:

[0050] Calculate local texture coherence based on the structure tensor. :

[0051] And calculate the local principal direction angle. :

[0052] This yields the texture normal direction vector. and texture tangential direction vector :

[0053] in, Indicates the main extension direction of the target surface texture. Indicates a direction orthogonal to the texture direction.

[0054] Furthermore, based on local texture coherence Tangential enhancement coefficient and normal suppression coefficient Construct the anisotropic structure guiding matrix:

[0055] in, Used to enhance gradient continuity along the tangential direction of the texture. This matrix is ​​used to suppress excessive diffusion in the texture normal direction. It allows the defect fusion process to transition naturally along the texture direction of the target surface, reducing texture breaks and abrupt boundary issues against a strong texture background.

[0056] Then, the candidate defect images are calculated separately. and target normal image In color channels gradient on:

[0057] Based on the defect depth response, softening mask, and local texture changes in the target image, the source defect gradient weights are constructed. and target background gradient weights :

[0058]

[0059] in, The gradient weight coefficients of the source defect are... The target background gradient weight coefficients, Minimize the defect retention weight. This is a local variance map of the target image, used to characterize the intensity of the target background texture.

[0060] Finally, construct the color channels. Anisotropic fusion gradient field on:

[0061] in, This represents the fused gradient field after structural guidance. Through the above method, the gradient contribution of the source defect is enhanced in the core defect region to preserve the true defect morphology and texture details; the gradient contribution of the target background is enhanced in the defect boundary region, allowing the defect boundary to naturally connect with the target's strong textured surface.

[0062] (v) Masked Poisson Reconstruction with Data Fidelity Constraints Obtaining the fusion gradient field guided by the anisotropic structure Subsequently, the present invention addresses the defect-affected area. Image reconstruction is performed within the process. Traditional Poisson fusion mainly achieves natural boundary transitions through gradient consistency constraints, but in highly textured industrial surfaces, this can easily lead to over-smoothing of weak defect responses. Therefore, this invention introduces a data fidelity term during the Poisson reconstruction process, ensuring that the reconstruction result retains the candidate defect image while satisfying the fusion gradient constraints. The core response to the defects in the process.

[0063] Specifically, for color channels Construct the following shielded Poisson equation:

[0064] in, Indicates color channel The fusion result to be solved above, Represents the Laplace operator. Denotes the divergence operator, This represents the anisotropic fused gradient field obtained from the aforementioned steps. This indicates the data fidelity weight.

[0065] The data fidelity weights are adaptively determined based on the defect mask, defect depth response map, and softening mask:

[0066] in, Based on the basic fidelity coefficient, Indicates the depth of the defect response. This represents the softening mask weight. The weight is larger in the core defect region, making the reconstruction result closer to the candidate defect image, thus avoiding over-smoothing of the defect during the Poisson solution process; it is relatively smaller in the defect boundary region, making the boundary easier to blend naturally with the target background.

[0067] In discrete images, the above equations can be solved using Jacobi iteration, Gauss-Seidel iteration, over-relaxation iteration, or multigrid methods. Taking over-relaxation iteration as an example, its update process is as follows:

[0068] in, Indicates the current pixel position. Represents pixels The set of four neighboring regions, This represents the relaxation factor.

[0069] To ensure the continuity between the fusion region and the target background boundary, the defect region boundary... Using target image pixels as Dirichlet boundary conditions:

[0070] By using the above-mentioned shielded Poisson reconstruction, the generated result can maintain the natural transition between the defect boundary and the target background, and also preserve the brightness, color and texture response of the core defect region, thus avoiding the problem of weak defects being weakened by ordinary Poisson fusion.

[0071] After completing the shielded Poisson reconstruction, the fused results obtained from the solution are analyzed. After pixel-range cropping and necessary color correction, the final synthesized defect image is obtained:

[0072] in, This means limiting pixel values ​​to the effective image grayscale range. Simultaneously, the defect mask, after spatial transformation and boundary softening, is used as the final output mask.

[0073] in, This represents a spatial transformation operation consistent with the source defect image. The final output is a synthesized defect image. and its corresponding defect mask .

[0074] The defect residual extraction method in this invention can be adjusted according to the characteristics of actual industrial images. For example, when the background texture of the source defect image is weak or the defect boundary is clear, mean filtering, Gaussian filtering, median filtering, bilateral filtering, or morphological closing operations can be used to construct a background proxy image. When the background texture is complex or the defect area is large, methods based on image inpainting, texture completion, or local neighborhood matching can be used to estimate the defect-free background. The photometric alignment process can also select different strategies according to the image type, such as mean-variance matching, histogram matching, local brightness normalization, or channel matching after color space conversion, to adapt to the imaging differences caused by different cameras, light sources, and material surfaces.

[0075] Furthermore, the anisotropic structure guidance and shielded Poisson reconstruction in this invention can also be achieved using equivalent methods. Local texture directions, in addition to the structure tensor, can be obtained through Gabor filtering, directional gradient histograms, local spectral analysis, or other texture direction estimation methods; the fused gradient field can be weighted and adjusted based on defect intensity, local variance, boundary distance, or texture coherence. The shielding equation can be solved using Jacobi iteration, Gauss-Seidel iteration, over-relaxation iteration, multi-grid methods, or frequency domain solutions. In scenarios with high real-time requirements, approximate multi-scale Alpha fusion, Laplacian pyramid fusion, or local gradient correction methods can be used instead of the complete Poisson solution to improve generation speed while ensuring the naturalness of the fusion.

[0076] This invention takes a small number of real defect samples, normal target images, and defect masks as input. It extracts defect residual information through background proxy reconstruction and photometric alignment, avoiding contamination of the target image by the source background. Furthermore, it utilizes local texture structure information of the target image to construct anisotropic direction constraints, ensuring a natural transition of defect boundaries with the target surface texture direction during gradient fusion. An adaptive fusion gradient field is constructed by combining defect response, local variance, and a softening mask. Finally, defect region reconstruction is completed through a masked Poisson equation with data fidelity constraints. This improves the naturalness, texture continuity, and usability of generated samples while preserving the core features of real defects. The protection focus of this method should cover defect residual extraction, structural tensor or equivalent texture direction estimation, anisotropic gradient fusion, masked Poisson reconstruction, and the combined defect sample generation process of the above modules.

[0077] This experiment uses the MVTec AD industrial anomaly detection dataset for validation. This dataset is a commonly used public benchmark dataset in the field of industrial surface defect detection, containing 15 categories: `bottle`, `cable`, `capsule`, `carpet`, `grid`, `hazelnut`, `leather`, `metal_nut`, `pill`, `screw`, `tile`, `toothbrush`, `transistor`, `wood`, and `zipper`, covering two typical industrial scenarios: textured surfaces and object-type products. Each category includes defect-free normal samples as well as various real defect samples. Defect types include scratches, damage, contamination, holes, bends, missing parts, color differences, etc., and corresponding pixel-level defect annotation masks are provided (see [reference]). Figure 2-16 ).

[0078] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A method for generating industrial surface defects based on structure-guided Poisson fusion, characterized in that, Includes the following steps: Step 1: Defect extraction and mask preprocessing: Obtain the defect image and its corresponding defect mask, extract the defect region, and perform smoothing and softening processing on the defect mask to obtain a softened mask; Step 2, Background Proxy Reconstruction: The defect image is subjected to texture completion and low-frequency filtering within the defect mask area to reconstruct a low-frequency background proxy image without defect features. The defect residual information is extracted by calculating the difference between the defect image and the background proxy image, and the defect depth response map is calculated. Step 3, Photometric Alignment: Perform channel-level linear matching on the defect image to reduce the imaging difference between the source image and the target image, and inject the defect residual information into the target normal image to obtain the candidate defect image; Step 4: Adaptive fusion gradient field construction: Construct a local structure tensor based on the target normal image, extract local texture direction and coherence, and construct an anisotropic structure guiding matrix; Calculate the gradients of the candidate defect image and the target normal image. Construct source defect gradient weights and target background gradient weights based on the defect depth response, softening mask and local variance of the target image to generate an anisotropic fusion gradient field. Step 5, Shielded Poisson Reconstruction: Within the defect region, guided by the anisotropic fusion gradient field, and combined with data fidelity constraints, the shielded Poisson equation is solved to reconstruct the fused image; Step 6, Post-calibration and output: Perform pixel range cropping and color correction on the reconstruction results, and output the synthesized defect image and its corresponding defect mask.

2. The method for generating industrial surface defects based on structure-guided Poisson fusion according to claim 1, characterized in that: The smoothing and softening process in step one involves performing a Gaussian convolution operation on the binary defect mask to obtain a softened mask. : in, The standard deviation is expressed as Gaussian kernel, Indicates the convolution operation. Softening the mask. This is used to describe the transition strength of the defect region from the core to the boundary. Finally, defect features are extracted based on the processed mask to ensure the stability of the defect feature boundary transition.

3. The method for generating industrial surface defects based on structure-guided Poisson fusion according to claim 1, characterized in that: The background proxy reconstruction in step two specifically involves: using an image inpainting operator to perform texture completion on the defective image within the region defined by the binary defect mask, and combining this with a large-scale Gaussian smoothing kernel to remove high-frequency texture details, thereby reconstructing a low-frequency background proxy image. ; in, This indicates an image inpainting operation. Subsequently, the difference between the defect image and the background proxy image is calculated to extract defect residual information that characterizes only the brightness and color abrupt changes of the defect itself. : Defect residual information extracted by this method This is used to characterize the brightness, color, and local texture variations of real defects relative to a normal background. Furthermore, to describe the distribution of defect strength, we calculated a defect depth response map in grayscale space. : in, Indicates grayscale conversion. This indicates a normalization operation. As a defect depth adjustment factor, This represents pixel-by-pixel multiplication. This step separates the real defect information from the source image background information, reducing the contamination of the target image by differences in source background texture and lighting.

4. The method for generating industrial surface defects based on structure-guided Poisson fusion according to claim 1, characterized in that: The photometric alignment in step three involves: for each color channel, calculating the mean and standard deviation of the background region in the defective image neighborhood and the region to be fused in the normal target image, and then performing channel-level linear matching. in, This is the defect image after photometric matching. , These represent the background regions in the neighborhood of the defect image in the channels. The mean and standard deviation of the above. , This indicates the region to be fused in the normal image within the channel. The mean and standard deviation of the above. To prevent division by zero of constants. Furthermore, construct defect-enhanced weights. : in, This represents a numerical cropping operation. Then, the defect residual information is injected into the target image to obtain candidate defect images. in, This is a candidate defect image obtained after initially injecting the defect residual into the normal image; This represents the defect residual gain. To further ensure consistency between the actual defect appearance and the photometric properties of the target background, the photometrically matched defect image and the residual injection result can also be weighted and fused: in, , The source matching graph fusion weights.

5. The method for generating industrial surface defects based on structure-guided Poisson fusion according to claim 1, characterized in that: The method for constructing the anisotropic structure guidance matrix in step four is as follows: convert the target normal image into a grayscale image, calculate the horizontal and vertical gradients, and construct the structure tensor at a local scale. Calculate local texture coherence based on the structure tensor. : And calculate the local principal direction angle. : This yields the texture normal direction vector. and texture tangential direction vector : in, Indicates the main extension direction of the target surface texture. Indicates a direction orthogonal to the texture direction.

6. The method for generating industrial surface defects based on structure-guided Poisson fusion according to claim 1, characterized in that: The method for constructing the anisotropic fusion gradient field in step four is as follows: calculate the gradients of the candidate defect image and the target normal image in the color channels respectively, and construct the source defect gradient weights based on the defect depth response, the softening mask, and the local variance of the target image. : in, The gradient weight coefficients of the source defect are... The target background gradient weight coefficients, Minimize the defect retention weight. This is a local variance map of the target image, used to characterize the intensity of the target background texture.

7. The method for generating industrial surface defects based on structure-guided Poisson fusion according to claim 1, characterized in that: The shielded Poisson equation mentioned in step five is: in, Indicates color channel The fusion result to be solved above, Represents the Laplace operator. Denotes the divergence operator, This represents the anisotropic fused gradient field obtained from the aforementioned steps. This indicates the data fidelity weight.

8. The method for generating industrial surface defects based on structure-guided Poisson fusion according to claim 1, characterized in that: The method does not rely on deep generative model training. It takes normal images, defective images and defect masks as inputs and outputs synthetic defective images and their corresponding defect masks.

9. An industrial surface defect generation system based on structure-guided Poisson fusion, characterized in that, include: The defect extraction and mask preprocessing module is used to extract defect areas and smooth and soften the defect mask. The background proxy reconstruction module is used to reconstruct low-frequency background proxy images without defect features and extract defect residual information; The photometric alignment module is used to perform channel-level linear matching on defect images and generate candidate defect images; An adaptive fusion gradient field construction module is used to construct an anisotropic structure guiding matrix based on the local structure tensor and generate a fusion gradient field. The shielded Poisson reconstruction module is used to reconstruct fused images using the shielded Poisson equation with data fidelity constraints. The post-calibration and output module is used to output the synthesized defect image and its corresponding defect mask.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the steps of the method according to any one of claims 1-8.