CN111247527A - Method and device for determining characteristic image in convolutional neural network model - Google Patents

Method and device for determining characteristic image in convolutional neural network model Download PDF

Info

Publication number
CN111247527A
CN111247527A CN201780096076.0A CN201780096076A CN111247527A CN 111247527 A CN111247527 A CN 111247527A CN 201780096076 A CN201780096076 A CN 201780096076A CN 111247527 A CN111247527 A CN 111247527A
Authority
CN
China
Prior art keywords
convolution kernels
convolution
group
kernels
neural network
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
CN201780096076.0A
Other languages
Chinese (zh)
Other versions
CN111247527B (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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Publication of CN111247527A publication Critical patent/CN111247527A/en
Application granted granted Critical
Publication of CN111247527B publication Critical patent/CN111247527B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)

Abstract

A method and a device for determining a characteristic image in a convolutional neural network model belong to the technical field of model training. The method comprises the following steps: acquiring a plurality of input images of a target processing layer in a convolutional neural network model (S210); acquiring at least one group of convolution kernels of a target processing layer (S220), wherein different convolution kernels in the same group contain the same elements and different arrangement sequences of the elements; convolution calculation is respectively carried out on different input images based on each convolution kernel in at least one group of convolution kernels to obtain a plurality of intermediate matrixes, and the intermediate matrixes are summed to obtain a characteristic image (S230). According to the method, through the characteristic that different convolution kernels contain the same elements but different arrangement sequences of the elements, resources occupied by the stored convolution kernels are reduced, the number of times of reading the convolution kernels is reduced, the calculation amount generated when the convolution layers determine the characteristic images is reduced, and system operation resources consumed in the calculation process are reduced.

Description

