CN110288030B - Image identification method, device and equipment based on lightweight network model - Google Patents
Image identification method, device and equipment based on lightweight network model Download PDFInfo
- Publication number
- CN110288030B CN110288030B CN201910566189.3A CN201910566189A CN110288030B CN 110288030 B CN110288030 B CN 110288030B CN 201910566189 A CN201910566189 A CN 201910566189A CN 110288030 B CN110288030 B CN 110288030B
- Authority
- CN
- China
- Prior art keywords
- image
- layer
- network
- nodes
- network model
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/241—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02T—CLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
- Y02T10/00—Road transport of goods or passengers
- Y02T10/10—Internal combustion engine [ICE] based vehicles
- Y02T10/40—Engine management systems
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Evolutionary Computation (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Software Systems (AREA)
- Mathematical Physics (AREA)
- Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Computing Systems (AREA)
- Molecular Biology (AREA)
- General Health & Medical Sciences (AREA)
- Evolutionary Biology (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Analysis (AREA)
Abstract
The invention discloses an image identification method, device and equipment based on a lightweight network model. The image recognition method comprises the following steps: s1, acquiring a target image to be identified; s2, inputting the target image into the trained lightweight network model; and S3, classifying the target images by using the trained lightweight network model. Wherein the process of obtaining the lightweight network model comprises the steps of: s21, constructing a variant convolutional neural network without a full connection layer; s22, classifying the image through a softmax classifier, and updating the weight of the convolutional layer; s23, extracting the features of the image again by adopting the weight-updated variant convolutional neural network, and carrying out standardization processing on the features; and S24, generating feature nodes and enhanced nodes by the standardized features according to a construction method of the width network, determining the number of the final feature nodes and enhanced nodes, and constructing a lightweight network model.
Description
Technical Field
The invention relates to the technical field of pattern recognition, in particular to an image recognition method, device and equipment based on a lightweight network model and a readable storage medium.
Background
When the deep neural network is applied to the field of image recognition, the deep neural network is difficult to analyze in theory due to the fact that the deep neural network involves a large number of hyper-parameters and a complex structure, most of the work involves adjusting parameters or stacking more layers to obtain better precision, and therefore the deep neural network is high in precision but long in calculation time and training time. The article "Broad Learning System: the wide network (BLS) proposed in An Effective and Effective implementation dependent Learning System with the Need for Deep Architecture is designed based on the idea of RVFLNN, and compared with a 'Deep' structure, the 'wide' structure is very simple due to no coupling between layers, and the training process of the BLS reduces the dependence on computer and storage resources. Because multilayer connection is not available, the BLS does not need to update the weight by gradient descent, finds the required connection weight by the false inverse of a ridge regression matrix, improves the precision by increasing the width of the network when the network precision does not meet the requirement, adopts an incremental learning algorithm to quickly reconstruct the network, does not need a retraining process, and has a calculation speed greatly superior to that of deep learning. Although the speed of the BLS is obviously improved, the BLS is applied to the field of image classification and identification, and the classification precision is not high enough.
Disclosure of Invention
The invention aims to overcome the defects in the prior art, and provides an image identification method, an image identification device, image identification equipment and a readable storage medium based on a lightweight network model, so as to realize the balance of the size, the efficiency, the resources and the precision of an image classification model, further realize the rapid and accurate classification of images, and solve the problems that a deep network depends on expensive hardware configuration, calculation and training are time-consuming, and the precision of a wide network is not high.
In order to achieve the above purpose, the invention provides the following technical scheme:
an image identification method based on a lightweight network model comprises the following steps:
s1, acquiring a target image to be identified;
s2, inputting the target image into the trained lightweight network model;
and S3, classifying the target images by using the trained lightweight network model.
Wherein the process of obtaining the lightweight network model comprises the steps of:
s21, constructing a variant convolutional neural network without a full connection layer according to a construction mode of the convolutional neural network, wherein the variant convolutional neural network comprises one or more network layers, and the network layers comprise a convolutional layer and a pooling layer;
s22, the marked image to be classified is subjected to a variant convolutional neural network to obtain a characteristic image of the image, the characteristic is input into a softmax classifier, the image is classified through the softmax classifier, and the weight of the convolutional layer is updated through a loss function according to a classification result and the real value of the marked image;
s23, extracting the features of the image again by adopting the weight-updated variant convolutional neural network, and carrying out standardization processing on the features;
and S24, generating feature nodes and enhanced nodes by the standardized features according to a construction method of the width network, determining the number of the final feature nodes and enhanced nodes, and constructing a lightweight network model.
Preferably, the procedure of the convolutional layer convolution operation in step S21 is as follows:
suppose thatThe original image data set is Xi, i is the ith image, i =1,2, \ 8230n; l represents the number of network layers, and the size of the l-th layer of convolution filter is k l *k l Depth d of l The convolution filter has a step size of s l ;
Ith image X i The series of convolution operations performed is represented as:
wherein l and l-1 represent the number of the convolution layers, l is the current layer, and l-1 is the previous layer;represents the image output by the l-layer convolutional layer>Represents the image output after the ith image is processed by the pooling layer in the l-1 layer network layer and is/is selected>Is an original image X i (ii) a W is the weight of the convolutional layer, b is the bias of the convolutional layer, and W and b are randomly generated, i.e., W (l) Weight matrix for the first convolutional layer, b (l) A bias matrix for the l-th convolutional layer; />Is a convolution operation.
Preferably, the pooling layer pooling operation in the step S21 is as follows:
adopting a pooling operation mode of taking the maximum value, wherein the step length of each pooling layer is t l Therefore, a channel pooling operation expansion of a feature picture after a convolution operation is calculated as:
wherein, C is the characteristic image output after the pooling operation.
Preferably, the detailed process of step S22 is as follows:
the characteristic image data of the training sample output by the multi-layer convolution and pooling operation is represented asWherein C 'is a feature image set output after multi-layer convolution and pooling, n is the number of images and the vector U' i Feature images extracted for the ith image by the variant CNN, and i ∈ [1, n ]](ii) a At this time, the images are to be divided into K types, and the output characteristic images subjected to multilayer convolution and pooling are fully connected to K nodes, which are represented as follows:
Y y =W Y C′+b Y ,y∈[1,K];
wherein Y is y Is the output of the y-th node, W Y Weights for node operations, b Y An offset for node operations;
after the nodes are fully connected to the K nodes, classifying the operation result by using a softmax classifier, wherein the softmax algorithm is as follows:
wherein S is y Representing the probability of the image being classified into the y-th class, a y Is the value of the y classification, a k For the value of the kth class, k ∈ [1, K ∈];a y I.e. the output Y of the Y node obtained by full connection y 。
Using the cross entropy L as a loss function, the cross entropy L is expressed as:
and updating the weight of the variant convolutional neural network through an Adam algorithm based on a cross entropy loss function.
Preferably, the detailed process of step S23 is as follows:
and extracting the features of the image again by adopting the weight-updated variant convolutional neural network, and standardizing the features, wherein the detailed process of standardization is as follows:
wherein U' i The characteristic image, mu, of the ith image extracted by the trained variant convolutional neural network after weight updating is referred to i The mean value of the characteristic image of the ith output image is used, and sigma is the variance of the characteristic image of the ith output image; u i The feature image is the normalized ith image;
the normalized feature set of the feature images of all images after normalization is represented as:
preferably, the detailed process of step S24 is as follows:
the width network feature node is represented as:
wherein Z is r A feature node representing a width network; phi is an arbitrary function; c' is a normalized characteristic image;random weight coefficients for feature nodes with appropriate dimensions; />E is the number of the characteristic nodes of the width network;
definition of Z E =[Z 1 ,Z 2 ,…,Z e ];
definition H F =[H 1 ,H 2 ,…,H f ];
Wherein H j A feature node representing a width network; ζ is the activation function;random weight coefficients for enhanced nodes with appropriate dimensions; />F is the number of characteristic nodes of the width network in order to enhance the bias of the nodes;
an overall representation based on a lightweight network structure is:
an image recognition device based on a lightweight network model comprises a target image acquisition module, a target image input module, a classification recognition module and a target model acquisition module;
the target image acquisition module is used for acquiring a target image to be identified;
the target image input module is used for inputting a target image into the target lightweight network model; the lightweight network model is obtained by removing a variant convolutional neural network and a width network structure of a full connection layer;
the classification identification module is used for classifying the target image by using the target lightweight network model to obtain an identification result;
an object model acquisition module comprising:
the model building unit is used for building a variant convolutional neural network without a full connection layer, obtaining width network characteristic nodes and enhanced nodes based on the building steps of the width network, and building a lightweight network model;
a loss function insertion unit for inserting a loss function in the variant convolutional neural network;
and the training unit is used for training the variant convolutional neural network by utilizing a loss function in combination with the softmax classifier, updating parameters and obtaining a target model.
An image recognition apparatus based on a lightweight network model, comprising:
a memory for storing a computer program;
and a processor for implementing the steps of the image recognition method based on the lightweight network model when the computer program is executed.
A readable storage medium, wherein a computer program is stored thereon, and when executed by a processor, the computer program implements the steps of the image recognition method based on a lightweight network model.
Compared with the prior art, the invention has the beneficial effects that: the image features are extracted through the variant convolutional neural network, the image features are input into the network structure based on the construction step of the width network, and the lightweight network model is obtained, the lightweight network model can reduce the dependence on computer storage resources in the image recognition process, can effectively reduce the training time, improves the image classification precision, and realizes the balance of the size, the efficiency, the resources and the precision of the image classification model.
Description of the drawings:
fig. 1 is a diagram of a lightweight network model structure of exemplary embodiment 1 of the present invention;
fig. 2 is a flowchart of an image recognition method based on a lightweight network model according to exemplary embodiment 1 of the present invention;
fig. 3 is a detailed flowchart of step S2 of the image recognition method based on a lightweight network model according to exemplary embodiment 1 of the present invention;
fig. 4 is a characteristic effect diagram of an MNIST data set extracted by an image recognition method based on a lightweight network model in exemplary embodiment 2 of the present invention;
fig. 5 is a schematic structural diagram of an image recognition apparatus based on a lightweight network model in exemplary embodiment 3 of the present invention;
fig. 6 is a schematic structural diagram of an image recognition apparatus based on a lightweight network model in exemplary embodiment 4 of the present invention;
fig. 7 is a schematic structural diagram of an image recognition apparatus based on a lightweight network model in exemplary embodiment 4 of the present invention.
Detailed Description
The present invention will be described in further detail with reference to test examples and specific embodiments. It should be understood that the scope of the above-described subject matter of the present invention is not limited to the following examples, and any technique realized based on the contents of the present invention is within the scope of the present invention.
Example 1
As shown in fig. 1 to 3, the present embodiment provides an image recognition method based on a lightweight network model, which specifically includes the following steps:
s1, acquiring a target image to be identified;
s2, inputting the target image into the trained lightweight network model;
and S3, classifying the target images by using the trained lightweight network model.
Wherein the process of obtaining the lightweight network model comprises the steps of:
s21, constructing a variant Convolutional Neural Network (CNN) without a full connection layer according to a construction mode of the convolutional neural network, wherein the variant convolutional neural network comprises one or more network layers, and the network layers comprise a convolutional layer and a pooling layer;
s22, inputting the marked image to be classified; the marked image to be classified is subjected to a variant convolutional neural network to obtain the characteristics of the image, the characteristics are input into a softmax classifier, the image is classified through the softmax classifier, and the weight of the convolutional layer is updated through a loss function according to the classification result and the real value of the marked image;
s23, extracting the features of the image again by adopting the weight-updated variant convolutional neural network, and carrying out standardization processing on the features;
and S24, generating a certain number of feature nodes and enhanced nodes from the features after the standardization treatment according to a construction method of the width network, determining the number of the final feature nodes and enhanced nodes, and constructing a lightweight network model.
The convolutional neural network without the full connection layer is used for image feature extraction, the order of magnitude of network parameters is reduced through weight sharing and pooling of convolutional operation, and features of BLS input data of the wide network are enhanced. By combining the variant convolutional neural network and the width network, a lightweight network structure is constructed, and rapid and accurate image classification is realized.
LeNet, alexNet, vggNet, resNet and the like are common network structure models in the field of convolutional neural networks, have certain difference in construction modes, and are suitable for data sets with different sizes. The embodiment selects the appropriate number of convolutional layers and pooling layers, the size of the convolutional layer filter, the moving step length of the convolutional layer filter and the mode of pooling operation according to the size of the image data set to be classified so as to construct the variant convolutional neural network without fully-connected layers. Wherein, the pooling operation has two operation modes of taking a maximum value and taking an average value.
The convolutional layer convolution operation in step S21 is as follows:
suppose thatFor the original image data set, X i I =1,2, \ 8230; n for the ith image; l represents the number of network layers and the size of the l-th layer convolution filter is k l *k l Depth d l The convolution filter has a step size of s l ;
Ith image X i The series of convolution operations performed is represented as:
wherein l and l-1 represent the number of the convolution layers, l is the current layer, and l-1 is the previous layer;image output by a convolutional layer representing a layer network layer l, <' > based on>Represents the image output after the ith image is processed by the pooling layer in the l-1 layer network layer and is/is selected>Is an original image X i (ii) a W is the weight of the convolutional layer, b is the bias of the convolutional layer, and W and b are randomly generated, i.e., W (l) Weight matrix for the first convolutional layer, b (l) A bias matrix for the first convolutional layer; />Is a convolution operation.
One channel convolution operation expansion for an image is calculated as:
wherein, W pq Is the weight coefficient in the weight matrix, wherein p belongs to (1, c) and q belongs to (1, c), and the size of the convolution kernel is c; x gh Inputting the value of an image pixel point of the convolution layer, wherein g belongs to (1, m), h belongs to (1, m), and the dimension of the image is m; b is the bias of the convolution layer; s is the step size of the convolution filter. Since the resolution size of the image is usually changed, enhanced, and denoised before the image recognition, and the image input to the network is usually square, the image shape is square, and the resolution size is m × m, but the image of the present application may be other shapes, and various substitutions, modifications, and improvements made by those skilled in the relevant art without departing from the principle and scope of the present invention should be included in the protection scope of the present invention.
The height new _ height and the width new _ width of the feature matrix of the output image after the convolution operation are both m/s, in order to facilitate the matrix calculation, the size of the matrix of the image input with the convolution operation needs to be expanded, and the numerical value of a pixel point to be supplemented is marked as 0; the number of pixels of the input image matrix which need to be expanded in height is as follows:
Pad_needed_height=(new_height-1)*s+c-m;
then, the calculation method of the number of pixels pad _ top to be expanded above the input matrix and the number of pixels pad _ bottom to be expanded below the input matrix is as follows:
pad_top=pad_neededd_height/2,pad_bottom=pad_needed_height-pad_top;
the calculation method of the number of pixels to be expanded, pad _ left, on the left side of the input matrix and the number of pixels to be expanded, pad _ right, on the right side of the input matrix is as follows:
pad_left=pad_top,pad_right=pad_bottom。
the operation process of the pooling layer in the step S21 is as follows:
the pooling operation of the embodiment adopts an operation mode of taking the maximum value, and the step length of the pooling layer of the layer-I network layer is t l And the moving step length of the l-th layer network convolution filter is s l Therefore, a channel pooling operation expansion of a feature picture after a convolution operation is calculated as:
wherein, C is the characteristic image output after the pooling operation.
The detailed process of step S22 is as follows.
The characteristic image data of the training sample output by the multi-layer convolution and pooling operation is represented asWherein C 'is a feature image set output after multilayer convolution and pooling, n is the number of images and a vector U' i The pixel value set of each pixel point of the characteristic image extracted by the ith image through the variant CNN is obtained, and i belongs to [1, n ]]. At this time, the images are to be divided into K types, and the output characteristic images subjected to multilayer convolution and pooling are fully connected to K nodes, which are represented as follows:
Y y =W Y C′+b Y ,y∈[1,K],
wherein Y is y Is the output of the y-th node, W Y As weights of node operations, b Y Is the bias of the node operation.
After the nodes are fully connected to the K nodes, classifying the operation result by using a softmax classifier, wherein the softmax algorithm is as follows:
wherein S is y Representing the probability of the image being classified into the y-th class, a y Is the value of the y classification, a k For the value of the kth class, k ∈ [1,K ]];a y I.e. the output Y of the Y-th node obtained by full connection y 。
The loss function of this implementation uses cross entropy L as the loss function, which is expressed as:
the weight update is performed on the variant convolutional neural network by using the Adam algorithm based on the calculated value of the loss function. In the process of constructing the variant convolutional neural network, weight and bias parameters are randomly generated, so that the ideal characteristics extracted after convolutional pooling operation cannot be ensured, and in order to solve the problem, the Adam algorithm is adopted for updating the network weight. The Adam algorithm designs independent adaptive learning rates for different parameters through first moment estimation and second moment estimation of random gradients, has advantages in a non-convex optimization problem, has better optimization effect compared with other existing optimization algorithms (such as Gradient Descent, adadelta and Adagrad algorithms), and has high classification precision of network images optimized by the Adam algorithm.
The Adam algorithm for updating the weights of the variant convolutional neural network is as follows:
z λ-1 =β 1 z λ-2 +(1-β 1 )f′(θ λ-1 ),
v λ-1 =β 2 v λ-2 +(1-β 2 )f′(θ λ-1 ) 2 ;
wherein λ represents the number of iterations; alpha is the hyper-parametric learning rate; beta is a 1 、β 2 An exponential decay rate estimated for the hyper-parametric moment for controlling the decay rate of the moving average; ε is a smoothing term; theta is an arbitrary variable; z and v are initialized zero vectors, deviation correction is performed on the variable theta so that the variable theta is not biased to zero, and the deviation-corrected z is calculated λ 、v λ To counteract these deviations; theta λ The theta vector representing the lambda iteration.
In this example, parameter β 1 、β 2 Respectively taking values0.9 and 0.999, and the value of the smoothing term epsilon is 10 -8 The learning rate α is fine-tuned during network training. And selecting a small batch of samples for training when the weight is updated, and reducing the iteration times of network training as much as possible.
Updating parameters by adopting a gradient descent algorithm, and carrying out step-by-step iterative solution by adopting a gradient descent method to obtain a minimized loss function and corresponding model parameter values, wherein the specific calculation process is as follows:
the derivative of the loss function with respect to the convolutional layer weight W is:
the derivative of the loss function with respect to convolutional layer bias b is:
for the weighting factor of the qth column of the pth row in the l-level weighting matrix, < >>For l layers the value of the pixel point of the g-th row and h-th column of the image of the convolutional layer is input, b (l) Is a bias of layer l>Is the value of the pixel point of the g-th row and h-th column of the image after l layers of convolution layer processing.
Constructing a variant convolutional neural network without a full connection layer according to a construction mode of the convolutional neural network, wherein the variant convolutional neural network comprises a convolutional layer and a pooling layer, and the order of magnitude of network parameters is reduced through weight sharing and pooling of convolutional operation, so that image features are better extracted; the image is then classified by a softmax classifier, and the variant convolutional neural network is weight updated by a gradient descent method based on the operation value of the cross entropy loss function by using the Adam algorithm. The feature extraction of the weight-updated variant convolutional neural network is more accurate.
In step S23, the feature of the image is extracted again by using the weight-updated variant convolutional neural network, and the feature is normalized, and the detailed process of normalization is as follows:
wherein U' i Refers to the pixel value set, mu, of each pixel point of the characteristic image of the ith image extracted by the trained variant CNN after weight updating i The sigma is the variance of the feature image of the ith output image; u i The normalized pixel values of all pixel points of the characteristic image of the ith image are obtained.
The normalized feature set of the feature images of all images after normalization is represented as:
and step S24, generating a certain quantity of feature nodes and enhanced nodes by the standardized features according to a construction method of the width network, determining the final number of the feature nodes and the enhanced nodes by using a grid search method, and constructing a lightweight network model. The characteristic nodes of the width network are used for extracting the characteristics of the image; while the enhanced nodes increase the overall network non-linearity for classification. The detailed construction process is as follows:
the breadth network feature node is represented as:
wherein, Z r A feature node representing a width network; phi is an arbitrary function; c' is a normalized characteristic image;random weight coefficients for feature nodes with appropriate dimensions; />E is the number of feature nodes of the width network.
Definition of Z E =[Z 1 ,Z 2 ,…,Z e ];
definition H F =[H 1 ,H 2 ,…,H f ]
Wherein H j A feature node representing a width network; ζ is the activation function;random weight coefficients for enhanced nodes with appropriate dimensions; />To enhance the biasing of the nodes.
An overall representation based on a lightweight network structure is:
through the steps, the image features are extracted through a variant Convolutional Neural Network (CNN), the features are input into the lightweight network model invented by the construction step based on the width network, and the image recognition is rapidly carried out. The image recognition method based on the lightweight network model can reduce the dependence on computer storage resources, effectively reduce training time, improve image classification precision and better balance three requirements of efficiency, resources and precision.
Example 2
The image recognition method based on the lightweight network model in embodiment 1 can be widely applied to the field of image recognition, and in this embodiment, an MNIST data set is used for testing and training a network, and the detailed process is as follows:
a variant Convolutional Neural Network (CNN) is constructed to extract image features. Constructing a variant CNN by taking a LeNet network structure as a reference, wherein a first convolution layer, a first pooling layer, a second convolution layer and a second pooling layer in the variant convolutional neural network are sequentially connected, the sizes of convolution filters of the first convolution layer and the second convolution layer are all 5 x 5, the moving step lengths are all 1, the depth of a filter of the first convolution layer is 32, and the depth of a filter of the second convolution layer is 64; and adopting a maximum pooling method for the first pooling layer and the second pooling layer, wherein the moving step length of a filter of each pooling layer is 2, connecting the result of the last layer of pooling to a certain number of nodes, constructing a variant CNN without a full connection layer, classifying by using a softmax classifier, and taking the cross entropy as a loss function.
60000 images of 28 × 1 in the MNIST dataset were input as training samples for variant CNNs, denoted asThe images were processed as described in example 1 for the convolutional pooling operation as follows:
X i the computational process for one pass through the filter of the first convolutional layer is expanded to:
the result of the above-mentioned channel passing through the first pooling layer filter becomes:
thus, the final output result for any image on the dataset is:
final layer pooling results for all training sample images:
And constructing CNN variants without full connection layers, then classifying the CNN variants by using a softmax classifier, taking cross entropy as a loss function, and updating network weights by using an Adam algorithm.
The weight updating selects 100 samples each time, and the iteration is performed 1000 times, wherein the iteration number can be increased or reduced according to the requirement of improving the precision and considering the time cost. After 1000 iterations, assuming that the network weight is W 'and the bias is b', extracting the features of the image again by using the weight-updated variant convolutional neural network, wherein the feature set of all the extracted images is represented as:
the features extracted by the variant CNN are more scientific than simple projection, direction and gravity center. The fitting ability of the overall model can be controlled by using different convolution, pooling and the size of the final output feature vector. The dimension of the feature vector can be reduced during overfitting, the output dimension of the convolutional layer can be improved during underfitting, and compared with other feature extraction methods, the method is more flexible.
And carrying out standardization processing on the image feature set extracted by the variant convolutional neural network after the weight is updated.
The image standardization is to realize centralized processing of data through mean value removal, and the data centralization accords with a data distribution rule according to convex optimization theory and data probability distribution related knowledge, so that a generalization effect after training is obtained more easily. Image characteristics of each imageThe feature image normalized feature set of all images is: />
And (4) taking the image features extracted by the trained variant CNN as input to construct a lightweight network structure.
Generating a certain number of feature nodes and enhanced nodes according to a construction method of a wide area network (BLS) by the normalized features, determining the number of the feature nodes to be 10 by using a grid search method, determining the number of the enhanced nodes to be 11000, and generating the feature nodes by the image features as follows:
definition of Z E =[Z 1 ,Z 2 ,…,Z 10 ];
an overall representation based on a lightweight network structure is:
and (4) keeping the training model and classifying the MNIST test set images.
Fig. 4 is a diagram illustrating a characteristic effect extracted by the variant CNN in an MNIST data set, specifically, a characteristic effect diagram obtained by passing the handwritten numeral 7 through a first convolutional layer, a first pooling layer, a second convolutional layer, and a second pooling layer, respectively.
The image identification method based on the lightweight network model provided by the embodiment better balances three requirements of efficiency, resources and precision, the detailed experiment parameters are shown in table 1, and the experiment effects of the deep neural network (LeNet 5), the wide neural network (BLS) and the lightweight network when applied to MNIST data sets for image identification are respectively shown. The experimental effects include accuracy, training time, and testing time.
Table 1
Network model classes | Precision (%) | Training time(s) | Test time(s) |
Deep neural network (LeNet 5) | 98.96 | 598.21 | 4.92 |
Width neural network (BLS) | 98.85 | 142.91 | 3.67 |
Lightweight network | 99.27 | 359.22 | 4.11 |
As can be seen from the experimental data in table 1, the image recognition method based on the lightweight network model provided by the embodiment better balances the three requirements of efficiency, resources and precision, and has better image recognition effect.
Example 3
In correspondence with the above method embodiments, the present embodiment also provides an image recognition apparatus based on a lightweight network model, and the image recognition apparatus based on a lightweight network model described below and the image recognition method based on a lightweight network model described above may be referred to in correspondence with each other.
Referring to fig. 5, the apparatus includes the following modules: a target image acquisition module 101, a target image input module 102, a classification recognition module 103 and a target model acquisition module 104;
the target image acquiring module 101 is configured to acquire a target image to be identified;
a target image input module 102, configured to input a target image into a target lightweight network model; the lightweight network model is obtained by removing a variant convolutional neural network and a width network structure of a full connection layer;
the classification identification module 103 is used for performing classification processing on the target image by using the target lightweight network model to obtain an identification result;
an object model acquisition module 104, comprising:
the model building unit is used for building a variant convolutional neural network without a full connection layer, obtaining width network characteristic nodes and enhanced nodes based on the building steps of the width network, and building a lightweight network model;
a loss function insertion unit for inserting a loss function in the variant convolutional neural network;
and the training unit is used for training the variant convolutional neural network by utilizing a loss function in combination with the softmax classifier, updating parameters and obtaining a target model.
By applying the device provided by the embodiment of the invention, the target image to be identified is obtained; and inputting the target image to a classification identification module to obtain an identification result.
And acquiring a target image to be identified, and inputting the target image into the lightweight network model. The lightweight network model is obtained based on a variant convolutional neural network without a fully connected layer and a width network. That is, the lightweight network model reduces the magnitude of network parameters through weight sharing and pooling of convolution operations, enhancing the characteristics of the wide network BLS input data. Then, the classification recognition module is used for classifying the target image, so that the recognition result of the target image can be obtained. Because the lightweight network model adopted by the classification and identification module is obtained based on the variant convolutional neural network without the full connection layer and the width network, the dependence on computer storage resources can be reduced, the training time can be effectively reduced, the image classification precision is improved, and the three requirements on efficiency, resources and precision are better balanced.
In an embodiment of the invention, the loss function insertion unit is specifically configured to insert a cross-entropy loss function in the variant convolutional neural network.
Example 4
Corresponding to the above method embodiments, the present embodiment also provides a lightweight network model-based image recognition apparatus, and a lightweight network model-based image recognition apparatus described below and a lightweight network model-based image recognition method described above may be referred to in correspondence with each other.
Referring to fig. 6, the image recognition apparatus based on a lightweight network model includes:
a memory D1 for storing a computer program;
and a processor D2, configured to implement the steps of the image identification method based on the lightweight network model according to the above method embodiment when executing the computer program.
Specifically, referring to fig. 7, a specific structure diagram of the image recognition device based on the lightweight network model provided in this embodiment is shown, the image recognition device based on the lightweight network model may generate relatively large differences due to different configurations or performances, and may include one or more processors (CPUs) 322 (e.g., one or more processors) and a memory 332, and one or more storage media 330 (e.g., one or more mass storage devices) storing an application 342 or data 344. Memory 332 and storage media 330 may be, among other things, transient storage or persistent storage. The program stored on the storage medium 330 may include one or more modules (not shown), each of which may include a series of instructions operating on a data processing device. Still further, the central processor 322 may be configured to communicate with the storage medium 330, and execute a series of instruction operations in the storage medium 330 on the image recognition apparatus 301 based on the lightweight network model.
The lightweight network model-based image recognition device 301 may also include one or more power sources 326, one or more wired or wireless network interfaces 350, one or more input-output interfaces 358, and/or one or more operating systems 341. For example, windows Server, mac OS XTM, unixTM, linuxTM, freeBSDTM, etc.
The steps in the above-described lightweight network model-based image recognition method may be implemented by the structure of a lightweight network model-based image recognition apparatus.
Example 5
Corresponding to the above method embodiments, the present embodiment further provides a readable storage medium, and a readable storage medium described below and an image recognition method based on a lightweight network model described above may be referred to correspondingly.
A readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the steps of the image recognition method based on a lightweight network model of the above-described method embodiments.
The readable storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and various other readable storage media capable of storing program codes.
The foregoing is merely a detailed description of specific embodiments of the invention and is not intended to limit the invention. Various alterations, modifications and improvements will occur to those skilled in the art without departing from the spirit and scope of the invention.
Claims (7)
1. An image recognition method based on a lightweight network model is characterized by comprising the following steps:
s1, acquiring a target image to be identified;
s2, inputting the target image into the trained lightweight network model;
s3, classifying the target images by using the trained lightweight network model;
wherein the process of obtaining the lightweight network model comprises the steps of:
s21, constructing a variant convolutional neural network without a full connection layer according to a construction mode of the convolutional neural network, wherein the variant convolutional neural network comprises one or more network layers, and the network layers comprise a convolutional layer and a pooling layer;
s22, the marked image to be classified is subjected to a variant convolutional neural network to obtain a characteristic image of the image, the characteristic is input into a softmax classifier, the image is classified through the softmax classifier, and the weight of the convolutional layer is updated through a loss function according to a classification result and the real value of the marked image;
the detailed process is as follows:
the characteristic image data of the training sample output by the multi-layer convolution and pooling operation is represented asWherein C 'is a feature image set output after multi-layer convolution and pooling, n is the number of images and the vector U' i Feature image extracted for ith image through variant CNN, and i E [1, n ]](ii) a At this time, the image is to be divided into K classes, and the output characteristic images subjected to multilayer convolution and pooling operation are all connected to K nodes, which are represented as:
Y y =W Y C′+b Y ,y∈[1,K];
wherein Y is y Is the output of the y-th node, W Y Weights for node operations, b Y An offset for node operations;
after all the nodes are connected to K nodes, classifying operation results by using a softmax classifier, wherein the softmax algorithm is as follows:
wherein S is y Representing the probability of the image being classified into the y-th class, a y Is the value of the y classification, a k For the value of the kth class, k ∈ [1,K ]];a y I.e. the output Y of the Y-th node obtained by full connection y ;
Using the cross entropy L as a loss function, the cross entropy L is expressed as:
updating the weight of the variant convolutional neural network through an Adam algorithm based on a cross entropy loss function;
s23, extracting the features of the image again by adopting the weight-updated variant convolutional neural network, and carrying out standardization processing on the features;
s24, generating feature nodes and enhanced nodes by the standardized features according to a construction method of a width network, determining the number of the final feature nodes and enhanced nodes, and constructing a lightweight network model;
the detailed process is as follows:
the width network feature node is represented as:
wherein Z is r A feature node representing a width network; phi is an arbitrary function; c' is a normalized characteristic image;random weight coefficients for feature nodes with appropriate dimensions; />E is the number of the characteristic nodes of the width network;
definition of Z E =[Z 1 ,Z 2 ,...,Z e ];
definition H F =[H 1 ,H 2 ,...,H f ];
Wherein H j A feature node representing a width network; ζ is the activation function;random weight coefficients for enhanced nodes with appropriate dimensions; />F is the number of characteristic nodes of the width network in order to enhance the bias of the nodes;
a lightweight network structure based overall representation is:
wherein, W f And represents the weight coefficient when the number of the enhanced nodes is f.
2. The method for image recognition based on a lightweight network model according to claim 1, wherein the convolutional layer convolution operation process in step S21 is as follows:
suppose thatFor the original image data set, X i I =1,2, \ 8230; n for the ith image; l represents the number of network layers and the size of the l-th layer convolution filter is k l *k l Depth d l The convolution filter is moved by a step size s l ;
Ith image X i The series of convolution operations performed is represented as:
wherein l and l-1 represent the number of the convolution layers, l is the current layer, and l-1 is the previous layer;represents the image output by the l-layer convolutional layer>Represents the image output after the ith image is processed by the pooling layer in the l-1 layer network layer and is/is selected>Is an original image X i (ii) a W is the weight of the convolutional layer, b is the bias of the convolutional layer, and W and b are randomly generated, i.e., W (l) Weight matrix for the first convolutional layer, b (l) A bias matrix for the first convolutional layer; />Is a convolution operation.
3. The image recognition method based on the lightweight network model according to claim 1, wherein the pooling operation of the pooling layer in the step S21 is as follows:
adopting a pooling operation mode of taking the maximum value, wherein the step length of each pooling layer is t l Therefore, a channel pooling operation expansion of a feature picture after a convolution operation is calculated as:
wherein C is a characteristic image output after the pooling operation; t is t l Representing the step size of a pooling layer of the layer l; s l Representing the moving step of the l-layer network convolution filter; m represents the image size of the input convolution layer, and the height and width of the output image feature matrix after convolution operation are both Representing a th ÷ in a pooled image>A block of pixel values of the block.
4. The method for image recognition based on a lightweight network model according to claim 1, wherein the detailed procedure of step S23 is as follows:
and extracting the features of the image again by adopting the weight-updated variant convolutional neural network, and standardizing the features, wherein the detailed process of standardization is as follows:
wherein U' i The characteristic image, mu, of the ith image extracted by the trained variant convolutional neural network after weight updating is referred to i The mean value of the characteristic image of the ith output image is used, and sigma is the variance of the characteristic image of the ith output image; u i The feature image is the normalized ith image;
the normalized feature set of the feature images of all images after normalization is represented as:
5. an image recognition device based on a lightweight network model is characterized by comprising a target image acquisition module, a target image input module, a classification recognition module and a target model acquisition module;
the target image acquisition module is used for acquiring a target image to be identified;
the target image input module is used for inputting a target image into the target lightweight network model; the lightweight network model is obtained by removing a variant convolutional neural network and a width network structure of a full connection layer;
the width network feature node is represented as:
wherein, Z r A feature node representing a width network; phi is an arbitrary function; c' is a normalized characteristic image;to have a suitable dimensionThe random weight coefficient of the feature node of (1); />E is the offset of the characteristic nodes, and e is the number of the characteristic nodes of the width network;
the classification identification module is used for classifying the target image by using the target lightweight network model to obtain an identification result;
an object model acquisition module comprising:
the model building unit is used for building a variant convolutional neural network without a full connection layer, obtaining width network characteristic nodes and enhanced nodes based on the building steps of the width network, and building a lightweight network model;
a loss function insertion unit for inserting a loss function in the variant convolutional neural network;
the training unit is used for training the variant convolutional neural network by utilizing a loss function in combination with the softmax classifier, updating parameters and obtaining a target model;
the characteristic image data of the training sample output by the multi-layer convolution and pooling operation is represented asWherein C 'is a feature image set output after multilayer convolution and pooling, n is the number of images and a vector U' i Feature images extracted for the ith image by the variant CNN, and i ∈ [1, n ]](ii) a At this time, the image is to be divided into K classes, and the output characteristic images subjected to multilayer convolution and pooling operation are all connected to K nodes, which are represented as:
Y y =W Y C′+b Y ,y∈[1,K];
wherein Y is y Is the output of the y-th node, W Y As weights of node operations, b Y An offset for node operations;
after all the nodes are connected to K nodes, classifying operation results by using a softmax classifier, wherein the softmax algorithm is as follows:
wherein S is y Representing the probability of the image being classified into the y-th class, a y Is the value of the y classification, a k For the value of the kth class, k ∈ [1, K ∈];a y I.e. the output Y of the Y node obtained by full connection y ;
Using the cross entropy L as a loss function, the cross entropy L is expressed as:
updating the weight of the variant convolutional neural network through an Adam algorithm based on a cross entropy loss function;
an overall representation based on a lightweight network structure is:
wherein, W f And represents the weight coefficient when the number of the enhanced nodes is f.
6. An image recognition device based on a lightweight network model, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the image recognition method based on a lightweight network model according to any one of claims 1 to 4 when executing the computer program.
7. A readable storage medium, having stored thereon a computer program which, when executed by a processor, implements the steps of the method for image recognition based on a lightweight network model according to any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910566189.3A CN110288030B (en) | 2019-06-27 | 2019-06-27 | Image identification method, device and equipment based on lightweight network model |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910566189.3A CN110288030B (en) | 2019-06-27 | 2019-06-27 | Image identification method, device and equipment based on lightweight network model |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110288030A CN110288030A (en) | 2019-09-27 |
CN110288030B true CN110288030B (en) | 2023-04-07 |
Family
ID=68007719
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910566189.3A Active CN110288030B (en) | 2019-06-27 | 2019-06-27 | Image identification method, device and equipment based on lightweight network model |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110288030B (en) |
Families Citing this family (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110837890A (en) * | 2019-10-22 | 2020-02-25 | 西安交通大学 | Weight value fixed-point quantization method for lightweight convolutional neural network |
CN112733585B (en) * | 2019-10-29 | 2023-09-05 | 杭州海康威视数字技术股份有限公司 | image recognition method |
CN110956202B (en) * | 2019-11-13 | 2023-08-01 | 重庆大学 | Image training method, system, medium and intelligent device based on distributed learning |
CN110909796B (en) * | 2019-11-22 | 2022-05-17 | 浪潮电子信息产业股份有限公司 | Image classification method and related device |
CN110929652B (en) * | 2019-11-26 | 2023-08-01 | 天津大学 | Handwriting Chinese character recognition method based on LeNet-5 network model |
CN112861896A (en) * | 2019-11-27 | 2021-05-28 | 北京沃东天骏信息技术有限公司 | Image identification method and device |
CN111476138B (en) * | 2020-03-31 | 2023-08-18 | 万翼科技有限公司 | Construction method, identification method and related equipment for building drawing component identification model |
CN113642592A (en) * | 2020-04-27 | 2021-11-12 | 武汉Tcl集团工业研究院有限公司 | Training method of training model, scene recognition method and computer equipment |
CN111614358B (en) * | 2020-04-30 | 2023-08-04 | 合肥的卢深视科技有限公司 | Feature extraction method, system, equipment and storage medium based on multichannel quantization |
CN111563483B (en) * | 2020-06-22 | 2024-06-11 | 武汉芯昌科技有限公司 | Image recognition method and system based on compact lenet model |
CN112070100A (en) * | 2020-09-11 | 2020-12-11 | 深圳力维智联技术有限公司 | Image feature recognition method and device based on deep learning model and storage medium |
CN112906829B (en) * | 2021-04-13 | 2022-11-08 | 成都四方伟业软件股份有限公司 | Method and device for constructing digital recognition model based on Mnist data set |
CN113205177B (en) * | 2021-04-25 | 2022-03-25 | 广西大学 | Electric power terminal identification method based on incremental collaborative attention mobile convolution |
CN114363477A (en) * | 2021-12-30 | 2022-04-15 | 上海网达软件股份有限公司 | Method and system for video self-adaptive sharpening based on sliding window weight regression |
CN114444622B (en) * | 2022-04-11 | 2022-06-17 | 中国科学院微电子研究所 | Fruit detection system and method based on neural network model |
CN114781650B (en) * | 2022-04-28 | 2024-02-27 | 北京百度网讯科技有限公司 | Data processing method, device, equipment and storage medium |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106529578A (en) * | 2016-10-20 | 2017-03-22 | 中山大学 | Vehicle brand model fine identification method and system based on depth learning |
CN107657233A (en) * | 2017-09-28 | 2018-02-02 | 东华大学 | Static sign language real-time identification method based on modified single multi-target detection device |
CN108304821A (en) * | 2018-02-14 | 2018-07-20 | 广东欧珀移动通信有限公司 | Image-recognizing method and device, image acquiring method and equipment, computer equipment and non-volatile computer readable storage medium storing program for executing |
CN108470320A (en) * | 2018-02-24 | 2018-08-31 | 中山大学 | A kind of image stylizing method and system based on CNN |
CN108564555A (en) * | 2018-05-11 | 2018-09-21 | 中北大学 | A kind of digital image noise reduction method based on NSST and CNN |
CN108717680A (en) * | 2018-03-22 | 2018-10-30 | 北京交通大学 | Spatial domain picture steganalysis method based on complete dense connection network |
CN109086806A (en) * | 2018-07-16 | 2018-12-25 | 福州大学 | A kind of IOT portable device visual identity accelerated method based on low resolution, compressed image |
CN109492766A (en) * | 2018-11-07 | 2019-03-19 | 西安交通大学 | A kind of width learning method based on minimum P norm |
CN109886971A (en) * | 2019-01-24 | 2019-06-14 | 西安交通大学 | A kind of image partition method and system based on convolutional neural networks |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10999247B2 (en) * | 2017-10-24 | 2021-05-04 | Nec Corporation | Density estimation network for unsupervised anomaly detection |
-
2019
- 2019-06-27 CN CN201910566189.3A patent/CN110288030B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106529578A (en) * | 2016-10-20 | 2017-03-22 | 中山大学 | Vehicle brand model fine identification method and system based on depth learning |
CN107657233A (en) * | 2017-09-28 | 2018-02-02 | 东华大学 | Static sign language real-time identification method based on modified single multi-target detection device |
CN108304821A (en) * | 2018-02-14 | 2018-07-20 | 广东欧珀移动通信有限公司 | Image-recognizing method and device, image acquiring method and equipment, computer equipment and non-volatile computer readable storage medium storing program for executing |
CN108470320A (en) * | 2018-02-24 | 2018-08-31 | 中山大学 | A kind of image stylizing method and system based on CNN |
CN108717680A (en) * | 2018-03-22 | 2018-10-30 | 北京交通大学 | Spatial domain picture steganalysis method based on complete dense connection network |
CN108564555A (en) * | 2018-05-11 | 2018-09-21 | 中北大学 | A kind of digital image noise reduction method based on NSST and CNN |
CN109086806A (en) * | 2018-07-16 | 2018-12-25 | 福州大学 | A kind of IOT portable device visual identity accelerated method based on low resolution, compressed image |
CN109492766A (en) * | 2018-11-07 | 2019-03-19 | 西安交通大学 | A kind of width learning method based on minimum P norm |
CN109886971A (en) * | 2019-01-24 | 2019-06-14 | 西安交通大学 | A kind of image partition method and system based on convolutional neural networks |
Non-Patent Citations (3)
Title |
---|
Discriminative graph regularized broad learning system for image recognition;Junwei JIN 等;《Science China(Information Sciences)》;20190115;179-192 * |
基于宽度学习方法的多模态信息融合;贾晨 等;《智能***学报》;20180523;51-57 * |
基于深度卷积神经网络的图像去噪研究;李传朋等;《计算机工程》;20170315(第03期);259-266 * |
Also Published As
Publication number | Publication date |
---|---|
CN110288030A (en) | 2019-09-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110288030B (en) | Image identification method, device and equipment based on lightweight network model | |
CN109754078B (en) | Method for optimizing a neural network | |
CN109241903B (en) | Sample data cleaning method, device, computer equipment and storage medium | |
JP6504590B2 (en) | System and computer implemented method for semantic segmentation of images and non-transitory computer readable medium | |
US20190228268A1 (en) | Method and system for cell image segmentation using multi-stage convolutional neural networks | |
WO2019091020A1 (en) | Weight data storage method, and neural network processor based on method | |
CN111882040A (en) | Convolutional neural network compression method based on channel number search | |
CN108985457B (en) | Deep neural network structure design method inspired by optimization algorithm | |
WO2022105108A1 (en) | Network data classification method, apparatus, and device, and readable storage medium | |
Ma et al. | Meta PID attention network for flexible and efficient real-world noisy image denoising | |
WO2021042857A1 (en) | Processing method and processing apparatus for image segmentation model | |
WO2019102984A1 (en) | Learning device and learning method, identification device and identification method, program, and recording medium | |
EP4341862A1 (en) | Low-rank adaptation of neural network models | |
CN116089883B (en) | Training method for improving classification degree of new and old categories in existing category increment learning | |
CN110929798A (en) | Image classification method and medium based on structure optimization sparse convolution neural network | |
CN113159072B (en) | Online ultralimit learning machine target identification method and system based on consistency regularization | |
CN111476346A (en) | Deep learning network architecture based on Newton conjugate gradient method | |
CN112634149A (en) | Point cloud denoising method based on graph convolution network | |
CN111353534A (en) | Graph data category prediction method based on adaptive fractional order gradient | |
CN111062474B (en) | Neural network optimization method for solving and improving adjacent operator machine | |
CN113408610B (en) | Image identification method based on adaptive matrix iteration extreme learning machine | |
WO2024060839A1 (en) | Object operation method and apparatus, computer device, and computer storage medium | |
CN116912576A (en) | Self-adaptive graph convolution brain disease classification method based on brain network higher-order structure | |
CN113590748B (en) | Emotion classification continuous learning method based on iterative network combination and storage medium | |
WO2021059527A1 (en) | Learning device, learning method, and recording medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |