An industrial surface defect detection method and system based on sampling disturbance optimization and history reuse

By employing sampling-based perturbation optimization and history reuse mechanisms, the problems of high computational overhead and poor generalization ability of deep learning models in industrial environments are solved, achieving efficient training and improved robustness, making it suitable for industrial surface defect detection.

CN122176411APending Publication Date: 2026-06-09GUILIN UNIV OF ELECTRONIC TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUILIN UNIV OF ELECTRONIC TECH
Filing Date
2026-03-27
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing deep learning defect detection models have high computational overhead during training and optimization, are prone to getting stuck in sharp minima, resulting in poor generalization ability and difficulty in efficient deployment in industrial environments.

Method used

We employ a sampling-based perturbation optimization and history reuse mechanism. By reusing historical state tensors in GPU memory and combining them with random sampling within the topological hypersphere, we replace the expensive adversarial gradient calculation with the loss function to find a flat minimum.

Benefits of technology

It significantly reduces training computational overhead, improves model generalization ability and robustness, meets industrial-grade deployment requirements, and reduces false negative and false positive rates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122176411A_ABST
    Figure CN122176411A_ABST
Patent Text Reader

Abstract

The application discloses an industrial surface defect detection method and system based on sampling disturbance optimization and history reuse, and relates to the technical field of industrial visual defect detection. In view of the problems that the background of an industrial defect image is complex, the loss topography is highly non-convex, which leads to model overfitting, and the traditional sharpness perception minimization algorithm relies on double back propagation, which leads to excessive algorithm cost, a lightweight optimization method is provided. The method introduces a sampling sharpness estimation mechanism in the network parameter update stage, generates a disturbance tensor by sampling within the preset norm boundary to explore the flat minimum value, and introduces a history reuse mechanism to dynamically evaluate and reuse the historical state, so as to bypass the back propagation calculation of the current calculation graph in part of the training period. With less memory cost, the application greatly reduces the disturbance calculation cost, effectively crosses the non-convex loss valley, significantly improves the generalization accuracy of industrial surface defect detection, and has a wide application prospect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial visual defect detection and artificial intelligence optimization technology, specifically to the application of an industrial surface defect detection method and system based on sampling perturbation optimization and historical reuse. Background Technology

[0002] In modern industrial manufacturing such as steel metallurgy, surface defects in steel (such as cracks, inclusions, spots, pitting, iron oxide scale, and scratches) are not only numerous but also exhibit no fixed distribution, seriously affecting product quality. Traditional inspection methods rely heavily on manual inspection or simple machine vision image processing algorithms, resulting in high false negative rates and difficulty in adapting to complex industrial environments.

[0003] In recent years, artificial intelligence technology has been widely used in industrial defect detection. However, because industrial defect images are often accompanied by a large amount of high-frequency background noise (such as water stains and oxide scale interference), the loss landscape in the high-dimensional feature space of the model during training exhibits extremely rugged and non-convex characteristics. Traditional SGD or AdamW optimizers are prone to getting trapped in sharp local minima, resulting in poor generalization ability and a high risk of overfitting in actual production lines.

[0004] To address this issue, the academic community proposed the Sharpness-Aware Minimization (SAM) algorithm (hereinafter referred to as the standard SAM algorithm), which improves the model's generalization ability by simultaneously optimizing the loss function and finding the flat minimum of the loss terrain. However, the standard SAM algorithm must perform two complete backpropagation calculations in each parameter update cycle, directly doubling the training time per session. In edge computing nodes or control cabinets with limited computing power in industrial environments, the standard SAM algorithm introduces severe computational redundancy, making it difficult to meet the needs of large-scale industrial deployments. Summary of the Invention

[0005] The purpose of this invention is to overcome the shortcomings of existing deep learning defect detection models, such as high computational cost during training and optimization, and easy getting stuck in sharp minima leading to weak generalization ability. This invention provides an industrial surface defect detection method and system based on sampling perturbation optimization and history reuse.

[0006] This invention provides an industrial surface defect detection method based on sampling-based perturbation optimization and history reuse. The overall flowchart of the method is as follows: Figure 1 As shown, it includes the following steps:

[0007] Step 1: Combining Figure 2 The diagram illustrates the data preprocessing process, which involves acquiring image data of surface defects on the industrial entity to be detected and preprocessing them into multidimensional feature tensors, which are then input into a deep neural network deployed in video memory.

