CN113836804A - Animal identification model establishing method based on convolutional neural network and application system thereof - Google Patents

Animal identification model establishing method based on convolutional neural network and application system thereof Download PDF

Info

Publication number
CN113836804A
CN113836804A CN202111080000.3A CN202111080000A CN113836804A CN 113836804 A CN113836804 A CN 113836804A CN 202111080000 A CN202111080000 A CN 202111080000A CN 113836804 A CN113836804 A CN 113836804A
Authority
CN
China
Prior art keywords
model
animal
identification
animal identification
training
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.)
Granted
Application number
CN202111080000.3A
Other languages
Chinese (zh)
Other versions
CN113836804B (en
Inventor
向前
王晓丹
王紫娇
王硕
宋亚飞
王坚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Individual
Original Assignee
Individual
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Individual filed Critical Individual
Priority to CN202111080000.3A priority Critical patent/CN113836804B/en
Publication of CN113836804A publication Critical patent/CN113836804A/en
Application granted granted Critical
Publication of CN113836804B publication Critical patent/CN113836804B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation
    • G06F30/27Design optimisation, verification or simulation using machine learning, e.g. artificial intelligence, neural networks, support vector machines [SVM] or training a model
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/082Learning methods modifying the architecture, e.g. adding, deleting or silencing nodes or connections
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/086Learning methods using evolutionary algorithms, e.g. genetic algorithms or genetic programming

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Molecular Biology (AREA)
  • General Health & Medical Sciences (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • Mathematical Physics (AREA)
  • Biophysics (AREA)
  • Biomedical Technology (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Biology (AREA)
  • Physiology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Medical Informatics (AREA)
  • Computer Hardware Design (AREA)
  • Geometry (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses an animal identification model establishing method based on a convolutional neural network and an application system thereof, wherein the animal identification model establishing method of the convolutional neural network firstly introduces grouping convolution into the convolutional neural network based on standard convolution to construct an animal identification initial model, and trains the animal identification initial model to obtain an animal identification pre-training model; then, sequentially carrying out transfer learning, pruning, sparse treatment and quantitative treatment on the animal identification pre-training model to obtain a final animal identification model; the animal identification model established by the method has higher identification accuracy and reduced model calculation amount, the established animal identification model is applied to the embedded animal identification system with low power consumption, the identification speed and accuracy of the model in the embedded equipment are higher, the real-time performance of the model is stronger, the rapid and accurate animal identification task can be completed, 321 animals can be identified, and the fine-grained identification of the animal types is realized to a certain extent.

Description

Animal identification model establishing method based on convolutional neural network and application system thereof
Technical Field
The invention relates to the technical field of animal identification, in particular to an animal identification model establishing method based on a convolutional neural network and an application system thereof.
Background
In the real world, animals are in a variety, and how to effectively identify the animal species is a topic to be researched urgently by scientists. The device for rapidly and accurately identifying the animal in the research can help scientists to rapidly judge the attribution of species in the field research, and the fine-grained animal identification is beneficial to the real-time and accurate species diversity monitoring and effective protection of an animal protection base. In addition, in recent years, events that wild animals break into human living areas to influence normal life of human beings occur continuously, such as northeast tiger village injury events occurring in 4 months of 2021, northwest elephant migration events occurring in 5 months of 2021 and the like.
Because the field environment is complex, the animal types are various, the tracks are uncertain, and the network environment is poor, the development of the embedded animal identification system is beneficial to flexibly and conveniently deploying the system. Convolutional Neural Networks (CNN) have achieved a good effect in multiple computer vision tasks as a current main deep learning technique, but often have a high computational complexity, so that deployment of the CNN on edge devices is limited, and a "fast and accurate" effect cannot be achieved.
The following problems exist in the prior art when a rapid and accurate embedded intelligent animal identification system is developed: 1. the animal types are numerous, the background is complex, a complete data set is not easy to obtain, and fine-grained identification under the complex background is difficult to realize; 2. the standard convolution module has large calculation amount and higher requirements on storage and operation resources of the embedded equipment; 3. the traditional convolutional neural network model has large parameter quantity, is difficult to be deployed in an embedded platform with limited computing resources, and has poor real-time performance; 4. the data size is large, and the model training is difficult to quickly converge.
Disclosure of Invention
Aiming at the existing problems, the invention aims to provide an animal identification model establishing method based on a convolutional neural network and application thereof.
In order to achieve the purpose, the technical scheme adopted by the invention is as follows:
the animal identification model building method based on the convolutional neural network is characterized by comprising the following steps,
s1: introducing the grouping convolution into a convolution neural network based on standard convolution, constructing an animal identification initial model, and training the animal identification initial model by using an ImageNet data set to obtain an animal identification pre-training model;
s2: training and updating trainable parameters in the animal identification pre-training model obtained in the step S1 by using an amplification data set, so as to realize transfer learning of the animal identification pre-training model and obtain an animal identification transfer model;
s3: establishing an optimization model taking the number of channels of each convolutional layer in the animal identification migration model as a variable and the identification rate of the model on a test set as a target, pruning the animal identification migration model by utilizing a global optimal guidance artificial bee colony algorithm, reducing the parameter number of the model and obtaining an animal identification pruning model;
s4: performing sparse training on the animal recognition pruning model obtained in the step S3 by combining a multiple regularization technology to obtain an animal recognition sparse model;
s5: and quantifying the animal identification sparse model in the step S4 to obtain a final animal identification model.
Further, the animal recognition initial model in step S1 includes an input layer, a hidden layer and an output layer;
the hidden layer comprises 10 convolutional layers, the output of each convolutional layer is processed by batch normalization, and then a ReLU function is adopted for activation; maximum pooling is used between every two convolution layers as an up-sampling layer, and average pooling is used after the last convolution layer as up-sampling; the end of the hidden layer is connected with a Softmax classifier based on a full connection layer.
Further, the augmented data set in step S2 includes an image set formed by scaling, cropping, flipping, rotating, shifting, adding gaussian noise and color dithering to the original animal image.
Further, the specific operation of step S2 includes the following steps,
s201: dividing the amplification data set into a training set and a testing set;
s202: configuring parameters of an optimizer; setting a training period, the number of samples of input models in each batch and an initial learning rate alpha0Upper and lower bound parameters of learning rate alphafExponential moving weighted average hyperparameter beta of gradient first moment estimation1Exponential moving weighted average hyperparameter beta for gradient second moment estimation2Adjusting the pace gamma and the constant epsilon of the upper and lower limits of the learning rate;
s203: initializing an animal identification pre-training model; initializing a parameter theta of the model, and setting the parameter of the model to be a random value close to 0;
s204: updating the parameter theta by using a self-adaptive gradient descent algorithm;
s205: and calculating the loss function value and the accuracy of the current model on the training set and the test set every time the parameters are updated, checking whether the performance of the current model is improved or not by taking the accuracy of the test set as performance measurement, if so, storing the parameters of the current model, recording the optimal recognition rate of the test set, and taking the model corresponding to the optimal recognition rate of the test set as the animal recognition migration model.
Further, the specific operation of step S204 includes the following steps,
s2041: first moment estimate m of the initialization gradient00 and second moment estimate v0=0;
S2042: for the t-th iteration, the forward propagation error L (θ) is calculated according to a loss functiont-1);
S2043: calculating the gradient of the loss function at the t-th iteration
Figure BDA0003263633900000031
S2044: updating the learning rate at the t-th iteration
Figure BDA0003263633900000032
S2045: lower bound of learning rate at the time of computing the t-th iteration
Figure BDA0003263633900000033
S2046: upper bound of learning rate at the time of computing the t-th iteration
Figure BDA0003263633900000041
S2047: updating first moment estimate m of gradient at t-th iterationt=βt·mt-1+(1-β1)·gt
S2048: updating second moment estimates of gradients at the tth iteration
Figure BDA0003263633900000042
S2049: updating parameters
Figure BDA0003263633900000043
Further, the specific operation of establishing the optimization model with the number of channels of each convolutional layer in the animal recognition and migration model as a variable and the recognition rate of the model on the test set as a target in step S3 includes the following steps,
s301: make animal discernment migration model
Figure BDA0003263633900000044
The set of convolution kernels of each convolution layer is
Figure BDA0003263633900000045
Wherein, W(l)And b(l)The weights and bias parameters of the convolution kernels respectively correspond to the sets formed by the number of the channels as
Figure BDA0003263633900000046
Identifying a number of convolutional layers of the migration model for the animal;
s302: will be provided with
Figure BDA0003263633900000047
Of a network of cells
Figure BDA0003263633900000048
The set composed of the convolution kernel and the number of channels is respectively expressed as
Figure BDA0003263633900000049
And
Figure BDA00032636339000000410
and is
Figure BDA00032636339000000411
S303: for a particular training set
Figure BDA00032636339000000412
And test set
Figure BDA00032636339000000413
To determine the optimal set of channel numbers
Figure BDA00032636339000000414
Targeting the corresponding sub-network
Figure BDA00032636339000000415
In that
Figure BDA00032636339000000416
After fine adjustment, the pair
Figure BDA00032636339000000417
The method has high identification accuracy, so that an optimization target which takes the number of channels of each convolutional layer in the animal identification migration model as a variable and the identification rate of the model on a test set as a target is described as the following planning problem:
Figure BDA00032636339000000418
Figure BDA00032636339000000419
Figure BDA00032636339000000420
in the formula, acc (. cndot.) represents a subnet
Figure BDA0003263633900000051
In the test set
Figure BDA0003263633900000052
The overall recognition accuracy of the above, alpha ∈ (0.100%]For a given percentage hyperparameter, it is indicated that at most only one model per convolutional layer of the subnetwork is retained during pruning
Figure BDA0003263633900000053
The number of channels with the percentage of the corresponding convolutional layer being alpha; when in use
Figure BDA0003263633900000054
When it is taken
Figure BDA0003263633900000055
The weight parameters representing the sub-networks are inherited from the original network.
Further, in step S302Sub-networks
Figure BDA0003263633900000056
Of the convolution kernel of
Figure BDA0003263633900000057
The calculation method of (a) includes the steps of,
s3021: order to
Figure BDA0003263633900000058
Sub-networks
Figure BDA0003263633900000059
The number of channels of each one-dimensional convolution layer is
Figure BDA00032636339000000510
3022: obtaining the channel number n of the first one-dimensional convolution layer in the original networkj=len(W(i));
S3023: randomly generating a one-dimensional array A ═ a1,a2,…,az]Wherein the ith element aiIs from the interval [1, n1]A positive integer selected at random, and a1≠a2≠…≠az
S3024: arranging the elements in the array A from small to large;
s3025: let j be aiThen, then
Figure BDA00032636339000000511
Further, the specific operation of pruning the animal identification migration model by using the global optimal guided artificial bee colony algorithm in the step S3 includes the following steps,
s304, an initialization stage: regarding the number of channels of each layer of the pruning model as a honey source of the artificial bee colony, regarding the jth honey source, in a closed interval [1, alpha C ](l)/ρ]Randomly selects a positive integer as the channel number of the first convolution layer
Figure BDA00032636339000000512
Where ρ ∈ (1, + ∞)](ii) a Each honey source is initialized to a smaller range [1, α C ](l)/ρ]Then expanding the search space to [1, α C ] during the search process(l)]Setting the maximum number of search cycles to
Figure BDA00032636339000000513
S305, a bee hiring stage: search formula using differential evolution algorithm
Figure BDA0003263633900000061
Performing a search, wherein a ≠ b ≠ c ≠ j, FlIs a convolution-layer-dependent scaling factor, each independently randomly derived from a positive-Taiwanese distribution with an expectation of 0.5 and a standard deviation of 0.1, i.e., FlN (0.5, 0.1); calculating the fitness value of the honey source according to the target planning problem established in the step S303
Figure BDA0003263633900000062
S306, following bee stage: using formulas
Figure BDA0003263633900000063
Selecting a honey source by roulette selection using a formula
Figure BDA0003263633900000064
Generating new honey sources according to the selected honey sources, and performing greedy selection on the new and old honey sources according to the respective fitness values of the new and old honey sources; in the formula (I), the compound is shown in the specification,
Figure BDA0003263633900000065
for avoiding
Figure BDA0003263633900000066
When is, Pj=0;e≠f≠j,
Figure BDA0003263633900000067
Is the value and the scaling factor of the current optimal honey sourceSubcompliance with positive Tai distribution, i.e. F'j~N(0.0,2.0);
S307, scouting bee: if honey source
Figure BDA0003263633900000068
If no honey source better than the original honey source is found in the neighborhood after psi search, a honey source is randomly generated to replace the original honey source according to the method of the initialization stage
Figure BDA0003263633900000069
S308, repeating the steps S305 to S307 until the completion
Figure BDA00032636339000000610
And (4) searching in each period, calculating the fitness values of all the honey sources according to the target planning problem established in the step S303, and taking the sub-network corresponding to the honey source with the maximum fitness as a final animal identification pruning model.
Further, the specific operation of step S5 includes the following steps,
s501: quantizing the 32-bit floating point type parameter value of the animal identification sparse model by adopting a dynamic 8-bit quantization method;
s502: during network training, the maximum value R of each parameter value is calculated by using exponential moving averagemaxAnd a minimum value RminJudging whether the value of the parameter is a signed floating point type or an unsigned floating point type;
s503: for signed floating point type, quantize it to integer interval [ -128, +127], for unsigned floating point type, quantize to integer interval [0, 255 ];
s504: for unsigned floating point parameter values, the corresponding integer number length is Il=log2(|RmaxI)); for signed floating point parameter value, its correspondent integer number length is Il=log2(max(|Rmin|,|Rmax|))+1;
S505: calculation of the molecular Length Fl=8-IlThen the quantized multiplication factor of the floating-point number is
Figure BDA0003263633900000071
S506: the floating-point type parameter value W and the quantized multiplication factor M are combinedqMultiplying, and clipping to appropriate integer range with or without sign, and for floating point type with no sign, the quantized value is Wq=clip(round(W*Mq) 0, 255) for signed floating point type, the quantized value is Wq=cllip(round(W*Mq),-128,+127)。
Further, an application system of the animal identification model based on the convolutional neural network is characterized in that: the application system comprises a processor, a video acquisition module, an identification processing module, a touch screen display control module and a network communication module; the animal identification model is embedded in the identification processing module, and the video acquisition module, the identification processing module, the touch screen display control module and the network communication module are all connected with the processor;
the video acquisition module is mainly responsible for real-time video acquisition;
the identification processing module identifies the animal species of the video stream provided by the video acquisition module in real time;
the touch screen display control module is mainly responsible for man-machine interaction, and has the functions of realizing the opening and closing of a touch control program and displaying a real-time identification result;
the network communication module provides communication between the animal identification system and other external devices.
The invention has the beneficial effects that: compared with the prior art, the invention has the improvement that,
1. the animal identification model establishing method based on the convolutional neural network can greatly improve the model identification accuracy and reduce the calculated amount of the model; in the aspect of improving the identification accuracy, the identification of animals with high accuracy and fine granularity is realized through a data enhancement scheme and a transfer learning scheme and by combining an AdaBound training optimization algorithm; in the aspect of reducing the calculated amount, firstly, aiming at the problem of channel redundancy, a network channel pruning scheme based on an improved artificial bee colony algorithm is provided, and an optimal channel subset of a network is searched in a network structure searching mode, so that the number of network channels is reduced; secondly, aiming at the problem of parameter redundancy, a sparse training scheme is designed, and the parameter quantity is reduced; finally, a model quantization scheme is designed, and the 32-bit floating point type value of the network parameter is converted into an 8-bit integer type value, so that the requirements of the network on storage and computing resources are further reduced.
2. The animal identification model established by the animal identification model establishing method based on the convolutional neural network can be deployed in embedded equipment with low power consumption, the identification speed and accuracy of the model in the embedded equipment are high, the real-time performance of the model is high, a rapid and accurate animal identification task can be completed, 321 animals can be identified, and the fine-grained identification of animal types is realized to a certain extent.
Drawings
FIG. 1 is a flow chart of the animal identification model establishment method based on the convolutional neural network.
Fig. 2 is a schematic diagram of packet convolution according to the present invention.
FIG. 3 is a schematic diagram showing the comparison between sample data enhancement and enhancement according to the present invention.
FIG. 4 is a flow chart of the transfer learning method of the present invention.
FIG. 5 is an overall flow of the animal identification model pruning algorithm based on the global optimal guidance artificial bee colony algorithm of the present invention.
FIG. 6 is a flow chart of sparse training according to the present invention.
FIG. 7 is a block diagram of the hardware design of the application system of the present invention.
FIG. 8 is a Matrix-GUI desktop at system startup in an embodiment of the present invention.
Fig. 9 is an application icon of the smart animal identification system when the system is started according to the embodiment of the invention.
Fig. 10 is an interface of the smart animal identification system at system start-up in an embodiment of the invention.
Fig. 11 shows the results of the animal image recognition test under different brightness conditions in the example of the present invention.
FIG. 12 shows the result of image recognition test of different species of animals according to an embodiment of the present invention.
Fig. 13 shows the results of the animal image recognition test under different angles in the example of the present invention.
Fig. 14 shows the results of animal image recognition tests under different noise conditions in the example of the present invention.
Fig. 15 shows the result of animal image recognition test under different color dithering conditions in the embodiment of the present invention.
FIG. 16 shows the results of animal identification tests under different occlusion conditions in an embodiment of the present invention.
Detailed Description
In order to make those skilled in the art better understand the technical solution of the present invention, the following further describes the technical solution of the present invention with reference to the drawings and the embodiments.
As shown in fig. 1, the animal recognition model building method based on the convolutional neural network comprises the following steps,
s1: introducing the grouping convolution into a convolution neural network based on standard convolution, constructing an animal identification initial model, and training the animal identification initial model by using an ImageNet data set to obtain an animal identification pre-training model;
in the CNN model, the computation amount of the convolutional layer is the largest and determines the speed of the inference operation, so it is important to reduce the complexity of the convolutional layer. As shown in fig. 2, the standard convolution is essentially a packet convolution when the number of packets G is 1, and when G increases, the number of lines between the input feature map and the convolution kernel decreases significantly, meaning that the computation between them decreases, and thus the packet convolution helps to reduce the computation cost of the convolution layer.
Specifically, the animal identification initial model in the application comprises an input layer, a hidden layer and an output layer; the structure of the hidden layer is set as shown in table 1 below, and includes 10 convolution (Conv) layers, where the output of each convolution layer is processed by Batch Normalization (BN), and then activated by a ReLU function; maximum pooling (MaxPool) is used as an upsampling layer between every two convolutional layers, and average pooling (AvgPool) is used as upsampling after the last convolutional layer; the end of the hidden layer was connected to a fully connected layer (FC) based Softmax classifier and the animal identified the initial model input image as 224 x 224 in size. It should be noted here that, when an animal identification initial model is constructed, the animal identification initial model needs to be pre-trained, an existing pre-training method is adopted, and an ImageNet data set is used to pre-train the animal identification initial model to obtain an animal identification pre-training model, and the pre-training operation is performed by the existing method, which is not described in detail in this application.
TABLE 1 hidden layer Structure arrangement
Figure BDA0003263633900000101
Further, S2: training and updating trainable parameters in the animal identification pre-training model obtained in the step S1 by using an amplification data set, so as to realize transfer learning of the animal identification pre-training model and obtain an animal identification transfer model;
specifically, the amplification data set comprises an image set formed by scaling, clipping, turning, mirroring, rotating, shifting, adding Gaussian noise and color dithering to an original animal image. Because the collected animal image data with labels is extremely limited, the training data is expanded by using data enhancement technologies such as scaling, clipping, turning, rotating, shifting, Gaussian noise adding, color dithering and the like, and the diversity of training samples is improved.
Zooming: the figures primarily include outward or inward scaling. In the outward zooming, in order to maintain the size of the original image, an image having the same size as the original image is cut out from the zoomed image. Zooming in reduces the image to a preset size.
Cutting: the cropping operation is mainly performed by considering the width and height disturbance of the original image, and in most image classification networks, samples have to be uniform in size before being input into the network, so that a large amount of data can be expanded by adjusting the size of the image. The design firstly cuts the picture with fixed size at random, and then adjusts the picture to the size required by the network through an interpolation algorithm.
Turning: the image turning is to carry out mirror image operation on an original image, and mainly comprises horizontal mirror image turning, vertical mirror image turning and origin mirror image turning.
Rotating: the angle rotation operation is opposite to image mirroring, and mainly performs arbitrary angle transformation along the center of a picture, wherein the transformation is realized by multiplying an original image and an affine transformation matrix.
And (3) shifting: shifting involves moving the image in either the X or Y direction (or both) only, which can effectively increase the number of samples.
Adding Gaussian noise: overfitting often occurs when neural networks tend to learn high frequency features (i.e., patterns that appear heavily in images) that may not be useful. Gaussian noise with zero mean has data points in substantially all frequencies, effectively distorting high frequency characteristics, increasing the generalization capability of the network.
Color dithering: the color dithering is mainly to enhance the color of the image, and mainly to adjust the brightness, saturation and contrast of the image. In order to simulate animal images under different environmental backgrounds and lighting conditions, the design carries out color dithering on data to different degrees.
The contrast before and after sample data enhancement is as shown in fig. 3, and the mirroring processing mode in fig. 3 is included in the above-described flipping operation, and therefore, the mirroring operation is not specifically described in the present application.
Further, Transfer Learning (Transfer Learning) is a machine Learning method, which is to Transfer knowledge in one domain (i.e., a source domain) to another domain (i.e., a target domain), so that the target domain can obtain a better Learning effect. The source domain has a large amount of data and corresponding labels, so that the supervised learning of the model can be sufficiently performed, and then the knowledge or the mode learned by the model on the source domain is applied to different but related target domains, so that the learning effect of the target domains is improved. In order to improve the training speed and the recognition effect of the model, as shown in fig. 4, an animal recognition initial model (the animal recognition initial model refers to a pre-trained model after pre-training) is used as an initial model, trainable parameters in the initial model are trained by using an amplification data set, the model is prevented from being trained from the beginning, the training frequency of the model is reduced, and meanwhile, an improved stochastic gradient descent algorithm AdaBound is introduced in the training process to accelerate the convergence of the model.
The training of the network is a process of dynamically adjusting model parameter values according to a loss function and input data, and due to the limitation of a computer memory, the whole training data set is generally not trained at the same time, but small batches of data are gradually sent to the network updating parameters by adopting a batch method. A Stochastic Gradient Descent (SGD) randomly extracts n training samples from a training set in batches each time and sends the n training samples to a network, and for the t-th iteration, the expression of parameter theta is updated to be
θt+1=θtt·gt (1-1)
In the formula, alphatTo learn rate, gtFor the gradient of the loss function, for the loss function L (θ)t;x(i:i+n);y(i:i+n)) Is provided with
Figure BDA0003263633900000121
In the training of the network, the SGD uses a fixed learning rate to update parameters, and the parameter updating mode is used for selecting a proper learning rate alphatThe challenge is that if the choice is too large, the training is difficult to converge, otherwise the speed of convergence is reduced, while there is a risk of falling into local minima and saddle points. Therefore, the parameter update process is optimized using an improved gradient descent algorithm (adaptive gradient descent method AdaBound) to alleviate the above problem. In each updating process, AdaBound considers the influence of the previous gradient, and respectively updates the formula theta by using the first-order moment estimation and the second-order moment estimation of the gradientt+1=θtt·gtAlpha in (A)tAnd gtSimultaneously to alphatApplying dynamic boundaries, αtThere will be a certain range in each iteration, and this range will beThis makes the parameter update more smooth as the number of iterations increases less and less.
Specifically, the training and updating of trainable parameters in an animal recognition pre-training model by using an amplification data set aims to output the model when the recognition rate of a test set reaches the highest by inputting training set and test set data, and the specific operation comprises the following steps,
s201: dividing the amplification data set into a training set and a testing set;
s202: configuring parameters of an optimizer; setting the training period epoch to be 200, wherein the sample number B of the input model in each batch is 32, namely, randomly selecting 32 samples in each batch to input into the network; setting parameter alpha simultaneously0=0.001αf=0.1,β1=0.9β2=0.999,γ=10-3ε=10-7In which α is0As an initial learning rate, αfFor upper and lower bound parameters, beta, of the learning rate1Exponentially moving weighted average hyperparameter, beta, for gradient first moment estimation2The exponential moving weighted average hyperparameter estimated by the gradient second moment is obtained, gamma is the adjustment step of the upper and lower limits of the learning rate, and epsilon is a constant and a decimal number.
S203: initializing an animal identification pre-training model; initializing a parameter theta of the model, and setting the parameter of the model to be a random value close to 0;
s204: updating the parameter theta by using a self-adaptive gradient descent algorithm; specifically, the updating is carried out according to the following steps:
s2041: first moment estimate m of the initialization gradient00 and second moment estimate v0=0;
S2042: for the t-th iteration, the forward propagation error L (θ) is calculated according to a loss functiont-1);
S2043: calculating the gradient of the loss function at the t-th iteration
Figure BDA0003263633900000141
S2044: updating the learning rate at the t-th iteration
Figure BDA0003263633900000142
S2045: lower bound of learning rate at the time of computing the t-th iteration
Figure BDA0003263633900000143
S2046: upper bound of learning rate at the time of computing the t-th iteration
Figure BDA0003263633900000144
S2047: updating first moment estimate m of gradient at t-th iterationt=βt·mt-1+(1-βt)·g;
S2048: updating second moment estimates of gradients at the tth iteration
Figure BDA0003263633900000146
S2049: updating parameters
Figure BDA0003263633900000145
S205: and calculating the loss function value and the accuracy of the current model on the training set and the test set every time the parameters are updated, checking whether the performance of the current model is improved or not by taking the accuracy of the test set as performance measurement, if so, storing the parameters of the current model, recording the optimal recognition rate of the test set, and taking the model corresponding to the optimal recognition rate of the test set as the animal recognition migration model.
Further, S3: establishing an optimization model taking the number of channels of each convolutional layer in the animal identification migration model as a variable and the identification rate of the model on a test set as a target, pruning the animal identification migration model by utilizing a global optimal guidance artificial bee colony algorithm, reducing the parameter number of the model and obtaining an animal identification pruning model;
specifically, the specific operation of optimizing the model with the number of channels of each convolutional layer in the animal identification migration model as a variable and the identification rate of the model on the test set as a target comprises the following steps,
S301: make animal discernment migration model
Figure BDA0003263633900000151
The set of convolution kernels of each convolution layer is
Figure BDA0003263633900000152
Wherein, W(l)And b(l)The weights and bias parameters of the convolution kernels respectively correspond to the sets formed by the number of the channels as
Figure BDA0003263633900000153
Identifying a number of convolutional layers of the migration model for the animal;
s302: will be provided with
Figure BDA0003263633900000154
Of a network of cells
Figure BDA0003263633900000155
The set composed of the convolution kernel and the number of channels is respectively expressed as
Figure BDA0003263633900000156
And
Figure BDA0003263633900000157
and is
Figure BDA0003263633900000158
The weight parameter representing the sub-network inherits from the original network
From a pre-trained original network with knowledge of the number of individual one-dimensional convolutional layer channels of the sub-network
Figure BDA0003263633900000159
In which a sub-network is randomly selected
Figure BDA00032636339000001510
Set of its convolution kernels
Figure BDA00032636339000001511
The calculation method of (a) includes the steps of,
s3021: order to
Figure BDA00032636339000001512
Sub-networks
Figure BDA00032636339000001513
The number of channels of each one-dimensional convolution layer is
Figure BDA00032636339000001514
S3022: obtaining the channel number n of the first one-dimensional convolution layer in the original networkl=len(W(l));
S3023: randomly generating a one-dimensional array A ═ a1,a2,…,az]Wherein the ith element aiIs from the interval [1, n1]A positive integer selected at random, and a1≠a2≠…≠az
S3024: arranging the elements in the array A from small to large;
s3025: let j be aiThen, then
Figure BDA00032636339000001515
S303: for a particular training set
Figure BDA00032636339000001516
And test set
Figure BDA00032636339000001517
To determine the optimal set of channel numbers
Figure BDA00032636339000001518
Targeting the corresponding sub-network
Figure BDA00032636339000001519
In that
Figure BDA00032636339000001520
After fine adjustment, the pair
Figure BDA00032636339000001521
The method has high identification accuracy, so that an optimization target which takes the number of channels of each convolutional layer in the animal identification migration model as a variable and the identification rate of the model on a test set as a target is described as the following planning problem:
Figure BDA0003263633900000161
Figure BDA0003263633900000162
Figure BDA0003263633900000163
in the formula, acc (. cndot.) represents a subnet
Figure BDA0003263633900000164
In the test set
Figure BDA0003263633900000165
The overall recognition accuracy of the above, alpha ∈ (0.100%]For a given percentage hyperparameter, it is indicated that at most only one model per convolutional layer of the subnetwork is retained during pruning
Figure BDA0003263633900000166
The number of channels with alpha corresponding to the convolutional layer percentage is limited, so that the upper bound of the number of sub-network channels is limited to achieve the pruning effect and reduce the search space. Since the number of channels per one-dimensional convolutional layer is not 0; therefore, in the formulas (1-3), when
Figure BDA0003263633900000167
When it is taken
Figure BDA0003263633900000168
Further, the overall process of pruning the animal identification migration model by using the global optimal guidance artificial bee colony algorithm is shown in fig. 5, and the specific operation comprises the following steps,
s304, an initialization stage: regarding the number of channels of each layer of the pruning model as a honey source of the artificial bee colony, regarding the jth honey source, in a closed interval [1, alpha C ](l)/ρ]Randomly selects a positive integer as the channel number of the first convolution layer
Figure BDA0003263633900000169
Where ρ ∈ (1, + ∞)](ii) a Each honey source is initialized to a smaller range [1, α C ](l)/ρ]As can be seen from the formula (1-3),
Figure BDA00032636339000001610
therefore, the search space of the honey source is expanded to [1, α C ] in the search process(l)]The purpose of preferentially selecting the network with smaller number of channels and then gradually selecting the network with larger number of channels according to the fitness value is realized, and the maximum search period number is set as
Figure BDA00032636339000001612
S305, a bee hiring stage: replacing the search formula of the standard artificial bee colony algorithm with the search formula of the differential evolution algorithm to improve the convergence rate of the algorithm
Figure BDA00032636339000001611
Wherein a ≠ b ≠ c ≠ j, FlIs a convolution-layer-dependent scaling factor, each independently randomly derived from a positive-Taiwanese distribution with an expectation of 0.5 and a standard deviation of 0.1, i.e., FlN (0.5, 0.1); calculating the fitness value of the honey source according to the target planning problem established in the step S303 in the formula (1-3)
Figure BDA0003263633900000171
S306, following bee stage: selecting a honey source by the follower bees through a roulette selection method by utilizing a formula (1-6), generating a new honey source according to the selected honey source by utilizing a formula (1-7), and performing greedy selection on the new and old honey sources according to respective fitness values of the new and old honey sources;
Figure BDA0003263633900000172
Figure BDA0003263633900000173
in the formula (1-6),
Figure BDA0003263633900000174
for avoiding
Figure BDA0003263633900000175
When is, Pj=0;
In the formula (1-7), e ≠ f ≠ j,
Figure BDA0003263633900000176
is the value of the current optimal honey source, and the scaling factor obeys positive distribution, namely F'jN (0.0, 2.0); compared with the formula (1-4), the formula (1-7) introduces the current optimal honey source into the search formula, so that the algorithm finds a better honey source around the current optimal value.
S307, scouting bee: if honey source
Figure BDA0003263633900000177
If no honey source better than the original honey source is found in the neighborhood after psi search, a honey source is randomly generated to replace the original honey source according to the method of the initialization stage
Figure BDA0003263633900000178
S308, repeatingSteps S305 to S307 are completed
Figure BDA0003263633900000179
And (4) searching in each period, calculating the fitness values of all the honey sources according to the target planning problem established in the step S303, and taking the sub-network corresponding to the honey source with the maximum fitness as a final animal identification pruning model.
Formulas (1-5) are used for a given honey source in both the hiring bee stage and the following bee stage
Figure BDA0003263633900000181
Is calculated, but is trained from scratch
Figure BDA0003263633900000182
Corresponding sub-network
Figure BDA0003263633900000183
Then, the obtained value is obtained by the formula (1-5)
Figure BDA0003263633900000184
Is very time consuming. Therefore, in the present invention, according to
Figure BDA0003263633900000185
The specific number of channels in each convolutional layer is first derived from the pre-trained original network
Figure BDA0003263633900000186
Randomly selecting a corresponding number of convolution kernels as the convolution kernel
Figure BDA0003263633900000187
A convolution kernel of, thus
Figure BDA0003263633900000188
In which the parameters of each convolutional layer are completely inherited from
Figure BDA0003263633900000189
Then to
Figure BDA00032636339000001810
Training a small number of cycles to calculate fitness.
In four stages in the network pruning process, each sub-network needs to train theta periods when calculating the fitness of the network by using the formula (1-5), and the total period number of the pruning algorithm can be calculated in order to estimate the complexity of the pruning algorithm in the invention. Because each honey source corresponds to a sub-network, in each search period of the pruning algorithm, the initialization phase, the bee hiring phase and the bee following phase generate Ω sub-networks respectively, so each phase needs to train Ω × Θ periods. The number of sub-networks generated in the scout bee stage has great randomness and is difficult to accurately estimate, and the total number of training periods in the stage is recorded as
Figure BDA00032636339000001811
In summary, the total number of training periods of the sub-network required by the pruning algorithm in the present invention is
Figure BDA00032636339000001812
I.e. the training period number of the network in the pre-training stage and the fine-tuning stage is removed, and the additional required training period number of the network in the pruning process is at least equal to
Figure BDA00032636339000001813
Therefore, the introduction of the pruning algorithm relatively increases the calculation amount of the model in the training process, which results in that the network is very time-consuming in the training stage, but for practical application, the reduction of the model complexity of the network in the testing process and the improvement of the recognition accuracy rate are more important than the reduction of the time consumption in the training process, and particularly, the deployment of the animal recognition model on the embedded device with low power consumption is more obvious. The pruning algorithm of the invention introduces the hyper-parameter alpha for controlling the upper limit of the channel number of each convolution layer of the sub-network, and preferentially selects the sub-network with smaller channel number according to the lottery hypothesis, so that the parameters of the network are correspondingly reduced compared with the original network, thereby reducing the calculation complexity of the network in the test stage.
Further, S4: performing sparse training on the animal recognition pruning model obtained in the step S3 by combining a multiple regularization technology to obtain an animal recognition sparse model;
the number of convolutional layer channels of the animal identification model is reduced by using the pruning algorithm, the complexity of the model is reduced from the aspect of reducing the parameter number, and on the other hand, the calculated amount of the network is increased due to the fact that the parameter value is too large. In order to reduce the calculation amount from the angle of parameter values, the invention combines multiple regularization technology to carry out sparse training on the pruned animal identification pruning model, and the process is shown in figure 6. Firstly, the dense parameters of the pruning model are normalized backwards by L2 and L1, the absolute value of the parameters is close to 0, the minimum parameters in a certain proportion are directly set to be zero by threshold sparseness, and therefore the number of the parameters can be reduced. Since the identification accuracy of the AnimalNets is reduced by directly setting part of the parameters to 0, the sparse parameters need to be finely adjusted by using the training data set, and finally the sparse model is obtained.
Further, S5: and quantifying the animal identification sparse model in the step S4 to obtain a final animal identification model.
The parameters of the obtained animal identification sparse model are 32-bit floating point numbers, and the floating point numbers have two defects compared with integer numbers when calculation is carried out: firstly, floating point numbers need to occupy larger storage space and memory space during operation, and if 32-bit floating point numbers are converted into 8-bit integer, the storage space can be reduced by 75%; and secondly, the floating point number can reduce the operation speed during operation, the energy consumption of the equipment is increased, 4 8-bit integers can be simultaneously read in bandwidth required by reading the 32-bit floating point number, and the integer operation is faster than the floating point operation, so that the power consumption of the equipment can be naturally reduced.
The specific operation of quantifying the sparse model for animal identification in the present application comprises the following steps,
s501: quantizing the 32-bit floating point type parameter value of the animal identification sparse model by adopting a dynamic 8-bit quantization method;
s502: during network training, the maximum value R of each parameter value is calculated by using exponential moving averagemaxAnd most preferablySmall value of RminJudging whether the value of the parameter is a signed floating point type or an unsigned floating point type;
s503: for signed floating point type, quantize it to integer interval [ -128, +127], for unsigned floating point type, quantize to integer interval [0, 255 ];
s504: for unsigned floating point parameter values, the corresponding integer number length is
Il=log2(|Rmax|) (1-8)
For signed floating point parameter values, the corresponding integer number length is
Il=log2(max(|Rmin,Rmax|))+1 (1-9)
S505: calculation of the molecular Length Fl=8-Il (1-10)
The quantized product factor of the floating-point number is
Figure BDA0003263633900000201
S506: the floating-point type parameter value W and the quantized multiplication factor M are combinedqMultiplying, and clipping the values to a suitable range of unsigned or signed integers, for unsigned floating point, the quantized value is
Wq=clip(round(W*Mq),0,255) (1-12)
For signed floating point type, the quantized value is
Wq=clip(round(W*Mq),-128,+127) (1-13)
Further, the application also provides an application system of the animal identification model based on the convolutional neural network, and the application system comprises a processor, a video acquisition module, an identification processing module, a touch screen display control module and a network communication module; the animal identification model is embedded in the identification processing module, and the video acquisition module, the identification processing module, the touch screen display control module and the network communication module are all connected with the processor; the overall hardware design block diagram of the system is shown in fig. 7.
The embedded animal identification system selects an industrial pie as a hardware platform. The industry pi (IndustriPi) is an open source intelligent hardware development platform designed based on an AM5708 heterogeneous multi-core processor of Sitara series products of Texas Instruments (TI) in usa, and is a minimum system based on AM 5708. The industrial school is a low-power-consumption product and has abundant peripheral interfaces. That is, the processor in the invention adopts a TI Sitara AM5708 SoC heterogeneous multi-core processor, which adopts an industrial group as a carrier, and the video acquisition module, the identification processing module, the touch screen display control module and the network communication module are in communication connection with the processor through an external interface of the industrial group. The functional characteristics of the industry pie are shown in table 2 below.
TABLE 2 characteristics of the Industrial pie function
Figure BDA0003263633900000211
The video acquisition module is mainly responsible for real-time video acquisition, and adopts a USB2.0 camera module CTLYLH2M V1.1 with a lens focal length of 3mm and a photosensitive element size of 2.7 inches, wherein the size of the acquired video is 640 multiplied by 480 pixels, and the acquisition speed is 20 FPS.
The identification processing module is used for identifying the video stream provided by the video acquisition module in real time by calling TIDL API (extract description language), the module mainly uses C66x DSP, and the working frequency is 750 MHz.
The touch screen display control module is mainly responsible for man-machine interaction, can realize the opening and closing of a touch control program, display a real-time identification result and the like, and adopts a 7-inch LCD display screen with an HDMI interface to support 1024 × 600 pixels.
The network communication module provides communication between the animal identification system and other external devices, is mainly realized through a self-contained network interface, and can also realize control on a development board by using a UART serial port.
Example (b):
in order to check the functional integrity of the system for animal identification in the industrial group, the animal identification model and the corresponding software program are deployed in the industrial group system and are started according to the following steps:
step 1: the power supply was connected to the industry pie and the Matrix-GUI desktop shown in FIG. 8 appeared after the tape board was started, selecting "Intelligent Storm Applications";
step 2: after the first step of selection, the application icon of the intelligent Animal Recognition System shown in figure 9 appears, and the user clicks to enter "Animal Recognition System V0.1";
and step 3: clicking the "run" button on the software introduction page pops up the smart animal identification system interface, as shown in fig. 10.
After the steps are started, the identification test experiment under different brightness conditions, different animal species, different angles, different noise conditions, different color jitter conditions and different shielding conditions can be carried out.
The result of recognizing the animal image under different brightness conditions is shown in fig. 11, in which (a) the brightness condition is dark and (b) the brightness condition is bright, and it can be seen that the system can correctly recognize the animal under the different brightness conditions shown in the figure.
The images of animals of the same type but different species were identified, and the fine-grained identification effect of the test system on the animals, in the case of canines, is shown in fig. 12, in which (a) is Australian peduncle (Australian terrier), (b) is chihuahuahuahua (Chihuahua), (c) is duckliner (doberman), (d) is golden retriever (golden retriever), and (e) is Norwegian Elkhound, and it can be seen that the system can correctly identify the animals of different species in the images.
The result of recognizing the animal images at different angles is shown in fig. 13, in which (a) is upright, (b) is inverted, and (c) is side-standing, and the system can correctly recognize the animal at different angles shown in the figure.
The animal images under different noise conditions are identified, the noise is white gaussian noise, and the result is shown in fig. 14, wherein (a) is high noise and (b) is low noise, so that the system can correctly identify the animal under the different noise conditions shown in the figure.
The result of identifying the animal image under different color dithering conditions is shown in fig. 15, wherein (a) is the result of adjusting the saturation condition, (b) is the result of adjusting the contrast condition, (c) is the result of adjusting the sharpness condition, and (d) is the result of adjusting all the above conditions, so that the system can correctly identify the animal under the different color dithering conditions shown in the figure.
The animal images are shielded to different degrees, and the recognition result is shown in fig. 16, wherein (a), (b) and (c) are three different shielding modes, and the system can correctly recognize the animal under the different shielding conditions shown in the figure.
The foregoing shows and describes the general principles, essential features, and advantages of the invention. It will be understood by those skilled in the art that the present invention is not limited to the embodiments described above, which are described in the specification and illustrated only to illustrate the principle of the present invention, but that various changes and modifications may be made therein without departing from the spirit and scope of the present invention, which fall within the scope of the invention as claimed. The scope of the invention is defined by the appended claims and equivalents thereof.