Method and device for determining characteristic image in convolutional neural network model Technical Field
The present disclosure relates to the field of model training technologies, and in particular, to a method and an apparatus for determining a feature image in a convolutional neural network model.
Background
The convolutional neural network is composed of convolutional layers, fully-connected layers, activation functions and the like, and the output of a single convolutional layer comprises a plurality of characteristic images. In the process of training the convolutional neural network model, a large number of samples need to be calculated. Wherein the computation amount generated in the convolutional layer accounts for 90% of the total computation amount in the whole training process.
For any convolution layer, the number of convolution kernels may be determined according to the number of input images and the number of output feature images, and a corresponding number of convolution kernels may be generated, each convolution kernel may be a small matrix, such as a 3 × 3 matrix, and each input image may be considered as a large matrix. The handling of the convolutional layer may be as follows: performing convolution calculation on an input image and a convolution kernel, specifically, extracting all matrixes with the same size as the convolution kernel from the input image, multiplying the extracted matrixes by the convolution kernel for alignment elements, adding the multiplication to obtain a numerical value, forming an intermediate matrix by all the obtained numerical values, performing convolution calculation on each input image and one convolution kernel to obtain an intermediate matrix, and adding the intermediate matrices to obtain a characteristic image.
In carrying out the present disclosure, the inventors found that at least the following problems exist:
because the convolutional neural network contains a large number of convolutional layers, each convolutional layer needs to output a large number of characteristic images, and the number of convolutional cores corresponding to each characteristic image is also large. The computation amount corresponding to each convolution kernel is large, and the total computation amount in the whole training process increases exponentially. Therefore, the amount of computation generated in the convolutional layer is large, and a large amount of processing resources are required.
Disclosure of Invention
In order to overcome the problems in the related art, the present disclosure provides the following technical solutions:
in a first aspect, there is provided a method for determining a feature image in a convolutional neural network model, the method comprising:
acquiring a plurality of input images of a target processing layer in a convolutional neural network model;
acquiring at least one group of convolution kernels of the target processing layer, wherein different convolution kernels in the same group contain the same elements and different arrangement sequences of the elements;
and performing convolution calculation on different input images respectively based on each convolution kernel in the at least one group of convolution kernels to obtain a plurality of intermediate matrixes, and summing the intermediate matrixes to obtain a characteristic image, wherein each element of the intermediate matrixes is a polynomial obtained by multiplying and adding the corresponding convolution kernel and the input image in the convolution calculation process.
The method provided by the embodiment comprises the steps of acquiring a plurality of input images; generating at least one group of convolution kernels, wherein different convolution kernels in the same group comprise the same elements and different arrangement sequences of the elements; and performing convolution calculation on different input images respectively based on each convolution kernel in at least one group of convolution kernels to obtain a plurality of intermediate matrixes, and summing the intermediate matrixes to obtain the characteristic image. By the characteristics that different convolution kernels of the convolution kernels contain the same elements and the arrangement sequences of the elements are different, resources occupied by the stored convolution kernels are reduced, the number of times of reading the convolution kernels is reduced, the calculation amount generated when the convolution layers determine the characteristic images is reduced, and system operation resources consumed in the calculation process are reduced.
In one possible implementation, the summing the plurality of intermediate matrices to obtain a feature image includes:
adding polynomials of elements at the same position in the plurality of intermediate matrixes to obtain a polynomial corresponding to each element of the characteristic image;
respectively carrying out merging similar item processing on the polynomial corresponding to each element of the characteristic image;
and respectively evaluating each combined polynomial processed by the same type of items to obtain the characteristic image.
The times of the multiplication and addition which are required in total are far more than the times of the multiplication and addition which are required by the polynomials which are not combined with the same terms. It can be seen that, as the number of convolution kernels included in a set of convolution kernels increases and the whole calculation process for determining the feature image is completed, the number of places involved in the calculation process, which can reduce the operation amount, greatly increases, and finally the speed for determining the feature image is accelerated.
In one possible implementation, before obtaining at least one set of convolution kernels of the target processing layer, the method further includes:
randomly generating N convolution kernels, wherein N is a preset group number;
and performing element displacement on each convolution kernel in the N convolution kernels by using a row unit and/or performing element displacement on each convolution kernel by using a column unit to obtain M-1 different convolution kernels, wherein the M-1 convolution kernels and the convolution kernels before element displacement form a group of convolution kernels of the target processing layer, and M is the number of the convolution kernels in a preset group.
By the characteristics that different convolution kernels of the convolution kernels contain the same elements and the arrangement sequences of the elements are different, resources occupied by the stored convolution kernels are reduced, the number of times of reading the convolution kernels is reduced, the calculation amount generated when the convolution layers determine the characteristic images is reduced, and system operation resources consumed in the calculation process are reduced.
In one possible implementation, the number of convolution kernels in each group is greater than 2 and less than the product of the number of rows and columns of convolution kernels.
In a possible implementation manner, after summing the plurality of intermediate matrices to obtain a feature image, the method further includes:
when the output result of the convolutional neural network model is obtained, determining the adjustment value of each element in each convolutional kernel in the at least one group of convolutional kernels according to the output result of the convolutional neural network model and a preset output result;
determining the sum of the adjustment values of the same elements contained in different convolution kernels in the same group as a corrected adjustment value corresponding to the adjustment value of the same element;
each convolution kernel is adjusted based on the modified adjustment value for each element.
In implementation, a plurality of convolutional layers exist in the convolutional neural network model, the convolutional layers from the first layer to the Z-1 layer output characteristic images, and the convolutional layer from the last layer, namely the Z-1 layer outputs a final output result. When the output result of the convolutional neural network model is obtained, because the convolutional neural network model is still in the training process, an error generally exists between the output result and a preset output result. Based on the error generated by the entire convolutional neural network model, the adjustment value for each element in each convolutional kernel in the plurality of sets of convolutional kernels can be determined. Then, the sum of the adjustment values of the same element included in the different convolution kernels in the same group is determined as a corrected adjustment value corresponding to the adjustment value of the same element.
In a second aspect, an apparatus for determining a feature image in a convolutional neural network model is provided, the apparatus comprising at least one module for implementing the method for determining a feature image in a convolutional neural network model provided in the first aspect.
In a third aspect, a terminal is provided that includes a processor, a memory, the processor configured to execute instructions stored in the memory; the processor implements the method for determining the characteristic image in the convolutional neural network model provided in the first aspect by executing the instructions.
In a fourth aspect, a computer-readable storage medium is provided, comprising instructions that, when run on a source server, cause the source server to perform the method for determining a feature image in a convolutional neural network model as provided in the first aspect above.
In a fifth aspect, a computer program product containing instructions which, when run on a source server, causes the source server to perform the method for determining a feature image in a convolutional neural network model as provided in the first aspect above.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:
the method provided by the embodiment comprises the steps of acquiring a plurality of input images; generating a plurality of groups of convolution kernels, wherein different convolution kernels in the same group comprise the same elements and different arrangement sequences of the elements; at least one characteristic image corresponding to the plurality of input images is determined. By the characteristics that different convolution kernels of the convolution kernels contain the same elements and the arrangement sequences of the elements are different, resources occupied by the stored convolution kernels are reduced, the number of times of reading the convolution kernels is reduced, the calculation amount generated when the convolution layers determine the characteristic images is reduced, and system operation resources consumed in the calculation process are reduced.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic diagram illustrating the structure of a terminal according to an exemplary embodiment;
FIG. 2 is a schematic flow diagram illustrating a method of determining a feature image in a convolutional neural network model, according to an exemplary embodiment;
FIG. 3 is a schematic flow diagram illustrating a method of determining a feature image in a convolutional neural network model in accordance with an exemplary embodiment;
FIG. 4 is a schematic flow diagram illustrating a method of determining a feature image in a convolutional neural network model in accordance with an exemplary embodiment;
FIG. 5 is a schematic flow diagram illustrating a method of determining a feature image in a convolutional neural network model, according to an exemplary embodiment;
FIG. 6 is a schematic flow diagram illustrating a method of determining a feature image in a convolutional neural network model, according to an exemplary embodiment;
FIG. 7 is a schematic flow diagram illustrating a method of determining a feature image in a convolutional neural network model in accordance with an exemplary embodiment;
FIG. 8 is a schematic flow diagram illustrating a method of determining a feature image in a convolutional neural network model in accordance with an exemplary embodiment;
FIG. 9 is a schematic flow diagram illustrating a method of determining a feature image in a convolutional neural network model in accordance with an exemplary embodiment;
fig. 10 is a schematic structural diagram illustrating an apparatus for determining a feature image in a convolutional neural network model according to an exemplary embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The embodiment of the invention provides a method for determining a characteristic image in a convolutional neural network model, wherein an execution main body of the method is a terminal.
The terminal may comprise a processor 110, a memory 120, and the processor 110 may be connected to the memory 120, as shown in fig. 1. Processor 110 may include one or more processing units; the Processor 110 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, etc.
In particular, the program may include program code including computer operating instructions. The terminal may further include a memory 120, the memory 120 may be used to store software programs and modules, and the processor 110 performs tasks by reading the software codes and modules stored in the memory 120.
In addition, the terminal may further include a receiver 130 and a transmitter 140, wherein the receiver 130 and the transmitter 140 may be respectively connected with the processor 110, and the transmitter 130 and the receiver 140 may be collectively referred to as a transceiver. The transmitter 140 may be used to transmit messages or data, and the transmitter 140 may include, but is not limited to, at least one Amplifier, a tuner, one or more oscillators, a coupler, an LNA (Low Noise Amplifier), a duplexer, and the like.
An exemplary embodiment of the present disclosure provides a method for determining a feature image in a convolutional neural network model, as shown in fig. 2, a processing flow of the method may include the following steps:
step S210, a plurality of input images of the target processing layer in the convolutional neural network model are acquired.
In the implementation, in the process of training the convolutional neural network model, first, the structure of the convolutional neural network model is designed, such as the number of convolutional layers included in the convolutional neural network model, the number of input images and convolutional kernels in each layer, and the number of output feature images. In the first round of training of the convolutional neural network model, the values of the elements of the convolution kernel used for performing convolution calculation on the input image to obtain the output image are random. The convolution kernel may be a matrix, and the elements of the convolution kernel are values at any position (position determined by rows and columns) in the matrix. For a convolution kernel of size 3X3, there are 9 values in the convolution kernel, 3 rows and 3 columns, and these 9 values are the elements of the convolution kernel. Similarly, for a convolution kernel of size 5X5, there are 25 values in the convolution kernel, i.e., 25 values in 5 rows and 5 columns, and these 25 values are the elements of the convolution kernel. Convolution kernels of other sizes and the like are not exemplified here. And in the process from the second round of training to the Nth theory of training, continuously returning to optimize the value of the element of the convolution kernel through the difference value between the result output by the convolution neural network model and the correct result in the sample, so that the difference value between the result output by the convolution neural network model and the correct result in the sample obtains the lowest value as far as possible after the Nth theory of training. For a target processing layer (a certain convolutional layer in the convolutional neural network model), a plurality of output images obtained by processing a plurality of characteristic images output by the convolutional layer on the target processing layer through other layers such as a Pooling layer and a RELU layer are a plurality of input images of the convolutional layer.
Each feature image in each convolutional layer in the convolutional neural network model can be determined using the method provided by the present embodiment.
Step S220, at least one set of convolution kernels of the target processing layer is obtained.
The multidimensional tensor (including three-dimensional or three-order matrix more than three-dimensional is the tensor) formed by all the convolution kernels in each group of convolution kernels can be a tensor with a special structure arranged according to a certain rule, and the purpose is to enable elements in each group of convolution kernels to be repeated, so that when elements of the convolution kernels are used for calculation, the calculation amount can be reduced by combining the same kind of items. The size of the convolution kernel is typically 3X3 or 5X5, and the height and width of the convolution kernel are typically the same value. Different convolution kernels in the same group contain the same elements and the elements are arranged in different orders.
In implementation, in initializing the convolutional neural network model, a plurality of sets of convolution kernels may be generated in units of sets. For example, as shown in fig. 3, in a convolutional layer, there are 6 input images in total, and there are 6 convolutional kernels corresponding to each input image. The 6 convolution kernels may be grouped, for example, the convolution kernels 1-3 into 1 group and the convolution kernels 4-6 into 1 group.
Optionally, before obtaining at least one set of convolution kernels of the target processing layer, the method provided in this embodiment may further include: randomly generating N convolution kernels, wherein N is a preset group number; and performing element displacement on each convolution kernel in the N convolution kernels by using a row unit and/or performing element displacement on each convolution kernel by using a column unit to obtain M-1 different convolution kernels, wherein the M-1 convolution kernels and the convolution kernels before element displacement form a group of convolution kernels of the target processing layer, and M is the number of the convolution kernels in a preset group.
In implementation, the convolutional neural network model is modeledIn the initialization process, for example, convolution kernels 1-3 are divided into 1 group and convolution kernels 4-6 are divided into 1 group as described above. First, 2 convolution kernels, namely, convolution kernel 1 and convolution kernel 4, are randomly generated. Next, element shift is performed on convolution kernel 1 in units of rows, and if the size of convolution kernel 1 is 3 × 3, then, as shown in fig. 4, element shift is performed on convolution kernel 1 in units of columns to obtain convolution kernel 2 and convolution kernel 3. Wherein, W1-W8Are elements in the convolution kernel. The convolution kernels 4-6 are generated in the same manner.
Optionally, the number M of convolution kernels in each group is greater than 2 and less than the product of the number of rows and columns of convolution kernels. E.g., no more than 9 max for convolution kernels of size 3X 3. Since, once M exceeds 9, the convolution kernel of size 3X3 has been element-shifted in row units and in column units, the shift pattern has been all possible, the 10 th convolution kernel must be one of the first 9 repeated convolution kernels. That is, to ensure that different convolution kernels in the same group contain the same elements and the elements are arranged in different orders, M is controlled not to exceed the product of the number of rows and the number of columns of the convolution kernels at maximum.
In an implementation, for example, there are 5 convolution kernels 1-5 in 1 set of convolution kernels. As shown in fig. 5, first, element shift may be performed by the convolution kernel 1 in units of columns to obtain convolution kernels 2 and 3, and then element shift may be performed by the convolution kernel 1 in units of rows to obtain convolution kernels 4 and 5. Or the convolution kernel 4 and the convolution kernel 5 obtained by performing element shift on the basis of a row unit by the convolution kernel 2, and the like.
Step S230, performing convolution calculation on different input images respectively based on each convolution kernel in at least one group of convolution kernels to obtain a plurality of intermediate matrices, and summing the intermediate matrices to obtain a feature image.
Each element of the intermediate matrix is a polynomial obtained by multiplying and adding the corresponding convolution kernel and the input image in the convolution calculation process by the alignment element.
In practice, as shown in fig. 6, there are 4 input images in the same convolutional layer, and the convolutional layer needs to output 2 feature images, i.e., feature image 1 and feature image 2. The 4 input images are respectively subjected to convolution calculation through 4 convolution kernels 1-4 to obtain intermediate matrixes 1-4, and the characteristic image 1 can be obtained based on the intermediate matrixes 1-4. And performing convolution calculation on the 4 input images again through 4 convolution kernels 5-8 to obtain intermediate matrixes 5-8, and obtaining the characteristic image 2 based on the intermediate matrixes 5-8.
With respect to FIG. 6, the convolution kernels 1-4 may be divided into sets of convolution kernels, and the convolution kernels 5-8 may also be divided into sets of convolution kernels. Here, this is merely an example, and in practice, the number of convolution kernels corresponding to 1 feature image is large, and the convolution kernels corresponding to 1 feature image may be divided into multiple sets of convolution kernels. For each set of convolution kernels, the different convolution kernels contain the same elements and the elements are arranged in different orders.
As shown in fig. 7, in terms of the determination process of the intermediate matrix 1, each time the input image 1 is taken out of 3X3 adjacent elements, the 3X3 adjacent elements in the input image 1 are multiplied by the elements of the convolution kernel at the corresponding position and then added to obtain a polynomial. Shifting the convolution kernel in the input image 1 according to the preset row number or the preset column number each time, repeating the operation of multiplying the 3X3 adjacent elements in the obtained input image 1 by the elements of the convolution kernel at the corresponding position and then adding to obtain a polynomial until the convolution kernel traverses all 3X3 adjacent elements on the input image, thus obtaining the intermediate matrix 1.
Optionally, the step of summing the plurality of intermediate matrices to obtain the feature image may include: adding the polynomials of the elements at the same position in the plurality of intermediate matrixes to obtain a polynomial corresponding to each element of the characteristic image; respectively carrying out merging similar item processing on the polynomial corresponding to each element of the characteristic image; and respectively evaluating each combined polynomial processed by the same type of items to obtain a characteristic image.
In implementation, for the method provided in this embodiment, the polynomials of the intermediate matrices may be determined simultaneously through multiple channels, and then the polynomials at the same position are added.
As shown in fig. 8, the convolution kernels 1, 2 and 3 are used to respectively apply to the upper left corners of the input image 1, 2 and 3For example, convolution calculation is performed on 3 × 3 adjacent elements of the position to obtain one element in the first row and the first column of the intermediate matrix 1, the intermediate matrix 2, and the intermediate matrix 3, respectively. An element in the first row and the first column of the intermediate matrix 1 corresponds to a polynomial of: w0×a0+W1×a1+W2×a2+W3×a3+W4×a4+W5×a5+W6×a6+W7×a7+W8×a8. An element of the first row and the first column of the intermediate matrix 2 corresponds to a polynomial of: w2×b0+W0×b1+W1×b2+W5×b3+W3×b4+W4×b5+W8×b6+W6×b7+W7×b8. An element of the first row and the first column of the intermediate matrix 3 corresponds to a polynomial of: w1×c0+W2×c1+W0×c2+W4×c3+W5×c4+W3×c5+W7×c6+W8×c7+W6×c8
When determining the feature image, polynomials of like-positioned elements of all intermediate matrices corresponding to the feature image are added, which includes adding polynomials of like-positioned elements of intermediate matrix 1, intermediate matrix 2, and intermediate matrix 3. Of course, the method also includes adding the polynomials corresponding to the elements in the first row and the first column of the intermediate matrices 1, 2 and 3 to obtain: w0×a0+W1×a1+W2×a2+W3×a3+W4×a4+W5×a5+W6×a6+W7×a7+W8×a8+W2×b0+W0×b1+W1×b2+W5×b3+W3×b4+W4×b5+W8×b6+W6×b7+W7×b8+W1×c0+W2×c1+W0×c2+W4×c3+W5×c4+W3×c5+W7×c6+W8×c7+W6×c8
It can be seen that the above formula can be processed by combining the same kind of terms to obtain: w0×(a0+b1+c2)+W1×(a1+b2+c0)+W2×(a2+b0+c1)+W3×(a3+b4+c5)+W4×(a4+b5+c3)+W5×(a5+b3+c4)+W6×(a6+b7+c8)+W7×(a7+b8+c6)+W8×(a8+b6+c7). It can be seen that the polynomial without the same term combination requires 27 multiplications and 26 additions to obtain the desired result, while the polynomial with the same term combination requires 9 multiplications and 26 additions to obtain the desired result.
It can be seen that the operation amount of 18 multiplications can be reduced for a small part of operations in determining the feature image. And as the number of the convolution kernels included in one group of the convolution kernels is increased and the whole calculation process for determining the characteristic image is completed, the positions involved in the calculation process, which can reduce the operation amount, are greatly increased, and finally the speed for determining the characteristic image is accelerated.
Optionally, after summing the plurality of intermediate matrices to obtain a feature image, the method provided in this embodiment further includes: when the output result of the convolutional neural network model is obtained, determining the adjustment value of each element in each convolutional kernel in at least one group of convolutional kernels according to the output result of the convolutional neural network model and a preset output result; determining the sum of the adjustment values of the same elements contained in different convolution kernels in the same group as a corrected adjustment value corresponding to the adjustment value of the same element; each convolution kernel is adjusted based on the modified adjustment value for each element.
In implementation, a plurality of convolutional layers exist in the convolutional neural network model, the convolutional layers from the first layer to the Z-1 layer output characteristic images, and the convolutional layer from the last layer, namely the Z-1 layer outputs a final output result. When the output result of the convolutional neural network model is obtained, because the convolutional neural network model is still in the training process, an error generally exists between the output result and a preset output result. Based on the error generated by the entire convolutional neural network model, the adjustment value for each element in each convolutional kernel in the plurality of sets of convolutional kernels can be determined. Then, the sum of the adjustment values of the same element included in the different convolution kernels in the same group is determined as a corrected adjustment value corresponding to the adjustment value of the same element. For example, with respect to fig. 8, if it is assumed that convolution calculations are performed on 3X3 adjacent elements in the input image 1, 3X3 adjacent elements in the input image 2, and 3X3 adjacent elements in the input image 3 by 3 channels by the convolution kernel 1, the convolution kernel 2, and the convolution kernel 3, respectively, then there is fig. 9, the following formula when calculating the corrected adjustment values corresponding to the adjustment values of the same elements:
Figure PCTCN2017117503-APPB-000001
Figure PCTCN2017117503-APPB-000002
Figure PCTCN2017117503-APPB-000003
Figure PCTCN2017117503-APPB-000004
Figure PCTCN2017117503-APPB-000005
Figure PCTCN2017117503-APPB-000006
Figure PCTCN2017117503-APPB-000007
Figure PCTCN2017117503-APPB-000008
Figure PCTCN2017117503-APPB-000009
wherein Δ w is a modified adjustment value corresponding to the adjustment value of the same element. WH is the product of the width and height of the feature image. DeltaRkFor sensitivity, δRkR in (1) represents the R-th feature image of the target processing layer, w _ size2Is the product of the width of the convolution kernel and the height of the convolution kernel.
Finally, the test was performed by the method provided in this example. Specifically, a Cifar10 data set is used for image recognition training, a convolutional neural network model is designed to be a 3-layer model, and the size of each layer of convolution kernel is 5X 5. The test results obtained are shown in the following table:
TABLE 1
Figure PCTCN2017117503-APPB-000010
The test was performed by the method provided in this example. Specifically, the convolutional neural network model training is used in the image super-resolution field, and the original image is amplified to be a new image with the size of 3 times. The convolutional neural network model was designed as a 3-layer model with the size of the convolution kernel being 5X 5. The test results obtained are shown in the following table:
TABLE 2
Figure PCTCN2017117503-APPB-000011
The PSNR is a commonly used measurement index in image super-resolution application, and the higher the PSNR is, the better the image super-resolution effect is. BaseHisrcnn is a convolutional neural network structure applied to image super-resolution.
The method provided by the embodiment comprises the steps of acquiring a plurality of input images; generating a plurality of groups of convolution kernels, wherein different convolution kernels in the same group comprise the same elements and different arrangement sequences of the elements; at least one characteristic image corresponding to the plurality of input images is determined. By the characteristics that different convolution kernels of the convolution kernels contain the same elements and the arrangement sequences of the elements are different, resources occupied by the stored convolution kernels are reduced, the number of times of reading the convolution kernels is reduced, the calculation amount generated when the convolution layers determine the characteristic images is reduced, and system operation resources consumed in the calculation process are reduced.
Yet another exemplary embodiment of the present disclosure provides an apparatus for determining a feature image in a convolutional neural network model, as shown in fig. 10, the apparatus including:
an obtaining module 1010, configured to obtain a plurality of input images of a target processing layer in a convolutional neural network model; at least one set of convolution kernels of the target processing layer is obtained. Wherein, different convolution kernels in the same group comprise the same elements and different arrangement sequences of the elements. The obtaining function in step S210 and step S220, and other implicit steps may be implemented specifically.
A determining module 1020, configured to perform convolution calculation on different input images respectively based on each convolution kernel in the at least one set of convolution kernels to obtain a plurality of intermediate matrices, and sum the plurality of intermediate matrices to obtain a feature image, where each element of the intermediate matrices is a polynomial obtained by multiplying and adding corresponding convolution kernels and input images in the convolution calculation process. The obtaining function in step S230, and other implicit steps may be implemented specifically.
Optionally, the determining module 1020 is configured to add polynomials of elements at the same position in the plurality of intermediate matrices to obtain a polynomial corresponding to each element of the feature image; respectively carrying out merging similar item processing on the polynomial corresponding to each element of the characteristic image; and respectively evaluating each combined polynomial processed by the same type of items to obtain the characteristic image.
Optionally, the apparatus further comprises:
the generating module is used for randomly generating N convolution kernels, wherein N is a preset group number;
and the displacement module is used for performing element displacement on each convolution kernel in the N convolution kernels by using a row unit and/or performing element displacement on each convolution kernel by using a column unit to obtain M-1 different convolution kernels, wherein the M-1 convolution kernels and the convolution kernels before element displacement form a group of convolution kernels of the target processing layer, and M is the number of the convolution kernels in a preset group.
Optionally, the number of convolution kernels in each group is greater than 2 and less than the product of the number of rows and columns of convolution kernels.
Optionally, the determining module 1020 is further configured to, when the output result of the convolutional neural network model is obtained, determine an adjustment value of each element in each convolutional kernel in the at least one group of convolutional kernels according to the output result of the convolutional neural network model and a preset output result; determining the sum of the adjustment values of the same elements contained in different convolution kernels in the same group as a corrected adjustment value corresponding to the adjustment value of the same element;
the apparatus further comprises an adjustment module:
and the adjusting module is used for adjusting each convolution kernel based on the corrected adjusting value of each element.
It should be noted that the obtaining module 1010 and the determining module 1020 may be implemented by a processor, or a processor and a memory, or a processor executes program instructions in a memory.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
By the characteristics that different convolution kernels of the convolution kernels contain the same elements and the arrangement sequences of the elements are different, resources occupied by the stored convolution kernels are reduced, the number of times of reading the convolution kernels is reduced, the calculation amount generated when the convolution layers determine the characteristic images is reduced, and system operation resources consumed in the calculation process are reduced.
It should be noted that: the apparatus for determining a feature image in a convolutional neural network model provided in the above embodiment is only illustrated by dividing the above functional modules when determining the feature image, and in practical applications, the function distribution may be completed by different functional modules according to needs, that is, the internal structure of the terminal is divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus for determining a feature image in a convolutional neural network model provided in the above embodiment and the method embodiment for determining a feature image in a convolutional neural network model belong to the same concept, and specific implementation processes thereof are detailed in the method embodiment and are not described herein again.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (17)

  1. A method of determining a feature image in a convolutional neural network model, the method comprising:
    acquiring a plurality of input images of a target processing layer in a convolutional neural network model;
    acquiring at least one group of convolution kernels of the target processing layer, wherein different convolution kernels in the same group contain the same elements and different arrangement sequences of the elements;
    and performing convolution calculation on different input images respectively based on each convolution kernel in the at least one group of convolution kernels to obtain a plurality of intermediate matrixes, and summing the intermediate matrixes to obtain a characteristic image, wherein each element of the intermediate matrixes is a polynomial obtained by multiplying and adding the corresponding convolution kernel and the input image in the convolution calculation process.
  2. The method of claim 1, wherein summing the plurality of intermediate matrices results in a feature image, comprising:
    adding polynomials of elements at the same position in the plurality of intermediate matrixes to obtain a polynomial corresponding to each element of the characteristic image;
    respectively carrying out merging similar item processing on the polynomial corresponding to each element of the characteristic image;
    and respectively evaluating each combined polynomial processed by the same type of items to obtain the characteristic image.
  3. The method of claim 1, wherein prior to obtaining at least one set of convolution kernels for the target processing layer, the method further comprises:
    randomly generating N convolution kernels, wherein N is a preset group number;
    and performing element displacement on each convolution kernel in the N convolution kernels by using a row unit and/or performing element displacement on each convolution kernel by using a column unit to obtain M-1 different convolution kernels, wherein the M-1 convolution kernels and the convolution kernels before element displacement form a group of convolution kernels of the target processing layer, and M is the number of the convolution kernels in a preset group.
  4. The method of claim 1, wherein the number of convolution kernels in each group is greater than 2 and less than the product of the number of rows and columns of convolution kernels.
  5. The method of claim 1, wherein after summing the plurality of intermediate matrices to obtain a feature image, the method further comprises:
    when the output result of the convolutional neural network model is obtained, determining the adjustment value of each element in each convolutional kernel in the at least one group of convolutional kernels according to the output result of the convolutional neural network model and a preset output result;
    determining the sum of the adjustment values of the same elements contained in different convolution kernels in the same group as a corrected adjustment value corresponding to the adjustment value of the same element;
    each convolution kernel is adjusted based on the modified adjustment value for each element.
  6. An apparatus for determining a feature image in a convolutional neural network model, the apparatus comprising:
    the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a plurality of input images of a target processing layer in a convolutional neural network model; acquiring at least one group of convolution kernels of the target processing layer, wherein different convolution kernels in the same group contain the same elements and different arrangement sequences of the elements;
    and the determining module is used for respectively carrying out convolution calculation on different input images based on each convolution kernel in the at least one group of convolution kernels to obtain a plurality of intermediate matrixes, and summing the intermediate matrixes to obtain the characteristic image, wherein each element of the intermediate matrixes is a polynomial obtained by multiplying and adding the corresponding convolution kernel and the input image in the convolution calculation process.
  7. The apparatus of claim 6, wherein the determining module is configured to add polynomials for elements at the same position in the plurality of intermediate matrices to obtain a polynomial corresponding to each element of the feature image; respectively carrying out merging similar item processing on the polynomial corresponding to each element of the characteristic image; and respectively evaluating each combined polynomial processed by the same type of items to obtain the characteristic image.
  8. The apparatus of claim 6, further comprising:
    the generating module is used for randomly generating N convolution kernels, wherein N is a preset group number;
    and the displacement module is used for performing element displacement on each convolution kernel in the N convolution kernels by using a row unit and/or performing element displacement on each convolution kernel by using a column unit to obtain M-1 different convolution kernels, wherein the M-1 convolution kernels and the convolution kernels before element displacement form a group of convolution kernels of the target processing layer, and M is the number of the convolution kernels in a preset group.
  9. The apparatus of claim 6, wherein the number of convolution kernels in each group is greater than 2 and less than the product of the number of rows and columns of convolution kernels.
  10. The apparatus according to claim 6, wherein the determining module is further configured to determine, when the output result of the convolutional neural network model is obtained, an adjustment value of each element in each convolution kernel in the at least one set of convolution kernels according to the output result of the convolutional neural network model and a preset output result; determining the sum of the adjustment values of the same elements contained in different convolution kernels in the same group as a corrected adjustment value corresponding to the adjustment value of the same element;
    the apparatus further comprises an adjustment module:
    and the adjusting module is used for adjusting each convolution kernel based on the corrected adjusting value of each element.
  11. A terminal, characterized in that the terminal comprises a processor and a memory, wherein:
    the processor is used for acquiring a plurality of input images of a target processing layer in the convolutional neural network model stored in the memory; acquiring at least one group of convolution kernels of the target processing layer stored in the memory, wherein different convolution kernels in the same group contain the same elements and different arrangement sequences of the elements; and performing convolution calculation on different input images respectively based on each convolution kernel in the at least one group of convolution kernels to obtain a plurality of intermediate matrixes, and summing the intermediate matrixes to obtain a characteristic image, wherein each element of the intermediate matrixes is a polynomial obtained by multiplying and adding the corresponding convolution kernel and the input image in the convolution calculation process.
  12. The terminal of claim 11, wherein the processor is configured to add polynomials for elements at the same position in the plurality of intermediate matrices to obtain a polynomial corresponding to each element of the feature image; respectively carrying out merging similar item processing on the polynomial corresponding to each element of the characteristic image; and respectively evaluating each combined polynomial processed by the same type of items to obtain the characteristic image.
  13. The terminal of claim 11, wherein the processor is further configured to randomly generate N convolution kernels, wherein N is a preset number of groups; and performing element displacement on each convolution kernel in the N convolution kernels by using a row unit and/or performing element displacement on each convolution kernel by using a column unit to obtain M-1 different convolution kernels, wherein the M-1 convolution kernels and the convolution kernels before element displacement form a group of convolution kernels of the target processing layer, and M is the number of the convolution kernels in a preset group.
  14. The terminal of claim 11, wherein the number of convolution kernels in each group is greater than 2 and less than the product of the number of rows and columns of convolution kernels.
  15. The terminal of claim 11, wherein the processor is further configured to determine an adjustment value of each element in each convolution kernel in the at least one set of convolution kernels according to an output result of the convolutional neural network model and a preset output result when obtaining the output result of the convolutional neural network model; determining the sum of the adjustment values of the same elements contained in different convolution kernels in the same group as a corrected adjustment value corresponding to the adjustment value of the same element; each convolution kernel is adjusted based on the adjusted value of each element after correction.
  16. A computer-readable storage medium comprising instructions that, when executed on a terminal, cause the terminal to perform the method of any of claims 1-5.
  17. A computer program product comprising instructions for causing a terminal to perform the method of any of claims 1-5 when the computer program product is run on the terminal.
