Neural network processing device, neural network processing method, and computer program

By serializing neural networks and adding complementary neurons to replicate identity mapping functions, the compression limitations of neural networks with identity mapping paths are overcome, achieving efficient model size reduction with maintained accuracy.

JP7533933B2Active Publication Date: 2024-08-14WAKAYAMA UNIVERSITY
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
JP2020123973
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Filing Date
2020-07-20
Publication Date
2024-08-14
Estimated Expiration
2040-07-20

AI Technical Summary

Technical Problem

Neural networks with identity mapping paths face limitations in compression due to constraints on pruning neurons connected to these paths, leading to reduced compression effectiveness.

Method used

The neural network is serialized to eliminate identity mapping paths, adding complementary neurons and optimizing weights to replicate the identity mapping function, allowing for more extensive pruning without performance loss.

Benefits of technology

This approach enables more significant compression while maintaining high model accuracy by allowing pruning across all layers, including those connected to identity mapping paths.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007533933000005
    Figure 0007533933000005
  • Figure 0007533933000012
    Figure 0007533933000012
  • Figure 0007533933000001
    Figure 0007533933000001
Patent Text Reader

Abstract

To reduce restrictions on pruning in a neural network having an identity mapping path.SOLUTION: A neural network processing apparatus performs generation processing of generating a second neural network to be subjected to neuron pruning, from a first neural network having an identity mapping path. The first neural network comprises a plurality of layers having neurons and weights connected to the individual neurons. The plurality of layers includes a start point layer being a start point of an identity mapping path, a terminal point layer being a terminal point of the identity mapping path, and an intermediate layer between the start point layer and the terminal point layer. The generation processing includes first processing of adding complementary neurons to the intermediate layer and setting weights to be connected to the complementary neurons and second processing of deleting the identity mapping path. In the generation processing, the second neural network is generated so that the complementary neurons and the weights connected to the complementary neurons have a role of the identity mapping path.SELECTED DRAWING: Figure 1
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present disclosure relates to a neural network processing device, a neural network processing method, and a computer program. [Background technology]

[0002] Neural networks include neural networks that have identity mapping paths, such as Residual Network (ResNet). ResNet is described in Non-Patent Document 1. ResNet has many identity mapping paths. By having identity mapping paths, ResNet can successfully learn tasks such as image recognition, and can build a more accurate model. [Prior art documents] [Non-patent literature]

[0003] [Non-Patent Document 1] He, K., Zhang, X., Ren, S., Sun, J.: Deep residual learning for image recognition. pp. 770-778 (2016) [Non-Patent Document 2] Kamma, K., Wada, T.: Reconstruction error aware pruning for accelerating neural networks. In: Proc. International Symposium on Visual Computing (2019) [Non-Patent Document 3] Duan, K., Bai, S., Xie, L., Qi, H., Huang, Q., Tian, ​​Q.: Centernet: Keypoint triplets for object detection. In: The IEEE International Conference on Computer Vision (ICCV) (October 2019) [Non-Patent Document 4] Lin, TY, Maire, M., Belongie, SJ, Bourdev, LD, Girshick, RB, Hays, J., Perona, P., Ramanan, D., Dollar, P., Zitnick, CL: Microsoft coco: Common objects in context. CoRR (2014)(2014) Summary of the Invention

[0004] A neural network architecture with an identity mapping path has a structure with many branches due to the identity mapping path, and is therefore disadvantageous when compressing a trained neural network (trained model) by pruning. Pruning is the process of removing redundant or unnecessary neurons from a trained model. Appropriate pruning makes it possible to compress the model while maintaining the performance of the trained model. Compressing the model can reduce the computational load on the computer.

[0005] However, when pruning a neural network with an identity mapping path, there is a constraint that neurons included in a layer to which the identity mapping path is connected must not be deleted. Therefore, in a neural network with an identity mapping path, neurons are pruned only in layers to which the identity mapping path is not connected. Therefore, in a neural network with an identity mapping path such as ResNet, the compression effect of pruning on the neural network is limited.

[0006] Therefore, it is desirable to reduce the pruning constraints in neural networks with identity mapping paths. In this disclosure, this problem is solved by eliminating the branching caused by the identity mapping path and serializing the neural network. The serialized neural network contains the same functionality as the identity mapping path. Further details are described in the following embodiments. [Brief description of the drawings]