Claims (10)

1. The animal identification model building method based on the convolutional neural network is characterized by comprising the following steps,
s1: introducing the grouping convolution into a convolution neural network based on standard convolution, constructing an animal identification initial model, and training the animal identification initial model by using an ImageNet data set to obtain an animal identification pre-training model;
s2: training and updating trainable parameters in the animal identification pre-training model obtained in the step S1 by using an amplification data set, so as to realize transfer learning of the animal identification pre-training model and obtain an animal identification transfer model;
s3: establishing an optimization model taking the number of channels of each convolutional layer in the animal identification migration model as a variable and the identification rate of the model on a test set as a target, pruning the animal identification migration model by utilizing a global optimal guidance artificial bee colony algorithm, reducing the parameter number of the model and obtaining an animal identification pruning model;
s4: performing sparse training on the animal recognition pruning model obtained in the step S3 by combining a multiple regularization technology to obtain an animal recognition sparse model;
s5: and quantifying the animal identification sparse model in the step S4 to obtain a final animal identification model.
2. The convolutional neural network-based animal recognition model building method as set forth in claim 1, wherein: the animal identification initial model in the step S1 comprises an input layer, a hidden layer and an output layer;
the hidden layer comprises 10 convolutional layers, the output of each convolutional layer is processed by batch normalization, and then a ReLU function is adopted for activation; maximum pooling is used between every two convolution layers as an up-sampling layer, and average pooling is used after the last convolution layer as up-sampling; the end of the hidden layer is connected with a Softmax classifier based on a full connection layer.
3. The convolutional neural network-based animal recognition model building method as set forth in claim 2, wherein: the augmented data set in step S2 includes an image set formed by scaling, cropping, flipping, rotating, shifting, adding gaussian noise and color dithering to the original animal image.
4. The convolutional neural network-based animal recognition model building method as claimed in claim 2, wherein the specific operation of step S2 includes the steps of,
s201: dividing the amplification data set into a training set and a testing set;
s202: configuring parameters of an optimizer; setting a training period, the number of samples of input models in each batch and an initial learning rate alpha0Upper and lower bound parameters of learning rate alphafExponential moving weighted average hyperparameter beta of gradient first moment estimation1Exponential moving weighted average hyperparameter beta for gradient second moment estimation2Adjusting the pace gamma and the constant epsilon of the upper and lower limits of the learning rate;
s203: initializing an animal identification pre-training model; initializing a parameter theta of the model, and setting the parameter of the model to be a random value close to 0;
s204: updating the parameter theta by using a self-adaptive gradient descent algorithm;
s205: and calculating the loss function value and the accuracy of the current model on the training set and the test set every time the parameters are updated, checking whether the performance of the current model is improved or not by taking the accuracy of the test set as performance measurement, if so, storing the parameters of the current model, recording the optimal recognition rate of the test set, and taking the model corresponding to the optimal recognition rate of the test set as the animal recognition migration model.
5. The convolutional neural network-based animal recognition model building method as claimed in claim 4, wherein the specific operation of step S204 comprises the steps of,
s2041: first moment estimate m of the initialization gradient00 and second moment estimate v0=0;
S2042: for the t-th iteration, the forward propagation error L (θ) is calculated according to a loss functiont-1);
S2043: calculating the gradient of the loss function at the t-th iteration
Figure FDA0003263633890000031
S2044: updating the learning rate at the t-th iteration
Figure FDA0003263633890000032
S2045: lower bound of learning rate at the time of computing the t-th iteration
Figure FDA0003263633890000033
S2046: upper bound of learning rate at the time of computing the t-th iteration
Figure FDA0003263633890000034
S2047: updating first moment estimate m of gradient at t-th iterationt=βt·mt-1+(1-βt)·gt
S2048: updating second moment estimates of gradients at the tth iteration
Figure FDA0003263633890000035
S2049: updating parameters
Figure FDA0003263633890000036
6. The method of claim 4, wherein the specific operation of building an optimization model with the number of channels of each convolutional layer in the animal recognition migration model as a variable and the recognition rate of the model on the test set as a target in step S3 comprises the following steps,
s301: make animal discernment migration model
Figure FDA0003263633890000037
The set of convolution kernels of each convolution layer is
Figure FDA0003263633890000038
Wherein, W(l)And b(l)The weights and bias parameters of the convolution kernels respectively correspond to the sets formed by the number of the channels as
Figure FDA0003263633890000039
Figure FDA00032636338900000310
Identifying a number of convolutional layers of the migration model for the animal;
s302: will be provided with
Figure FDA00032636338900000311
Of a network of cells
Figure FDA00032636338900000312
The set composed of the convolution kernel and the number of channels is respectively expressed as
Figure FDA00032636338900000313
And
Figure FDA00032636338900000314
and is
Figure FDA00032636338900000315
S303: training set specific to trunk
Figure FDA0003263633890000041
And test set
Figure FDA0003263633890000042
To determine the optimal set of channel numbers
Figure FDA0003263633890000043
Targeting the corresponding sub-network
Figure FDA0003263633890000044
In that
Figure FDA0003263633890000045
After fine adjustment, the pair
Figure FDA0003263633890000046
The method has high identification accuracy, so that an optimization target which takes the number of channels of each convolutional layer in the animal identification migration model as a variable and the identification rate of the model on a test set as a target is described as the following planning problem:
Figure FDA0003263633890000047
Figure FDA0003263633890000048
Figure FDA0003263633890000049
in the formula, acc (. cndot.) represents a subnet
Figure FDA00032636338900000410
In the test set
Figure FDA00032636338900000411
The overall recognition accuracy of the above, alpha ∈ (0.100%]For a given percentage hyperparameter, it is indicated that at most only one model per convolutional layer of the subnetwork is retained during pruning
Figure FDA00032636338900000412
The number of channels with the percentage of the corresponding convolutional layer being alpha; when in use
Figure FDA00032636338900000413
When it is taken
Figure FDA00032636338900000414
Figure FDA00032636338900000415
The weight parameters representing the sub-networks are inherited from the original network.
7. The convolutional neural network-based animal identification model building method as claimed in claim 6, wherein the sub-network is used in step S302
Figure FDA00032636338900000416
Of the convolution kernel of
Figure FDA00032636338900000417
The calculation method of (a) includes the steps of,
s3021: order to
Figure FDA00032636338900000418
Figure FDA00032636338900000419
Sub-networks
Figure FDA00032636338900000420
The number of channels of each one-dimensional convolution layer is
Figure FDA00032636338900000421
S3022: obtaining the channel number n of the first one-dimensional convolution layer in the original network1=len(W(l));
S3023: randomly generating a one-dimensional array A ═ a1,a2,…,az]Wherein the ith element aiIs from the interval [1, n1]A positive integer selected at random, and a1≠a2≠…≠az
S3024: arranging the elements in the array A from small to large;
s3025: let j be aiThen, then
Figure FDA00032636338900000422
8. The animal recognition model building method based on convolutional neural network of claim 6, wherein the specific operation of pruning the animal recognition migration model by using the global optimal guided artificial bee colony algorithm in step S3 comprises the following steps,
s304, beginningAn initialization stage: regarding the number of channels of each layer of the pruning model as a honey source of the artificial bee colony, regarding the jth honey source, in a closed interval [1, alpha C ](l)/ρ]Randomly selects a positive integer as the channel number of the first convolution layer
Figure FDA0003263633890000051
Where ρ ∈ (1, + ∞)](ii) a Each honey source is initialized to a smaller range [1, α C ](l)/ρ]Then expanding the search space to [1, α C ] during the search process(l)]Setting the maximum number of search cycles to
Figure FDA0003263633890000052
S305, a bee hiring stage: search formula using differential evolution algorithm
Figure FDA0003263633890000053
Performing a search, wherein a ≠ b ≠ c ≠ j, FlIs a convolution-layer-dependent scaling factor, each independently randomly derived from a positive-Taiwanese distribution with an expectation of 0.5 and a standard deviation of 0.1, i.e., FlN (0.5, 0.1); calculating the fitness value of the honey source according to the target planning problem established in the step S303
Figure FDA0003263633890000054
S306, following bee stage: using formulas
Figure FDA0003263633890000055
Selecting a honey source by roulette selection using a formula
Figure FDA0003263633890000056
Generating new honey sources according to the selected honey sources, and performing greedy selection on the new and old honey sources according to the respective fitness values of the new and old honey sources; in the formula (I), the compound is shown in the specification,
Figure FDA0003263633890000057
beta e (0, 1) for avoiding
Figure FDA0003263633890000058
When is, Pj=0;e≠f≠j,gbestj (l)Is the value of the current optimal honey source, and the scaling factor obeys positive distribution, namely F'j~N(0.0,2.0);
S307, scouting bee: if honey source
Figure FDA0003263633890000059
If no honey source better than the original honey source is found in the neighborhood after psi search, a honey source is randomly generated to replace the original honey source according to the method of the initialization stage
Figure FDA0003263633890000061
S308, repeating the steps S305 to S307 until the completion
Figure FDA0003263633890000063
And (4) searching in each period, calculating the fitness values of all the honey sources according to the target planning problem established in the step S303, and taking the sub-network corresponding to the honey source with the maximum fitness as a final animal identification pruning model.
9. The convolutional neural network-based animal recognition model building method as claimed in claim 6, wherein the specific operation of step S5 includes the steps of,
s501: quantizing the 32-bit floating point type parameter value of the animal identification sparse model by adopting a dynamic 8-bit quantization method;
s502: during network training, the maximum value R of each parameter value is calculated by using exponential moving averagemaxAnd a minimum value RminJudging whether the value of the parameter is a signed floating point type or an unsigned floating point type;
s503: for signed floating point type, quantize it to integer interval [ -128, +127], for unsigned floating point type, quantize to integer interval [0, 255 ];
s504: for unsigned floating point parameter values, the corresponding integer number length is Il=log2(|RmaxI)); for signed floating point parameter value, its correspondent integer number length is Il=log2(max(|Rmin|,|Rmax|))+1;
S505: calculation of the molecular Length Fl=8-IlThen the quantized multiplication factor of the floating-point number is
Figure FDA0003263633890000062
S506: the floating-point type parameter value W and the quantized multiplication factor M are combinedqMultiplying, and clipping to appropriate integer range with or without sign, and for floating point type with no sign, the quantized value is Wq=clip(round(W*Mq) 0, 255) for signed floating point type, the quantized value is Wq=clip(round(W*Mq),-128,+127)。
10. An application system of an animal identification model based on a convolutional neural network is characterized in that: the application system comprises a processor, a video acquisition module, an identification processing module, a touch screen display control module and a network communication module; the animal identification model is embedded in the identification processing module, and the video acquisition module, the identification processing module, the touch screen display control module and the network communication module are all connected with the processor;
the video acquisition module is mainly responsible for real-time video acquisition;
the identification processing module identifies the animal species of the video stream provided by the video acquisition module in real time;
the touch screen display control module is mainly responsible for man-machine interaction, and has the functions of realizing the opening and closing of a touch control program and displaying a real-time identification result;
the network communication module provides communication between the animal identification system and other external devices.
CN202111080000.3A 2021-09-15 2021-09-15 Animal identification model building method based on convolutional neural network and application system thereof Active CN113836804B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111080000.3A CN113836804B (en) 2021-09-15 2021-09-15 Animal identification model building method based on convolutional neural network and application system thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111080000.3A CN113836804B (en) 2021-09-15 2021-09-15 Animal identification model building method based on convolutional neural network and application system thereof

