Small sample deep cavity curved surface defect image generation method, device, equipment and medium
Patent Information
- Application Number
- CN202610908306.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-23
- Publication Date
- 2026-10-20
- Estimated Expiration
- 2046-06-23
AI Technical Summary
[0006]本申请一方面提供了小样本深腔曲面缺陷图像生成方法,解决现有技术针对深腔曲面结构时,因缺陷样本稀缺且类型分布不均、曲面几何复杂和光照条件复杂的情况下难以提供接近真实情况缺陷,无法为下游检测提供高质量缺陷图像训练样本的技术问题
本申请提出了一种基于物理-几何联合先验的小样本深腔曲面缺陷图像生成方法。在无深度真值,仅依赖少量缺陷样本的前提下,本申请通过法线估计、平均曲率和多尺度几何统计构建几何条件场,并在生成器中采用几何感知归一化,使缺陷更容易出现在高曲率、几何不连续及各向异性显著的区域,从而更符合复杂深腔曲面结构中缺口、缺块、裂纹等缺陷在实际工况下的空间分布规律。
Smart Images

Figure CN122435060B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of industrial inspection technology, and in particular to a method, apparatus, equipment, and medium for generating images of small-sample deep cavity surface defects. Background Technology
[0002] In industries such as precision manufacturing, the surface integrity of complex curved surfaces and deep cavity structures directly affects service safety and lifespan. Due to process discreteness, batch-to-batch material variations, and operating environments, these components are prone to defects such as cracks, corrosion pits, coating peeling, and abrasive scratches. Existing deep learning-based defect detection methods typically rely on training with a large number of labeled defect samples. However, in actual engineering settings, deep cavity surface defects often have a low probability of occurrence, are difficult to collect, and have a limited number of available samples, making it difficult to meet the sample size requirements of detection models.
[0003] On the one hand, existing surface defect data augmentation methods based on general generative networks such as GANs and diffusion models are mostly based on the assumption that "the background is approximately planar". They learn the defect distribution only from the two-dimensional texture level. When there are very few defect samples and long-tailed categories, they are prone to pattern collapse, overfitting and semantic confusion of defects. At the same time, they do not consider the relationship between the curvature, anisotropy and other structural features of deep cavity surfaces and defects. They simply regard defects as texture blocks that can be superimposed at any position, which cannot reflect the true spatial distribution of defects. For example, cracks extend along the principal curvature path, and defects such as notches and gaps appear preferentially at the edges of pits, edges and geometric discontinuities.
[0004] On the other hand, deep cavity curved surface structures generally have self-occlusion, strong reflection and complex lighting conditions. Existing generation models mostly adopt planar or simplified lighting assumptions, which makes it difficult to reconstruct the real light and dark relationship and shadow shape under the coupling of defects and curved surface morphology. As a result, although the generated images are visually clear, they deviate greatly from the real working conditions in the overall relationship of "defect-deep cavity curved surface-lighting", which makes it difficult to effectively improve the detection performance in real-world scenarios.
[0005] Therefore, it is necessary to design a method for generating high-quality defect data under small sample conditions. Summary of the Invention
[0006] This application provides a method for generating images of defects in deep cavity surfaces with small samples, which solves the technical problem that existing technologies are unable to provide images that closely resemble real-world defects when dealing with deep cavity surface structures due to the scarcity and uneven distribution of defect samples, complex surface geometry, and complex lighting conditions. This makes it impossible to provide high-quality defect image training samples for downstream detection.
[0007] This application is achieved through the following solution: A method for generating images of small-sample deep cavity surface defects includes the following steps: S1. Data preprocessing and training settings, including preprocessing deep cavity surface images containing normal and defective samples and setting training parameters; S2, Defect Prototype Statistics and Markov Gated Sampling, including performing prototype statistics and gated sampling on a small number of defect samples to obtain defect prototype feature vectors; S3, Geometric condition construction, including the geometric processing module obtaining the unit normal field, mean curvature and geometric confidence map under the condition of no depth truth, and constructing the geometric condition field; S4. Defect phase field generation and physical phase field constraint: Based on the defect prototype feature vector and the depthless geometric condition field, geometrically sensed defect phase field generation is performed, and a diffusion-reaction phase field model and a phase field evolution refinement layer are introduced on the estimation surface to impose physical constraints on the spatial distribution and morphological evolution of the generated defects. S5. Construct illumination consistency constraints, including a multi-branch conditional discriminator at the discrimination end, and implement adversarial constraints from multiple aspects. At the same time, introduce physical prior constraints and illumination consistency constraints to ensure the physical and optical rationality of the generated results. S6. Construction of multi-branch discriminator and total loss: Construct a multi-branch discriminator consisting of a multi-scale appearance branch discriminator, a geometric consistency branch discriminator, and a prototype projection branch discriminator, and calculate the total loss of the discriminator and the total adversarial loss of the generator. S7. Output the deep cavity surface defect image after training according to the training settings.
[0008] Further, step S1 specifically includes the following steps: S11. First, perform center cropping and scaling on the deep cavity surface image to unify the input into a single image of size 512×512, and normalize the pixels to... interval; S12. Divide the dataset, which includes real defect samples and normal samples, into a training set and a validation set according to a set ratio; S13. Configure training hardware, optimizer, learning rate, batch size, and total number of training rounds.
[0009] Furthermore, step S2 specifically includes the following steps: S21, using a pre-trained feature extractor For each type of defect sample Feature extraction and statistics are performed to obtain feature vectors. ,in Indicates the defect type. Indicates the first under this type For each sample, calculate the class center for the same type of defect: ; in, Indicates the number of samples of this type; S22. Obtaining robust covariance using a contraction approach: ; in, The shrinkage coefficient, Sample covariance matrix, For trace operators, For feature dimension, It is the identity matrix; S23. During the generation process, new prototype feature vectors are generated by interpolating and superimposing Gaussian perturbations between feature vectors of the same defect type: ; in, To obtain samples of this type of defect Two feature vectors randomly selected from the data. , To ensure that the new prototype feature vector still falls within the statistical confidence region of the defect type feature due to Gaussian perturbation, we choose to calculate the mean vector of the prototype feature vector relative to the defect type feature. Mahalanobis distance: ; S24. Use a soft gating function to control sampling validity: ; in For the Sigmoid function, >0 represents the temperature parameter. Set the degrees of freedom to Chi-square distribution In quantiles The value at; S25, Gating weights With prototype feature vector A multilayer perceptron block is input together and mapped to a defect prototype feature vector. It is used to control the type and intensity of defects in the generator.
[0010] Furthermore, step S3 specifically includes the following steps: S31, Constructing the geometry processing module Without ground truth depth values, a normal estimation network can directly estimate the normal field from a sample image. After unitization, it becomes Estimate the geometric confidence level Through mathematical approximation Approximate mean curvature Finally, the three elements are used to construct a direction-sensitive, multi-scale, and robust geometric condition field to describe the local concavity and convexity of the deep cavity surface and its scale stability, wherein: ; Constrain the normal field to a unit normal field: ; ; S32, Calculate pixel points divergence at: ; To incorporate geometric confidence into curvature estimation, a piecewise confidence-weighted average curvature approximation is constructed. Different weighting functions are used for curvature estimation in different confidence intervals, making the curvature more sensitive to reliable geometric information and significantly suppressing unreliable geometric information, thereby obtaining a more stable average curvature that better reflects the true surface. ; Among them, in the high confidence interval Inside, Used to adjust the upper limit of the weight; Used to control the degree of influence of geometric confidence on curvature. , The larger the curvature, the more sensitive it is to confidence level, and the faster the weight increases within the high confidence interval; The smaller the value, the more gradual the growth, which is suitable for scenarios where the overall geometric estimation is relatively stable; right The curvature field is obtained by compression and normalization: ; S33. Without explicitly restoring the depth, construct a pseudo-depth gradient based on the unit normal, and introduce depth gradient integrability constraints and edge-aware smoothing constraints: First, the pseudo-depth gradient is estimated based on the normal, and then a confidence level is defined. Weighted integrability loss: ; in, These are the components of the unit normal. To prevent constants with a denominator of zero, It is considered an approximation of the depth gradient; To ensure the integrability of the pseudo-depth field, integrability weights jointly modulated by geometric confidence and image edges are introduced: ; in, Let x be the gradient of the input image at pixel x. The integrability loss is defined by the weight parameters: ; in, , This represents the total number of pixels involved in the loss calculation. Based on the integrability constraint, an edge-aware geometric smoothing term is introduced to suppress sharp fluctuations in curvature in non-edge regions, preserving necessary geometric details near the true edges. Edge weights are defined as follows: ; in, To control the effect of image gradient on smoothing intensity, when When smaller, Approximately 1; when When it is large, Significantly reduced, defined geometric smoothing loss: ; in, , This represents the total number of pixels involved in the loss calculation; S34. Weight the two sub-losses, and define the total loss for geometric condition construction as follows: , in, , where is the weight parameter, and its gradient is isolated from the loss of the generator and discriminator. Only the geometry processing module updates the parameter through the geometric loss, avoiding the adversarial loss from interfering with the geometric estimation. S35. Define the kernel function In pixels Centered on, scale is Normalized two-dimensional Gaussian kernel: ; in, For pixels within the neighborhood, As the normalization factor, Represents pixels To pixel The distance; The gradient of the normal field in the image coordinate direction is denoted as . Using the finite difference operator to differentiate each channel, the geometric structure tensor is defined as follows: ; in, It is a symmetric positive semi-definite matrix. Reflecting spatial distance weight, Reflecting the confidence level of geometric estimation, It reflects the directionality and intensity of the change in normal; right Perform eigenvalue decomposition, and let the eigenvalues be... The corresponding feature vector is Therefore, the anisotropy index is: ; when When the value is close to 1, it indicates that the geometric change at this scale has a significant single principal direction; when... When the value is close to 0, it indicates that the geometric transformation is approximately isotropic; scalar geometry at multiple scales Calculate the mean, variance, scale derivative, and absolute deviation of the median, including: Define the neighborhood weights for geometric confidence weighting: ; ; The purpose is to differentiate the weights of pixels with lower confidence levels by using the non-linear part within the parentheses. This naturally reduces the weights of pixels with lower confidence levels, minimizing the impact of unreliable geometric information such as noise normals, shadows, and highlights on curvature neighborhood statistics. For pixels with medium to high confidence levels, the weights are increased to better highlight key geometric features such as true surface structures and defect edges. The value of can be used for confidence levels greater than 0. curvature By assigning greater weights, the subsequent weighted mean and standard deviation can more closely approximate the true structure rather than a noisy distribution. Define the geometric confidence weighted mean and standard deviation of curvature: ; ; in, For the normalized kernel function, Represented by pixels Centered on, scale is The local neighborhood; To characterize the variation trend of geometric structure in the scale domain, the scale derivative is introduced: ; in, The scale step size; In addition, to enhance robustness to isolated outliers, median absolute bias is introduced: ; Through joint use , , and In order to distinguish noise points from real defects, then at multiple scales The calculations are performed on the above, and the mean, standard deviation, and anisotropy index of each scale are concatenated into a multi-scale geometric statistical vector: ; in, Indicates the first One scale, Indicates the total number of scales; S36. Construct a complete geometric condition field .
[0011] Furthermore, step S4 specifically includes the following steps: S41. Transfer the defect prototype feature vector The image is mapped to a feature map with the same resolution as the image through a fully connected layer and upsampling operation, denoted as . ,in, Represents pixels on the image plane; simultaneously, the geometric condition field... Dimensionality is reduced to geometric conditional features through several convolutional layers. The two are concatenated along the channel dimension to obtain the joint conditional feature: ; The defect generation network employs an encoder-decoder structure. In the decoding stage, the intermediate features are modulated using a geometric perception normalization module. Let the first... Layer decoding feature map is Their mean and standard deviation are respectively... Due to conditional features Scale and offset parameters are predicted by a small convolutional subnetwork. The modulated characteristics are: ; in Based on conditional features Predicted by a small convolutional network; S42. The defect generation network first outputs the initial defect phase field. It outputs a color / brightness residual map of the same size as the input image. Given a normal image The initial generated defect image is represented as: ; in, To map phase field values to intervals The normalization function, ⊙ represents pixel-wise multiplication; S43, in the estimated unit normal field curvature field and anisotropy index Based on this, a diffusion-response phase field model defined on the estimation surface is introduced, and a tangent space projection operator is constructed using the unit normal: ; in, Let the identity matrix be the surface gradient operator and the surface Laplacian operator: ; in, It is a planar gradient operator; Based on the above operators, the defect phase field The evolution is defined as a diffusion-reaction process: ; in, The diffusion coefficient is related to curvature and multi-scale geometric statistics. For the reaction term, The diffusion coefficient is selected as the defect nucleation threshold. ; in, As the reference diffusion coefficient, To adjust the parameters, It is the average value of the anisotropy index at different scales, used to characterize regions with obvious directionality, including groove cracks and pit edges; Obtained from multi-scale geometrical statistical vector regression: ; in, Weights to be learned The sigmoid function, the reaction function Adopting a bistable form: ; in, This is a parameter representing the reaction strength. S44. Generate the initial phase field output by the network. Considering the initial state of the above diffusion-reaction phase-field model, the values are calculated on the estimation surface according to discrete time steps. Total number of steps Evolutionary progress: ; in, , will go through Phase field after step evolution The final defect phase field is used to generate the defect image and calculate the physical constraint loss. The final defect image is represented as follows: ; After obtaining the steady-state phase field Then, substituting it into the steady-state form of the diffusion-reaction phase-field model, we obtain the pixel. Physical residuals at the location: ; S45, Utilizing phase field values Define interface weights: ; The weight is equal to 0 in the pure background and pure defect regions with phase field values of 0 and 1, respectively, and takes a larger value at the defect edge with a phase field value of 0.5; then the geometric confidence level is used. and the average anisotropy index at different scales Constructing geometric weights: ; in, To adjust the parameters, the interface-geometry joint weight is defined as follows: ; Based on this, we define the physical prior loss: ; in, Total number of pixels It is a Charbonnier robust function. , , which is a small constant, is used to mitigate the effects of extreme residuals.
[0012] Furthermore, step S5 specifically includes the following steps: S51. Introduce an albedo estimation subnetwork. To generate an image Input: Albedo ; Represents pixels albedo at that location It is a shallow network consisting of several convolutional layers; Using the obtained unit normal field Low-order spherical harmonic functions are used to model the incident lighting of the scene. For spherical harmonic basis functions, corresponding to illumination coefficients The value is obtained by regression from the generated image by the illumination estimation subnetwork, then at the pixel level... The predicted brightness at this location is: ; in, Using predefined spherical harmonic basis functions, extract the luminance channel from the generated image, denoted as . Then the illumination residual is defined as: ; Lighting residuals are used to represent the deviation between the brightness obtained by re-rendering the normals and lighting model and the actual generated brightness. S52, Constructing Illumination Confidence Weighting the illumination residuals of different pixels, including normalizing the brightness of the generated image. Select the high light threshold With shadow threshold Specular response and shadow response are defined as follows: ; in, Using the slope parameter, the illumination confidence level is constructed as follows: , in This represents the penalty coefficient for highlights and shadows. This indicates that the result will be cropped to... interval; S53. Define illumination consistency loss based on illumination confidence and illumination residual: ; in, Total number of pixels ε light It is a small smoothing constant, used to improve the numerical stability of the loss function.
[0013] Furthermore, step S6 specifically includes the following steps: S61. Construct a multi-branch discriminator consisting of a multi-scale appearance branch discriminator, a geometric consistency branch discriminator, and a prototype projection branch discriminator, and uniformly adopt a hinge-type adversarial loss, wherein: A multi-scale appearance branch discriminator is used to determine whether the generated image is consistent with the real defect image in terms of texture details, noise distribution, and local structure, including construction. s PatchGAN discriminator at various scales The effects are applied to the original resolution image and its downsampled image, respectively, for the first... A scale, given a real image With generated image The appearance branch discriminator loss is defined as: ; The corresponding generator appearance adversarial loss is: ; The total loss of the multi-scale appearance branch is obtained by averaging across all scales: ; The geometric consistency branch discriminator is used to determine whether the appearance of defects in an image is consistent with the geometric condition field. To achieve consistency, the current image and the corresponding geometric condition field are concatenated along the channel dimension to construct the geometric condition input: ; The stitching is performed only on the feature channels, spatially... Maintain alignment, geometric branch discriminator by and Given the input, its loss is defined as: ; The corresponding generator geometric adversarial loss is: ; Prototype projection branch discriminator The scoring format is defined as follows: ; in, For learnable weight vectors, For learnable matrices, This represents a score indicating the authenticity of the image features themselves. This characterizes the degree of consistency between image features and given defect prototype features; The prototype projection branch discriminator and generator losses are as follows: ; ; Here, the constraint generation result is compared with the defect prototype feature vector learned in step one. To achieve semantic consistency, a conditional discriminant branch of prototype projection form is introduced, assuming that from the image... The extracted features are Vector representations are obtained by performing global average pooling on the intermediate layer feature maps, which is useful for real defect images. Its corresponding defect prototype features are For generating images The corresponding defect prototype feature is the one used as input to the generator. ; S62. Based on the above branches, the total loss of the discriminator and the total adversarial loss of the generator are respectively: ; ; in These are the weight coefficients for each branch; S63. Define the total loss of the generator: ; in, This represents the balance coefficient for different types of loss.
[0014] This application also provides a device for generating images of small-sample deep cavity surface defects, including: The preprocessing module is used for data preprocessing and training settings, including preprocessing deep cavity surface images containing normal and defective samples and setting training parameters. The statistics and sampling module is used for defect prototype statistics and Markov gated sampling, including performing prototype statistics and gated sampling on a small number of defect samples to obtain defect prototype feature vectors. The geometry condition construction module is used for geometry condition construction. It includes the geometry processing module, which obtains the unit normal field, mean curvature and geometric confidence map under the condition of no depth truth, and constructs the geometry condition field. The defect phase field generation and physical phase field constraint module is used for defect phase field generation and physical phase field constraint. Based on the defect prototype feature vector and the depthless geometric condition field, it performs geometrically sensed defect phase field generation, and introduces a diffusion-reaction phase field model and a phase field evolution refinement layer on the estimation surface to impose physical constraints on the spatial distribution and morphological evolution of the generated defects. The illumination consistency constraint module is used to construct illumination consistency constraints, including a multi-branch conditional discriminator as the discrimination end, which provides adversarial constraints from multiple aspects, while introducing physical prior constraints and illumination consistency constraints to ensure the physical and optical rationality of the generated results. The multi-branch discriminator and total loss construction module is used to construct the branch discriminator and total loss. It constructs a multi-branch discriminator consisting of a multi-scale appearance branch discriminator, a geometric consistency branch discriminator, and a prototype projection branch discriminator, and calculates the discriminator's total loss and the generator's adversarial total loss. The defect image output module is used to output deep cavity surface defect images after training based on the training settings.
[0015] This application also provides an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method for generating small sample deep cavity surface defect images.
[0016] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for generating small sample deep cavity surface defect images.
[0017] This application also provides a computer program product, including a computer program or computer executable instructions, which, when executed by a processor, implement the method for generating small sample deep cavity surface defect images.
[0018] Compared with the prior art, this application can produce the following beneficial effects: This application proposes a method for generating images of deep cavity surface defects based on a small sample size using a physical-geometric joint prior. Without ground truth depth data and relying only on a small number of defect samples, this application constructs a geometric condition field through normal estimation, mean curvature, and multi-scale geometric statistics. Furthermore, it employs geometric-aware normalization in the generator to make defects more likely to appear in regions with high curvature, geometric discontinuities, and significant anisotropy, thus better reflecting the spatial distribution patterns of defects such as notches, gaps, and cracks in complex deep cavity surface structures under actual working conditions.
[0019] Under small sample conditions, this application performs defect prototype statistics and sampling by shrinking covariance and Mahalanobis distance gating, ensuring that the generated features are within the statistical confidence region of the corresponding defect type. This alleviates the pattern collapse of the generation network in long-tail scenarios and improves the controllability of defect type and intensity. At the same time, the surface diffusion-reaction phase field equation and interface-geometric weighted physical residual are embedded into the generation process. Combined with illumination consistency constraints based on spherical harmonic functions and multi-branch discriminators such as multi-scale appearance, geometric consistency and prototype projection, unreasonable pseudo-defects are suppressed from multiple levels of physical, geometric and texture semantics. This makes the defect images generated under complex illumination and deep cavity surface conditions both realistic in appearance and reasonable in mechanism. While significantly reducing the dependence on real defect samples, it effectively improves the recall rate of the downstream detection network and reduces the false detection rate.
[0020] In summary, this application addresses the problem that it is difficult to obtain a sufficient number of realistic defect images suitable for engineering inspection on deep cavity surfaces such as the inner wall of crucibles under conditions of extremely few defect samples and complex lighting and occlusion. It generates high-quality defect samples, effectively alleviating the shortcomings of traditional GANs in scenarios with small samples and long-tail distributions, such as easy collapse, pattern collapse, and difficulty in transferring to actual industrial inspection.
[0021] In addition to the purposes, features, and advantages described above, this application has other purposes, features, and advantages. A further detailed description of this application will be provided below with reference to the figures. Attached Figure Description
[0022] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0023] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort, wherein: Figure 1 This is a flowchart illustrating a preferred embodiment of the method for generating images of small-sample deep cavity surface defects in this application. Figure 2 This is a schematic diagram of the module of the small sample deep cavity surface defect image generation device according to a preferred embodiment of this application; Figure 3 This is a schematic block diagram of an electronic device according to a preferred embodiment of this application; Figure 4 This is a schematic diagram of the internal structure of a computer device according to a preferred embodiment of this application. Detailed Implementation
[0024] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0025] It should be noted that the executing entity in this embodiment can be a computing service system with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or a small-sample deep cavity surface defect image generation device capable of achieving the above functions. The following description uses a small-sample deep cavity surface defect image generation device as the executing entity to illustrate this embodiment and the subsequent embodiments.
[0026] The following implementation method takes the deep cavity surface image of the crucible inner wall as the object, and provides a complete and feasible implementation process for the aforementioned method. It also provides the specific values of the parameters involved in various formulas, and gives quantitative evaluation results for three typical defects: notches, missing blocks, and cracks.
[0027] like Figure 1 As shown, to address the aforementioned technical problems, a preferred embodiment of this application provides a method for generating images of small-sample deep cavity surface defects, comprising the following steps: S1. Data preprocessing and training settings, including preprocessing deep cavity surface images containing normal and defective samples and setting training parameters; S2, Defect Prototype Statistics and Markov Gated Sampling, including performing prototype statistics and gated sampling on a small number of defect samples to obtain defect prototype feature vectors; S3, Geometric condition construction, including the geometric processing module obtaining the unit normal field, mean curvature and geometric confidence map under the condition of no depth truth, and constructing the geometric condition field; S4. Defect phase field generation and physical phase field constraint: Based on the defect prototype feature vector and the depthless geometric condition field, geometrically sensed defect phase field generation is performed, and a diffusion-reaction phase field model and a phase field evolution refinement layer are introduced on the estimation surface to impose physical constraints on the spatial distribution and morphological evolution of the generated defects. S5. Construct illumination consistency constraints, including a multi-branch conditional discriminator at the discrimination end, and implement adversarial constraints from multiple aspects. At the same time, introduce physical prior constraints and illumination consistency constraints to ensure the physical and optical rationality of the generated results. S6. Construction of multi-branch discriminator and total loss: Construct a multi-branch discriminator consisting of a multi-scale appearance branch discriminator, a geometric consistency branch discriminator, and a prototype projection branch discriminator, and calculate the total loss of the discriminator and the total adversarial loss of the generator. S6. Output the deep cavity surface defect image after training according to the training settings.
[0028] The small-sample deep cavity surface defect image generation method of this embodiment provides a defect image generation method that can simultaneously consider the structural features of deep cavity surfaces and the actual defect distribution law under the conditions of scarce defect samples, uneven type distribution, complex surface geometry and lighting conditions. This makes the generated defects closer to the real situation in terms of position, shape and lighting performance, and provides high-quality training samples for downstream detection.
[0029] Preferably, step S1 specifically includes the following steps: S11. First, the deep cavity surface image is center-cropped and scaled. In the experiment, the original crucible inner wall image resolution was 2560×1920. The input was unified to a single image of size 512×512, and the pixels were normalized to... interval; S12. Divide the dataset, which includes real defect samples and normal samples, into training set and validation set according to a set ratio. The dataset contains about 600 images, of which about 270 are real defect samples. They are divided into 100 images of notches, 30 images of missing blocks, and 140 images of cracks by type. The rest are normal samples. Divide the training set and validation set in a 7:3 ratio. S13. Configure training hardware, optimizer, learning rate, batch size, and total number of training epochs. Training is performed on a single NVIDIA RTX 3090 GPU, using the Adam optimizer, and the learning rate is set to... The batch size is set to 4, and the total number of training rounds is 300.
[0030] Preferably, step S2 specifically includes the following steps: S21, using a pre-trained feature extractor For each type of defect sample Feature extraction and statistics are performed to obtain feature vectors. In this embodiment, the feature extractor A pre-trained ResNet-50 feature extraction network is used to perform global average pooling on real defect images to obtain a dimension of [missing value]. eigenvectors, where Indicates the defect type. Indicates the first under this type For each sample, calculate the class center for the same type of defect: ; in, Indicates the number of samples of this type; S22, due to the sample covariance matrix Unstable under small sample conditions, a contraction approach is used to obtain robust covariance: ; in, The shrinkage coefficient is used in this embodiment. , Sample covariance matrix, For trace operators, For feature dimension, It is the identity matrix; S23. During the generation process, new prototype feature vectors are generated by interpolating and superimposing Gaussian perturbations between feature vectors of the same defect type. In this embodiment, two feature vectors are randomly selected from this type of sample. And add Gaussian noise: ; in, To obtain samples of this type of defect Two feature vectors randomly selected from the data. , The perturbation is Gaussian. To ensure that the new prototype feature vector still falls within the statistical confidence region of this defect type feature, the standard deviation of the perturbation is set to... Choose to calculate the mean vector of the prototype feature vector relative to the features of this defect type. Mahalanobis distance: ; S24. Use a soft gating function to control sampling validity: ; in For the Sigmoid function, take , >0 represents the temperature parameter. Set the degrees of freedom to The chi-square distribution value at the 0.95 quantile gives approximately 95% of the samples of this defect type a high gating weight, while candidate prototypes falling into the out-of-class tail region are suppressed. By constructing a Sigmoid gating function based on Mahalanobis distance and chi-square distribution quantile, a soft determination of whether candidate prototypes fall within the statistical confidence region of this defect type is achieved. Confidential prototypes are given higher weights, while abnormal prototypes that deviate from the distribution of this type are suppressed. This maintains the stability of the feature distribution of this defect type and mitigates mode collapse under small sample conditions. S25, Gating weights With prototype feature vector The input is a two-layer multilayer perceptron (MLP) that maps to an output feature vector of 128 dimensions, representing a defect prototype. , as the prototype condition input for subsequent generators, is used to control the type and intensity of defects in the generator.
[0031] Preferably, step S3 specifically includes the following steps: S31, Constructing the geometry processing module Without ground truth depth values, a normal estimation network can directly estimate the normal field from a sample image. After unitization, it becomes In this embodiment, the Ominidata pre-trained normal network is used to estimate the initial normals of a 512×512 input image. and geometric confidence level The unit normal is obtained. Estimate the geometric confidence level Through mathematical approximation Approximate mean curvature Finally, the three elements are used to construct a direction-sensitive, multi-scale, and robust geometric condition field to describe the local concavity and convexity of the deep cavity surface and its scale stability, wherein: ; Constrain the normal field to a unit normal field: ; ; S32, Calculate pixel points divergence at: ; To incorporate geometric confidence into curvature estimation, a piecewise confidence-weighted average curvature approximation is constructed. Different weighting functions are used for curvature estimation in different confidence intervals, making the curvature more sensitive to reliable geometric information and significantly suppressing unreliable geometric information, thereby obtaining a more stable average curvature that better reflects the true surface. ; This step uses a piecewise weighted approach to estimate curvature by applying a weighted method to the divergence, thus strengthening the influence of high-confidence regions. Specifically, in low-confidence intervals... Within this range, the overall weight smoothly increases from 0.09 to 0.28, and the non-linear part in the formula causes the weight to vary with... The curvature increases monotonically but remains within a reasonable range, avoiding complete loss of curvature in extremely low confidence regions, suppressing erroneous curvature peaks caused by noise normals, and reducing the interference of geometric pseudo-signals from shadows, reflections, and other regions on subsequent phase fields and the generation network; in the medium confidence interval... Within this range, the weights smoothly converge from a confidence level of 0.31 to 0.5, making... A continuous transition is achieved between the "weak curvature constraint" given in the low-confidence interval and the "enhanced curvature constraint" in the high-confidence interval to avoid abrupt weight changes and ensure training stability; in the high-confidence interval... Inside, Used to adjust the upper limit of the weight, here we take To avoid over-amplifying curvature estimates in the extremely high confidence region. Used to control the degree of influence of geometric confidence on curvature. , The larger the curvature, the more sensitive it is to confidence level, and the faster the weight increases within the high confidence interval; The smaller the value, the more gradual the growth, which is suitable for scenarios where the overall geometric estimation is relatively stable. In this example, the value is 0.5. Overall, this piecewise geometric confidence-weighted curvature estimation significantly suppresses noise curvature in the low-confidence region, achieves a smooth transition in the medium-confidence region, and moderately amplifies reliable geometric information in the high-confidence region. It provides adjustable sensitivity control. Compared with simple uniform weights or linear weights, this design can more accurately reflect the true curvature of the actual surface in different reliability regions, providing a more reliable and stable geometric prior for subsequent phase field evolution and defect generation, thereby reducing spurious defects and unreasonable contours, and improving the physical rationality and robustness of the entire generation model in complex deep cavity surface scenarios; To suppress the influence of extreme curvature values on subsequent statistics and retain curvature sign information, the following measures were taken: The curvature field is obtained by compression and normalization: ; S33. To improve the integrability and local smoothness of the geometric field, a pseudo-depth gradient is constructed based on the unit normal without explicitly restoring the depth, and depth gradient integrability constraints and edge-aware smoothness constraints are introduced: To ensure the integrability of the normal field, the normal is converted into a pseudo-depth gradient. First, the pseudo-depth gradient is estimated based on the normal, and then a confidence level is defined. Weighted integrability loss: ; in, These are the components of the unit normal. To prevent constants with a denominator of zero, It is considered an approximation of the depth gradient; To ensure the integrability of the pseudo-depth field, integrability weights jointly modulated by geometric confidence and image edges are introduced: ; in, Let x be the gradient of the input image at pixel x. The integrability loss is defined by the weight parameters: ; in, , This represents the total number of pixels involved in the loss calculation. The loss strengthens integrability constraints in regions with high geometric confidence and weak image edges, while relaxing constraints at edges and in low-confidence regions, thus avoiding erroneous constraints introduced by noise and occlusion. Based on the integrability constraints, an edge-aware geometric smoothing term is introduced to suppress sharp fluctuations in curvature in non-edge regions, preserving necessary geometric details near true edges. Edge weights are defined as follows: ; in, To control the parameters that affect the smoothing intensity of the image gradient, this embodiment removes... ,when When smaller, Approximately 1; when When it is large, Significantly reduced, defined geometric smoothing loss: ; in, , This represents the total number of pixels involved in the loss calculation. This smoothing term suppresses high-frequency noise in smooth areas and automatically weakens smoothing at geometric and texture edges, thereby reducing noise while preserving the true defect contours. S34. Weight the two sub-losses, and define the total loss for geometric condition construction as follows: ; in, , where is the weighting parameter, and in this embodiment, we take . Its gradient is isolated from the loss of the generator and discriminator, and only the geometry processing module updates the parameters through the geometric loss, thus avoiding the adversarial loss from interfering with the geometric estimation. Building upon this, to distinguish between strongly directional structures such as groove-like defects and cracks and isotropic structures such as near-circular pitting, a more stable geometric context needs to be provided for the generator G. Therefore, a multi-scale geometrical statistic is further constructed. For a given pixel and radius neighborhood Internal structure geometry tensor ; S35. Define the kernel function In pixels Centered on, scale is Normalized two-dimensional Gaussian kernel: ; in, For pixels within the neighborhood, As the normalization factor, Represents pixels To pixel The distance; The gradient of the normal field in the image coordinate direction is denoted as . Using the finite difference operator to differentiate each channel, the geometric structure tensor is defined as follows: ; in, It is a symmetric positive semi-definite matrix. Reflecting spatial distance weight, Reflecting the confidence level of geometric estimation, It reflects the directionality and intensity of the change in normal; right Perform eigenvalue decomposition, and let the eigenvalues be... The corresponding feature vector is Therefore, the anisotropy index is: ; when When the value is close to 1, it indicates that the geometric change at this scale has a significant single principal direction; when... When the value is close to 0, it indicates that the geometric transformation is approximately isotropic; To enhance robustness to noise and isolated outliers, scalar geometric quantities are optimized at multiple scales. Calculate the mean, variance, scale derivative, and absolute deviation of the median, including: Define the neighborhood weights for geometric confidence weighting: ; ; The purpose is to differentiate the weights of pixels with lower confidence levels by using the non-linear part within the parentheses. This naturally reduces the weights of pixels with lower confidence levels, minimizing the impact of unreliable geometric information such as noise normals, shadows, and highlights on curvature neighborhood statistics. For pixels with medium to high confidence levels, the weights are increased to better highlight key geometric features such as the true surface structure and defect edges. For confidence levels greater than curvature By assigning greater weights, the subsequent weighted mean and standard deviation can more closely approximate the true structure rather than a noisy distribution. Define the geometric confidence weighted mean and standard deviation of curvature: ; ; in, For the normalized kernel function, Represented by pixels Centered on, scale is The local neighborhood; To characterize the variation trend of geometric structure in the scale domain, the scale derivative is introduced: ; in, The scale step size; In addition, to enhance robustness to isolated outliers, median absolute bias is introduced: ; Through joint use , , and This is to distinguish noise points from real defects, such as cracks and gaps, and then at multiple scales. The calculations are performed on the above, and the mean, standard deviation, and anisotropy index of each scale are concatenated into a multi-scale geometric statistical vector: ; in, Indicates the first One scale, Indicates the total number of scales; S36. Construct a complete geometric condition field .
[0032] In subsequent steps, the geometric condition field is used as an input feature. On the one hand, it is input into the geometric perception normalization module in the generator to modulate the normalization parameters of the multi-scale feature map, making the generated defects more likely to appear in regions with corresponding geometric features. On the other hand, it is input into the geometric branch discriminator to judge the consistency between the appearance of the generated image and the geometric statistics, thereby forming a "geometry-appearance-physical" closed-loop constraint in adversarial training.
[0033] Preferably, step S4 specifically includes the following steps: S41. Transfer the defect prototype feature vector The image is mapped to a feature map with the same resolution as the image through a fully connected layer and upsampling operation, denoted as . ,in, Represents pixels on the image plane; simultaneously, the geometric condition field... Dimensionality is reduced to geometric conditional features through several convolutional layers. The two are concatenated along the channel dimension to obtain the joint conditional feature: ; The defect generation network employs an encoder-decoder structure. In the decoding stage, the intermediate features are modulated using a geometric perception normalization module. Let the first... Layer decoding feature map is Their mean and standard deviation are respectively... Due to conditional features Scale and offset parameters are predicted by a small convolutional subnetwork. The modulated characteristics are: ; in Based on conditional features Predicted by a small convolutional network; This embodiment employs an encoder-decoder U-Net generator. The encoding part uses 4 downsampling layers with channel numbers of [64, 128, 256, 512], while the decoding part symmetrically sets 4 upsampling layers with skip connections. A geometrically perceptual normalization model is introduced in each decoding layer to normalize the feature map. Perform normalized modulation: Through the above geometric perception normalization, regions with high curvature, concavity, significant anisotropy, and high geometric confidence have a stronger defect generation response in the feature space, thereby explicitly guiding defects to preferentially grow in physically reasonable curved surface regions in terms of spatial location and orientation. S42. Under this conditional generation structure, the defect generation network first outputs the initial defect phase field. It outputs a color / brightness residual map of the same size as the input image. Given a normal image The initial generated defect image is represented as: ; in, To map phase field values to intervals The normalization function, in this embodiment, is taken as... Mapping phase field values to intervals , ⊙ represents pixel-by-pixel multiplication. This residual overlay method modulates only the defective areas while maintaining the original background texture and overall lighting style. S43. To describe the evolution of defects on the inner wall surface, in the estimated unit normal field... curvature field and anisotropy index Based on this, a diffusion-response phase field model defined on the estimation surface is introduced, and a tangent space projection operator is constructed using the unit normal: ; in, Let the identity matrix be the surface gradient operator and the surface Laplacian operator: ; in, It is a planar gradient operator; Based on the above operators, the defect phase field The evolution is defined as a diffusion-reaction process: ; in, The diffusion coefficient is related to curvature and multi-scale geometric statistics. For the reaction term, The diffusion coefficient is selected as the defect nucleation threshold to reflect the modulating effect of curvature and anisotropy on the defect aggregation tendency. ; in, As the reference diffusion coefficient, To adjust the parameters, the example cannot be taken. , , The average anisotropy index at different scales is used to characterize directional regions including groove cracks and pit edges. This design makes diffusion more intense in regions with high curvature and strong anisotropy, and defects are more likely to initiate and extend along the main direction. Diffusion is suppressed in flat or isotropic regions, thus reflecting the physical prior that "defects preferentially develop in regions of stress concentration and geometric discontinuity". Obtained from multi-scale geometrical statistical vector regression: ; in, w Weights to be learned w Initialize as a Gaussian random vector with a mean of 0 and a standard deviation of 0.01 and update during training. The sigmoid function, the reaction function Adopting a bistable form: ; in, As the reaction strength parameter, this embodiment takes... The equation is in Two relatively stable states are formed nearby, and the intermediate state is easy to transition, which is beneficial to use the phase field interface to describe the formation process of defects from nothing to something. S44. To further improve the physical consistency of generated defects, the structure of the phase field partial differential equation is explicitly embedded into the forward propagation process of the generator network. In this step, a phase field evolution refinement layer is introduced at the generator output. Specifically, the initial phase field output by the generator network is refined... Considering the initial state of the above diffusion-reaction phase-field model, the values are calculated on the estimation surface according to discrete time steps. Total number of steps =5 evolutionary advancement: ; in, , will go through Phase field after step evolution The final defect phase field is used to generate defect images and calculate physical constraint loss. By explicitly expanding the phase field evolution in a finite number of steps within the generation network, the structure of the surface diffusion-reaction partial differential equation is embedded into the network in a differentiable manner. This allows the network to learn the initial defect distribution while automatically correcting the phase field morphology through a physical evolution refinement layer, improving the physical consistency of the generated defects. The final defect image is represented as follows: ; After obtaining the steady-state phase field Then, substituting it into the steady-state form of the diffusion-reaction phase-field model (i.e., making the time derivative term close to zero), we obtain the pixel. Physical residuals at the location: ; S45. To highlight the physical constraints near the defect interface and the geometrically reliable region, an interface-aware and geometrically modulated weighting function is constructed. First, the phase field value is used... Define interface weights: ; The weight is equal to 0 in the pure background and pure defect regions with phase field values of 0 and 1, respectively, and takes a larger value at the defect edge with a phase field value of 0.5; then the geometric confidence level is used. and the average anisotropy index at different scales Constructing geometric weights: ; in, To adjust the parameters, take The interface-geometry joint weight is defined as follows: ; Based on this, we define the physical prior loss: ; in, Total number of pixels It is a Charbonnier robust function. , As a small constant, this function is used to mitigate the influence of extreme residuals. Through interface-geometric weighting, the phase-field physical constraints are mainly concentrated on the defect edges and regions with high geometric confidence and strong anisotropy. This effectively constrains the evolution behavior of crack fronts and groove-shaped defect edges, reducing the interference of background and geometrically unreliable regions on the physical residuals. By jointly designing geometrically aware condition generation, a surface diffusion-reaction phase-field model, a phase-field evolution refinement layer, and interface-geometric weighted physical residuals, the geometric priors of the deep cavity surface are explicitly coupled with the phase-field physical model. This ensures that the generated defects maintain consistency with the actual physical mechanism of the inner wall of the curved deep cavity in terms of location distribution, morphological evolution, and interface structure.
[0034] This embodiment uses the obtained defect prototype features and the constructed depthless geometric condition field. Based on this, a geometrically sensed defect phase field is generated, and a diffusion-reaction phase field model and a phase field evolution refinement layer are introduced on the estimation surface to impose physical constraints on the spatial distribution and morphological evolution of the generated defects.
[0035] Preferably, step S5 specifically includes the following steps: S51. To separate material reflection from geometry and lighting, an albedo estimation subnetwork is introduced. To generate an image Input: Albedo ; Represents pixels albedo at that location It is a shallow network consisting of several convolutional layers; Using the obtained unit normal field Low-order spherical harmonic functions are used to model the incident lighting of the scene. For spherical harmonic basis functions, corresponding to illumination coefficients The illumination estimation subnetwork is derived from the generated image through regression. The network employs a 3-layer convolutional structure with [32, 64, 1] channels and ReLU activation. Illumination is modeled using a second-order spherical harmonic model with 9 basis functions per channel, totaling [number missing]. Illumination coefficient Obtained from global image features using a two-layer MLP, then at the pixel level... The predicted brightness at this location is: ; in, Using predefined spherical harmonic basis functions, extract the luminance channel from the generated image, denoted as . Then the illumination residual is defined as: ; Lighting residuals are used to represent the deviation between the brightness obtained by re-rendering the normals and lighting model and the actual generated brightness. S52. Considering the existence of areas in the deep cavity surface that are difficult to model accurately, such as high light saturation and deep shadows, construct the illumination confidence level. Weighting the illumination residuals of different pixels, including normalizing the brightness of the generated image. Select the high light threshold With shadow threshold Specular response and shadow response are defined as follows: ; in, For the slope parameter, take the slope parameter. Thus, the illumination confidence level is constructed: , in, The highlight and shadow penalty coefficients are taken as follows: , This indicates that the result will be cropped to... This design allows for optimal performance in areas with moderate brightness and predominantly diffuse reflection. The confidence level is relatively high, and it automatically decreases in areas of significant highlight or deep shadow. S53. Define illumination consistency loss based on illumination confidence and illumination residual: ; in, Total number of pixels ε light A small smoothing constant is used to improve the numerical stability of the loss function. In this embodiment... This loss, along with adversarial loss, geometric loss, and phase-field physical residuals, constitutes the generator's total loss during the training phase. It is used to backflip the generator and the albedo estimation subnetwork. And related parameters such as the illumination estimation subnetwork, without changing the forward generation process of the generated image.
[0036] By constraining the above-mentioned illumination consistency, based on the existing geometric and physical phase field priors, the brightness level is further constrained to ensure that the highlight position, shadow direction and estimated unit normal field and spherical harmonic illumination coefficient of the generated defect image are consistent with each other, so as to avoid the appearance of pseudo-defects with obvious contradictions between geometric shape and illumination effect, and improve the physical interpretability and visual rationality of the generated results.
[0037] This embodiment, based on the obtained unit normal field and the generated defect image, constructs an illumination consistency constraint based on a spherical harmonic illumination model. This constraint is used during the training phase to ensure that the brightness distribution of the generated defect image remains consistent with the estimated geometric and illumination parameters. This embodiment does not change the forward generation process of the generated image; it only outputs the illumination consistency loss. It is then used in conjunction with other losses in the subsequent generator total loss to optimize the generator network parameters.
[0038] Preferably, step S6 specifically includes the following steps: S61. Construct a multi-scale appearance branch discriminator. Geometric Consistency Branch Discriminator and prototype projection branch discriminator A multi-branch discriminator is constructed, and a hinge-type adversarial loss is uniformly adopted, wherein: A multi-scale appearance branch discriminator is used to determine whether the generated image is consistent with the real defect image in terms of texture details, noise distribution, and local structure, including construction. s =PatchGAN discriminator with 3 scales (512×512, 256×256, 128×128) The effects are applied to the original resolution image and its downsampled image, respectively, for the first... s =3 scales, given a real image With generated image The appearance branch discriminator loss is defined as: ; The corresponding generator appearance adversarial loss is: ; The total loss of the multi-scale appearance branch is obtained by averaging across all scales: ; This branch primarily constrains the generated images to closely approximate the distribution of real defect images in terms of overall visual appearance. The geometric consistency branch discriminator is used to determine whether the appearance of defects in an image is consistent with the geometric condition field. To achieve consistency, the current image and the corresponding geometric condition field are concatenated along the channel dimension to construct the geometric condition input: ; The stitching is performed only on the feature channels, spatially... Maintain alignment, geometric branch discriminator by and Given the input, its loss is defined as: ; The corresponding generator geometric adversarial loss is: ; In this branch, geometric condition fields Used only as a fixed-condition input, the corresponding geometric processing module parameters remain frozen during the training of the discriminator and generator, and do not accept gradient updates from the adversarial loss. Through the geometric consistency branch, unreasonable situations such as "geometric statistics indicate a smooth background but strong defects appear in the generated image" or "geometric statistics indicate a groove structure but the generated texture is obviously inconsistent with it" can be suppressed, thus explicitly introducing geometric-appearance consistency constraints in adversarial learning; To constrain the generated results and the learned defect prototype feature vector To achieve semantic consistency, a conditional discriminant branch in the form of prototype projection is introduced; let's assume that from the image... The extracted features are Vector representations are obtained by performing global average pooling on the intermediate layer feature maps. For real defect images Its corresponding defect prototype features are For generating images The corresponding defect prototype feature is the one used as input to the generator. ; Prototype projection branch discriminator The scoring format is defined as follows: ; in, For learnable weight vectors, For learnable matrices, This represents a score indicating the authenticity of the image features themselves. This characterizes the degree of consistency between image features and given defect prototype features; Prototype projection branch discriminator for intermediate layer features Perform global average pooling to obtain the vector and with defect prototype features They were sent together to the projection discriminator. ,in For learnable weight vectors, For a learnable matrix, the prototype projection branch discriminator and generator losses are respectively:
[0039] ; This branch constrains the generated image, controlled by a certain defect prototype feature vector, to match the prototype in terms of morphology and texture style, thus suppressing the generator from deviating from the statistical distribution of the defect type, pattern collapse, or prototype confusion in small sample scenarios. S62. Based on the above branches, the total loss of the discriminator and the total adversarial loss of the generator are respectively: ; ; in These are the weight coefficients for each branch; S63. Based on the total loss of the discriminator and the adversarial total loss of the generator, in order to ensure that the generated deep cavity surface defect images have high credibility in terms of appearance, geometry, and physics, the geometric total loss, physical prior loss, illumination consistency loss, and adversarial learning of the multi-branch discriminator are organically combined, and weighted parameters are selected. Total generator loss: ; in, As a balancing coefficient for different types of loss, this embodiment uses weighting parameters. .
[0040] This embodiment aims to simultaneously constrain the appearance realism of the generated defect image, its consistency with the geometric condition field, and its consistency with the features of the defect prototype. This step constructs a multi-branch, multi-scale conditional discriminator structure. The discriminator consists of a multi-scale appearance branch discriminator, a geometric consistency branch discriminator, and a prototype projection branch discriminator, all employing a hinge-based adversarial loss. The discriminator is only used during the training phase, and its output is the discrimination score of each branch and the corresponding adversarial loss, used to inversely constrain the generator without altering the forward generation process during the inference phase.
[0041] Preferably, in step S7, when outputting the deep cavity surface defect image after training according to the training settings, the training adopts an alternating update strategy: in each iteration, the generator is first fixed, and then minimized. Update the discriminator once, then fix the discriminator and minimize it. Update the generator once.
[0042] Under the above parameter configuration, this embodiment generates 50 sets of defect images for three types of defects—notches, missing blocks, and cracks—in the test set, and compares them with the corresponding real defect images. The statistical results obtained using peak signal-to-noise ratio (PSNR, dB, the higher the better), structural similarity (SSIM, the closer to 1 the better), learned perceptual similarity (LPIPS, the lower the better), and downstream false detection rate are shown in Table 1. Table 1
[0043] As shown in Table 1, the method proposed in this embodiment can stably generate high-quality defect images on three typical deep cavity surface defects: notches, missing blocks, and cracks. The PSNR of all three types of defects reaches above 28.5 dB, the SSIM is above 0.83, and the LPIPS is below 0.17, indicating that the generated images perform well in terms of pixel fidelity, structural similarity, and perceptual consistency. Furthermore, the false detection rate in downstream detection tasks is below 9%, indicating that the generated samples can effectively serve the training of the detection model. Among them, crack defects have the best PSNR and LPIPS, indicating that they perform best in terms of reconstruction fidelity and perceptual similarity; notch defects have better SSIM and false detection rate, indicating higher structural consistency and greater stability for downstream detection; missing block defects have slightly lower indicators, but are still at a good level overall. In summary, the method of this application has good generation effects and engineering application value for various typical deep cavity surface defects.
[0044] like Figure 2 As shown, another preferred embodiment of this application also provides a device for generating images of small-sample deep cavity surface defects, including: The preprocessing module is used for data preprocessing and training settings, including preprocessing deep cavity surface images containing normal and defective samples and setting training parameters. The statistics and sampling module is used for defect prototype statistics and Markov gated sampling, including performing prototype statistics and gated sampling on a small number of defect samples to obtain defect prototype feature vectors. The geometry condition construction module is used for geometry condition construction. It includes the geometry processing module, which obtains the unit normal field, mean curvature and geometric confidence map under the condition of no depth truth, and constructs the geometry condition field. The defect phase field generation and physical phase field constraint module is used for defect phase field generation and physical phase field constraint. Based on the defect prototype feature vector and the depthless geometric condition field, it performs geometrically sensed defect phase field generation, and introduces a diffusion-reaction phase field model and a phase field evolution refinement layer on the estimation surface to impose physical constraints on the spatial distribution and morphological evolution of the generated defects. The illumination consistency constraint module is used to construct illumination consistency constraints, including a multi-branch conditional discriminator as the discrimination end, which provides adversarial constraints from multiple aspects, while introducing physical prior constraints and illumination consistency constraints to ensure the physical and optical rationality of the generated results. The multi-branch discriminator and total loss construction module is used to construct the branch discriminator and total loss. It constructs a multi-branch discriminator consisting of a multi-scale appearance branch discriminator, a geometric consistency branch discriminator, and a prototype projection branch discriminator, and calculates the discriminator's total loss and the generator's adversarial total loss. The defect image output module is used to output deep cavity surface defect images after training based on the training settings.
[0045] The small-sample deep cavity surface defect image generation device provided in this embodiment adopts the small-sample deep cavity surface defect image generation method in the above embodiments. It solves the technical problem in existing technologies that, for deep cavity surface structures, it is difficult to provide near-realistic defect images due to the scarcity and uneven distribution of defect samples, complex surface geometry, and complex lighting conditions, thus failing to provide high-quality defect image training samples for downstream detection. Compared with the prior art, the beneficial effects of the small-sample deep cavity surface defect image generation device provided in this embodiment are the same as those of the small-sample deep cavity surface defect image generation method provided in the above embodiments, and other technical features in the small-sample deep cavity surface defect image generation device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0046] like Figure 3 As shown, a preferred embodiment of this embodiment also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the method for generating small sample deep cavity surface defect images in the above embodiment.
[0047] This embodiment also provides an electronic device that uses the small-sample deep cavity surface defect image generation method described in the above embodiments. This solves the technical problem that existing technologies, when dealing with deep cavity surface structures, struggle to provide near-realistic defect images due to the scarcity and uneven distribution of defect samples, complex surface geometry, and complex lighting conditions. Consequently, they are unable to provide high-quality defect image training samples for downstream detection. Compared with existing technologies, the beneficial effects of the electronic device provided in this embodiment are the same as those of the small-sample deep cavity surface defect image generation method described in the above embodiments. Furthermore, other technical features of the electronic device are the same as those disclosed in the methods of the above embodiments, and will not be elaborated upon here.
[0048] like Figure 4 As shown, a preferred embodiment of this application also provides a computer device, which may be a terminal or a liveness detection server, and its internal structure diagram may be as follows. Figure 4 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computational and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface is used to communicate with other external computer devices via a network connection. When the computer program is executed by the processor, it implements the steps of the aforementioned method for generating images of small-sample deep-cavity surface defects.
[0049] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the solution of this embodiment, and does not constitute a limitation on the computer device to which the solution of this embodiment is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0050] The computer device provided in this embodiment employs the small-sample deep cavity surface defect image generation method described in the above embodiments. This addresses the technical problem in the prior art that, when dealing with deep cavity surface structures, it is difficult to provide defects that closely resemble real-world conditions due to the scarcity and uneven distribution of defect samples, complex surface geometry, and complex lighting conditions. Consequently, it is unable to provide high-quality defect image training samples for downstream detection. Compared with the prior art, the beneficial effects of the computer device provided in this embodiment are the same as those of the small-sample deep cavity surface defect image generation method described in the above embodiments. Furthermore, other technical features in the electronic device are the same as those disclosed in the methods of the above embodiments, and will not be elaborated upon here.
[0051] A preferred embodiment of this application also provides a storage medium, the storage medium including a stored program, which, when the program is executed, controls the device where the storage medium is located to perform the steps of the small sample deep cavity surface defect image generation method in the above embodiments.
[0052] 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.
[0053] If the functions described in this embodiment are implemented as software functional units and sold or used as independent products, they can be stored in one or more computing device-readable storage media. Based on this understanding, the parts of this embodiment that contribute to the prior art or the technical solution can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a computing device (which may be a personal computer, server, mobile computing device, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this embodiment. The aforementioned storage media include: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media capable of storing program code.
[0054] Those skilled in the art will understand that the embodiments of this example can be provided as methods, systems, or computer program products. Therefore, this example can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this example can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code. The solutions in this example can be implemented using various computer languages, such as the object-oriented programming language C++ and the embedded programming language C.
[0055] This embodiment is described with reference to flowchart illustrations and / or block diagrams of the method, apparatus (system), and computer program product according to this embodiment. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A system that specifies functions in one or more boxes.
[0056] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including an instruction set implemented in a process. Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0057] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0058] This embodiment also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the small sample deep cavity surface defect image generation method described above.
[0059] The computer program product provided in this embodiment solves the technical problem in existing technologies for deep cavity curved surface structures, where it is difficult to provide near-realistic defects due to the scarcity and uneven distribution of defect samples, complex surface geometry, and complex lighting conditions, thus failing to provide high-quality defect image training samples for downstream detection. Compared with the prior art, the beneficial effects of the computer program product provided in this embodiment are the same as those of the small-sample deep cavity curved surface defect image generation method provided in the above embodiments, and will not be repeated here.
[0060] In the context of scarce defect samples, uneven type distribution, complex surface geometry, and complex lighting conditions, this application constructs a defect image generation method that can simultaneously consider the structural features of deep cavity surfaces and the actual defect distribution patterns. This makes the generated defects more closely resemble the real situation in terms of location, shape, and lighting, providing high-quality training samples for downstream detection.
[0061] Obviously, those skilled in the art can make various modifications and variations to this embodiment without departing from the spirit and scope of this embodiment. Therefore, if these modifications and variations of this embodiment fall within the scope of the claims of this embodiment and their equivalents, this embodiment is also intended to include these modifications and variations.
Claims
1. A method for generating images of small-sample deep cavity surface defects, characterized in that, Including the following steps: S1. Data preprocessing and training settings, including preprocessing deep cavity surface images containing normal and defective samples and setting training parameters; S2, Defect Prototype Statistics and Markov Gated Sampling, including performing prototype statistics and gated sampling on a small number of defect samples to obtain defect prototype feature vectors; S3, Geometric condition construction, including the geometric processing module obtaining the unit normal field, mean curvature and geometric confidence map under the condition of no depth truth, and constructing the geometric condition field; S4. Defect Phase Field Generation and Physical Phase Field Constraints: Based on the defect prototype feature vector and the depthless geometric condition field, geometrically sensed defect phase field generation is performed. A diffusion-reaction phase field model and a phase field evolution refinement layer are introduced on the estimation surface to impose physical constraints on the spatial distribution and morphological evolution of the generated defects. Specific steps include: S41. Transfer the defect prototype feature vector The image is mapped to a feature map with the same resolution as the image through a fully connected layer and upsampling operation, denoted as... ,in, Represents pixels on the image plane; simultaneously, the geometric condition field... Dimensionality is reduced to geometric conditional features through several convolutional layers. The two are concatenated along the channel dimension to obtain the joint conditional feature: ; The defect generation network employs an encoder-decoder structure. In the decoding stage, the intermediate features are modulated using a geometry-aware normalization module. Let the first... Layer decoding feature map is Their mean and standard deviation are respectively... Due to conditional features Scale and offset parameters are predicted by a small convolutional subnetwork. The modulated characteristics are: ; in Based on conditional features Predicted by a small convolutional network; S42. The defect generation network first outputs the initial defect phase field. It outputs a color / brightness residual map of the same size as the input image. Given a normal image The initial generated defect image is represented as: ; in, To map phase field values to intervals The normalization function, ⊙ represents pixel-wise multiplication; S43, in the estimated unit normal field curvature field and anisotropy index Based on this, a diffusion-response phase field model defined on the estimation surface is introduced, and a tangent space projection operator is constructed using the unit normal: ; in, Let the identity matrix be the surface gradient operator and the surface Laplacian operator: ; in, It is a planar gradient operator; Based on the above operators, the defect phase field The evolution is defined as a diffusion-reaction process: ; in, The diffusion coefficient is related to curvature and multi-scale geometric statistics. For the reaction term, The diffusion coefficient is selected as the defect nucleation threshold. ; in, As the reference diffusion coefficient, To adjust the parameters, It is the average value of the anisotropy index at different scales, used to characterize regions with obvious directionality, including groove cracks and pit edges; Obtained from multi-scale geometrical statistical vector regression: ; in, Weights to be learned The sigmoid function, the reaction function Adopting a bistable form: ; in, This is a parameter representing the reaction strength. S44. Generate the initial phase field output by the network. Considering the initial state of the above diffusion-reaction phase-field model, the values are calculated on the estimation surface according to discrete time steps. Total number of steps Evolutionary progress: ; in, , will go through Phase field after step evolution The final defect phase field is used to generate the defect image and calculate the physical constraint loss. The final defect image is represented as follows: ; After obtaining the steady-state phase field Then, substituting it into the steady-state form of the diffusion-reaction phase-field model, we obtain the pixel. Physical residuals at the location: ; S45, Utilizing phase field values Define interface weights: ; The weight is equal to 0 in the pure background and pure defect regions with phase field values of 0 and 1, respectively, and takes a larger value at the defect edge with a phase field value of 0.5; then the geometric confidence level is used. and the average anisotropy index at different scales Constructing geometric weights: ; in, To adjust the parameters, the interface-geometry joint weight is defined as follows: ; Based on this, we define the physical prior loss: ; in, Total number of pixels It is a Charbonnier robust function. , , being a small constant, is used to mitigate the effects of extreme residuals; S5. Construct illumination consistency constraints, and implement adversarial constraints from multiple aspects. At the same time, introduce physical prior constraints and illumination consistency constraints to ensure the physical and optical rationality of the generated results. S6. Construction of Multi-Branch Discriminator and Total Loss: A multi-branch discriminator is constructed, consisting of a multi-scale appearance branch discriminator, a geometric consistency branch discriminator, and a prototype projection branch discriminator. The total discriminator loss and the generator adversarial total loss are calculated. The multi-scale appearance branch discriminator is used to determine whether the generated image is consistent with the real defect image in terms of texture details, noise distribution, and local structure. The geometric consistency branch discriminator is used to determine whether the appearance of the defect in the image is consistent with the geometric condition field. The prototype projection branch discriminator is used to constrain the image generated by a certain defect prototype feature vector to match the prototype in terms of morphology and texture style. S7. Output the deep cavity surface defect image after training according to the training settings.
2. The method for generating images of small-sample deep cavity surface defects according to claim 1, characterized in that, Step S1 specifically includes the following steps: S11. First, perform center cropping and scaling on the deep cavity surface image to unify the input into a single image of size 512×512, and normalize the pixels to... interval; S12. Divide the dataset, which includes real defect samples and normal samples, into a training set and a validation set according to a set ratio; S13. Configure training hardware, optimizer, learning rate, batch size, and total number of training rounds.
3. The method for generating images of small-sample deep cavity surface defects according to claim 1, characterized in that, Step S2 specifically includes the following steps: S21, using a pre-trained feature extractor For each type of defect sample Feature extraction and statistics are performed to obtain feature vectors. ,in Indicates the defect type. Indicates the first under this type For each sample, calculate the class center for the same type of defect: ; in, Indicates the number of samples of this type; S22. Obtaining robust covariance using a contraction approach: ; in, The shrinkage coefficient, Sample covariance matrix, For trace operators, For feature dimension, It is the identity matrix; S23. During the generation process, new prototype feature vectors are generated by interpolating and superimposing Gaussian perturbations between feature vectors of the same defect type: ; in, To obtain samples of this type of defect Two feature vectors randomly selected from the data. , To ensure that the new prototype feature vector still falls within the statistical confidence region of the defect type feature due to Gaussian perturbation, we choose to calculate the mean vector of the prototype feature vector relative to the defect type feature. Mahalanobis distance: ; S24. Use a soft gating function to control sampling validity: ; in For the Sigmoid function, >0 represents the temperature parameter. Set the degrees of freedom to Chi-square distribution In quantiles The value at; S25, Gating weights With prototype feature vector A multilayer perceptron block is input together and mapped to a defect prototype feature vector. It is used to control the type and intensity of defects in the generator.
4. The method for generating images of small-sample deep cavity surface defects according to claim 3, characterized in that, Step S3 specifically includes the following steps: S31, Constructing the geometry processing module Without ground truth depth values, a normal estimation network can directly estimate the normal field from a sample image. After unitization, it becomes Estimate the geometric confidence level Through mathematical approximation Approximate mean curvature Finally, the three elements are used to construct a direction-sensitive, multi-scale, and robust geometric condition field to describe the local concavity and convexity of the deep cavity surface and its scale stability, wherein: ; Constrain the normal field to a unit normal field: ; ; S32, Calculate pixel points divergence at: ; To incorporate geometric confidence into curvature estimation, a piecewise confidence-weighted average curvature approximation is constructed. Different weighting functions are used for curvature estimation in different confidence intervals, making the curvature more sensitive to reliable geometric information and significantly suppressing unreliable geometric information, thereby obtaining a more stable average curvature that better reflects the true surface. ; Among them, in the high confidence interval Inside, Used to adjust the upper limit of the weight; Used to control the degree of influence of geometric confidence on curvature. , The larger the curvature, the more sensitive it is to confidence level, and the faster the weight increases within the high confidence interval; The smaller the value, the more gradual the growth, which is suitable for scenarios where the overall geometric estimation is relatively stable; right The curvature field is obtained by compression and normalization: ; S33. Without explicitly restoring the depth, construct a pseudo-depth gradient based on the unit normal, and introduce depth gradient integrability constraints and edge-aware smoothing constraints: First, the pseudo-depth gradient is estimated based on the normal, and then a confidence level is defined. Weighted integrability loss: ; in, These are the components of the unit normal. To prevent constants with a denominator of zero, It is considered an approximation of the depth gradient; To ensure the integrability of the pseudo-depth field, integrability weights jointly modulated by geometric confidence and image edges are introduced: ; in, Let x be the gradient of the input image at pixel x. The integrability loss is defined by the weight parameters: ; in, , This represents the total number of pixels involved in the loss calculation. Based on the integrability constraint, an edge-aware geometric smoothing term is introduced to suppress sharp fluctuations in curvature in non-edge regions, preserving necessary geometric details near the true edges. Edge weights are defined as follows: ; in, To control the effect of image gradients on smoothing intensity, a geometric smoothing loss is defined: ; in, , This represents the total number of pixels involved in the loss calculation; S34. Weight the two sub-losses, and define the total loss for geometric condition construction as follows: , in, , where is the weight parameter, and its gradient is isolated from the loss of the generator and discriminator. Only the geometry processing module updates the parameter through the geometric loss, avoiding the adversarial loss from interfering with the geometric estimation. S35. Define the kernel function In pixels Centered on, scale is Normalized two-dimensional Gaussian kernel: ; in, For pixels within the neighborhood, As the normalization factor, Represents pixels To pixel The distance; The gradient of the normal field in the image coordinate direction is denoted as . Using the finite difference operator to differentiate each channel, the geometric structure tensor is defined as follows: ; in, It is a symmetric positive semi-definite matrix. Reflecting spatial distance weight, Reflecting the confidence level of geometric estimation, It reflects the directionality and intensity of the change in normal; right Perform eigenvalue decomposition, and let the eigenvalues be... The corresponding feature vector is Therefore, the anisotropy index is: ; when When the value is close to 1, it indicates that the geometric change at this scale has a significant single principal direction; when... When the value is close to 0, it indicates that the geometric transformation is approximately isotropic; scalar geometry at multiple scales Calculate the mean, variance, scale derivative, and absolute deviation of the median, including: Define the neighborhood weights for geometric confidence weighting: ; ; The purpose is to differentiate the weights of pixels with lower confidence levels by using the non-linear part within the parentheses. This naturally reduces the weights of pixels with lower confidence levels, minimizing the impact of unreliable geometric information such as noise normals, shadows, and highlights on curvature neighborhood statistics. For pixels with medium to high confidence levels, the weights are increased to better highlight key geometric features such as true surface structures and defect edges. The value of can be used for confidence levels greater than 0. curvature By assigning greater weights, the subsequent weighted mean and standard deviation can more closely approximate the true structure rather than a noisy distribution. Define the geometric confidence weighted mean and standard deviation of curvature: ; ; in, For the normalized kernel function, Represented by pixels Centered on, scale is The local neighborhood; To characterize the variation trend of geometric structure in the scale domain, the scale derivative is introduced: ; in, The scale step size; In addition, to enhance robustness to isolated outliers, median absolute bias is introduced: ; Through joint use , , and In order to distinguish noise points from real defects, then at multiple scales The calculations are performed on the above, and the mean, standard deviation, and anisotropy index of each scale are concatenated into a multi-scale geometric statistical vector: ; in, Indicates the first One scale, Indicates the total number of scales; S36. Construct a complete geometric condition field .
5. The method for generating images of small-sample deep cavity surface defects according to claim 1, characterized in that, Step S5 specifically includes the following steps: S51. Introduce an albedo estimation subnetwork. To generate an image Input: Albedo ; Represents pixels albedo at that location It is a shallow network consisting of several convolutional layers; Using the obtained unit normal field Low-order spherical harmonic functions are used to model the incident lighting of the scene. For spherical harmonic basis functions, corresponding to illumination coefficients The value is obtained by regression from the generated image by the illumination estimation subnetwork, then at the pixel level... The predicted brightness at this location is: ; in, Using predefined spherical harmonic basis functions, extract the luminance channel from the generated image, denoted as . Then the illumination residual is defined as: ; Lighting residuals are used to represent the deviation between the brightness obtained by re-rendering the normals and lighting model and the actual generated brightness. S52, Constructing Illumination Confidence Weighting the illumination residuals of different pixels, including normalizing the brightness of the generated image. Select the high light threshold With shadow threshold Specular response and shadow response are defined as follows: ; in, Using the slope parameter, the illumination confidence level is constructed as follows: , in This represents the penalty coefficient for highlights and shadows. This indicates that the result will be cropped to... interval; S53. Define illumination consistency loss based on illumination confidence and illumination residual: ; in, Total number of pixels ε light It is a small smoothing constant, used to improve the numerical stability of the loss function.
6. The method for generating images of small-sample deep cavity surface defects according to claim 5, characterized in that, Step S6 specifically includes the following steps: S61. Construct a multi-branch discriminator consisting of a multi-scale appearance branch discriminator, a geometric consistency branch discriminator, and a prototype projection branch discriminator, and uniformly adopt a hinge-type adversarial loss, wherein: A multi-scale appearance branch discriminator is used to determine whether the generated image is consistent with the real defect image in terms of texture details, noise distribution, and local structure, including the construction of... s PatchGAN discriminator at various scales The effects are applied to the original resolution image and its downsampled image, respectively, for the first... A scale, given a real image With generated image The appearance branch discriminator loss is defined as: ; The corresponding generator appearance adversarial loss is: ; The total loss of the multi-scale appearance branch is obtained by averaging across all scales: ; The geometric consistency branch discriminator is used to determine whether the appearance of defects in an image is consistent with the geometric condition field. To achieve consistency, the current image and the corresponding geometric condition field are concatenated along the channel dimension to construct the geometric condition input: ; The stitching is performed only on the feature channels, spatially... Maintain alignment, geometric branch discriminator by and Given the input, its loss is defined as: ; The corresponding generator geometric adversarial loss is: ; Prototype projection branch discriminator The scoring format is defined as follows: ; in, For learnable weight vectors, For learnable matrices, This represents a score indicating the authenticity of the image features themselves. This characterizes the degree of consistency between image features and given defect prototype features; The prototype projection branch discriminator and generator losses are as follows: ; ; Here, the constraint generation result is compared with the defect prototype feature vector learned in step one. To achieve semantic consistency, a conditional discriminant branch of prototype projection form is introduced, assuming that from the image... The extracted features are Vector representations are obtained by performing global average pooling on the intermediate layer feature maps, which is useful for real defect images. Its corresponding defect prototype features are For generating images The corresponding defect prototype feature is the one used as input to the generator. ; S62. Based on the above branches, the total loss of the discriminator and the total adversarial loss of the generator are respectively: ; ; in These are the weight coefficients for each branch; S63. Define the total loss of the generator: ; in, This represents the balance coefficient for different types of loss.
7. A device for generating images of small-sample deep-cavity surface defects, used to implement the method as described in any one of claims 1 to 6, characterized in that, include: The preprocessing module is used for data preprocessing and training settings, including preprocessing deep cavity surface images containing normal and defective samples and setting training parameters. The statistics and sampling module is used for defect prototype statistics and Markov gated sampling, including performing prototype statistics and gated sampling on a small number of defect samples to obtain defect prototype feature vectors. The geometry condition construction module is used for geometry condition construction. It includes the geometry processing module, which obtains the unit normal field, mean curvature and geometric confidence map under the condition of no depth truth, and constructs the geometry condition field. The defect phase field generation and physical phase field constraint module is used for defect phase field generation and physical phase field constraint. Based on the defect prototype feature vector and the depthless geometric condition field, it performs geometrically sensed defect phase field generation, and introduces a diffusion-reaction phase field model and a phase field evolution refinement layer on the estimation surface to impose physical constraints on the spatial distribution and morphological evolution of the generated defects. The illumination consistency constraint module is used to construct illumination consistency constraints, which are counteracted from multiple aspects. At the same time, physical prior constraints and illumination consistency constraints are introduced to ensure the physical and optical rationality of the generated results. The multi-branch discriminator and total loss construction module is used to construct the branch discriminator and total loss. It constructs a multi-branch discriminator consisting of a multi-scale appearance branch discriminator, a geometric consistency branch discriminator, and a prototype projection branch discriminator, and calculates the discriminator's total loss and the generator's adversarial total loss. The defect image output module is used to output deep cavity surface defect images after training based on the training settings.
8. An electronic device, the electronic device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, when the processor executes the computer program, it implements a method for generating small-sample deep-cavity surface defect images as described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the method for generating small sample deep cavity surface defect images as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Electric spindle temperature measuring point optimization selection method based on finite element thermal analysis
CN115795938A
Device crack identification method and device
CN116778237A