[0007] [Figure 1] FIG. 1 is a configuration diagram of a neural network processing device and a neural network utilization device. [Diagram 2] FIG. 2 is a flowchart showing the procedure of the compression process. [Diagram 3] FIG. 3 is a schematic diagram of a DNN that does not have an identity mapping path. [Figure 4] FIG. 4 is a schematic diagram of ResNet. [Diagram 5] Figure 5 is a schematic diagram of pruning for ResNet. [Figure 6] FIG. 6 is a schematic diagram of an SRN. [Figure 7] FIG. 7 is a flowchart showing a procedure of the second neural network generating process. [Figure 8] FIG. 8 is a schematic diagram illustrating an example of an SRN. [Figure 9] FIG. 9 is a schematic diagram of a ResNet equivalent to the SRN in FIG. [Figure 10] FIG. 10 is a diagram illustrating regularization. [Figure 11] FIG. 11 is a table showing the reduction rate of each embodiment in the experiment. [Figure 12] FIG. 12 is a table showing the evaluation results in the experiment. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0008] <1. Overview of Neural Network Processing Device, Neural Network Processing Method, and Computer Program>

[0009] (1) An apparatus according to an embodiment is a neural network processing apparatus configured to execute a generation process for generating a second neural network in which neurons are pruned from a first neural network having an identity mapping path. The first neural network includes a plurality of layers each having neurons and weights connected to each neuron. The plurality of layers includes an origin layer which is a starting point of the identity mapping path, an end layer which is an end point of the identity mapping path, and an intermediate layer which exists between the origin layer and the end layer.

[0010] The generating process includes a first process of adding a complementary neuron to the hidden layer and setting a weight connected to the complementary neuron, and a second process of deleting the identity mapping path, in order to generate the second neural network. In the generating process, the second neural network is generated such that the complementary neuron and the weight connected to the complementary neuron play the role of the identity mapping path.

[0011] Since the second neural network does not have an identity mapping path, the constraint that neurons in a layer connected to the identity mapping path must not be pruned is eliminated. Therefore, the pruning constraint in a neural network with an identity mapping path is reduced.

[0012] (2) The neuron has an activation function, and the activation function is preferably Relu. When the activation function is Relu, even if the identity mapping path is deleted, it is easy to ensure a role equivalent to that of the identity mapping path.

[0013] (3) It is preferable that the neural network processing device is further configured to execute a process of pruning the second neural network, and a learning process of the second neural network, which is executed between the generation process and the pruning process. By executing the learning process before pruning, it is possible to maintain high model accuracy even after pruning is executed.

[0014] (4) The learning process preferably includes optimizing weights in the second neural network using regularization, and the regularization is preferably performed using a difference between the weights and the initial values ​​of the weights at the start of the learning process. In this case, it is possible to prevent the weights from departing from an optimal solution.

[0015] (5) A method according to an embodiment is a neural network processing method that includes generating a second neural network in which neurons are pruned from a first neural network having an identity mapping path. The first neural network includes a plurality of layers each having a neuron and a weight connected to each neuron, the plurality of layers including an origin layer that is a starting point of the identity mapping path, an end layer that is an end point of the identity mapping path, and an intermediate layer between the origin layer and the end layer, and the neural network processing method includes adding a complementary neuron to the intermediate layer, setting a weight connected to the complementary neuron, and deleting the identity mapping path to generate the second neural network, and the second neural network is generated such that the complementary neuron and the weight connected to the complementary neuron play the role of the identity mapping path.

[0016] (6) The neuron has an activation function, and the activation function is preferably a real.

[0017] (7) It is preferable that the method further includes pruning the second neural network, and training the second neural network between generating the second neural network and pruning the second neural network.

[0018] (8) The learning preferably includes optimizing weights in the second neural network using regularization, the regularization being performed using the difference between the weights and their initial values ​​at the start of the learning.

[0019] (9) A computer program according to an embodiment is a computer program for causing a computer to execute a process including a generation process for generating a second neural network in which pruning of neurons is performed from a first neural network having an identity mapping path. The first neural network includes a plurality of layers each having a neuron and a weight connected to each neuron, the plurality of layers including an origin layer which is a starting point of the identity mapping path, an end layer which is an end point of the identity mapping path, and an intermediate layer between the origin layer and the end layer, the generation process includes a first process of adding a complementary neuron to the intermediate layer and setting a weight connected to the complementary neuron, and a second process of deleting the identity mapping path, in order to generate the second neural network, and the second neural network is generated such that the complementary neuron and the weight connected to the complementary neuron play the role of the identity mapping path.