CN201780096076.0A 2017-12-20 2017-12-20 Method and device for determining characteristic images in convolutional neural network model Active CN111247527B (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/117503 WO2019119301A1 (en) 2017-12-20 2017-12-20 Method and device for determining feature image in convolutional neural network model

Publications (2)

Publication Number Publication Date
CN111247527A true CN111247527A (en) 2020-06-05
CN111247527B CN111247527B (en) 2023-08-22

Family

ID=66992897

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201780096076.0A Active CN111247527B (en) 2017-12-20 2017-12-20 Method and device for determining characteristic images in convolutional neural network model

Country Status (2)

Country Link
CN (1) CN111247527B (en)
WO (1) WO2019119301A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111767928A (en) * 2020-06-28 2020-10-13 中国矿业大学 Method and device for extracting image characteristic information based on convolutional neural network
CN112149694A (en) * 2020-08-28 2020-12-29 特斯联科技集团有限公司 Image processing method, system, storage medium and terminal based on convolutional neural network pooling module
CN115861043A (en) * 2023-02-16 2023-03-28 深圳市旗云智能科技有限公司 Image data processing method and system based on artificial intelligence

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112541565B (en) * 2019-09-20 2023-08-29 腾讯科技(深圳)有限公司 Convolution calculation data stream mapping method and device
CN110807170B (en) * 2019-10-21 2023-06-27 中国人民解放军国防科技大学 Method for realizing Same convolution vectorization of multi-sample multi-channel convolution neural network
CN112733585B (en) * 2019-10-29 2023-09-05 杭州海康威视数字技术股份有限公司 image recognition method
CN112766474B (en) * 2019-11-04 2024-03-22 北京地平线机器人技术研发有限公司 Method, device, medium and electronic equipment for realizing convolution operation
CN110929623A (en) * 2019-11-15 2020-03-27 北京达佳互联信息技术有限公司 Multimedia file identification method, device, server and storage medium
KR20210082970A (en) 2019-12-26 2021-07-06 삼성전자주식회사 A method and an apparatus for performing convolution operations
CN113052756A (en) * 2019-12-27 2021-06-29 武汉Tcl集团工业研究院有限公司 Image processing method, intelligent terminal and storage medium
CN111241993B (en) * 2020-01-08 2023-10-20 咪咕文化科技有限公司 Seat number determining method and device, electronic equipment and storage medium
CN111414995B (en) * 2020-03-16 2023-05-19 北京君立康生物科技有限公司 Detection processing method and device for micro-target colony, electronic equipment and medium
CN113919405B (en) * 2020-07-07 2024-01-19 华为技术有限公司 Data processing method and device and related equipment
CN114090470B (en) * 2020-07-29 2023-02-17 深圳市中科元物芯科技有限公司 Data preloading device and preloading method thereof, storage medium and computer equipment
CN112016740B (en) * 2020-08-18 2024-06-18 京东科技信息技术有限公司 Data processing method and device
CN112132279B (en) * 2020-09-23 2023-09-15 平安科技(深圳)有限公司 Convolutional neural network model compression method, device, equipment and storage medium
CN116295188B (en) * 2023-05-15 2023-08-11 山东慧点智能技术有限公司 Measuring device and measuring method based on displacement sensor

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104077233A (en) * 2014-06-18 2014-10-01 百度在线网络技术(北京)有限公司 Single-channel convolution layer and multi-channel convolution layer handling method and device
CN104915322A (en) * 2015-06-09 2015-09-16 中国人民解放军国防科学技术大学 Method for accelerating convolution neutral network hardware and AXI bus IP core thereof
CN106326985A (en) * 2016-08-18 2017-01-11 北京旷视科技有限公司 Neural network training method, neural network training device, data processing method and data processing device
CN106682736A (en) * 2017-01-18 2017-05-17 北京小米移动软件有限公司 Image identification method and apparatus
CN107491787A (en) * 2017-08-21 2017-12-19 珠海习悦信息技术有限公司 Local binarization CNN processing method, device, storage medium and processor

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016064703A1 (en) * 2014-10-21 2016-04-28 Life Technologies Corporation Methods, systems, and computer-readable media for blind deconvolution dephasing of nucleic acid sequencing data
CN106156781B (en) * 2016-07-12 2019-09-10 北京航空航天大学 Sort convolutional neural networks construction method and its image processing method and device
CN106447030B (en) * 2016-08-30 2021-09-21 深圳市诺比邻科技有限公司 Method and system for optimizing computing resources of convolutional neural network
CN106778584B (en) * 2016-12-08 2019-07-16 南京邮电大学 A kind of face age estimation method based on further feature Yu shallow-layer Fusion Features
CN106971174B (en) * 2017-04-24 2020-05-22 华南理工大学 CNN model, CNN training method and CNN-based vein identification method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104077233A (en) * 2014-06-18 2014-10-01 百度在线网络技术(北京)有限公司 Single-channel convolution layer and multi-channel convolution layer handling method and device
US20150371359A1 (en) * 2014-06-18 2015-12-24 Baidu Online Network Technology (Beijing) Co., Ltd Processing method and apparatus for single-channel convolution layer, and processing method and apparatus for multi-channel convolution layer
CN104915322A (en) * 2015-06-09 2015-09-16 中国人民解放军国防科学技术大学 Method for accelerating convolution neutral network hardware and AXI bus IP core thereof
CN106326985A (en) * 2016-08-18 2017-01-11 北京旷视科技有限公司 Neural network training method, neural network training device, data processing method and data processing device
CN106682736A (en) * 2017-01-18 2017-05-17 北京小米移动软件有限公司 Image identification method and apparatus
CN107491787A (en) * 2017-08-21 2017-12-19 珠海习悦信息技术有限公司 Local binarization CNN processing method, device, storage medium and processor

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
H. YALCIN AND S. RAZAVI: "Plant classification using convolutional neural networks", 《2016 FIFTH INTERNATIONAL CONFERENCE ON AGRO-GEOINFORMATICS (AGRO-GEOINFORMATICS)》, pages 1 - 5 *
李子强: "一种新的基于无损失函数的深度卷积神经网络的图像特征提取方法", 《中国优秀博硕士论文全文数据库(硕士)信息科技辑》, no. 9, pages 7 - 40 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111767928A (en) * 2020-06-28 2020-10-13 中国矿业大学 Method and device for extracting image characteristic information based on convolutional neural network
CN111767928B (en) * 2020-06-28 2023-08-08 中国矿业大学 Method and device for extracting image characteristic information based on convolutional neural network
CN112149694A (en) * 2020-08-28 2020-12-29 特斯联科技集团有限公司 Image processing method, system, storage medium and terminal based on convolutional neural network pooling module
CN112149694B (en) * 2020-08-28 2024-04-05 特斯联科技集团有限公司 Image processing method, system, storage medium and terminal based on convolutional neural network pooling module
CN115861043A (en) * 2023-02-16 2023-03-28 深圳市旗云智能科技有限公司 Image data processing method and system based on artificial intelligence
CN115861043B (en) * 2023-02-16 2023-05-16 深圳市旗云智能科技有限公司 Image data processing method and system based on artificial intelligence

Also Published As

Publication number Publication date
WO2019119301A1 (en) 2019-06-27
CN111247527B (en) 2023-08-22

Similar Documents

Publication Publication Date Title
CN111247527B (en) Method and device for determining characteristic images in convolutional neural network model
US11816532B2 (en) Performing kernel striding in hardware
EP3373210B1 (en) Transposing neural network matrices in hardware
CN112214726B (en) Operation accelerator
KR102415576B1 (en) Method and system for reducing computational complexity of convolutional neural networks
CN109324827B (en) Apparatus, method and system for processing instructions for accessing data
US10083395B2 (en) Batch processing in a neural network processor
US20180341479A1 (en) Accessing data in multi-dimensional tensors using adders
TWI678617B (en) "system, computer-implemented method, and apparatus for accessing data in multi-dimensional tensors using adders"
JP2020524318A (en) Alternate loop limit
CN111465924A (en) System and method for converting matrix input to vectorized input for a matrix processor
CN109313663B (en) Artificial intelligence calculation auxiliary processing device, method, storage medium and terminal
US11580194B2 (en) Information processing apparatus, information processing method, and program
CN106373112B (en) Image processing method and device and electronic equipment
US10963746B1 (en) Average pooling in a neural network
CN111723906A (en) Accelerated calculation method and system of recurrent neural network and related device
CN112970036A (en) Convolution block array for implementing neural network applications, method of using the same, and convolution block circuit
US20210303987A1 (en) Power reduction for machine learning accelerator background
CN114741650A (en) Tensor calculation device, data processor, tensor calculation method, and storage medium
GB2567038B (en) Accessing prologue and epilogue data
CN111985628A (en) Computing device and neural network processor including the same
EP4113278B1 (en) Circuit for handling processing with outliers
EP4361892A1 (en) Methods and systems for performing a per channel affine transformation using a neural network accelerator
US20240192922A1 (en) System and method for handling processing with sparse weights and outliers
CN116955906A (en) Hamiltonian matrix orthogonal normalization method and device

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