Publications (2)

Publication Number Publication Date
CN113836804A true CN113836804A (en) 2021-12-24
CN113836804B CN113836804B (en) 2024-06-18

Family

ID=78959421

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111080000.3A Active CN113836804B (en) 2021-09-15 2021-09-15 Animal identification model building method based on convolutional neural network and application system thereof

Country Status (1)

Country Link
CN (1) CN113836804B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115049055A (en) * 2022-06-29 2022-09-13 厦门大学 Dynamic dual trainable boundary-based hyper-resolution neural network quantification method
CN115526266A (en) * 2022-10-18 2022-12-27 支付宝(杭州)信息技术有限公司 Model training method and device, and business prediction method and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110378435A (en) * 2019-07-25 2019-10-25 安徽工业大学 A method of the Apple Leaves disease recognition based on convolutional neural networks
WO2021129570A1 (en) * 2019-12-25 2021-07-01 神思电子技术股份有限公司 Network pruning optimization method based on network activation and sparsification

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110378435A (en) * 2019-07-25 2019-10-25 安徽工业大学 A method of the Apple Leaves disease recognition based on convolutional neural networks
WO2021129570A1 (en) * 2019-12-25 2021-07-01 神思电子技术股份有限公司 Network pruning optimization method based on network activation and sparsification

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
白洁;张金松;刘倩宇;: "基于卷积网络特征迁移的小样本物体图像识别", 计算机仿真, no. 05, 15 May 2020 (2020-05-15) *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115049055A (en) * 2022-06-29 2022-09-13 厦门大学 Dynamic dual trainable boundary-based hyper-resolution neural network quantification method
CN115049055B (en) * 2022-06-29 2024-06-04 厦门大学 Super-division neural network quantification method based on dynamic double trainable limit
CN115526266A (en) * 2022-10-18 2022-12-27 支付宝(杭州)信息技术有限公司 Model training method and device, and business prediction method and device
CN115526266B (en) * 2022-10-18 2023-08-29 支付宝(杭州)信息技术有限公司 Model Training Method and Device, Service Prediction Method and Device