[0020] <2. Examples of Neural Network Processing Device, Neural Network Processing Method, and Computer Program>

[0021] 1 shows a neural network processing device 10 (hereinafter referred to as "processing device 10") and a neural network utilizing device 100 (hereinafter referred to as "utilizing device 100") according to an embodiment. The processing device 10 according to the embodiment executes a compression process 21 for compressing a neural network N1 to reduce its size. That is, the processing device 10 also functions as a neural network compression device.

[0022] A neural network is an artificial computation mechanism in which a plurality of artificial neurons (also called "nodes") are connected. Hereinafter, the artificial neuron is also simply called a neuron. The neural network is, for example, a deep neural network (DNN). The DNN may be, for example, a fully connected neural network (FCN) or a convolutional neural network (CNN). Hereinafter, the neural network N1 to be subjected to the compression process 21 is referred to as a "first neural network" or an "original neural network", and the compressed neural network N2 is referred to as a "compressed neural network". Note that the processing device 10 according to the embodiment is also capable of executing a process for machine learning (deep learning) of the original neural network N1. The processing device 10 compresses the learned original neural network N1.

[0023] The processing device 10 is configured by a computer having one or more processors 20 and a storage device 30. The one or more processors 20 include, for example, a graphic processing unit (GPU). The one or more processors 20 may further include a CPU. A massively parallel computing mechanism such as a GPU is suitable for large-scale calculations for performing processing related to a large-scale neural network.

[0024] The storage device 30 stores a computer program 31 executed by the processor 20. The processor 20 executes the computer program 31 to perform a compression process 21. The compression process 21 includes a second neural network generation process 22 as a pre-processing step for pruning, pruning 24, and learning processes 23 and 25.

[0025] The storage device 30 can store data (compressed neural network data) N20 representing the compressed neural network N2 produced by the compression process 21. The compressed neural network data N20 is data consisting of various parameters (weights, connections, etc.) that represent the compressed neural network N2. The processing device 10 can output the compressed neural network data N20 to a neural network engine or the like. The compressed neural network data N20 is read into the neural network engine, causing the neural network engine to function as the compressed neural network N2.

[0026] The utilization device 100 has a neural network engine that reads the compressed neural network data N20 and functions as a compressed neural network N2. The neural network engine includes, for example, a processor 200 and a storage device 300. The processor 200 may be, for example, a low-power CPU in an embedded system. The compressed neural network data N20 is smaller in size than the data of the original neural network N1, and therefore can be processed by a low-power CPU.

[0027] An embedded system is not a general-purpose computer system, but a computer system for a specific purpose, such as a smartphone, home appliances, industrial robots, medical equipment, automobiles, drones, and other devices. Embedded systems often use low-power CPUs as processors, but the compressed neural network data N20 is easy to execute because of its small data size.

[0028] The compressed neural network N2 is used for applications such as image and voice conversion, segmentation, and identification. More specifically, it can be used to extract necessary information from images of objects, such as measuring the number of customers in a store, gender and age group analysis, vehicle counting, and vehicle type analysis. The original neural network N1 is large-scale and requires high calculation costs, making it difficult to run on an embedded system, but the compressed neural network N2 is small-scaled and easy to run on an embedded system.

[0029] The compression process 21 will be described below. For ease of understanding, the compression process 21 according to the embodiment will be described below on the premise of a fully connected neural network (FCN), but a similar compression process 21 according to the embodiment can also be applied to a convolutional neural network (CNN).

[0030] As shown in FIG. 2, in the compression process 21, first, as a first pre-processing of pruning 24, a generation process 22 of a second neural network from a first neural network is performed. As an example, the first neural network is a trained ResNet having an identity mapping path. The generation process 22 serializes the trained ResNet. Here, the serialized ResNet is called a Serialized Residual Network (SRN). That is, the generation process 22 according to the embodiment is a generation process of an SRN model as a second neural network.

[0031] Here, we first explain the architecture of ResNet and its problems. Figure 3 shows a general deep neural network (DNN) that does not have an identity mapping path. The DNN in Figure 3 is an FCN. The DNN shown in Figure 3 has multiple layers L1, L2, and L3, and each layer has multiple neurons. In Figure 3, neurons are shown as circles. The straight lines connecting the circles representing neurons indicate connections between neurons, and the connections between neurons have weights. The DNN shown in Figure 3 has a serial architecture without branching due to an identity mapping path.

