An industrial defect image generation method based on multi-candidate parameter adaptive generation and multi-dimensional evaluation
Patent Information
- Application Number
- CN202610985827.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-03
- Publication Date
- 2026-10-20
AI Technical Summary
[0007]本发明针对工业缺陷图像合成中的关键技术难题,提出了一种基于多候选参数自适应生成与多维评估的工业缺陷图像生成方法,旨在解决现有技术中参数配置依赖人工、单次生成质量不稳定以及缺乏多维度量化评估体系的核心问题
(1)降低人工调参成本:本发明利用多模态视觉语言模型构建视觉智能体,将正常图像、参考缺陷图像及各自掩码组合为视觉面板输入模型,由模型直接输出多组扩散合成参数,实现了参数的自适应规划与自动生成,无需领域专家反复手动调节参数,显著降低了人工调参的工作量与门槛。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer vision and deep learning technology, and in particular to a method for generating industrial defect images based on adaptive generation of multiple candidate parameters and multidimensional evaluation. Background Technology
[0002] Industrial defect detection is a crucial aspect of quality control in manufacturing. In recent years, deep learning-based defect detection methods have made significant progress. However, these methods typically require a large number of labeled defect images for training, while in real-world industrial scenarios, defect samples are often scarce and costly to obtain, limiting the performance of deep learning models in low-sample environments.
[0003] Traditional methods such as Pix2Pix have some applications in defect image synthesis, but they rely on pairwise training data, resulting in unstable training processes and difficulty in generating highly realistic defect images. Latent Diffusion Models (LDM), based on diffusion models, improves image generation quality, but still suffers from the following problems in defect image synthesis: (1) Parameter configuration depends on human experience: The defect injection parameters of the diffusion model (such as mask radius, attention replacement step size, layer interval, etc.) need to be manually adjusted by domain experts, which is inefficient and difficult to find the optimal configuration.
[0004] (2) Unstable quality of single generation: Single generation often fails to guarantee the quality and diversity of defective images, and the stability of the generation results is insufficient.
[0005] (3) Lack of multi-dimensional comprehensive quality assessment: Existing methods lack a complete multi-dimensional quantitative assessment system and usually rely on manual qualitative judgment or single indicator assessment.
[0006] Therefore, there is an urgent need for a technical solution that can automatically generate high-quality defect images in scenarios with few samples, and has adaptive parameter planning and multi-dimensional evaluation capabilities. Summary of the Invention
[0007] This invention addresses key technical challenges in industrial defect image synthesis by proposing a method for generating industrial defect images based on adaptive generation of multiple candidate parameters and multidimensional evaluation. The aim is to solve the core problems in existing technologies, such as reliance on manual parameter configuration, unstable quality of single generation, and lack of a multidimensional quantitative evaluation system.
[0008] To achieve the above objectives, this invention provides a method for generating industrial defect images based on adaptive generation of multiple candidate parameters and multidimensional evaluation, comprising: The normal image to be processed, the reference defect image, and the corresponding normal image mask and reference defect image mask are combined into a multi-source visual input, which is then input into a multimodal visual language model to generate several sets of diffusion model synthesis parameters. Each set of diffusion model synthesis parameters is used, and the diffusion model is guided by the mask to inject the defect features in the reference defect image into the normal image to obtain several candidate defect images; For each candidate defect image, scores are calculated from five dimensions: defect existence, positioning accuracy, authenticity, background preservation, and distribution rationality. These scores are then weighted and fused according to preset weights to obtain a comprehensive physical score for each candidate defect image. Candidate defect images with a comprehensive physical score lower than a first preset threshold are removed. The candidate defect images with the highest comprehensive physical score are selected from the remaining candidate defect images and input into the same multimodal visual language model for quality inspection and verification. The candidate defect images that pass the verification are used as the final output defect images.
[0009] Preferably, the multi-source visual input is a four-grid visual panel; the first grid of the four-grid visual panel is the normal image, the second grid is the superimposed image of the normal image and the normal image mask, the third grid is the reference defect image, and the fourth grid is the superimposed image of the reference defect image and the reference defect image mask; the mask of the normal image and the mask of the reference defect image are encoded with different colors when superimposed.
[0010] Preferably, when the number of groups of diffusion model synthesis parameters generated by the multimodal visual language model is less than a preset number, the morphological features of the normal image mask and the texture features of the reference defect image within the mask area are extracted, the basic synthesis parameters are dynamically calculated based on the extracted features, a preset strategy variant is applied to the basic synthesis parameters, and the required number of completion candidate parameters are amplified and generated.
[0011] Preferably, the morphological features include the area ratio, aspect ratio, and boundary roughness of the normal image mask; the texture features are the gray-level variance of the reference defect image within the mask area. The dynamic calculation basic synthesis parameters include: determining the mask radius based on the area ratio and aspect ratio, determining the mask iteration number based on the boundary roughness, and determining the cross-attention replacement step size interval and guidance intensity based on the texture features; The self-attention replacement step size interval is adaptively determined based on the boundary roughness, and the rotation transformation angle is conditionally activated based on the aspect ratio.
[0012] Preferably, the defect features in the reference defect image are injected into the normal image using the mask-guided diffusion model, including: Perform DDIM inversion on the normal image and the reference defect image respectively to obtain their respective inversion latent variable trajectories; Morphological dilation is performed on the mask of the normal image to obtain an expanded mask; During the denoising process, the extended mask is used to locally mix the latent variables of the current denoising step with the inverted latent variables of the normal image; In the cross-attention layer and self-attention layer of the diffusion model, cross-attention replacement and self-attention replacement are performed respectively within the time step interval and network layer interval specified by the diffusion model synthesis parameters, so as to transfer the semantics and structure of the reference defect to the target region.
[0013] Preferably, the defect presence score is obtained by calculating the intensity of pixel changes between the generated image and the normal image within the mask area, and by weighted fusion of the anomaly score output by the generated image in conjunction with an independent industrial anomaly detection model. The positioning accuracy score is obtained by calculating the difference heatmap between the generated image and the normal image, and then performing an intersection-union (IUU) calculation on the difference heatmap and the target mask. The authenticity score is obtained by fusing the gradient sharpness of the generated image, the perceptual similarity to normal images, and the CLIP semantic consistency with the preset defective text description. Background preservation score is obtained by calculating the pixel difference between the generated image and the normal image in the background region outside the mask region; The distribution rationality score is obtained by matching the feature embeddings of the masked region in the generated image with the features in a pre-built real defect feature library using maximum cosine similarity.
[0014] Preferably, the first preset threshold is the lower limit of the comprehensive physical score, and the quality inspection verification is a qualitative judgment made by the multimodal visual language model based on cross-modal understanding on whether the candidate defect image presents a real and valid defect. Only when the comprehensive physical score of the candidate defect image is not lower than the lower limit and the quality inspection verification result is passed, the corresponding candidate defect image is finally output.
[0015] Preferably, the multimodal visual language model is Qwen2.5-VL-3B-Instruct, and the diffusion model is Stable-Diffusion-v1-5.
[0016] The present invention also provides an industrial defect image generation system based on adaptive generation and multidimensional evaluation of multiple candidate parameters, for executing the industrial defect image generation method based on adaptive generation and multidimensional evaluation of multiple candidate parameters.
[0017] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the aforementioned method for generating industrial defect images based on adaptive generation and multidimensional evaluation of multiple candidate parameters.
[0018] Compared with the prior art, the present invention has the following advantages and technical effects: (1) Reduce the cost of manual parameter tuning: This invention uses a multimodal visual language model to construct a visual intelligent agent, which combines normal images, reference defect images and their respective masks into a visual panel input model. The model directly outputs multiple sets of diffusion synthesis parameters, realizing adaptive planning and automatic generation of parameters. This eliminates the need for domain experts to repeatedly adjust parameters manually, significantly reducing the workload and threshold of manual parameter tuning.
[0019] (2) Improve the efficiency of defect data construction: The present invention adopts a parallel generation mode with multiple candidate parameters to generate multiple candidate defect images at one time, and automatically selects the optimal sample through multi-dimensional evaluation and dual gating mechanism. Compared with the traditional single generation and manual screening method, the efficiency of defect dataset construction is greatly improved.
[0020] (3) Improve the stability of the generated quality: This invention introduces a five-dimensional physical evaluation (defect existence, positioning accuracy, authenticity, background protection degree, distribution rationality) to quantify and score each candidate, and combines it with a visual language model to conduct a second quality inspection and verification, forming a dual-gated closed-loop optimization mechanism, which effectively ensures the stability and reliability of the output defect image and avoids the problem of unstable quality in a single generation.
[0021] (4) Enhanced adaptability to low-sample scenarios: The present invention designs a morphological feature completion mechanism. When the visual language model output is insufficient, it automatically extracts the area, compactness, aspect ratio, boundary roughness and texture variance of the target mask and the reference defect image, dynamically calculates the basic parameters and amplifies and completes the candidates through multi-strategy variants, ensuring that a sufficient number of candidate parameters can still be generated in the case of low sample or unstable visual language model output, thereby enhancing the system's adaptability in industrial low-sample scenarios.
[0022] (5) Maintaining background consistency: The present invention specifically sets a background protection score in the multidimensional evaluation to quantitatively evaluate whether the non-defect area is destroyed during the diffusion synthesis process, and selects the candidate with the best background preservation through weighted fusion to ensure that the background of the generated defect image is highly consistent with the original normal image, which meets the strict requirements for background fidelity in industrial defect detection. Attached Figure Description
[0023] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a model architecture diagram of an embodiment of the present invention; Figure 2 This is a flowchart of the multi-candidate parameter generation and parameter completion process according to an embodiment of the present invention; Figure 3 This is a structural diagram of the multidimensional evaluation module according to an embodiment of the present invention; Figure 4 This is a flowchart of an industrial defect image generation method based on adaptive generation and multidimensional evaluation of multiple candidate parameters, according to an embodiment of the present invention. Detailed Implementation
[0024] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0025] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0026] This embodiment proposes an industrial defect image generation method based on multi-candidate parameter adaptive generation and multi-dimensional evaluation, such as... Figure 4 ,include: The normal image to be processed, the reference defect image, and the corresponding normal image mask and reference defect image mask are combined into a multi-source visual input, which is then input into a multimodal visual language model to generate several sets of diffusion model synthesis parameters. Each set of diffusion model synthesis parameters is used, and the diffusion model is guided by the mask to inject the defect features in the reference defect image into the normal image to obtain several candidate defect images; For each candidate defect image, scores are calculated from five dimensions: defect existence, positioning accuracy, authenticity, background preservation, and distribution rationality. These scores are then weighted and fused according to preset weights to obtain a comprehensive physical score for each candidate defect image. Candidate defect images with a comprehensive physical score lower than a first preset threshold are removed. The candidate defect images with the highest comprehensive physical score are selected from the remaining candidate defect images and input into the same multimodal visual language model for quality inspection and verification. The candidate defect images that pass the verification are used as the final output defect images.
[0027] Specifically, including: S1. Data Preparation and Parameter Generation: Input a normal image, a reference defect image, and the corresponding normal image mask and reference defect image mask; use the Qwen2.5-VL-3B-Instruct multimodal visual language model to parse the image, and generate N sets of candidate parameters based on the analysis results. Each set of candidate parameters includes mask radius, mask iteration count, cross-attention replacement step size interval, self-attention replacement step size interval, starting layer, ending layer, rotation transformation angle, guidance strength, and inference steps; S2. Morphological feature completion: When the number of N candidate parameters is less than the preset number, the area, compactness, aspect ratio and texture variance features of the target mask are automatically extracted, and the candidate parameters are completed based on the morphological features. S3, Multi-candidate diffusion synthesis: Each set of candidate parameters independently drives the image synthesis process based on the diffusion model Stable-Diffusion-v1-5, generating N candidate defect images; S4. Multidimensional evaluation and model quality inspection: Calculate multidimensional scores for each candidate defect image, and obtain a comprehensive score by weighted fusion based on preset weights; remove candidate images with comprehensive scores below a preset threshold, input the highest-scoring candidate among the remaining candidates into the visual language model for quality inspection and verification, and finally output the candidate defect images that pass the quality inspection and store them in the sample library.
[0028] Furthermore, the multi-source visual input is a four-grid visual panel; the first grid of the four-grid visual panel is the normal image, the second grid is the superimposed image of the normal image and the normal image mask, the third grid is the reference defect image, and the fourth grid is the superimposed image of the reference defect image and the reference defect image mask; the mask of the normal image and the mask of the reference defect image are encoded with different colors when superimposed.
[0029] Specifically, S1, data preparation and parameter generation includes: S1.1 Source Data Processing: Obtain the source normal image (Original image of the industrial product to be injected with defects), reference defect image (Includes example images of the target defect type), normal image mask (Target area to be injected with defects) and reference defect map mask (Identify the defect area in the reference defect image).
[0030] All images are scaled uniformly to [size value]. Resolution, pixel values normalized to Interval: ; In the formula, The image after normalization. The image before normalization.
[0031] The mask is uniformly converted to a binary floating-point tensor. ,in, Indicates the defect area. This indicates the background area. The reference defect image is of the same type as the target defect.
[0032] S1.2, Construction of a four-grid visual panel: Original normal image Source normal image and mask overlay, reference defect image The defect image and mask overlay are combined in the order of top left, top right, bottom left, and bottom right to form a four-grid visual panel. .
[0033] The mask overlay uses color coding: In this embodiment, the normal image mask is in green (… ) superimposed, with the defect map mask highlighted in red ( Overlay, transparency The superposition formula is: ; In the formula, For the mask color vector, For indicator functions, This is a mask overlay image. M is a base image overlaid with a mask, where M is a general binary mask.
[0034] S1.3, Visual Language Model Parameter Inference: Input the four-grid visual panel into the Qwen2.5-VL-3B-Instruct multimodal visual language model. The model is guided to generate data through structured prompts. Group candidate parameter configuration ( The default value is 5). The prompt explicitly requires the model to output a pure JSON array format: ; In the formula, For the set of candidate parameters; Among them, each set of parameters This is a nine-dimensional vector, and its components are defined as follows: Mask expansion radius. Mask inflation iteration count Cross-attention replacement normalized time step interval Self-attention replacement normalized time step interval UNet Attention Control Start Layer UNet Attention Control End Layer Mask rotation angle transformation Classifier-independent strength and the total number of DDIM inference steps Among them, those that satisfy the constraints , , .
[0035] S1.4, Parameter deduplication and normalization: The candidate parameters output by the visual language model are parsed with JSON for fault tolerance. Each group of parameters is clipped according to a safe interval, and duplicate parameters are removed and unique values are retained.
[0036] Each parameter component is normalized using the following mapping: Continuous value parameter ( , , ): ; Step interval parameters: , ; Rotation angle After quantization and rounding: If Then place ,otherwise Limited to ;in, This is the quantized rotation angle.
[0037] Ultimately, no more than A set of valid candidate parameters are provided for subsequent diffusion synthesis.
[0038] Furthermore, when the number of groups of diffusion model synthesis parameters generated by the multimodal visual language model is less than the preset number, the morphological features of the normal image mask and the texture features of the reference defective image in the mask area are extracted. Based on the extracted features, the basic synthesis parameters are dynamically calculated, and a preset strategy variant is applied to the basic synthesis parameters to amplify and generate the required number of completion candidate parameters.
[0039] The morphological features include the area ratio, aspect ratio, and boundary roughness of the normal image mask; the texture features are the gray-level variance of the reference defect image within the mask area. The dynamic calculation basic synthesis parameters include: determining the mask radius based on the area ratio and aspect ratio, determining the mask iteration number based on the boundary roughness, and determining the cross-attention replacement step size interval and guidance intensity based on the texture features; The self-attention replacement step size interval is adaptively determined based on the boundary roughness, and the rotation transformation angle is conditionally activated based on the aspect ratio.
[0040] Specifically, S2, morphological feature completion includes: If the number of valid candidates is insufficient This triggers the step morphological feature completion mechanism, specifically including: S2.1 Extraction of target mask area ratio: Mask the target Binarize the data and calculate its area percentage: ; In the formula, , These are the height and width of the mask, respectively; The area percentage of the target area to be masked; S2.2 Calculation of contour morphological features: Binarization mask Extracting the contour of the largest connected component Based on the contour, the following morphological features are calculated: Compactness: Measures the roundness of a defective area, defined as... ; In the formula, The area enclosed by the outline (pixel count). For the perimeter of the outline, To prevent small constants from being divided by zero, .
[0041] Aspect ratio (Elongation): Measures the flatness of the bounding rectangle of the defect area, defined as: ; In the formula, , These are the width and height of the smallest bounding rectangle of the outline, respectively. (Truncation of the upper limit).
[0042] Boundary roughness: measures the degree of irregularity at the boundary of a defect region, defined as: ; In the formula, For outline The area of the convex hull; A larger value indicates a more irregular defect boundary.
[0043] S2.3, Extraction of texture variance from reference defect image: Reference defect image Convert to grayscale image using standard weighting factors : ; In the formula, For reference defect image At pixel position The corresponding gray value at that location For reference defect image At pixel position The red channel pixel value at that location, For reference defect image At pixel position The green channel pixel value at that location, For reference defect image At pixel position The blue channel pixel value at that location; Reference mask Calculate texture variance within non-zero regions : ; In the formula, For the reference mask valid area, The total number of pixels in the effective area of the reference mask. The grayscale average of the effective area of the reference mask: ; when At that time, take .
[0044] Further normalization to texture score : ; S2.4 Dynamic calculation of basic parameters driven by morphology: Based on the four extracted morphological features—area proportion Aspect Ratio (abbreviated as) Boundary roughness (abbreviated as) Texture score Dynamically calculate the basic values of each diffusion parameter: Basic mask radius : ; Number of basic mask iterations : ; Basic attentional replacement step size interval: ; ; in, The initial normalized time step for the basic attention replacement, The end normalized time step of the attention replacement is based on this.
[0045] Basic guiding strength : ; Basic reasoning steps : ; Basic starting layer : .
[0046] S2.5, Multi-strategy variant amplification to generate completion candidates: Using the basic parameters of the calculation as the reference point, the application Group preset strategy variant vector: ; Parameter amplification is performed, with each strategy applying either a multiplicative or additive offset to the base parameters. , ): ; ; ; ; ; ; ; The value ranges of each offset variable are as follows: : Mask radius multiplication factor, with a value range of approximately ; : Mask iteration count, addition offset (integer), value range ; , The multiplicative factors of the attention replacement step size are approximately... ; : Guided intensity additive offset, with a value range of approximately ; Inference step addition offset (integer), value range ; : Initial layer addition offset (integer), value range ; For the first Mask expansion radius in the group of candidate parameters; For the first The number of mask inflation iterations in the group of candidate parameters; For the first Cross-attention replacement of the initial normalized time step in the group candidate parameters For the first The cross-attention replacement in the group candidate parameters ends at the normalized time step. For the first The classifier-guided strength in the group candidate parameters For the first Number of diffusion inference steps in the candidate parameters group For the first Attention control in the initial layer of the group of candidate parameters.
[0047] Based on this, the self-attention replacement step size interval is determined according to the boundary roughness. Adaptive determination: .
[0048] Rotation change angle Based on aspect ratio Conditional activation: ; In the formula, This means clipping the value to a range. Inside.
[0049] Finally, range pruning is applied to each set of amplification parameters to ensure that the parameters are within a preset safety range, generating... The candidate parameter configuration driven by group morphological features is merged with the candidate parameters output by the visual language model to the target number.
[0050] Furthermore, using the mask-guided diffusion model, defect features from the reference defect image are injected into the normal image, including: Perform DDIM inversion on the normal image and the reference defect image respectively to obtain their respective inversion latent variable trajectories; Morphological dilation is performed on the mask of the normal image to obtain an expanded mask; During the denoising process, the extended mask is used to locally mix the latent variables of the current denoising step with the inverted latent variables of the normal image; In the cross-attention layer and self-attention layer of the diffusion model, cross-attention replacement and self-attention replacement are performed respectively within the time step interval and network layer interval specified by the diffusion model synthesis parameters, so as to transfer the semantics and structure of the reference defect to the target region.
[0051] Specifically, S3, multi-candidate diffusion synthesis includes: S3.1, DDIM Inversion: Original normal image and reference defect image via VAE encoder Mapping to the hidden space ( ), execute respectively Step-deterministic DDIM inversion, preserving the list of intermediate latent variables. and The inversion recursive formula is: ; In the formula, For time step The hidden variable for the next time step obtained by recursion, For the diffusion scheduler at time step The corresponding cumulative noise retention factor, For the diffusion scheduler at time step The corresponding cumulative noise retention factor, For noise prediction networks in unconditional text input Below, for latent variables At time step Predictive noise, For time step The corresponding latent variables in the image, This refers to the discrete time step numbering in the diffusion or inversion process. An empty text condition or no condition prompt.
[0052] S3.2 Mask preprocessing and local blending: Perform max-pooling-based morphological dilation on the target mask Furthermore, in each denoising step, the Local Blend mechanism is used to blend the target region with the latent variables of the source image: ; In the formula, The time step after blending in the Local Blend region Latent variables, To inject a region mask into the target The extended mask obtained after morphological dilation For the source normal image at time step The corresponding hidden variables, Generate a branch for the previous time step The corresponding implicit variables.
[0053] S3.3, MCA Attention Control Injection: Execute the following commands in the specified time step interval and UNet layer interval using the McaControlReplace editor: (a) Cross-attention replacement: Apply masked region weighted gain to the defect type token to inject the defect semantics of the reference image into the target image; (b) Self-attention replacement: Foreground / background regions are separated based on a mask, using a temperature coefficient. Sharpening foreground attention enables the transfer of defective structures from the reference image to the target image.
[0054] The denoising process is guided by a classifier-free approach. ; In the formula, The noise prediction results are after classifier-guided fusion. For noise prediction networks in unconditional text input The noise prediction results of the output are as follows. For noise prediction networks, conditional text input The noise prediction results of the output are as follows. This represents the intensity without a classifier.
[0055] S3.4 Decoding and fallback: Completed After noise reduction, it passes through the VAE decoder. Output: ; In the formula, To generate an image of the defects obtained after diffusion synthesis. The current generated latent variables obtained at time step 0 after all denoising steps have been completed. This is the scaling factor for the hidden variables in the VAE.
[0056] If an OOM (Out of Memory) error is encountered, the system will automatically reduce the load and retry. If the error still fails, the original image will be returned as a fallback.
[0057] Furthermore, the defect presence score is obtained by calculating the intensity of pixel changes between the generated image and the normal image within the masked area, and by combining the anomaly score of the generated image output with an independent industrial anomaly detection model for weighted fusion. The positioning accuracy score is obtained by calculating the difference heatmap between the generated image and the normal image, and then performing an intersection-union (IUU) calculation on the difference heatmap and the target mask. The authenticity score is obtained by fusing the gradient sharpness of the generated image, the perceptual similarity to normal images, and the CLIP semantic consistency with the preset defective text description. Background preservation score is obtained by calculating the pixel difference between the generated image and the normal image in the background region outside the mask region; The distribution rationality score is obtained by matching the feature embeddings of the masked region in the generated image with the features in a pre-built real defect feature library using maximum cosine similarity.
[0058] Specifically, S4, multidimensional evaluation and model quality control, includes: (1) Defect Existence Score : Verify whether the defect has been successfully injected and is visible.
[0059] The absolute change intensity of the local masked region is combined with the anomaly score output by the industrial anomaly detection model for weighted fusion. ; in: Local change intensity Defined as generating an image Compared with the source normal image In the target mask area Average absolute difference per pixel within: ; In the formula, The anomaly score of the generated image output by the industrial anomaly detection model (preferably PatchCore or PaDiM) is mapped to a sigmoid function. : ; In the formula, This is the original output distance value of the model. Offset threshold (take) ), This is the sigmoid function.
[0060] If the anomaly detection model is not ready, it degenerates into... Weighting coefficients , .
[0061] (2) Positioning accuracy score : Verify whether the defect is accurately generated within the specified target mask area.
[0062] Heatmap based on the difference between the generated image and the source image Calculate its relationship with the target mask. Intersection over Union (IoU): ; Among them, the differential heat map The image is obtained by Gaussian smoothing the average absolute difference between the generated image and the source image across all channels. ; , For the difference diagram The difference response map was obtained after smoothing with a 15×15 Gaussian kernel. This represents the maximum response value in the smoothed difference response plot; , For binarization threshold, This is the set of pixels representing the predicted defect area obtained from the differential heatmap; For the target mask area; The number of image channels. To prevent small constants from being divided by zero.
[0063] (3) Authenticity score : To evaluate the texture clarity and visual realism of defective areas, the following three sub-indicators are used: a) Gradient sharpness score Based on the generated image , The gradient variance of the direction measures the sharpness of the defect edge. ; In the formula, Generate an image of the defect obtained after diffusion synthesis; b) Perceptual similarity penalty Learned Perceptual ImagePatch Similarity (LPIPS) based on a pre-trained VGG network measures the perceptual distance between the generated and source images in the feature space. ; If the LPIPS model is not loaded, then .
[0064] c) Text-image semantic consistency score Image and defect text descriptions are generated based on the CLIP model. Cosine similarity (e.g., "a photo of a {anomaly_type} on a {object}"): ; in, , ; In the formula, The semantic feature vector of the generated image is extracted by the CLIP image encoder. This is the semantic feature vector of the defective text extracted by the CLIP text encoder. For CLIP image encoder, This is the CLIP text encoder.
[0065] Final authenticity score The fusion formula is: ; ; in, A subjective authenticity score for the visual language model (optional input). .
[0066] (4) Background protection score : Ensure that the non-defect areas (background areas) are not destroyed by the diffusion synthesis process.
[0067] Calculate the background mask The mean absolute error within the range and its inversion: ; The background mask is the reverse region of the defect mask: ; when When (i.e., the entire image is a defect area), .
[0068] (5) Distribution rationality score : To ensure that the generated defect morphology matches the feature distribution of real industrial defect datasets in the feature space, a pre-trained ResNet-18 is used as a feature extractor to extract embedding vectors from the masked region, which are then matched with the real defect feature library using cosine similarity. ; in: To generate the L2-normalized embedding vector extracted from the defect region after masking; To pre-extract and normalize from real defect image datasets One reference feature vector; To be Extend to A mask tensor with the same number of channels; if the feature extractor or defect feature library is not ready, the default value is returned. .
[0069] (6) Score Fusion: The scores from the five dimensions are weighted and combined according to preset weights to obtain the final comprehensive score. : ; The default value for the weighting coefficient is... (Existence) (position), (Authenticity) (Background protection) (Rationality of distribution), and satisfies All submodule scores are normalized to interval, .
[0070] Comprehensive score The highest-ranking candidate defect image is input into the Qwen2.5-VL-3B-Instruct multimodal visual language model, which is guided by structured prompts to perform industrial quality inspection judgments. The model outputs the quality inspection results in JSON format.
[0071] Furthermore, the first preset threshold is the lower limit of the comprehensive physical score, and the quality inspection verification is a qualitative judgment made by the multimodal visual language model based on cross-modal understanding as to whether the candidate defect image presents a real and valid defect; only when the comprehensive physical score of the candidate defect image is not lower than the lower limit and the quality inspection verification result is passed, the corresponding candidate defect image is finally output.
[0072] Specifically, under the dual-gating mechanism: if (threshold) If the physical score and visual language model both pass the quality check, the candidate image will be deemed unqualified and discarded. Only when both the physical score and visual language model certifications are passed can the candidate defective image be added to the database.
[0073] This embodiment also provides an industrial defect image generation system based on adaptive generation and multidimensional evaluation of multiple candidate parameters, used to execute the aforementioned industrial defect image generation method based on adaptive generation and multidimensional evaluation of multiple candidate parameters.
[0074] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a method for generating industrial defect images based on adaptive generation of multiple candidate parameters and multidimensional evaluation.
[0075] To more clearly illustrate the technical solution of the present invention, specific embodiments are provided below for description: like Figure 4The process, based on multi-candidate parameter adaptive generation and multi-dimensional evaluation, for generating industrial defect images includes the following steps: S1. Data Preparation and Parameter Generation: Input a normal image, a reference defect image, and the corresponding normal image mask and reference defect image mask; use the Qwen2.5-VL-3B-Instruct multimodal visual language model to parse the image, and generate N sets of candidate parameters based on the analysis results. Each set of candidate parameters includes mask radius, mask iteration count, cross-attention replacement step size interval, self-attention replacement step size interval, starting layer, ending layer, rotation transformation angle, guidance strength, and inference steps; S2. Morphological feature completion: When the number of N sets of candidate parameters is less than the preset number, the area, compactness, aspect ratio and texture variance features of the target mask are automatically extracted, and the candidate parameters are completed based on the morphological features. S3, Multi-candidate diffusion synthesis: Each set of candidate parameters independently drives the image synthesis process based on the diffusion model Stable-Diffusion-v1-5, generating N candidate defect images; S4. Multidimensional evaluation and model quality inspection: Calculate multidimensional scores for each candidate defect image, and obtain a comprehensive score by weighted fusion based on preset weights; remove candidates whose comprehensive scores are lower than preset thresholds, input the highest-scoring candidate among the remaining candidates into the visual language model for quality inspection and verification, and finally output the candidate defect images that pass the quality inspection and store them in the sample library.
[0076] The specific technical approach is as follows: S1. Data Preparation and Parameter Generation: S1.1 Source Data Processing: To ensure that the input is as follows... Figure 1 The image data of the model shown has a uniform scale. This embodiment obtains the source normal image. (Original image of the industrial product to be injected with defects), reference defect image (Includes example images of the target defect type), normal image mask (Target area to be injected with defects) and reference defect map mask After identifying the defect area in the reference defect image, all images are uniformly scaled to [the specified size]. Resolution, pixel values normalized to Interval: .
[0077] The mask is uniformly converted to a binary floating-point tensor: ,in Indicates the defect area. This indicates the background area. The reference defect image is of the same type as the target defect.
[0078] S1.2, Construction of a four-grid visual panel: From the source normal image Source normal image and mask overlay, reference defect image The reference defect image and the mask overlay image are combined in the order of top left, top right, bottom left, and bottom right to form a four-grid visual panel. .
[0079] Mask overlay uses color coding: the normal image mask is in green ( ) superimposed, with the defect map mask highlighted in red ( Overlay, transparency The superposition formula is: ; in, For the mask color vector, This is an indicator function.
[0080] S1.3 Visual Language Model Parameter Inference: The four-grid visual panel... Input Qwen2.5-VL-3B-Instruct Multimodal Visual Language Model The model is guided to generate data through structured prompts. Group candidate parameter configuration ( The default value is 5).
[0081] The prompt explicitly requires the model to output a pure JSON array format: ; In the formula, For the set of candidate parameters; Among them, each set of parameters This is a nine-dimensional vector, and its components are defined as follows: Mask expansion radius. Mask inflation iteration count Cross-attention replacement normalized time step interval Self-attention replacement normalized time step interval UNet Attention Control Start Layer UNet Attention Control End Layer Mask rotation angle transformation Classifier-independent strength and the total number of DDIM inference steps Among them, those that satisfy the constraints , , .
[0082] S1.4 Parameter Deduplication and Normalization: The candidate parameters output by the visual language model are parsed using JSON parsing with error tolerance. Each group of parameters is clamped according to a safe interval, and duplicate parameter groups are deduplicated, retaining only unique values. Each parameter component undergoes the following normalization mapping: Continuous value parameter ( , , ): ; Step interval parameters: , ; Rotation angle After quantization and rounding: If Then place ,otherwise Limited to .
[0083] Ultimately, no more than A set of valid candidate parameters is used for subsequent diffusion synthesis. If the number of valid candidates is insufficient... This triggers the morphological feature completion mechanism.
[0084] Through the above steps, standardized preprocessing of input data, construction of a four-grid visual panel, and automatic reasoning and normalization of multiple candidate parameters based on a visual language model are achieved. This transforms the traditional parameter configuration process that relies on human experience into an end-to-end automated generation of the model, providing standardized input and a diverse parameter space for subsequent diffusion synthesis.
[0085] S2, Morphological Feature Completion: like Figure 2 As shown, this embodiment solves the above problem using two parallel paths: The main path utilizes the cross-modal understanding capability of the Qwen2.5-VL-3B-Instruct visual language model, taking a four-grid visual panel as input and outputting multiple sets of defect generation candidate parameters at once, replacing the manual trial-and-error parameter tuning process. The fallback path is automatically triggered when the visual language model output is insufficient. It dynamically calculates basic parameters by extracting the morphological features of the target mask (area ratio, compactness, aspect ratio, boundary roughness, and texture variance), and then expands and supplements the candidates through multi-strategy variants to ensure the completeness of the candidate parameters.
[0086] This dual-path collaborative mechanism effectively bridges the gap between the uncertainty of visual language model output and the deterministic requirements of diffusion synthesis parameters.
[0087] S2.1 Extraction of target mask area ratio: Mask the target Binarize the data and calculate its area percentage: ; In the formula, , These are the height and width of the mask, respectively; The area percentage of the target area to be masked; S2.2 Calculation of contour morphological features: Binarization mask Extracting the contour of the largest connected component Based on the contour, the following morphological features are calculated: Compactness: Measures the roundness of a defective area, defined as: ; In the formula, The area enclosed by the outline (pixel count). For the perimeter of the outline, To prevent small constants from being divided by zero, .
[0088] Aspect ratio (Elongation): Measures the flatness of the bounding rectangle of the defect area, defined as... ; In the formula, , These are the width and height of the smallest bounding rectangle of the outline, respectively. (Truncation of the upper limit).
[0089] Boundary roughness: measures the degree of irregularity at the boundary of a defect region, defined as... ; In the formula, For outline The area of the convex hull; A larger value indicates a more irregular defect boundary.
[0090] S2.3, Extraction of texture variance from reference defect image: Reference defect image Convert to grayscale image using standard weighting factors : ; Reference mask Calculate texture variance within non-zero regions: ; In the formula, For the reference mask valid area, The total number of pixels in the effective area of the reference mask. The grayscale average of the effective area of the reference mask: ; when At that time, take .
[0091] Further normalization to texture score : .
[0092] S2.4 Dynamic calculation of basic parameters driven by morphology: Based on the four extracted morphological features—area proportion Aspect Ratio (abbreviated as) Boundary roughness (abbreviated as) Texture score Dynamically calculate the basic values of each diffusion parameter: Basic mask radius : ; Number of basic mask iterations : ; Basic attentional replacement step size interval: ; ; Basic guiding strength : ; Basic reasoning steps : ; Basic starting layer : .
[0093] S2.5, Multi-strategy variant amplification to generate completion candidates: Using the basic parameters of the calculation as the reference point, the application Group Preset Strategy Variants Vector ; Parameter amplification is performed, with each strategy applying either a multiplicative or additive offset to the base parameters. , ): ; ; ; ; ; ; ; The value ranges of each offset variable are as follows: : Mask radius multiplication factor, with a value range of approximately ; : Mask iteration count, addition offset (integer), value range ; , The multiplicative factors of the attention replacement step size are approximately... ; : Guided intensity additive offset, with a value range of approximately ; Inference step addition offset (integer), value range ; : Initial layer addition offset (integer), value range ; For the first Mask expansion radius in the group of candidate parameters; For the first The number of mask inflation iterations in the group of candidate parameters; For the first Cross-attention replacement of the initial normalized time step in the group candidate parameters For the first The cross-attention replacement in the group candidate parameters ends at the normalized time step. For the first The classifier-guided strength in the group candidate parameters For the first Number of diffusion inference steps in the candidate parameters group For the first Attention control in the initial layer of the group of candidate parameters.
[0094] Based on this, the self-attention replacement step size interval is determined according to the boundary roughness. Adaptive determination: .
[0095] Rotation change angle Based on aspect ratio Conditional activation: ; In the formula, This means clipping the value to a range. Inside.
[0096] Finally, range pruning is applied to each set of amplification parameters to ensure that the parameters are within a preset safety range, generating... The candidate parameter configuration driven by group morphological features is merged with the candidate parameters output by the visual language model to the target number.
[0097] Through the above steps, when the visual language model output is insufficient, the morphological features of the target mask and the texture features of the reference image are automatically extracted, and the candidate parameters are dynamically supplemented by multi-strategy variant amplification, thus ensuring the completeness and robustness of the multi-candidate generation strategy.
[0098] S3, Multiple Candidate Diffusion Synthesis: S3.1, DDIM Inversion: Converting the original normal image and reference defect image via VAE encoder Mapping to the hidden space ( ), execute respectively Step-deterministic DDIM inversion, preserving the list of intermediate latent variables. and The inversion recursive formula is: .
[0099] S3.2 Mask Preprocessing and Local Blending: Perform morphological dilation based on max pooling on the target mask. Furthermore, in each denoising step, the Local Blend mechanism is used to blend the target region with the latent variables of the source image: .
[0100] S3.3, MCA Attention Control Injection: Executed via the McaControlReplace editor at specified time step intervals and UNet layer intervals respectively—(a) Cross-attention replacement: Applying mask region weighted gain to the defect type token to inject the defect semantics of the reference image into the target image; (b) Self-attention replacement: Separating the foreground / background regions based on the mask, using temperature coefficients… Sharpening foreground attention enables the transfer of defective structures from the reference image to the target image. The denoising process employs a classifier-free guided approach. .
[0101] S3.4 Decoding and fallback: Completed After noise reduction, it passes through the VAE decoder. Output If an OOM (Out of Memory) error occurs, the system will automatically reduce the load and retry. If the error still fails, the system will return the original image as a fallback.
[0102] Through the above steps, each set of candidate parameters independently drives the diffusion synthesis process based on DDIM inversion and MCA attention control, generating multiple candidate defect images.
[0103] S4. Multidimensional Assessment and Model Quality Inspection: like Figure 3 As shown, this embodiment uses a multi-dimensional evaluation module to quantitatively score and weightedly fuse each candidate from five dimensions: defect existence, location accuracy, authenticity, background protection, and distribution rationality. Candidates below the threshold are rejected outright, achieving automated and objective screening across multiple dimensions. The optimal candidate is further submitted to a visual language model for final qualitative verification. If it fails, the model adjusts the parameters based on the returned parameters, updates the parameters, and re-synthesizes the image, forming a closed-loop iterative optimization with dual gating of physical scoring and visual semantics. This mechanism effectively replaces the manual evaluation process, significantly improving the efficiency of defect image screening and the quality of image storage.
[0104] (1) Defect Existence Score : Verify whether the defect has been successfully injected and is visible.
[0105] The absolute change intensity of the local masked region is combined with the anomaly score output by the industrial anomaly detection model for weighted fusion. ; in: Local change intensity Defined as generating an image Compared with the source normal image In the target mask area Average absolute difference per pixel within: ; In the formula, The anomaly score of the generated image output by the industrial anomaly detection model (preferably PatchCore or PaDiM) is mapped to a sigmoid function. : ; In the formula, This is the original output distance value of the model. Offset threshold (take) ), This is the sigmoid function.
[0106] If the anomaly detection model is not ready, it degenerates into... Weighting coefficients , .
[0107] (2) Positioning accuracy score : Verify whether the defect is accurately generated within the specified target mask area.
[0108] Heatmap based on the difference between the generated image and the source image Calculate its relationship with the target mask. Intersection over Union (IoU): ; Among them, the differential heat map The image is obtained by Gaussian smoothing the average absolute difference between the generated image and the source image across all channels. ; , For the difference diagram The difference response map was obtained after smoothing with a 15×15 Gaussian kernel. This represents the maximum response value in the smoothed difference response plot; , For binarization threshold, This is the set of pixels representing the predicted defect area obtained from the differential heatmap; For the target mask area; The number of image channels. To prevent small constants from being divided by zero.
[0109] (3) Authenticity score : To evaluate the texture clarity and visual realism of defective areas, the following three sub-indicators are used: a) Gradient sharpness score Based on the generated image , The gradient variance of the direction measures the sharpness of the defect edge. ; In the formula, Generate an image of the defect obtained after diffusion synthesis; b) Perceptual similarity penalty Learned Perceptual ImagePatch Similarity (LPIPS) based on a pre-trained VGG network measures the perceptual distance between the generated and source images in the feature space. ; If the LPIPS model is not loaded, then .
[0110] c) Text-image semantic consistency score Image and defect text descriptions are generated based on the CLIP model. Cosine similarity (e.g., "a photo of a {anomaly_type} on a {object}"): ; in, , ; In the formula, The semantic feature vector of the generated image is extracted by the CLIP image encoder. This is the semantic feature vector of the defective text extracted by the CLIP text encoder. For CLIP image encoder, This is the CLIP text encoder.
[0111] Final authenticity score The fusion formula is: ; ; in, A subjective authenticity score for the visual language model (optional input). .
[0112] (4) Background protection score : Ensure that the non-defect areas (background areas) are not destroyed by the diffusion synthesis process.
[0113] Calculate the background mask The mean absolute error within the range and its inversion: ; The background mask is the reverse region of the defect mask: ; when When (i.e., the entire image is a defect area), .
[0114] (5) Distribution rationality score : To ensure that the generated defect morphology matches the feature distribution of real industrial defect datasets in the feature space, a pre-trained ResNet-18 is used as a feature extractor to extract embedding vectors from the masked region, which are then matched with the real defect feature library using cosine similarity. ; in: To generate the L2-normalized embedding vector extracted from the defect region after masking; To pre-extract and normalize from real defect image datasets One reference feature vector; To be Extend to A mask tensor with the same number of channels; if the feature extractor or defect feature library is not ready, the default value is returned. .
[0115] (6) Score Fusion: The scores from the five dimensions are weighted and combined according to preset weights to obtain the final comprehensive score. : ; The default value for the weighting coefficient is... (Existence) (position), (Authenticity) (Background protection) (Rationality of distribution), and satisfies All submodule scores are normalized to interval, .
[0116] Comprehensive score The highest-ranking candidate defect image is input into the Qwen2.5-VL-3B-Instruct multimodal visual language model, which is guided by structured prompts to perform industrial quality inspection judgments. The model outputs the quality inspection results in JSON format.
[0117] Under a dual-gating mechanism: if (threshold) If the physical score and visual language model both pass the quality check, the candidate image will be deemed unqualified and discarded. Only when both the physical score and visual language model certifications are passed can the candidate defective image be added to the database.
[0118] This embodiment constructs a visual agent using the Qwen2.5-VL-3B-Instruct multimodal visual language model. It takes a normal image, a reference defect image, and their respective masks as input, combining them into a four-grid visual panel. The model directly outputs multiple sets of nine-dimensional candidate parameter configurations with diverse styles, effectively replacing manual parameter tuning. When the visual language model output is insufficient, it automatically extracts the morphological features of the target mask and dynamically supplements the candidates through multi-strategy variant amplification. Furthermore, based on StableDiffusion v1.5's DDIM inversion and mask-guided multi-axis attention control mechanism, defect feature injection and image synthesis are achieved. In addition, to further improve the generation quality and stability, this embodiment introduces a dual-gated closed-loop optimization mechanism that coordinates multi-dimensional evaluation and visual language model quality control. It quantitatively filters by weighted fusion of defect existence, location accuracy, realism, background protection, and distribution rationality scores, and the visual language model performs final verification of the optimal candidates, significantly enhancing the usability and consistency of the generated defect images. (1) By constructing a four-grid visual panel, the normal image, the reference defect image and their respective masks are combined in a color-coded overlay manner, so that the visual language model can simultaneously perceive the spatial correspondence between the area to be injected and the reference defect. (2) Through the generation of multiple candidate parameters by the visual language model, based on the cross-modal understanding of the visual panel content, multiple sets of diffusion synthesis parameters are output at one time, without the need for repeated manual trial and error; (3) Through the morphological feature-driven fallback completion mechanism, when the visual language model output is insufficient, the mask morphology and texture features are automatically extracted and the completion candidates are dynamically generated through multi-strategy variant amplification to ensure the completeness of the candidate parameters. (4) Through the closed-loop iteration of multidimensional evaluation and dual-gated quality inspection, quantitative scoring is combined with visual semantic verification. Samples below the threshold are rejected, and the best candidate is confirmed a second time to ensure the quality of the samples entering the database.
[0119] The above are merely preferred embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for generating industrial defect images based on adaptive generation of multiple candidate parameters and multidimensional evaluation, characterized in that, include: The normal image to be processed, the reference defect image, and the corresponding normal image mask and reference defect image mask are combined into a multi-source visual input, which is then input into a multimodal visual language model to generate several sets of diffusion model synthesis parameters. Each set of diffusion model synthesis parameters is used, and the diffusion model is guided by the mask to inject the defect features in the reference defect image into the normal image to obtain several candidate defect images; For each candidate defect image, scores are calculated from five dimensions: defect existence, positioning accuracy, authenticity, background preservation, and distribution rationality. These scores are then weighted and fused according to preset weights to obtain a comprehensive physical score for each candidate defect image. Candidate defect images with a comprehensive physical score lower than a first preset threshold are removed. The candidate defect images with the highest comprehensive physical score are selected from the remaining candidate defect images and input into the same multimodal visual language model for quality inspection and verification. The candidate defect images that pass the verification are used as the final output defect images.
2. The method according to claim 1, characterized in that, The multi-source visual input is a four-grid visual panel; the first grid of the four-grid visual panel is the normal image, the second grid is the superimposed image of the normal image and the normal image mask, the third grid is the reference defect image, and the fourth grid is the superimposed image of the reference defect image and the reference defect image mask; the mask of the normal image and the mask of the reference defect image are encoded with different colors when superimposed.
3. The method according to claim 2, characterized in that, When the number of groups of diffusion model synthesis parameters generated by the multimodal visual language model is less than the preset number, the morphological features of the normal image mask and the texture features of the reference defect image in the mask area are extracted. Based on the extracted features, the basic synthesis parameters are dynamically calculated, and a preset strategy variant is applied to the basic synthesis parameters to amplify and generate the required number of completion candidate parameters.
4. The method according to claim 3, characterized in that, The morphological features include the area ratio, aspect ratio, and boundary roughness of the normal image mask; the texture features are the gray-level variance of the reference defect image within the mask area. The dynamic calculation basic synthesis parameters include: determining the mask radius based on the area ratio and aspect ratio, determining the mask iteration number based on the boundary roughness, and determining the cross-attention replacement step size interval and guidance intensity based on the texture features; The self-attention replacement step size interval is adaptively determined based on the boundary roughness, and the rotation transformation angle is conditionally activated based on the aspect ratio.
5. The method according to claim 1, characterized in that, Using the mask-guided diffusion model, defect features from the reference defect image are injected into the normal image, including: Perform DDIM inversion on the normal image and the reference defect image respectively to obtain their respective inversion latent variable trajectories; Morphological dilation is performed on the mask of the normal image to obtain an expanded mask; During the denoising process, the extended mask is used to locally mix the latent variables of the current denoising step with the inverted latent variables of the normal image; In the cross-attention layer and self-attention layer of the diffusion model, cross-attention replacement and self-attention replacement are performed respectively within the time step interval and network layer interval specified by the diffusion model synthesis parameters, so as to transfer the semantics and structure of the reference defect to the target region.
6. The method according to claim 1, characterized in that, The defect presence score is obtained by calculating the intensity of pixel changes between the generated image and the normal image within the mask area, and by weighting and fusing the anomaly score output by the generated image with an independent industrial anomaly detection model. The positioning accuracy score is obtained by calculating the difference heatmap between the generated image and the normal image, and then performing an intersection-union (IUU) calculation on the difference heatmap and the target mask. The authenticity score is obtained by fusing the gradient sharpness of the generated image, the perceptual similarity to normal images, and the CLIP semantic consistency with the preset defective text description. Background preservation score is obtained by calculating the pixel difference between the generated image and the normal image in the background region outside the mask region; The distribution rationality score is obtained by matching the feature embeddings of the masked region in the generated image with the features in a pre-built real defect feature library using maximum cosine similarity.
7. The method according to claim 1, characterized in that, The first preset threshold is the lower limit of the comprehensive physical score. The quality inspection verification is a qualitative judgment made by the multimodal visual language model based on cross-modal understanding as to whether the candidate defect image presents a real and valid defect. Only when the comprehensive physical score of the candidate defect image is not lower than the lower limit and the quality inspection verification result is passed, the corresponding candidate defect image is finally output.
8. The method according to claim 1, characterized in that, The multimodal visual language model is Qwen2.5-VL-3B-Instruct, and the diffusion model is Stable-Diffusion-v1-5.
9. An industrial defect image generation system based on multi-candidate parameter adaptive generation and multi-dimensional evaluation, characterized in that, Used to perform the method according to any one of claims 1-8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1-8.