[0008] Specifically, let the input image batch tensor be... (in (These represent batch size, number of channels, height, and width, respectively), with the corresponding true defect label y. The deep neural network is represented as... ,in The parameters are weights for the current period of the network, and the output is the prediction result of the specific type of defect.

[0009] Step 2: When entering the network parameter update cycle t of the deep neural network, determine whether the current cycle meets the preset historical reuse trigger condition. The specific determination operation is as follows:

[0010] Calculate the interval between the current period t and the last historical reuse t'. Its mathematical expression is:

[0011]

[0012] when ( (For the preset reuse trigger interval) or ( When the set memory load threshold is reached, it is determined that the historical reuse trigger condition is met.

[0013] Step 3: As Figure 3 As shown in the reuse and sampling scheduling logic diagram, based on the determination result of step 2, a dual-branch logic is triggered:

[0014] Branch 1: When the triggering condition is met, the history reuse mechanism is triggered, and the history state tensor of cycle t' is read directly from the high-speed buffer of video memory through low-level addressing instructions. And assign the value to the perturbation tensor of the current period. At the same time, the backpropagation process of the current cycle calculation graph is bypassed;

[0015] Branch 2: When the triggering condition is not met, activate the sampling-based sharpness estimation module, within the preset range. Random sampling is performed within the norm constraint boundaries. Specifically, this includes:

[0016] Constructing the boundary of a topological hypersphere ,in Let this be the perturbation radius. A pseudo-random number generator is used to perform uniform sampling within this boundary:

[0017]

[0018] Generate lightweight candidate perturbation tensors (in The k candidate perturbation tensors are input into the evaluation module, and the optimal candidate perturbation tensor is selected. .

[0019] Specifically, the evaluation module will calculate sharpness based on the following formula:

[0020]

[0021] The candidate perturbation tensor with the highest sharpness is selected as the lightweight approximate perturbation tensor. Output.

[0022] Step 4: Convert the perturbation tensor Superimposed on the tensor corresponding to the parameter weights The parameters are perturbed as described above. Based on the perturbed weights, backpropagation is performed to calculate the gradient, and the network parameters are corrected accordingly, as follows:

[0023] Define the sharpness-perceiving loss function with perturbation as follows: Calculate the approximate gradient based on the perturbation weights. Using a base optimizer (such as Adam or SGD) with a learning rate Update network parameters to guide the model to converge toward the flat minimum region of the loss plane: ;

[0024] Step 5: Solidify the trained and converged deep neural network and deploy it on the quality inspection terminal equipment of the industrial production line to perform inference on the collected physical surface images and output control signals that represent the specific type of defects.

[0025] The beneficial effects of adopting the above technical solution are as follows:

[0026] Significantly reduced training computational overhead: By introducing a history reuse mechanism, adaptive scheduling is achieved using real-time GPU memory. Experiments show that when training on the industrial surface defect dataset NEU-CLS-64, as... Figure 3 As shown, compared with the standard Sharpness-Aware Minimization (SAM) algorithm, the method of the present invention reduces the peak memory usage by 14.35% while shortening the average total training time by 45.75%, which greatly alleviates the computing power bottleneck of industrial edge devices.

[0027] Improving the generalization ability and robustness of the model: This invention utilizes topological hyperspheres. Internal sampling perturbation It replaces expensive adversarial gradient calculations, combining the characteristics of finding flat minima with the introduction of beneficial random noise. On the NEU-CLS-64 test set, which contains relatively complex lighting and noise interference, such as... Figure 4As shown, the method of the present invention reduces computing power while achieving an average accuracy (mAP) of 97.54%, which is 0.81% higher than the baseline method, effectively reducing the false alarm rate and the missed detection rate.

[0028] Highly suited to industrial-grade deployment requirements: This algorithm optimizes the convergence path only during the training phase without changing the original inference architecture of the model. This allows the deployed model to maintain its lightweight nature while possessing strong anti-interference capabilities, fully meeting the needs of real-time detection on the production line. Attached Figure Description

[0029] Figure 1 This is a schematic diagram of the overall process of an embodiment of the present invention.

[0030] Figure 2 This is a schematic diagram illustrating data preprocessing and feature construction provided in an embodiment of the present invention.

[0031] Figure 3 This is a histogram comparing the total training time and peak memory consumption of the deep neural network (ResNet-18) under different optimization strategies in an embodiment of the present invention.

[0032] Figure 4 This is a comparison table of the accuracy of the deep neural network (ResNet-18) in this embodiment of the invention under different optimization strategies for NEU-CLS-64 and NEU-CLS-200.

[0033] Figure 5 This is a block diagram of the industrial surface defect detection system based on sampling perturbation optimization and history reuse according to the present invention. Detailed Implementation

[0034] This invention provides an industrial surface defect detection system and method based on sampling-based perturbation optimization and history reuse. The experimental platform uses an NVIDIA Tesla V100 GPU, an Archlinux 6.18.5-arch1-1 system, and Python 3.10.9 and PyTorch 2.9.1 as the software environment. The system is validated using the ResNet-18 lightweight neural network architecture. This embodiment uses the NEU-CLS-64 dataset as an example. The system structure diagram is shown below. Figure 5 As shown, the specific steps are as follows:

[0035] Step 1, Acquiring and preprocessing physical image signals:

[0036] Industrial camera sensors acquire optical imaging data of the surface of hot-rolled or cold-rolled steel sheets in real time. To adapt to neural network input, computer equipment performs grayscale stretching and size normalization preprocessing on the acquired raw images, and finally converts the batches of images into multidimensional feature tensors. And then fed into the ResNet-18 deep neural network residing in the GPU memory;

[0037] In this embodiment, the batch size is set to The channel is (Grayscale image), height and width H=W=64. The lightweight ResNet-18 network architecture is used as the backbone for feature extraction in object detection. The weight tensor of the network in the current cycle is denoted as... .

[0038] Step 2, Status monitoring and condition determination of network parameter update cycle:

[0039] During the t-cycle iteration of a deep neural network, the scheduling module in the computer device determines whether to trigger the history reuse mechanism, mainly using two methods: the historical perturbation time interval and the memory load.

[0040] Calculate historical disturbance time intervals The optimizer saves the last reused period. And calculate the last historical reuse The time interval from the current period t can be mathematically expressed as:

[0041]

[0042] Memory load monitoring: By calling the underlying NVIDIA NVML API interface, the GPU memory usage of the current workstation can be read in real time. In this embodiment, a resource reuse trigger threshold is set. Memory load threshold When detected At that time, or when When the conditions for triggering historical reuse are met, it is determined that the conditions are met.

[0043] Step 3, Bypass computation graph and sampling feature perturbation:

[0044] Based on the determination result of step 2, the system executes one of the following two branches:

[0045] Branch 1 (Historical Reuse Trigger Conditions Met): The historical reuse mechanism is triggered at this point. The computer device utilizes the high-speed cache of the video memory to directly retrieve the... 'Periodicly stored historical state tensor' As a disturbance in the current cycle At the same time, the system will call the PyTorch framework to explicitly release the computation graph cache and force the backpropagation computation of the current cycle to bypass, thereby saving a lot of computational overhead.

[0046] Branch 2 (Historical reuse trigger condition not met): This indicates that the current period exceeds the preset interval or resource limit, and new perturbation needs to be sampled. Set perturbation radius. ,use Norms construct the boundary of topological hyperspheres The system invokes a pseudo-random number generator to perform uniform sampling within the sphere:

[0047]

[0048] Generated lightweight candidate perturbation tensors Dimensions and baseline weight tensors The results are completely identical and can be obtained without performing backpropagation again, significantly improving computational efficiency. The generated candidate perturbation tensors are input into the evaluation module to select the optimal approximate perturbation tensor. .

[0049] Step 4, Parameter Correction and Flat Minimum Optimization:

[0050] Obtain the perturbation tensor Then, the system performs a forward propagation simulation:

[0051] Add the perturbation to the current weights: Using virtual weights For input tensor Perform one forward propagation and calculate the perturbed cross-entropy loss function. Based on this loss, the actual parameter update gradient is calculated using an automatic differentiation mechanism. :

[0052]

[0053] Finally, SGD is invoked as the base optimizer, with an initial learning rate. In this case, update the network's true baseline weights:

[0054]

[0055] This process forces the model to consider not only the loss value at the current point during optimization, but also its surrounding radius. The loss situation within the neighborhood is analyzed, thus steadily converging towards the "flat minimum region" with better generalization performance.

[0056] Step 5, Industrial Entity Detection and Control Output:

[0057] After training on industrial datasets such as NEU-CLS, the convergent and highly generalizable weights of the deep neural network are solidified and deployed on industrial quality inspection terminals on industrial production lines. These terminals perform real-time inference on images of steel materials on the production line and output control signals representing the specific types of defects to sorting robotic arms or audible and visual alarms.

[0058] It should be understood that any parts not described in detail in this specification belong to the prior art.

[0059] It should be understood that the above description of the preferred embodiments is quite detailed, but it should not be considered as a limitation on the scope of protection of this invention. Those skilled in the art, under the guidance of this invention, can make substitutions or modifications without departing from the scope of protection of the claims of this invention, and all such substitutions or modifications fall within the scope of protection of this invention. The scope of protection of this invention should be determined by the appended claims.

Claims

1. A method and system for detecting industrial surface defects based on sampling-based perturbation optimization and history reuse, characterized in that, This includes the following steps performed by computer equipment: Step 1: Data Acquisition and Preprocessing Collect the surface defects of the physical industrial objects to be inspected, and preprocess them into a multidimensional feature tensor (where batch size, number of channels, height and width are respectively) and input them into a deep neural network deployed in a computing device; Step 2: Historical Reuse and Bypass Selection When entering the network parameter update cycle of the deep neural network, it is determined whether the current cycle meets the preset historical reuse trigger condition; Step 2.1: Backpropagation of the bypass computation graph based on the history reuse mechanism When the aforementioned history reuse triggering condition is met, the history reuse mechanism is triggered, and the first history is read directly from the high-speed buffer of the video memory via an addressing instruction. The historical perturbation tensor is periodically saved, and the backpropagation calculation of the automatic computation graph for the current period is bypassed. Step 2.2: Activate the sampling-based sharpness estimation module and the evaluation module. When the historical reuse triggering condition is not met, the sampling sharpness estimation module is activated, and k samples are performed within the boundary of the norm constraint (where is the norm of the perturbation and is the perturbation radius) to generate a lightweight candidate perturbation tensor (where is). The k candidate perturbation tensors are input into the evaluation module to select the optimal candidate perturbation tensor. Step 3: Deep Neural Network Perturbation Based on Heuristic Sharpness Perception The historical state tensor or the candidate perturbation tensor is used to perturb the parameter matrix of the deep neural network. The gradient g is obtained by backpropagation based on the perturbation weights, and the neural network parameters are updated accordingly to guide the model to converge to the flat minimum region of the loss plane. Step 4 Industrial Fault Detection Module The trained and converged deep neural network is deployed on the quality inspection terminal equipment of the industrial production line to perform inference on the real-time acquired physical surface images and output the specific type of defect.

2. The detection method according to claim 1, characterized in that, Step 2, determining whether the current period meets the preset historical reuse triggering conditions, specifically includes: Calculate the current period t and the period of the last historical disturbance used. The interval is determined to be satisfied when the disturbance interval reaches the historical reuse trigger interval, or when the memory load of the current cycle exceeds the set threshold.

3. The detection method according to claim 1, characterized in that, Step 2, which involves activating the sampling-based sharpness estimation module to generate a lightweight approximate perturbation tensor, specifically includes: Step 3.1: Construct the topological hypersphere boundary based on the specified norm; Step 3.2: Use a pseudo-random number generator to extract coordinate points within the boundary of the topological hypersphere and generate candidate perturbation tensors with specific shapes; Step 3.3: Input the candidate perturbation tensor into the evaluation module, filter out the optimal perturbation tensor and output it as the lightweight approximate perturbation tensor.

4. The detection method according to claim 1, characterized in that, The physical industrial surface defect image data includes optical imaging data of the surface of hot-rolled or cold-rolled steel plates, and the specific types of defects include at least one of cracks, scratches, spots, or iron oxide scale.

5. An industrial surface defect detection system based on sampling-based perturbation optimization and history reuse mechanism, specifically comprising: The image acquisition module is used to acquire image data of surface defects of the physical entity to be inspected and preprocess them into multidimensional feature tensors; The bypass and sampling scheduling module is used to determine the historical reuse triggering conditions during the parameter update cycle. If the conditions are met, the historical state tensor is read from the high-speed buffer and the backpropagation calculation of the current cycle is bypassed. If the conditions are not met, the candidate perturbation tensor is generated through the sampling sharpness estimation module and input into the evaluation module to filter out the approximate perturbation tensor. The forward inference and update module is used to superimpose the historical state tensor or candidate perturbation tensor onto the baseline weight tensor to obtain the local sharpness evaluation results and gradients, and to correct the network parameters accordingly. The entity control signal output module is used to run the converged deep neural network and output classification and positioning control signals for the real-time acquired images.