[0032] When input data is given to the neural network shown in Figure 3, each neuron outputs a scalar value. Therefore, the output of all neurons in each layer can be expressed as a vector with the same dimension as the number of neurons in each layer. For example, the output vector of layer L1 in Figure 3 is represented by x1, and the number of dimensions of x1 is equal to the number of neurons D1 included in layer L1. Similarly, the output vector of layer L2 is represented by x2, and the number of dimensions of x2 is equal to the number of neurons D2 included in layer L2. Moreover, the output vector of layer L3 is represented by x3, and the number of dimensions of x3 is equal to the number of neurons D3 included in layer L3. Each output vector x1, x2, and x3 becomes an input vector input to the next layer.

[0033] In each layer, a linear mapping using weights and a nonlinear mapping using activation functions are applied to the input vectors x1, x2, and x3 to obtain an output vector. For example, if the outputs of all the neurons in layer L1, which has D1 neurons, are represented by output vector x1, x1 is input as an input vector to the next layer L2, which has D2 neurons. In this case, if the weight matrix for the linear mapping applied to x1 is W1 and the activation function of each neuron is f, the calculation of formula (1) in Figure 3 is performed to obtain the output vector x2 in layer L2. The size of the weight matrix W1 is D2 x D1.

[0034] Furthermore, the output vector x2 is input as an input vector to the next layer L3, whose number of neurons is D3. In this case, if the weight matrix for the linear mapping applied to x2 is W2 and the activation function of each neuron is f, the calculation of equation (2) in Figure 3 is performed to obtain the output vector x3 in layer L3. The size of the weight matrix W2 is D3 x D2.

[0035] FIG. 4 shows ResNet. ResNet shown in FIG. 4 is obtained by adding an identity mapping path connecting layer L1 and layer L3 to the neural network shown in FIG. 3. In ResNet, each neuron has an activation function f, and the activation function f is Relu. Hereinafter, the layer L1 which is the origin of the identity mapping path is called the origin layer L1, and the layer L3 which is the end point of the identity mapping path is called the end layer L3. The layer L2 between the origin layer L1 and the end layer L3 is called the intermediate layer L2. There are one or more intermediate layers L2 between the origin layer L1 and the end layer L3. Note that an actual ResNet is formed by stacking many architectures shown in FIG. 4 in series. That is, ResNet has multiple identity mapping paths. When the architectures shown in FIG. 4 are stacked many times in series, the end layer connected to a certain identity mapping path can be the origin layer of another identity mapping path.

[0036] In ResNet, to obtain output vectors x2 and x3, calculations are performed using equations (3) and (4) shown in Figure 4. Here, equations (1) and (3) are the same. On the other hand, equations (2) and (4) are different. The difference between equations (2) and (4) arises from the identity mapping path of ResNet. In equation (4) in ResNet, the calculation of W2x2+x1 is performed immediately before the second nonlinear mapping using the activation function f. "+x1" in equation (4) is the calculation that corresponds to the identity mapping path.

[0037] In formula (4), when calculating the sum of "W2x2" and "x1", the dimensions of "W2x2" and "x1" must match. However, as shown in Figure 5, if the neurons in the starting layer L1 connected to the identity mapping path are reduced by pruning, the number of dimensions of x1 decreases and does not match the number of dimensions of "W2x2". As a result, it becomes impossible to calculate "W2x2+x1" in formula (4). Similarly, if the neurons in the ending layer L3 are reduced by pruning, the dimensions of "W2x2" and "x1" also do not match.

[0038] For the above reasons, in ResNet, pruning cannot be performed on layers L1 and L3 connected to the identity mapping path. When compressing ResNet by pruning, only the hidden layer L2, which is not connected to the identity mapping path, must be targeted. For this reason, if the ResNet model is pruned as is, the performance of the trained model is likely to deteriorate if the number of neurons is reduced.

[0039] In order to overcome the constraint that the number of layers that can be pruned is limited, in the generation process 22 shown in Fig. 2, the trained ResNet, which is the first neural network, is serialized to generate an SRN model (second neural network) equivalent to the trained ResNet. The SRN model has a serial architecture similar to a general DNN, but can reproduce the identity mapping path of the ResNet.

