Summary of the invention
In view of above-mentioned analysis, the embodiment of the present invention, which proposes, a kind of establishes image classification neural network model and image point
Class method, apparatus, to solve existing intensive connection convolutional neural networks, with widening for network-wide and adding for depth
Deeply, the problem of explosive increase can occur for the parameter amount of network.
To achieve the above object, the present invention adopts the following technical scheme:
According in a first aspect, the embodiment of the present invention provides a kind of method for establishing image classification neural network model, this is built
The method of vertical image classification neural network model includes: to obtain the training set comprising image of having classified;According to intensive connection convolution
The distance between each convolutional layer in the intensive block of neural network model determines the number for inputting the characteristic pattern of each convolutional layer in intensive block
Amount forms second and intensively connects convolutional neural networks model;Using training set to the second intensive connection convolutional neural networks model
It is trained, generates image classification neural network model.
With reference to first aspect, in first aspect first embodiment, according to intensive connection convolutional neural networks model
The distance between each convolutional layer, determines the quantity for inputting the characteristic pattern of each convolutional layer in intensive block in intensive block, and it is close to form second
Collection connection convolutional neural networks model, comprising: obtain in intensive block the distance between each convolutional layer and two neighboring convolutional layer it
Between the quantity of characteristic pattern transmitted;It is transmitted between two neighboring convolutional layer according to the distance between convolutional layer each in intensive block
The quantity of characteristic pattern determines the characteristic pattern quantity growth rate for inputting intensive each convolutional layer of block;According to the growth rate, determine that input is close
The quantity of the characteristic pattern of each convolutional layer in glomeration forms second and intensively connects convolutional neural networks model.
First embodiment with reference to first aspect is determined defeated in first aspect second embodiment by following formula
Enter the characteristic pattern quantity growth rate G of each convolutional layer of intensive block:
Wherein, Δ L indicates that the distance between first layer convolutional layer and the last layer convolutional layer in intensive block, h indicate adjacent
The distance between two convolutional layers, s indicate the quantity of the characteristic pattern of first layer convolutional layer output, s0Indicate two neighboring convolutional layer
Between the quantity of characteristic pattern transmitted.
Second embodiment with reference to first aspect is determined defeated in first aspect third embodiment by following formula
Enter the quantity of the characteristic pattern of each convolutional layer in intensive block, sLIndicate input L layer convolutional layer characteristic pattern quantity, L for greater than
Positive integer equal to 2:
Wherein, s1Indicate the quantity of the characteristic pattern of the intensive block first layer convolutional layer of input, l indicates defeated to L layers of convolutional layer
Enter the convolutional layer of characteristic pattern.
According to second aspect, the embodiment of the present invention provides a kind of image classification method, which includes: to obtain
Image to be classified data;Image classification nerve net is established using what above-mentioned first aspect or first aspect any embodiment provided
The image classification neural network model that the method for network model obtains classifies to image to be classified data.
According to the third aspect, the embodiment of the present invention provides a kind of device for establishing image classification neural network model, this is built
The device of vertical image classification neural network model includes: that training set obtains module, for obtaining the training comprising image of having classified
Collection;Second convolution Establishment of Neural Model module, for each in the intensive block according to intensive connection convolutional neural networks model
The distance between convolutional layer determines the quantity for inputting the characteristic pattern of each convolutional layer in intensive block, forms second and intensively connects convolution
Neural network model;Image classification neural network model generation module, for being rolled up using above-mentioned training set to the second intensive connection
Product neural network model is trained, and generates image classification neural network model.
In conjunction with the third aspect, in third aspect first embodiment, above-mentioned second convolution Establishment of Neural Model mould
Block includes: distance and quantity parameter acquisition module, for obtaining the distance between each convolutional layer and two neighboring volume in intensive block
The quantity of the characteristic pattern transmitted between lamination;Growth rate determining module, for according to the distance between convolutional layer each in intensive block
The quantity of the characteristic pattern transmitted between two neighboring convolutional layer determines that the characteristic pattern quantity for inputting intensive each convolutional layer of block increases
Rate;Second convolution neural network model forms module, for determining and inputting each convolutional layer in intensive block according to above-mentioned growth rate
The quantity of characteristic pattern forms second and intensively connects convolutional neural networks model.
In conjunction with third aspect first embodiment, in third aspect second embodiment, above-mentioned growth rate determining module
The characteristic pattern quantity growth rate G for inputting intensive each convolutional layer of block is determined by following formula:
Wherein, Δ L indicates that the distance between first layer convolutional layer and the last layer convolutional layer in intensive block, h indicate adjacent
The distance between two convolutional layers, s indicate the quantity of the characteristic pattern of first layer convolutional layer output, s0Indicate two neighboring convolutional layer
Between the quantity of characteristic pattern transmitted.
In conjunction with third aspect second embodiment, in third aspect third embodiment, above-mentioned second convolution nerve net
Network model forms module and determines the quantity for inputting the characteristic pattern of each convolutional layer in intensive block, s by following formulaLIndicate input the
The quantity of the characteristic pattern of L layers of convolutional layer, L are the positive integer more than or equal to 2:
Wherein, s1Indicate the quantity of the characteristic pattern of the intensive block first layer convolutional layer of input, l indicates defeated to L layers of convolutional layer
Enter the convolutional layer of characteristic pattern.
According to fourth aspect, the embodiment of the present invention provides a kind of image classification device, which includes: wait divide
Class image data acquisition module, for obtaining image to be classified data;Image classification module, for using the above-mentioned third aspect or
The image classification nerve net that the device for establishing image classification neural network model that third aspect any embodiment provides obtains
Network model classifies to image to be classified data.
According to the 5th aspect, the embodiment of the present invention provides a kind of computer readable storage medium, the computer-readable storage
Media storage has computer instruction, and the computer instruction is for making computer execute above-mentioned first aspect or any reality of first aspect
What the mode of applying provided establishes the method for image classification neural network model or the image classification method of above-mentioned second aspect offer.
According to the 6th aspect, the embodiment of the present invention provides a kind of electronic equipment, which includes: memory and processing
Device communicates with each other connection between memory and processor, memory is stored with computer instruction, and processor is by executing the calculating
Machine instruction establishes image classification neural network mould thereby executing what above-mentioned first aspect or first aspect any embodiment provided
The image classification method that the method for type or above-mentioned second aspect provide.
Technical solution of the present invention at least has the advantages that compared with prior art
Image classification neural network model and image classification method, device are established the embodiment of the invention provides a kind of, it should
It establishes in the method for image classification neural network model, obtains the training set comprising image of having classified first, then according to intensive
The distance between each convolutional layer in the intensive block of convolutional neural networks model is connected, determines the spy for inputting each convolutional layer in intensive block
The quantity of figure is levied, second is formed and intensively connects convolutional neural networks model, and using above-mentioned training set to the second intensive connection
Convolutional neural networks model is trained, and generates image classification neural network model, then using establishing image classification nerve net
The image classification neural network model that the method for network model generates classifies to image to be classified data.The embodiment of the present invention exists
It is improved on the basis of existing intensive connection convolutional neural networks model, it is true according to the distance between convolutional layer each in intensive block
The transmitting quantity for determining characteristic pattern classifies to image to be classified using the image classification neural network model that training generates, by
Have in the transmitting quantity of used characteristic pattern and significantly reduce, therefore reduces the network parameter amount during image classification.
Specific embodiment
Technical solution of the present invention is clearly and completely described below in conjunction with attached drawing, it is clear that described implementation
Example is a part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skill
Personnel's every other embodiment obtained without making creative work, shall fall within the protection scope of the present invention.
In the description of the present invention, it should be noted that term " first ", " second " are used for description purposes only, and cannot
It is interpreted as indication or suggestion relative importance.
As long as in addition, the non-structure each other of technical characteristic involved in invention described below different embodiments
It can be combined with each other at conflict.
The embodiment of the invention provides a kind of methods for establishing image classification neural network model, as shown in Figure 1, the foundation
The method of image classification neural network model includes:
Step S1: the training set comprising image of having classified is obtained;It specifically can be and choose training from CIFAR data set
Collection.
Step S2: it according to the distance between each convolutional layer in the intensive block of intensive connection convolutional neural networks model, determines
The quantity of the characteristic pattern of each convolutional layer in intensive block is inputted, second is formed and intensively connects convolutional neural networks model.
Step S3: the second intensive connection convolutional neural networks model is trained using training set, generates image classification
Neural network model.
In the intensive block of existing intensive connection convolutional neural networks model, each layer of convolutional layer is by all layers in its front
All output characteristic patterns as input, S1 to step S3 through the above steps of the embodiment of the present invention, to existing intensive connection
Convolutional neural networks model improves, and second improved intensively connects in the intensive block of convolutional neural networks model, often
One layer of convolutional layer is when receiving the output characteristic pattern of all layers of its front, and the characteristic pattern that non-reception each forward layer is all, but
According to the distance between convolutional layer each in intensive block, the quantity for inputting the characteristic pattern of each convolutional layer in intensive block is determined, distance is not
Together, received characteristic pattern quantity is different, the second intensive connection convolutional Neural then obtained using the training set of acquisition to improvement
Network model is trained, and image classification neural network model is generated, due to the network parameter of convolutional layer in neural network model
Amount is therefore the quantity of convolution kernel, the product of input feature vector figure quantity and output characteristic pattern quantity three are implemented using of the invention
The image classification neural network model that example obtains classifies to image, reduces the network parameter amount during image classification.
Below by taking 40 layers of intensive connection convolutional neural networks model as an example, to existing intensive connection convolutional neural networks model
It is illustrated:
As shown in Fig. 2, existing 40 layers intensive connection convolutional neural networks model include three groups of intensive block (Dense altogether
Block), the make of three groups of intensive blocks is identical, and there are two types of makes for every group of intensive block, the first make is by 12
The convolutional layer of a 3*3 connects composition, and second of make is made of the convolutional layer of 6 3*3, before the convolutional layer of each 3*3
The convolutional layer of a 1*1 is all connected, under two kinds of structures mode, each convolutional layer is the filter of 3*3 in intensive block, and is inputted
The fixation that every one side of characteristic pattern is filled up by zero pixel to keep characteristic pattern size, the characteristic pattern size point in three intensive blocks
It Wei 32 × 32,16 × 16 and 8 × 8.As shown in figure 3, each 3*3 convolutional layer receives in the make of two kinds of intensive blocks
Its all forward layer x0, x1..., xl-1Characteristic pattern as input, it may be assumed that
xl=Hl([x0,x1..., xl-1]),
Wherein, Hl() is the compound function of three continuous operations: batch normalization (BN), linear amending unit (ReLU)
And convolution, and the quantity of each 3*3 convolutional layer output characteristic pattern is all the same.
Since an important component of convolutional neural networks is pond layer (Pooling), but pondization operation can change
The size of characteristic pattern, therefore, in addition to the layer of pond, in the intensive connection convolutional neural networks model of the embodiment of the present invention, Suo Youjuan
Lamination uses above-mentioned Hl() function, in addition, being provided with transition zone between two neighboring intensive block, transition zone is by 1*1
Convolutional layer and 2*2 average pond layer composition, the embodiment of the present invention retain across transition zone characteristic pattern quantity, i.e., if
The output of first intensive block includes m characteristic pattern, then first transition zone also generates m output characteristic pattern, and is transmitted to the
In two intensive blocks.As shown in Fig. 2, being additionally provided with the convolutional layer of a 3*3 before first intensive block, output channel number is
16, global average pond is carried out at the end of the last one intensive block, and be provided with a softmax linear classifier.
As shown in figure 4, the embodiment of the present invention mainly improves the intensive block of intensive connection convolutional neural networks model,
In the intensive block for improving the second obtained intensive connection convolutional neural networks model, the output characteristic pattern of every layer of 3*3 convolutional layer
All layers in the rear part are all input to, but the rear part layer receives quantity the determining apart from size by two interlayers of the characteristic pattern of this layer
It is fixed, and distance is bigger, and the quantity of received characteristic pattern is more.Specifically, as shown in figure 5, above-mentioned steps S2, according to intensively connecting
The distance between each convolutional layer in the intensive block of convolutional neural networks model is connect, determines the feature for inputting each convolutional layer in intensive block
The quantity of figure forms second and intensively connects convolutional neural networks model, comprising:
Step S201: the feature transmitted between the distance between each convolutional layer and two neighboring convolutional layer in intensive block is obtained
The quantity of figure.
Step S202: the feature transmitted between two neighboring convolutional layer according to the distance between convolutional layer each in intensive block
The quantity of figure determines the characteristic pattern quantity growth rate for inputting intensive each convolutional layer of block.
As shown in fig. 6, abscissa Δ l indicates that the distance between two convolutional layers, ordinate n indicate between two convolutional layers
The quantity of the characteristic pattern of transmitting can determine the characteristic pattern quantity growth rate G for inputting intensive each convolutional layer of block by following formula:
Wherein, Δ L indicates that the distance between first layer convolutional layer and the last layer convolutional layer in intensive block, h indicate adjacent
The distance between two convolutional layers, s indicate the quantity of the characteristic pattern of first layer convolutional layer output, s0Indicate two neighboring convolutional layer
Between the quantity of characteristic pattern transmitted.In 40 layers of intensive connection convolutional neural networks model, when intensive block is above-mentioned first
When kind make, Δ L is 11h, and when intensive block is above-mentioned second of make, Δ L is 5h.
Step S203: it according to the growth rate, determines the quantity for inputting the characteristic pattern of each convolutional layer in intensive block, forms second
Intensive connection convolutional neural networks model.
Specifically, the quantity for inputting the characteristic pattern of each convolutional layer in intensive block, s are determined by following formulaLIndicate input
The quantity of the characteristic pattern of L layers of convolutional layer, L are the positive integer more than or equal to 2:
Wherein, s1Indicate the quantity of the characteristic pattern of the intensive block first layer convolutional layer of input, l indicates defeated to L layers of convolutional layer
Enter the convolutional layer of characteristic pattern.
Optionally, in some embodiments of the invention, above-mentioned steps S3 can be using SGD gradient descent method pair
300 epoch of CIFAR data set are trained, and mini-batch (small lot) size is 64, and initial learning rate is set as
0.1, and be set as when 0.5 and 0.75 score of training epoch sum divided by 10, weight decay (weight decaying)
1e-4, momentum are set as 0.9.
The method provided in an embodiment of the present invention for establishing image classification neural network model, in existing intensive connection convolution mind
The advantages of being improved on the basis of network model, maintaining existing intensive connection convolutional neural networks model, can be effective
Alleviate gradient disappearance problem, strengthen feature propagation, supported feature reuses, the second intensive connection convolutional Neural obtained using improvement
Network model is trained training set, obtains image classification neural network model, uses the image classification neural network model
When to image classification, network parameter amount is reduced.
The embodiment of the invention also provides a kind of image classification methods, as shown in fig. 7, the image classification method includes:
Step S4: image to be classified data are obtained.
Step S5: the mind of image classification obtained in the above-mentioned embodiment of the method for establishing image classification neural network model is used
Classify through network model to image to be classified data.
Specifically, still by taking 40 layers of intensive connection convolutional neural networks model as an example, above-mentioned image to be classified data are input to
40 layers of image classification neural network model carries out the convolution of a 3*3 first, and then three intensive blocks treat classification chart respectively
As data progress feature extraction, and respectively to the output feature of the output characteristic pattern and second intensive block of first intensive block
Figure carries out the operation of convolution sum pondization, carries out global average pond at the end of the intensive block of third, finally passes through a softmax
Classifier obtains the classification results of image to be classified data.
Image classification method provided in an embodiment of the present invention uses the above-mentioned method for establishing image classification neural network model
Obtained image classification neural network model carries out image classification to image to be classified data, during reducing image classification
Network parameter amount.
The embodiment of the invention also provides a kind of devices for establishing image classification neural network model, as shown in figure 8, this is built
The device of vertical image classification neural network model includes: that training set obtains module 1, for obtaining the training comprising image of having classified
Collection, detailed content can refer to the step S1 of above method embodiment.Second convolution Establishment of Neural Model module 2 is used for root
According to the distance between each convolutional layer in the intensive block of intensive connection convolutional neural networks model, determines and input each convolution in intensive block
The quantity of the characteristic pattern of layer, forming second, intensively connection convolutional neural networks model, detailed content can refer to above method implementation
The step S2 of example.Image classification neural network model generation module 3, for intensively connecting convolution to second using above-mentioned training set
Neural network model is trained, and generates image classification neural network model, and detailed content can refer to above method embodiment
Step S3.
As shown in figure 9, above-mentioned second convolution Establishment of Neural Model module 2 includes: that distance and number parameter obtain mould
Block 201, for obtaining the number of the characteristic pattern transmitted between the distance between each convolutional layer and two neighboring convolutional layer in intensive block
Amount;Growth rate determining module 202, for being passed between two neighboring convolutional layer according to the distance between convolutional layer each in intensive block
The quantity for the characteristic pattern passed determines the characteristic pattern quantity growth rate for inputting intensive each convolutional layer of block;Second convolutional neural networks mould
Type forms module 203, for determining the quantity for inputting the characteristic pattern of each convolutional layer in intensive block according to above-mentioned growth rate, is formed
Second intensive connection convolutional neural networks model.
Specifically, above-mentioned growth rate determining module 202 determines the feature for inputting intensive each convolutional layer of block by following formula
Figure quantity growth rate G:
Wherein, Δ L indicates that the distance between first layer convolutional layer and the last layer convolutional layer in intensive block, h indicate adjacent
The distance between two convolutional layers, s indicate the quantity of the characteristic pattern of first layer convolutional layer output, s0Indicate two neighboring convolutional layer
Between the quantity of characteristic pattern transmitted.
Specifically, above-mentioned second convolution neural network model forms module 203 and determines the intensive block of input by following formula
In each convolutional layer characteristic pattern quantity, sLIndicate the quantity of the characteristic pattern of L layers of convolutional layer of input, L is just more than or equal to 2
Integer:
Wherein, s1Indicate the quantity of the characteristic pattern of the intensive block first layer convolutional layer of input, l indicates defeated to L layers of convolutional layer
Enter the convolutional layer of characteristic pattern.
The device provided in an embodiment of the present invention for establishing image classification neural network model, in existing intensive connection convolution mind
The advantages of being improved on the basis of network model, maintaining existing intensive connection convolutional neural networks model, can be effective
Alleviate gradient disappearance problem, strengthen feature propagation, supported feature reuses, the second intensive connection convolutional Neural obtained using improvement
Network model is trained training set, obtains image classification neural network model, uses the image classification neural network model
When to image classification, network parameter amount is reduced.
The embodiment of the invention also provides a kind of image classification devices, as shown in Figure 10, the image classification device include: to
Classification image data acquisition module 4, for obtaining image to be classified data;Image classification module 5, for being schemed using above-mentioned foundation
As the image classification neural network model that the device of Classification Neural model obtains classifies to image to be classified data.
Image classification device provided in an embodiment of the present invention uses the above-mentioned device for establishing image classification neural network model
Obtained image classification neural network model carries out image classification to image to be classified data, during reducing image classification
Network parameter amount.
Detail and technical effect about the device and image classification device for establishing image classification neural network model
Reference can be made to the associated description in the above-mentioned method for establishing image classification neural network model and image classification method embodiment, herein
It repeats no more.
The embodiment of the present invention also provides a kind of electronic equipment, and as shown in figure 11, which may include 6 He of processor
Memory 7, wherein processor 6 and memory 7 can communicate with each other connection by bus or other modes.
Processor 6 can be central processing unit (Central Processing Unit, CPU).Processor 6 can also be
Other general processors, digital signal processor (Digital Signal Processor, DSP), specific integrated circuit
(Application Specific Integrated Circuit, ASIC), field programmable gate array (Field-
Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic,
The combination of the chips such as discrete hardware components or above-mentioned all kinds of chips.
Memory 7 be used as a kind of non-transient computer readable storage medium, can be used for storing non-transient software program, it is non-temporarily
State computer executable program, instruction and module, as in the embodiment of the present invention establish image classification neural network model
Device and the corresponding program instruction/module of image classification device.Processor 6 is stored in non-transient in memory 7 by operation
Software program, instruction and module, thereby executing the various function application and data processing of processor, i.e. the realization above method
The method and image classification method for establishing image classification neural network model in embodiment.
Memory 7 may include storing program area and storage data area, wherein storing program area can storage program area,
Application program required at least one function;It storage data area can the data etc. that are created of storage processor 6.In addition, storage
Device 7 may include high-speed random access memory, can also include non-transient memory, for example, at least a magnetic disk storage
Part, flush memory device or other non-transient solid-state memories.In some embodiments, it includes relative to processing that memory 7 is optional
The remotely located memory of device 6, these remote memories can pass through network connection to processor 6.The example packet of above-mentioned network
Include but be not limited to internet, intranet, local area network, mobile radio communication and combinations thereof.
Said one or multiple modules are stored in memory 7, when being executed by processor 6, execute such as Fig. 1 or Fig. 5
The image classification side in the method for establishing image classification neural network model or embodiment as shown in Figure 7 in illustrated embodiment
Method.
The detail of above-mentioned electronic equipment can correspond to corresponding associated description in refering to fig. 1-embodiment shown in Fig. 7
Understood with effect, details are not described herein again.
It is that can lead to it will be understood by those skilled in the art that realizing all or part of the process in above-described embodiment method
Computer program is crossed to instruct relevant hardware and complete, the program can be stored in a computer readable storage medium,
The computer-readable recording medium storage computer instruction, the computer instruction is for executing computer as shown in Fig. 1 or Fig. 5
The method for establishing image classification neural network model, or computer is made to execute image classification method as shown in Figure 7.Wherein,
The storage medium can be magnetic disk, CD, read-only memory (Read-Only Memory, ROM), random access memory
(Random Access Memory, RAM), flash memory (Flash Memory), hard disk (Hard Disk Drive, contracting
Write: HDD) or solid state hard disk (Solid-State Drive, SSD) etc.;The storage medium can also include depositing for mentioned kind
The combination of reservoir.
Although being described in conjunction with the accompanying the embodiment of the present invention, those skilled in the art can not depart from the present invention
Spirit and scope in the case where various modifications and variations can be made, such modifications and variations are each fallen within by appended claims institute
Within the scope of restriction.