CN-121482507-B - Image classification method, device, equipment and storage medium based on double-layer optimized neural network
Abstract
The application discloses an image classification method, device, equipment and storage medium based on a double-layer optimized neural network, and relates to the technical field of industrial image classification, wherein the method comprises the steps of preprocessing historical industrial image data and dividing the data into a training set and a verification set with class labels; the method comprises the steps of constructing an initial image classification model based on a target neural network structure, a preset loss function, initial network parameters and initial disturbance vectors, training the model through a double-layer optimization and neural dynamics mechanism by utilizing a training set to obtain a reference image classification model, performing performance evaluation and parameter adjustment on the reference model according to a verification set to obtain a final industrial image classification model, and inputting a newly-added industrial image into the model to obtain a classification result. According to the application, in an industrial image classification task, the coupling problem of disturbance and parameter update during deep neural network training can be relieved, the sensitivity to super parameters is reduced, and the generalization capability and stability of the model under complex working conditions are improved.
Inventors
- SU DAN
- HAN JIE
- YANG CHUNHUA
- GUI WEIHUA
Assignees
- 中南大学
Dates
- Publication Date
- 20260512
- Application Date
- 20260107
Claims (7)
- 1. An image classification method based on a double-layer optimized neural network, which is characterized by comprising the following steps: preprocessing historical industrial image data to obtain a training set and a verification set, wherein the training set and the verification set both contain corresponding category labels; Constructing an initial image classification model according to the target neural network structure, a preset loss function, initial network parameters and an initial disturbance vector; Training the initial image classification model according to the training set based on double-layer optimization and a neural dynamics mechanism to obtain a reference image classification model; performing performance evaluation and parameter adjustment on the reference image classification model according to the verification set to obtain an industrial image classification model; Inputting the newly added industrial image into the industrial image classification model to obtain a classification result; The step of training the initial image classification model according to the training set based on the double-layer optimization and the neural dynamics mechanism to obtain a reference image classification model comprises the following steps: Selecting a batch of training samples and the corresponding class labels from the training set, and inputting the initial image classification model for forward propagation to obtain predictive probability distribution; calculating a loss value between the prediction probability distribution and the class label according to the preset loss function; adding the initial network parameters and the initial disturbance vector to obtain a disturbed parameter point; Calculating a first gradient corresponding to the parameter point after disturbance of the initial image classification model and a second gradient corresponding to the initial disturbance vector based on the loss value; Training the initial image classification model according to a fast time scale update strategy, the second gradient, a neural dynamics update equation, a slow time scale update strategy, the first gradient and the initial network parameter to obtain a reference image classification model; The step of training the initial image classification model according to the fast time scale update strategy, the second gradient, the neural dynamics update equation, the slow time scale update strategy, the first gradient and the initial network parameter to obtain a reference image classification model comprises the following steps: Updating the initial disturbance vector according to a fast time scale updating strategy by combining the second gradient and a neural dynamics updating equation to obtain an updated disturbance vector; Performing projection operation on the updated disturbance vector according to a preset norm constraint to obtain a target disturbance vector; updating the initial network parameters according to a slow time scale updating strategy and combining the first gradient to obtain updated network parameters; Respectively taking the updated network parameters and the target disturbance vector as initial network parameters and initial disturbance vectors of the next iteration, returning to the step of selecting a batch of training samples and the corresponding class labels from the training set, inputting the initial image classification model for forward propagation to obtain a prediction probability distribution until the loss value converges or reaches the preset training round number to obtain a reference image classification model; the neuromechanical update equation is expressed as follows: Wherein, the Refers to the disturbance vector during the kth round of iteration, Refers to the disturbance vector after the kth round of fast time scale update, Refers to a preset fast time scale learning rate, It is meant that the second gradient is such that, Is the vector of the disturbance of the pointer pair Is used for the gradient operator of (1), Refers to the initial network parameters in the kth round of iteration, To activate the function, it is used to ensure that the disturbance vector is within a preset norm constraint.
- 2. The method of claim 1, wherein the step of calculating a first gradient corresponding to the post-perturbation parameter point and a second gradient corresponding to the initial perturbation vector for the initial image classification model based on the loss value comprises: calculating the partial derivative of the loss value to the disturbed parameter point based on a back propagation algorithm to obtain an original gradient; performing gradient clipping treatment on the original gradient to obtain a clipped gradient; Taking the cut gradient as a first gradient corresponding to the disturbed parameter point; and calculating the partial derivative of the loss value to the initial disturbance vector to obtain a second gradient corresponding to the initial disturbance vector.
- 3. The method of claim 1, wherein the step of updating the initial perturbation vector in accordance with a fast time scale update strategy in combination with the second gradient and the neuromechanical update equation to obtain an updated perturbation vector comprises: Determining an activation function in a neuro-dynamics update equation, wherein the activation function is used for limiting the value range of a disturbance vector; Inputting the second gradient into the activation function to perform nonlinear conversion to obtain a converted gradient; Adding the initial disturbance vector and the converted gradient according to the neurodynamics updating equation to obtain an intermediate disturbance vector; subtracting the initial disturbance vector from the intermediate disturbance vector to obtain a disturbance update increment; multiplying the disturbance update increment by a preset fast time scale learning rate, and adding the multiplied disturbance update increment with the initial disturbance vector to obtain an updated disturbance vector.
- 4. The method of claim 1, wherein the step of updating the initial network parameters in conjunction with the first gradient according to a slow time scale update strategy to obtain updated network parameters comprises: adjusting a preset slow time scale learning rate by adopting a cosine annealing strategy to obtain a target slow time scale learning rate; multiplying the first gradient by a preset weight attenuation coefficient to obtain an attenuated gradient; According to a preset momentum factor, calculating a historical gradient accumulation value, wherein the historical gradient accumulation value is a numerical value formed by carrying out weighted accumulation on the first gradient obtained by each iteration calculation according to the preset momentum factor in each iteration process before the current iteration; adding the decayed gradient and the historical gradient accumulated value to obtain a current gradient accumulated value; Multiplying the current gradient accumulated value by the target slow time scale learning rate to obtain a gradient update quantity; Subtracting the gradient update amount from the initial network parameter to obtain an updated network parameter.
- 5. An image classification device based on a double-layer optimized neural network, the device comprising: the data preprocessing module is used for preprocessing the historical industrial image data to obtain a training set and a verification set, wherein the training set and the verification set both contain corresponding category labels; the model construction module is used for constructing an initial image classification model according to the target neural network structure, the preset loss function, the initial network parameters and the initial disturbance vector; The model training module is used for training the initial image classification model according to the training set based on a double-layer optimization and neural dynamics mechanism to obtain a reference image classification model, the step of training the initial image classification model according to the training set based on the double-layer optimization and neural dynamics mechanism to obtain a reference image classification model comprises the steps of selecting a batch of training samples and corresponding class labels from the training set, inputting the initial image classification model to conduct forward propagation to obtain a predictive probability distribution, calculating a loss value between the predictive probability distribution and the class labels according to the preset loss function, adding the initial network parameters and the initial disturbance vector to obtain a post-disturbance parameter point, calculating a first gradient corresponding to the post-disturbance parameter point of the initial image classification model and a second gradient corresponding to the initial disturbance vector based on the loss value, updating the initial image classification model according to a fast time scale updating strategy, the second gradient, a neural dynamics updating strategy, the first gradient and the initial network parameters, obtaining a new model, and a neural dynamic model according to the first gradient, the initial model, the first gradient and the initial model, the step of obtaining a new model, the model is combined with the initial model, the first gradient and the initial model is obtained according to the first gradient, the first gradient and the initial model, the initial model is updated according to the first gradient, the new gradient and the initial model is updated according to the time scale, the new model, and the initial model is obtained by the new model, the method comprises the steps of obtaining a target disturbance vector by carrying out projection operation on the updated disturbance vector, updating the initial network parameter according to a slow time scale updating strategy and combining the first gradient to obtain an updated network parameter, respectively taking the updated network parameter and the target disturbance vector as an initial network parameter and an initial disturbance vector of the next iteration, returning the initial disturbance vector to the training set, selecting a batch of training samples and the corresponding class labels from the training set, inputting the initial image classification model for forward propagation to obtain a predicted probability distribution, and obtaining a reference image classification model until the loss value converges or reaches a preset training round number, wherein the neuromechanical updating equation is expressed as follows: Wherein, the Refers to the disturbance vector during the kth round of iteration, Refers to the disturbance vector after the kth round of fast time scale update, Refers to a preset fast time scale learning rate, It is meant that the second gradient is such that, Is the vector of the disturbance of the pointer pair Is used for the gradient operator of (1), Refers to the initial network parameters in the kth round of iteration, For activating the function, the method is used for ensuring that the disturbance vector is in a preset norm constraint; The model verification module is used for performing performance evaluation and parameter adjustment on the reference image classification model according to the verification set to obtain an industrial image classification model; and the image classification module is used for inputting the newly added industrial image into the industrial image classification model to obtain a classification result.
- 6. An image classification apparatus based on a two-layer optimized neural network, characterized in that the apparatus comprises a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the image classification method based on a two-layer optimized neural network as claimed in any one of claims 1 to 4.
- 7. A storage medium, characterized in that the storage medium is a computer-readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, implements the steps of the image classification method based on a two-layer optimized neural network according to any one of claims 1 to 4.
Description
Image classification method, device, equipment and storage medium based on double-layer optimized neural network Technical Field The application relates to the technical field of industrial image classification, in particular to an image classification method, device and equipment based on a double-layer optimized neural network and a storage medium. Background With the wide application of deep learning technology in the intelligent manufacturing field, the deep neural network has made remarkable progress in the task of classifying industrial images, and has been deployed in a plurality of typical scenes such as automatic classification of metal ores, surface defect detection of metallurgical products, and operation state recognition of electrolytic baths. Along with the continuous expansion of the scale of model parameters, the over-parameterized structure becomes a normal state gradually, and how to improve the generalization capability of the model in a complex industrial environment becomes a key problem of an intelligent visual system. In an industrial field, the image data often has the problems of low resolution, uneven illumination, complex background, serious noise interference and the like, so that the distribution difference between the training data and the actual application data is obvious. The traditional optimization method based on local gradient is difficult to perceive the geometric characteristics of the loss function, and is easy to sink into a high sharpness minimum value, so that overfitting is caused and generalization performance is reduced. To alleviate this problem, the sharpness-aware minimization method improves generalization to some extent by minimizing the worst-case loss function in the parameter perturbation neighborhood, leading to the model converging on a flat minimum region. However, the method has the coupling relation between disturbance and parameter update in the optimization process, is sensitive to super parameters, and has insufficient stability under the non-stationary training condition. These limitations are particularly pronounced in industrial scenarios where the data is complex and noise is significant. Therefore, how to solve the problem of coupling disturbance and parameter update during deep neural network training, reduce sensitivity to super parameters, and improve generalization capability and stability of a model under complex working conditions in an industrial image classification task is a urgent problem. Disclosure of Invention The application aims to provide an image classification method, device, equipment and storage medium based on a double-layer optimized neural network, and aims to solve the technical problems of how to relieve the coupling problem of disturbance and parameter update during deep neural network training, reduce sensitivity to super parameters and improve generalization capability and stability of a model under complex working conditions in an industrial image classification task. In order to achieve the above object, the present application provides an image classification method based on a double-layer optimized neural network, the method comprising: preprocessing historical industrial image data to obtain a training set and a verification set, wherein the training set and the verification set both contain corresponding category labels; Constructing an initial image classification model according to the target neural network structure, a preset loss function, initial network parameters and an initial disturbance vector; Training the initial image classification model according to the training set based on double-layer optimization and a neural dynamics mechanism to obtain a reference image classification model; performing performance evaluation and parameter adjustment on the reference image classification model according to the verification set to obtain an industrial image classification model; and inputting the newly added industrial image into the industrial image classification model to obtain a classification result. In an embodiment, the step of training the initial image classification model according to the training set based on the dual-layer optimization and the neural dynamics mechanism to obtain the reference image classification model includes: Selecting a batch of training samples and the corresponding class labels from the training set, and inputting the initial image classification model for forward propagation to obtain predictive probability distribution; calculating a loss value between the prediction probability distribution and the class label according to the preset loss function; adding the initial network parameters and the initial disturbance vector to obtain a disturbed parameter point; Calculating a first gradient corresponding to the parameter point after disturbance of the initial image classification model and a second gradient corresponding to the initial disturbance vector based on the loss