[0040] FIG. 6 shows an SRN model in which the ResNet shown in FIG. 4 is serialized. The SRN model shown in FIG. 6 does not have a branch due to an identity mapping path and is a serial architecture. In the SRN model shown in FIG. 6, the number of neurons (the number of dimensions of the output vector x1) in the origin layer L1 connected to the identity mapping path is the same as that of the ResNet shown in FIG. 4. Therefore, the output vector x1 of the origin layer L1 is the same as that of the ResNet shown in FIG. 4. In the SRN model in FIG. 6, the weight matrix applied to the output vector x1 is represented as W'1. The weight matrix W'1 will be described later.

[0041] In the hidden layer L2 of the SRN model, a number D1 of complementary neurons corresponding to the number of neurons in the previous origin layer L1 is added. For example, if the number of neurons in the origin layer L1 and the hidden layer L2 in FIG. 4 is four, the hidden layer L2 of the SRN model shown in FIG. 6 has a total of eight neurons, including the four original neurons and four complementary neurons. These four complementary neurons and the weights connected to the interpolation neurons replace the function of the identity mapping path. The activation function of the complementary neurons is also ReLU.

[0042] 6, the output vector of the hidden layer L2 is denoted as x2', and the weighting matrix applied to the output vector x2' is denoted as W'2. The weighting matrix W'2 will be described later.

[0043] In the SRN model shown in Fig. 6, the number of neurons (the number of dimensions of the output vector x3) in the terminal layer L3 connected to the identity mapping path is the same as that in the ResNet shown in Fig. 4. In the SRN model in Fig. 6, the output vector of the terminal layer L3 is represented as x3'.

[0044] The weight matrix W'1 is expressed as a concatenation of the ResNet weight matrix W1 and the unit matrix I, as shown in equation (5A) of FIG. 6. The size of the unit matrix is ​​D1×D1. The weight matrix W'2 is expressed as a concatenation of the ResNet weight matrix W2 and the unit matrix I, as shown in equation (6) of FIG. 6. The size of the unit matrix is ​​D1×D1.

[0045] In the SRN model shown in FIG. 6, the calculation of formula (7) shown in FIG. 6 is performed to obtain the output vector x2'. Also, the calculation of formula (8) shown in FIG. 6 is performed to obtain the output vector x3'. As shown in FIG. 6, the output vector x2' is a concatenation of the output vector x2 and the output vector x1. Also, as shown in FIG. 6, the output vector x3' is equal to the output vector x3. Therefore, the SRN model shown in FIG. 6 is equivalent to the ResNet shown in FIG. 4. In this way, a ResNet having an identity mapping path can be replaced with an equivalent SRN.

[0046] 7 shows details of a generation process 22 for obtaining a second neural network serialized like an SRN from a first neural network having an identity mapping path. First, the processor 20 of the neural network processing device 10 identifies a pair of layers (the origin layer L1 and the destination layer L3) connected to the identity mapping path of the first neural network (step S101). The processor 20 also identifies one or more intermediate layers L2 between the origin layer L1 and the destination layer L3.

[0047] Next, the processor 20 adds D1 complementary neurons to the intermediate layer L2, the number of which corresponds to the number of dimensions D1 of the origin layer L1 (step S102). If there are multiple intermediate layers L2 between the origin layer L1 and the destination layer L3, D1 complementary neurons are added to each of the multiple intermediate layers L2.

[0048] The processor 20 updates the weight matrices W1 and W2 connected to the hidden layer L2 to which the complementary neuron has been added to obtain W1' and W2' (step S103). If the weight matrix connected to the hidden layer L2 is the weight matrix W1 from the origin layer L1 to the hidden layer L2, that is, if it is the weight matrix W1 applied to the output vector x1 from the origin layer L1, the weight matrix W1 is updated to the weight matrix W1' according to equation (5A) (step S104).

[0049] If the weighting matrix coupled to the intermediate layer L2 is the weighting matrix W2 from the intermediate layer L2 to the end layer L3, i.e., if it is the weighting matrix W2 applied to the output vector x2 input to the end layer L3, the weighting matrix W2 is updated to the weighting matrix W2' according to equation (6) (step S106).

[0050] When there are multiple intermediate layers L2 between the starting layer L1 and the ending layer L3, the weight matrix W3 from the first intermediate layer to the second intermediate layer also exists as a weight matrix connected to the intermediate layer L2. The weight matrix W3 is applied to the output vector from the first intermediate layer. The weight matrix W3 is updated to a weight matrix W3' according to equation (5B) shown in FIG. 7 (step S105). In equation (5B), I is a unit matrix of size D1×D1, and 0 is a zero matrix.