Also Published As

Publication number Publication date
CN113836804B (en) 2024-06-18

Similar Documents

Publication Publication Date Title
Strumberger et al. Designing convolutional neural network architecture by the firefly algorithm
WO2022057262A1 (en) Image recognition method and device, and computer-readable storage medium
CN112163465A (en) Fine-grained image classification method, fine-grained image classification system, computer equipment and storage medium
CN112613581A (en) Image recognition method, system, computer equipment and storage medium
CN112052948B (en) Network model compression method and device, storage medium and electronic equipment
CN113836804B (en) Animal identification model building method based on convolutional neural network and application system thereof
CN109961102B (en) Image processing method, image processing device, electronic equipment and storage medium
CN114925320B (en) Data processing method and related device
CN109583367A (en) Image text row detection method and device, storage medium and electronic equipment
US20200257966A1 (en) Quality monitoring and hidden quantization in artificial neural network computations
CN114332545A (en) Image data classification method and device based on low-bit pulse neural network
Yang et al. Automated garden-insect recognition using improved lightweight convolution network
Peng et al. An adaptive Lévy flight firefly algorithm for multilevel image thresholding based on Rényi entropy
WO2020165629A1 (en) Quality monitoring and hidden quantization in artificial neural network computations
Mocerino et al. CoopNet: Cooperative convolutional neural network for low-power MCUs
Wang et al. MetaScleraSeg: an effective meta-learning framework for generalized sclera segmentation
Rugina et al. Meta-learning and self-supervised pretraining for real world image translation
Prasad et al. Analysis on content based image retrieval using image enhancement and deep learning convolutional neural networks
Ghosh et al. PB3C-CNN: An integrated PB3C and CNN based approach for plant leaf classification
Kepesiova et al. Comparison of Optimization Techniques for Process Recognition Using Deep Neural Network
CN117649631B (en) Client image processing method and system based on improved convolutional neural network
CN114140654B (en) Image action recognition method and device and electronic equipment
CN113869193B (en) Training method of pedestrian re-recognition model, pedestrian re-recognition method and system
US11989653B2 (en) Pseudo-rounding in artificial neural networks
Fang et al. Embedded image recognition system for lightweight convolutional Neural Networks

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