Product surface defect detection method based on MSAP-YOLO model
By optimizing the network architecture using the MSAP-YOLO model, the problems of insufficient real-time performance and missed detection of small defects in existing technologies are solved, enabling efficient and accurate detection of complex defects, which is applicable to the field of industrial vision inspection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-12
- Publication Date
- 2026-03-17
AI Technical Summary
Existing industrial vision inspection technologies suffer from problems such as insufficient real-time performance, missed detection of small defects, poor adaptability to deformation, and sample imbalance in the detection of surface defects on products, making it difficult to meet the needs of high-speed production lines and the identification of minute defects.
A product surface defect detection method based on the MSAP-YOLO model is adopted. By introducing a dynamic convolution module, a fine-grained detection head, and a shape-aware loss function, and combining the R3GAN generative model with traditional data augmentation methods, a hybrid data augmentation strategy is constructed to optimize the network architecture and improve detection efficiency and accuracy.
It significantly reduces computational complexity and processing latency, enhances the ability to perceive small-sized defects, achieves accurate localization and efficient detection of complex geometric deformation defects, and improves the robustness and generalization ability of the model.
Smart Images

Figure CN121685474A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial visual inspection technology, and in particular to a method for detecting product surface defects based on the MSAP-YOLO model. Background Technology
[0002] Industrial visual defect detection plays a crucial role as a core technology for quality control in modern intelligent manufacturing. Traditional methods mainly rely on manual visual inspection or detection schemes based on traditional image processing algorithms, but these methods are no longer sufficient to meet the high standards of efficiency, accuracy, and consistency required by modern production lines. Manual inspection suffers from problems such as strong subjectivity, fatigue, low efficiency, and high cost; while traditional machine vision algorithms lack generalization ability when faced with complex and varied defect types with indistinct features, especially in the digital manufacturing industry, where surface defects such as dirt, scratches, dents, and paint peeling not only affect the product's appearance but may also indicate potential structural or functional problems. Currently, the industry still relies mainly on manual inspection or traditional image processing, but the former is easily influenced by human experience, leading to inconsistent inspection standards, while the latter shows a significant decrease in accuracy in identifying defects in complex backgrounds or with low contrast.
[0003] In recent years, deep learning methods based on convolutional neural networks (CNNs) have achieved automatic defect identification and localization through end-to-end learning, improving the level of automation. Existing deep learning methods can be divided into two categories: image segmentation and object detection. Object detection-based methods can be further categorized into two-stage and single-stage models based on their network structure. Despite progress, challenges remain in practical industrial applications, such as poor real-time performance, high false negative rates for small defects, and limited model generalization ability. In product surface defect detection, existing methods struggle to meet the stringent requirements of high-speed production lines and the identification of minute defects.
[0004] Specifically, the existing technologies most similar to this invention fall into three categories: The first category is segmentation network-based methods, such as U-Net or DeepLabv3+, which use an encoder-decoder architecture to achieve pixel-level segmentation. While these methods can provide accurate defect shape information, they suffer from high computational complexity, slow inference speed, and multiple downsampling leads to the loss of small defect features and blurred boundary localization. The second category is two-stage network-based methods, such as Faster R-CNN or Mask R-CNN, which achieve high-precision localization through the collaborative work of a region proposal network (RPN) and a detection network. However, the serial processing of the two stages results in large inference delays, and the imbalance between positive and negative samples affects the detection of rare defects. Furthermore, the preset anchor point mechanism is difficult to adapt to defects with varied shapes. The third category is single-stage network-based methods, such as YOLO or SSD, which use an end-to-end framework to balance accuracy and speed. However, the shallow detection branch has insufficient resolution, limited ability to perceive extremely small defects, and the fixed receptive field of standard convolution is difficult to model complex geometric deformations. The loss function has weak ability to distinguish difficult samples.
[0005] In summary, existing technologies generally suffer from insufficient real-time performance, missed detection of small defects, poor adaptability to deformation, and sample imbalance, which limit their large-scale application in industrial scenarios. This invention addresses these limitations by proposing an innovative solution. Summary of the Invention
[0006] This invention addresses the problems of high computational complexity of existing segmentation networks, large inference latency of two-stage networks, and insufficient accuracy of small defect detection in single-stage networks by providing a product surface defect detection method based on the MSAP-YOLO model.
[0007] To achieve the above-mentioned objectives, the technical solution adopted by the present invention is as follows:
[0008] A product surface defect detection method based on the MSAP-YOLO model includes the following steps:
[0009] S1. In the data acquisition stage, a line scan camera is used to collect images of the products on the production line from all angles.
[0010] S2. In the data annotation stage, annotation tools are used to annotate the collected images. The annotation objects include four types of defects: dirt, scratches, dents, and paint peeling.
[0011] S3. Data preprocessing stage: Obtain the original product surface image dataset X;
[0012] S4. In the hybrid data augmentation stage, the original dataset X is augmented using the R3GAN generative model and the traditional data augmentation method to generate the augmented dataset X*.
[0013] S5. Construct a detection model based on the MSAP-YOLO architecture. The model includes: introducing a dynamic convolutional module (DynBlock) into the backbone network to achieve adaptive sampling, designing a fine-grained detection head (FGDH) to increase high-resolution shallow detection branches, and introducing a shape-aware loss function (SAW) to combine shape-aware mechanisms and geometric distribution modeling.
[0014] S6. In the defect detection inference stage, the trained MSAP-YOLO network is used to predict the product surface image, output the defect category, location coordinates and confidence score, and filter the detection results according to the threshold.
[0015] Furthermore, the mixed data augmentation in step S4 includes:
[0016] S41. Traditional data augmentation methods, including random rotation, flipping, translation, and brightness adjustment, are applied to both the original and generated images.
[0017] S42. High-quality defect images are generated using the R3GAN generative model. R3GAN, an advanced generative adversarial network that abandons the redundancy techniques of traditional GANs, is composed of a regularized relative adversarial loss (RpGAN+R1+R2) and an improved ResNet backbone architecture. This architecture incorporates optimized designs such as grouped convolutions and inverted bottlenecks, and adopts a non-normalized layer scheme. While ensuring training stability, it effectively alleviates the pattern collapse phenomenon, accurately learns the distribution of real defect features, and generates visually realistic synthetic defect images, thereby effectively supplementing the sample quantity of scarce defect categories. The core loss function of R3GAN is defined as follows:
[0018] The basic Relative Adversarial Loss (RpGAN) constructs relative discriminative logic between samples by coupling the discriminator outputs of real samples and generated samples, avoiding the pattern loss problem caused by a single decision boundary. Its formula is:
[0019] Where θ and ψ are the generators G and ψ, respectively. θ With discriminator D ψ Network parameters; z is derived from the prior distribution p z The sampled latent vector; x is the vector from the real data distribution p. D Sampled real defect images; G θ (z) is the synthetic defect image generated by the generator based on the latent vector z; This is the discriminant's output. To generate the difference in discrimination scores between the sample and the real sample, a relative discrimination logic is constructed; This is the activation function used to smoothly transform the difference in discrimination scores; This represents taking the expectation of both the potential distribution and the actual data distribution simultaneously. This loss avoids the gradient vanishing problem caused by discriminator saturation in traditional GANs through a relative comparison mechanism.
[0020] The zero-center gradient penalty term imposes constraints on both the real and generated data distributions, limiting the norm of the discriminator's gradient and thus preventing gradient explosion and oscillations during training, ensuring model convergence stability. Their formulas are as follows:
[0021]
[0022]
[0023] Where R1(ψ) and R2(θ,ψ) are the zero-center gradient penalty terms on the real data distribution and the generated data distribution, respectively; γ is the gradient penalty strength coefficient; and These represent the expectations for the actual data distribution and the generated data distribution, respectively. This is the gradient of the discriminator output relative to the input $x$; It is the square of the L2 norm.
[0024] Furthermore, the dynamic convolution module (DynBlock) in step S5 employs a deformable convolution mechanism, and its output feature map... The calculation formula is:
[0025]
[0026] in: Indicates the position on the output feature map; Indicates the first Standard grid positions for each sampling point; The offset obtained through learning is used to adaptively adjust the sampling position; This is a modulation scalar used to adjust the contribution weight of the sampling points; These are the convolution weights; This represents the total number of sampling points.
[0027] Furthermore, the shape-aware loss function (SAW) in step S5 combines the Shape-IoU mechanism and the normalized Wasserstein distance (NWD), and is defined as follows:
[0028]
[0029] in: , and These are shape loss terms for width and height, respectively, used to measure the shape deviation of the bounding box;
[0030] ,in Represents the Wasserstein distance, used to model the geometric distribution of the bounding box. and These are Gaussian distributions representing the predicted bounding box and the ground truth bounding box, respectively. This is the normalization constant;
[0031] These are balancing parameters used to adjust the weights of Shape-IoU and NWD.
[0032] Furthermore, in step S5, the fine-grained detection head (FGDH) adds a high-resolution shallow detection branch to the original three-layer detection head, and realizes bidirectional feature fusion and multi-scale information interaction through the FPN-PAN architecture to preserve the detailed features of small target defects.
[0033] Furthermore, the R3GAN generative model in step S4 adopts regularized relative adversarial loss and an improved ResNet backbone architecture, abandoning traditional redundant techniques such as batch normalization. This effectively alleviates pattern collapse while ensuring training stability, and generates high-quality defective synthetic samples.
[0034] Furthermore, the conventional data augmentation methods also include at least one of noise injection, contrast adjustment, and scaling transformation to further enhance data diversity.
[0035] Furthermore, the offset in the dynamic convolution module (DynBlock) and modulation scalar It learns from the input feature map through convolutional layers to achieve end-to-end adaptive sampling.
[0036] Furthermore, the Wasserstein distance in the shape-aware loss function is calculated based on the Gaussian distribution model of the bounding box. The geometric similarity between the predicted box and the ground truth box is measured by the center point coordinates and width and height parameters. The normalization constant C is set as the average diagonal length of the bounding boxes in the dataset to achieve cross-scale loss stability.
[0037] A computer device 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 above-described product surface defect detection method.
[0038] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method for detecting surface defects in a product.
[0039] Compared with the prior art, the advantages of the present invention are as follows:
[0040] 1. This invention significantly reduces the computational complexity of the model by adopting a single-stage detection scheme, making the detection process more efficient and smooth. Compared with traditional segmentation networks, this design reduces the number of network parameters and computational burden, better adapting to the real-time requirements of industrial environments and improving the response speed and practicality of the detection system.
[0041] 2. By introducing a fine-grained detection head and a high-resolution detection branch, this invention effectively enhances the ability to detect small-sized defects. This design preserves the detailed features of minute defects, such as the subtle textures of scratches and stains, thereby significantly reducing the false negative rate and ensuring comprehensive and accurate detection.
[0042] 3. The shape-aware loss function and target detection framework employed in this invention avoid information loss during the upsampling process, achieving precise localization of defect boundaries. This not only improves the measurement accuracy of defect geometry but also provides a more reliable basis for quality assessment, enhancing the overall reliability of the inspection.
[0043] 4. Compared to two-stage networks, the end-to-end single-stage framework of this invention eliminates redundant steps in candidate region generation and simplifies the inference process. This optimization significantly reduces processing latency, enabling the system to meet the efficiency requirements of high-speed production lines and enhancing the immediacy and applicability of detection.
[0044] 5. By combining the R3GAN generative model with a traditional data augmentation strategy, this invention effectively alleviates the problems of sample scarcity and class imbalance. This method increases the sample diversity of rare defect categories, improves the model's ability to identify uncommon defects, and thus increases recall.
[0045] 6. An adaptive sampling mechanism using a dynamic convolution module is introduced, enabling the model to flexibly handle diverse defect shapes. This design breaks through the limitations of fixed anchor points or standard convolution, enhancing the modeling ability for irregular defects such as thin scratches or planar stains, and significantly improving detection accuracy.
[0046] 7. This invention incorporates a dynamic convolution module into shallow features, enhancing its adaptability to complex geometric deformation defects. By overcoming the constraints of a fixed receptive field, the model can more accurately identify defects with distorted or irregular shapes, improving its performance in complex industrial scenarios.
[0047] 8. A shape-aware loss function is employed to provide stable supervision signals for difficult samples, such as defects with low contrast or blurred boundaries. This mechanism reduces reliance on complex loss functions, effectively reduces false positives and false negatives, and improves the model's robustness and generalization ability. Attached Figure Description
[0048] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0049] Figure 1 This is a schematic diagram of the data augmentation method in an embodiment of the present invention;
[0050] Figure 2 This is an overall architecture diagram of MSAP-YOLO in an embodiment of the present invention. Detailed Implementation
[0051] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0052] This invention provides a product surface defect detection method based on MSAP-YOLO, comprising the following steps:
[0053] S1. In the data acquisition phase, high-resolution line scan cameras (such as the Basler series) are installed along the production line to capture omnidirectional images of moving products (such as speakers). Acquisition settings ensure uniform lighting (using linear light sources) and avoid glare or shadows, capturing 5-10 frames per second to cover the entire product surface. After acquisition, the images are manually annotated using data annotation tools (such as Labelme).
[0054] S2, Data Labeling Stage: The acquired images are finely labeled. The labeling focuses on four typical defects: dirt, scratches, dents, and paint peeling. Each defect region requires a bounding box and category label, forming a structured labeled dataset to provide supervisory signals for model training.
[0055] S3. In the data preprocessing stage, the original dataset X is standardized, including image size normalization, brightness correction and noise filtering, in order to eliminate the variation factors introduced during the acquisition process and improve data consistency and model generalization ability.
[0056] S4. In the hybrid data augmentation stage, the R3GAN generative model and traditional data augmentation methods are used to augment the original data and generate an augmented dataset X*.
[0057] S41. Apply random rotation, flipping, translation, and brightness adjustment transformations to the original and generated images to simulate changes in viewpoint and lighting in actual production.
[0058] S42. High-quality defect images are synthesized using the R3GAN generative model. R3GAN, as an advanced generative adversarial network that abandons the redundancy techniques of traditional GANs, ensures training stability through regularized relative adversarial loss and an improved ResNet architecture. It can accurately learn the distribution of real defect features and generate synthetic samples with high visual realism. This data augmentation method is as follows: Figure 1 As shown, it specifically includes:
[0059] S421 and R3GAN employ generators. and discriminator A dual-network structure is used, with the generator sampling from the latent space. Generate synthetic defect images The discriminator is responsible for distinguishing the real image x from the generated image;
[0060] S422. Introduce a regularized relative adversarial loss function (RpGAN+R1+R2). The total loss function is: The relative adversarial loss is achieved by comparing the real sample x with the generated sample. Discriminator score difference A relative discrimination logic is constructed, which avoids the problems of pattern loss and discriminator saturation caused by a single decision boundary;
[0061] S423. Introduce zero-center gradient penalty terms R1 and R2 to impose constraints on the real data distribution and the generated data distribution, respectively: By limiting the discriminator gradient norm, gradient explosion and oscillation during training are avoided, thus ensuring the model's convergence stability.
[0062] S424 adopts an improved ResNet backbone architecture, integrates optimized designs such as grouped convolution and inverted bottleneck, and abandons traditional redundant techniques such as batch normalization and spectral normalization, effectively alleviating the mode collapse phenomenon while ensuring training stability.
[0063] S425. Through the above mechanism, R3GAN can efficiently learn the texture, morphology and distribution features of real defects, generate diverse high-quality synthetic defect samples, effectively supplement the number of samples of scarce defect categories, and alleviate the problem of data imbalance.
[0064] S5. Construct a detection model based on the MSAP-YOLO architecture, specifically including:
[0065] S51. Introduce a dynamic convolutional module (DynBlock) into the backbone network to achieve adaptive sampling by learning the offset and modulation scalar. This enables the model to adaptively model irregular defect shapes;
[0066] S52. Design a fine-grained detection head (FGDH), which adds a high-resolution shallow detection branch to the original three-layer detection head to retain more details of small targets. It achieves bidirectional feature fusion and multi-scale information interaction through the FPN-PAN architecture.
[0067] S53. Introduce the Shape-Aware Loss Function (SAW), and combine the Shape-IoU shape-aware mechanism with the geometric distribution model of the normalized Wasserstein distance. , The final loss function is ;
[0068] The overall architecture of MSAP-YOLO is as follows: Figure 2 As shown, the interaction relationships between components are clearly presented.
[0069] S6. In the defect detection inference stage, the trained MSAP-YOLO network is used to predict the product surface image. The detection results are output through forward inference of the network, including defect category, location coordinates and confidence score. Valid detection results are filtered according to the set threshold to complete the product surface defect detection.
[0070] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0071] In another embodiment of the present invention, a terminal device is provided, comprising a processor and a memory. The memory stores a computer program, which includes program instructions. The processor executes the program instructions stored in the computer storage medium. The processor may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing and control core of the terminal, suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions to achieve a corresponding method flow or corresponding function. The processor described in this embodiment of the present invention can be used for the operation of a product surface defect detection method.
[0072] In another embodiment of the present invention, a storage medium is provided, specifically a computer-readable storage medium (Memory). This computer-readable storage medium is a memory device in a terminal device used to store programs and data. It is understood that the computer-readable storage medium here can include both the built-in storage medium in the terminal device and extended storage media supported by the terminal device. The computer-readable storage medium provides storage space that stores the terminal's operating system. Furthermore, this storage space also stores one or more instructions suitable for loading and execution by a processor. These instructions can be one or more computer programs (including program code). It should be noted that the computer-readable storage medium here can be high-speed RAM or non-volatile memory, such as at least one disk storage device.
[0073] One or more instructions stored in a computer-readable storage medium can be loaded and executed by a processor to implement the corresponding steps of the product surface defect detection method in the above embodiments; one or more instructions in the computer-readable storage medium are loaded and executed by a processor.
[0074] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0075] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0076] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A product surface defect detection method based on a MSAP-YOLO model, characterized in that, The method comprises the following steps: S1, a data acquisition stage, using a linear array camera to collect images of products on a production line in all directions; S2, a data labeling stage, using a labeling tool to label the collected images, and the labeled objects include four types of defects, namely, dirt, scratch, dent, and paint loss; S3, a data preprocessing stage, obtaining an original product surface image dataset X; S4, a mixed data augmentation stage, using an R3GAN generative model and a traditional data augmentation method to augment the original dataset X to generate an augmented dataset X*; S5, constructing a detection model based on an MSAP-YOLO architecture, the detection model comprising: introducing a dynamic convolution module into a shallow network to realize adaptive sampling, designing a fine-grained detection head to increase a high-resolution shallow detection branch, and introducing a shape-aware loss function to accelerate convergence and improve positioning accuracy through boundary box Gaussian distribution modeling; S6, a defect detection reasoning stage, using the trained MSAP-YOLO network to predict product surface images, outputting defect categories, position coordinates, and confidence scores, and screening the detection results according to a threshold.
2. The method of claim 1, wherein, The mixed data augmentation in the step S4 comprises: S41, using a traditional data augmentation method of random rotation, flipping, translation, and brightness adjustment on original images and generated images; S42, using an R3GAN generative model to generate high-quality defect images, and the core loss function of R3GAN is defined as follows: The basic relative confrontation loss RpGAN is constructed by coupling the discriminator outputs of the real samples and the generated samples, and the relative discrimination logic between the samples is constructed to avoid the mode loss problem caused by the single decision boundary, and the formula is: ; Where θ and ψ are the generators G and ψ, respectively. θ With discriminator D ψ Network parameters; z is derived from the prior distribution p z The sampled latent vector; x is the vector from the real data distribution p. D Sampled real defect images; G θ (z) is the synthetic defect image generated by the generator based on the latent vector z; This is the discriminant's output. To generate the difference in discrimination scores between the sample and the real sample, a relative discrimination logic is constructed; This is the activation function used to smoothly transform the difference in discrimination scores; This means taking the expectation of both the potential distribution and the actual data distribution simultaneously; A zero-centered gradient penalty term: constraints are imposed on the real data distribution and the generated data distribution respectively to limit the norm of the discriminator gradient, and the formulas are respectively: ; ; where R1(ψ) and R2(θ, ψ) are zero-centered gradient penalty terms on the real data distribution and the generated data distribution, respectively; and γ is a gradient penalty strength coefficient; and denote the expectation over the real data distribution and the generated data distribution, respectively; is the gradient of the discriminator output with respect to the input x; is the square of the L2 norm.
3. The method of claim 1, wherein, The dynamic convolution module in the step S5 adopts a deformable convolution mechanism, and the output feature map of the dynamic convolution module is The calculation formula is: ; wherein: represents a position on the output feature map; represents a standard grid position of the th sampling point; is an offset obtained by learning, for adaptively adjusting the sampling position; is a modulation scalar, for adjusting the contribution weight of the sampling point; is a convolution weight; is the total number of sampling points.
4. The method of claim 1, wherein, The shape-aware loss function in the step S5 combines the Shape-IoU mechanism and the normalized Wasserstein distance, and is defined as: ; wherein: , and are width and height shape loss terms, respectively, to measure the shape deviation of the bounding box; wherein denotes the Wasserstein distance modeling the geometric distribution of the bounding boxes, and are the Gaussian distribution representation of the predicted and ground truth boxes, respectively, is a normalization constant; is a balancing parameter used to adjust the weights of Shape-IoU and NWD.
5. The method of claim 1, wherein, The fine-grained detection head in the step S5 increases a high-resolution shallow detection branch on the basis of the original three-layer detection head, and realizes bidirectional feature fusion and multi-scale information interaction through an FPN-PAN architecture to retain the detailed features of small target defects.
6. The method of claim 1, wherein, The R3GAN generative model in the step S4 uses a regularization relative adversarial loss and an improved ResNet backbone architecture to effectively alleviate mode collapse while ensuring training stability, and generates high-quality defect synthetic samples.
7. The method of claim 2, wherein, The traditional data augmentation method further comprises at least one of noise injection, contrast adjustment, and scaling transformation to further enhance data diversity.
8. The method of claim 3, wherein, The offset in the dynamic convolution module And the modulation scalar Learned from the input feature map by the convolution layer to achieve end-to-end adaptive sampling.
9. The method of claim 4, wherein, The Wasserstein distance in the shape-aware loss function is calculated based on boundary box Gaussian distribution modeling, and the geometric similarity between the predicted box and the real box is measured through the center point coordinates and the width and height parameters, and the normalization constant C is set as the average diagonal length of the boundary box of the dataset.
10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the product surface defect detection method of any one of claims 1 to 9 when executing the computer program.