[0051] Finally, the processor 20 deletes the identity mapping path (step S107). Note that the deletion of the identity mapping path does not need to be performed at the end of the generation process 22, and may be performed at any timing during the generation process 22. As a result, a second neural network serialized like an SRN is obtained from the first neural network having an identity mapping path.

[0052] In the embodiment, steps S103, S104, and S105 are referred to as a first process, and step S107 is referred to as a second process.

[0053] FIG. 8 shows a specific example of an SRN generated from the ResNet shown in FIG. 9 by the generation process 22 and its weight matrices W1', W2'. For simplicity, in FIG. 8, the number of neurons included in each layer L1, L2, L3 is set to three. In this case, the weight matrices W1, W2 in the ResNet are expressed as shown in FIG. 9. In the SRN shown in FIG. 9, three complementary neurons are added to the hidden layer L2. The weight matrix W1' is expressed by concatenating the weight matrix W1 with the unit matrix I. Moreover, the weight matrix W2' is expressed by concatenating the weight matrix W2 with the unit matrix I.

[0054] Returning to FIG. 2, in the compression process 21, after the generation process 22 which is the first pre-processing of pruning, the learning process 23 of the SRN which is the second neural network is performed as the second pre-processing of pruning 24. As described above, the weight matrices W1', W2' in the SRN model immediately after serialization are the concatenation of the weight matrices W1, W2 inherited from the original ResNet and the unit matrix. The weight matrices W1, W2 inherited from the original ResNet are sufficiently optimized when the ResNet model was learned, whereas the unit matrix is ​​not optimized. However, by performing the learning process 23, the weights of the part represented by the unit matrix (or zero matrix) can be optimized to further improve the model accuracy. By improving the model accuracy before pruning, it is possible to offset the decrease in model accuracy due to pruning and perform compression while maintaining high model accuracy.

[0055] After the learning process 23, a pruning process 24 is performed on the SRN model. The pruning process reduces the number of neurons included in the SRN model. Pruning can be performed, for example, by a method called REAP described in Non-Patent Document 2. REAP not only performs pruning, but also updates the weights of the remaining neurons using the least squares method to minimize errors caused by pruning, thereby maintaining the accuracy of the model.

[0056] Finally, in the compression process 21, a re-learning process 25 of the SRN model, which is the second neural network, is performed. The re-learning process 25 can improve the accuracy of the SRN model after pruning.

[0057] Here, in the learning process 23 performed before the above-mentioned pruning process 24, the weights in the SRN model, which is the second neural network, are optimized using regularization. Generally, L2 regularization is used as regularization for optimizing the weights, but in the regularization according to this embodiment, the difference between the weights and the initial weight values ​​is used, and more specifically, the square of the difference between the weights and the initial weight values ​​is used. The regularization according to this embodiment is called Elastic Weight Regularization (EWR).

[0058] The reasons why EWR is better than L2 regularization are as follows:

[0059] In the serialized SRN model, part of the weight matrix is ​​composed of an identity matrix. The elements of the identity matrix are 0 and 1. Here, empirically, the weights of the ResNet model are at most 10 -1 The number 1 in the unit matrix is ​​very large. The problem here is the "side effect" of L2 regularization.

[0060] The neural network model is trained by sequentially optimizing each weight using the backpropagation method. The basic equation for sequentially optimizing each weight w using the backpropagation method is expressed by equation (13) in Figure 10.

[0061] However, when learning is performed using equation (13), the weight w may take an extremely large value or a small value (large negative value), and the generalizability of the model may be lost. For this reason, L2 regularization shown in equation (14) in Figure 10 is used. Equation (14) is obtained by adding an L2 regularization term to equation (13). The L2 regularization term prevents the value of w from becoming too large in either the positive or negative direction.

[0062] However, when training an SRN model whose weight matrix contains a unit matrix, L2 regularization produces side effects. As can be seen from equation (14), the larger the squared value of the weight w, the greater the effect of L2 regularization when updating the weight w. The elements of a unit matrix consist of 0 and 1, but empirically, the weights of the ResNet model should be no larger than 10 -1 In comparison, the value of 1 in the unit matrix is ​​very large. For this reason, when learning, the weights w whose initial value is 1 are updated to a much larger value than the weights inherited from the ResNet model or the weights whose initial value is 0. Naturally, in learning neural networks including SRNs, the weights are not independent of each other. Therefore, if a weight whose initial value is 1 is updated to a larger value, the weights that were already optimized at the stage of training the original ResNet model will also be updated to a larger value again, which is thought to result in convergence to a suboptimal solution that is far from the optimal solution.

[0063] Therefore, in EWR, the weight w is optimized according to equation (15) in FIG. * is the initial value of the weight w at the start of the learning process 23. L2 regularization penalizes the weight w so that it does not deviate too far from 0, whereas EWR is the weight w at the initial value w when learning begins. * This gives a penalty so that the weight w, which has an initial value of 1, is not too affected by the regularization term.

[0064] <3. Experiment>

[0065] In order to verify the effectiveness of the compression process 21 according to the embodiment, an experiment was conducted using an object detection model. The object detection model used in the experiment is CenterNet (see Non-Patent Document 3). CenterNet detects objects in an input image. In CenterNet, ResNet-18 is used in a part called Backbone. ResNet-18 has 18 layers, and has 16 layers excluding the input layer and the final output layer. ResNet-18 has 8 identity mapping paths, and the architecture shown in FIG. 4 is configured in multiple stages in series so that the end layer of a certain identity mapping path becomes the start layer of the next identity mapping path. In ResNet-18, the number of intermediate layers between the start layer and the end layer is one.

[0066] In the experiment, the backbone using ResNet-18 was used for serialization and pruning. The number of pixels in the input image for CenterNet is 512 × 512.

[0067] For the experiments, we used a dataset called MS-COCO (see Non-Patent Document 4). MS-COCO is a dataset for object detection tasks, consisting of approximately 80,000 training images and 40,000 test images, covering 80 types of objects. As preprocessing, we resized and cropped the images so that the number of pixels was 512 x 512.

[0068] The experimental procedure is as follows. We performed serialization and pruning of the branching structure for ResNet, the backbone of CenterNet. We serialized the branching structure in order of proximity to the input layer, and performed the following each time we serialized a location. Step 1. Training (5 epochs, learning rate 1.25 × 10 -4 ) Step 2. Perform pruning Step 3. Training (5 epochs, learning rate 1.25 × 10 -4 )

[0069] Finally, we retrained the model for 60 epochs, with the initial learning rate set to 1.25 × 10 -4The learning rate was multiplied by 1 / 10 every 20 epochs.

[0070] In step 2), the reduction rate of FLOPs (the number of operations required to process one image) of the entire backbone was set to A) 1 / 4 times, B) 1 / 2 times, and C) 3 / 4 times that of ResNet-18. The case of A) 1 / 4 times is called Example A, the case of B) 1 / 2 times is called Example B, and the case of C) 3 / 4 times is called Example C. As can be seen from Figure 6, in the SRN model immediately after serialization, the number of neurons in layers L1 and L3 that were originally connected to the identity mapping path remains unchanged, but the number of neurons in the other layer L2 increases. Here, for convenience, the former will be called "layer 1" and the latter will be called "layer 2". Layer 1 corresponds to the origin layer L1 and the destination layer L3, and layer 2 corresponds to the hidden layer L2. The specific neuron reduction rates in layers 1 and 2 for Examples A, B, and C are as shown in Figure 11. In addition, in FIG. 11, Examples A, B, and C are shown as patterns A), B), and C).

[0071] As a comparative example, we also considered the case where ResNet was pruned as it was without serialization. In ResNet, layers connected to the identity mapping path cannot be pruned, so a certain percentage of neurons were deleted in other layers. The pruning method used was REAP, described in Non-Patent Document 2.

[0072] In the experiment, we evaluated prediction accuracy and inference speed. Prediction accuracy was evaluated using the mean average precision (mAP) of the test data. Inference speed was measured as the processing time per image using Jetson Nano, a device specialized for inference using neural networks.

[0073] FIG. 12 shows the evaluation results. In FIG. 12, ResNet-18 (original) shows the original model without serialization and pruning. ResNet-18-pruned shows a comparative example. In FIG. 12, SRN-18-pruned (A) shows Example A, SRN-18-pruned (B) shows Example B, and SRN-18-pruned (C) shows Example C.

[0074] As shown in Figure 12, it can be seen that SRN-18-pruned (Example) is superior to ResNet-18-pruned (Comparative Example). In the Comparative Example, it can be seen that the prediction accuracy is always degraded by pruning regardless of the FLOPS reduction rate. On the other hand, in the Example in which ResNet is converted to SRN and then pruned, the accuracy of the original model is almost maintained. Moreover, as in Example A, there are cases where a 1.43 times speedup is achieved. It can also be confirmed that the mAP value is high in Examples B and C.

[0075] SRNs have a higher number of neurons than ResNets, resulting in a higher computational load. However, SRNs have a serial structure with no branching due to identity mapping paths, which gives the advantage that pruning can be performed at any layer. Therefore, converting ResNets to SRNs and then pruning them can make the model smaller or faster while maintaining high accuracy, compared to pruning ResNets directly. The above was also demonstrated in the above experiment using an object detection model.

[0076] <4. Notes>

[0077] The present invention is not limited to the above-described embodiment, and various modifications are possible. [Explanation of symbols]

[0078] 10: Neural network processing unit 20: Processor 21: Compression process 22: Generation process 23: Learning process 24: Pruning process 25: Re-learning process 30: Storage device 31: Computer Programs 100: Neural network device 200: Processor 300: Storage device L1: Origin layer L2: Middle layer L3: Destination layer N1: Original neural network N2: Compressed Neural Network N20: Compressed Neural Network Data

Claims

1. A neural network processing device configured to perform a generation process for generating a second neural network in which neurons are pruned from a first neural network having an identity mapping path, the device comprising: The first neural network comprises: A number of layers, each having neurons; The weights connected to each neuron, Equipped with The plurality of layers include An origin layer that is the origin of the identity mapping path; an end layer that is an end point of the identity mapping path; an intermediate layer between the starting layer and the ending layer; having In order to generate the second neural network, the generation process a first process of adding a complementary neuron to the hidden layer and setting weights for coupling the complementary neuron; a second process of deleting the identity mapping path; having In the generation process, the second neural network is generated such that the complementary neuron and the weights connecting the complementary neuron play the role of the identity mapping path. Neural network processing unit.

2. The neuron has an activation function, the activation function being Relu 2. The neural network processing device according to claim 1.

3. pruning the second neural network; a training process for the second neural network performed between the generating process and the pruning process; is further configured to 3. The neural network processing device according to claim 1 or 2.

4. the training process includes optimizing weights in a second neural network using regularization; The regularization is performed using the difference between the weight and the initial value of the weight at the start of the learning process.

4. The neural network processing device according to claim 3.

5. 1. A neural network processing method, in which a computer executes neural network processing, comprising generating a second neural network in which pruning of neurons is performed from a first neural network having an identity mapping path, the method comprising: The first neural network comprises: A number of layers, each having neurons; The weights connected to each neuron, Equipped with The plurality of layers include An origin layer that is the origin of the identity mapping path; an end layer that is an end point of the identity mapping path; an intermediate layer between the starting layer and the ending layer; having The neural network process includes: adding complementary neurons to the hidden layer and setting weights connecting the complementary neurons; and deleting the identity mapping path; The second neural network is generated such that the complementary neurons and the weights connecting the complementary neurons play the role of the identity mapping path. Neural network processing method.

6. The neuron has an activation function, the activation function being Relu 6. The neural network processing method according to claim 5.

7. The neural network processing comprises: pruning the second neural network; training the second neural network between generating the second neural network and pruning the second neural network; Further comprising 7. The neural network processing method according to claim 5 or 6.

8. The training includes optimizing weights in a second neural network using regularization; The regularization is performed using the difference between the weight and the initial value of the weight at the start of the learning.

8. The neural network processing method according to claim 7.

9. A computer program for causing a computer to execute a process including a generation process for generating a second neural network in which pruning of neurons is performed from a first neural network having an identity mapping path, the computer program comprising: The first neural network comprises: A number of layers, each having neurons; The weights connected to each neuron, Equipped with The plurality of layers include An origin layer that is the origin of the identity mapping path; an end layer that is an end point of the identity mapping path; an intermediate layer between the starting layer and the ending layer; having In order to generate the second neural network, the generation process a first process of adding a complementary neuron to the hidden layer and setting weights for coupling the complementary neuron; a second process of deleting the identity mapping path; having In the generation process, the second neural network is generated such that the complementary neuron and the weights connecting the complementary neuron play the role of the identity mapping path. Computer program.

Citation Information

Patent Citations

  • Structure device for neural network and pattern recognition device using neural network

    JP1992175964A

  • Learning method

    JP2019105899A

  • Learning and applying method, apparatus and storage medium of multilayer neural network model

    JP2020109647A

  • System and method for compact and efficient sparse neural networks

    US20190347536A1

  • System and method for implementing a neural network

    US20190378017A1