The present invention relates to artificial neural network, for example, convolutional neural network. In particular, the present invention relates to how to implement and optimize a convolutional neural network based on an embedded FPGA. Specifically, it proposes an overall design process of compressing, fix-point quantization and compiling the neural network model.
Please help me write a proper abstract based on the patent claims. CLAIM: 1. A method for optimizing an Artificial Neural Network (ANN), said ANN at least comprises convolutional layers CONV 1, CONV 2, . . . CONV n, and fully connected layers FC 1, FC 2, . . . , FC m, wherein n and m are positive integers, said ANN can receive a data set as input and process said data set by said CONV 1, . . . CONV n, FC 1, . . . FC m in sequence and provide a corresponding feature map set as each layer's output, said method comprising: compressing step for compressing weights of said convolutional layers CONV 1, CONV 2, . . . CONV n, and fully connected layers FC 1, FC 2, . . . , FC m of said ANN, fix-point quantization step for converting floating-point numbers into fixed-point numbers, including: weight quantization step, for converting weights of said convolutional layers CONV 1, CONV 2, . . . CONV n, and fully connected layers FC 1, FC 2, . . . , FC m of the compressed ANN from floating-point numbers into fixed-point numbers, wherein the numerical range of quantization is dynamically chosen for different layers while remains static in one layer, data quantization step, for converting data of feature map sets j from floating-point numbers into fixed-point numbers, wherein the numerical range of quantization is dynamically chosen for different feature map sets while remains static in one feature map set, wherein said feature map sets j are output by said CONV layers and FC layers of said ANN, compiling step, for compiling said compressed ANN to generate instructions to be executed by an ANN accelerator, so as to implement said ANN on said ANN accelerator, wherein the compiling step is conducted on the basis of the quantized weights of CONV and FC layers of said ANN, and the chosen quantization numerical range for respective feature map sets output by said CONV and FC layers. 2. The method of claim 1, the step of compressing further comprises a step of pruning, comprising: (a) initializing said ANN to establish all connections of CONV layers and FC layers, said connections being assigned weights of random values, (b) training said ANN by adjusting weights of CONV layers and FC layers of ANN until the accuracy of ANN reaches a predetermined level, (c) pruning said ANN to prune insignificant connections, said insignificant connections are decided based on a predetermined criteria, (d) fine-tuning said ANN to restore the pruned connections and assigning zero-value weights to these restored connections; repeating steps (b) to (d), until the accuracy of ANN reaches a predetermined level. 3. The method of claim 2, step (b) comprises using a stochastic gradient descent algorithm to adjust weights of ANN. 4. The method of claim 2, step (c) comprises using at least one of the following as said predetermined criteria: deciding a connection is insignificant if weight of the connection is zero, or deciding a connection is insignificant if weight of the connection is smaller than a threshold. 5. The method of claim 1, the step of compressing further comprises SVD decomposition of weights matrix W, said weights matrix W corresponds to one of CONV layers and FC layers of ANN, so as to achieve a sparse version of said weight matrix W. 6. The method of claim 1, the step of fix-point quantizing comprises, converting a 64 bit, 32 bit, or 16 bit float-point numbers into a 16 bit, 8 bit or 4 bit fixed-point numbers. 7. The method of claim 1, the step of weight quantization further comprises: n = ∑ i = 0 bw - 1  B i · 2 - f l · 2 i using the above expression to denote a fixed-point number representing the weights of the ANN, wherein bw is the bit width of the number, f1 is the fractional length which can be negative fraction, deciding the optimal f1for weights in each layer of the CONV layers and FC layers. 8. The method of claim 7, wherein the step of deciding the optimal f1 comprises: estimating the floating-number range of weights of one layer, designating an initial value for f1, searching for an optimal f1 in the adjacent domains of the initial value based on the following calculation: f l = arg   min f l  ∑  W float - W  ( bw , f l )  wherein W is the weight matrix of one layer, W (bw, f1) represents the fixed-point format of W under the given bw and f1. 9. The method of claim 7, wherein the step of deciding the optimal f1 comprises: estimating the floating-number range of weights of one layer, designating an initial value for f1, searching for an optimal f1 in the adjacent domains of the initial value based on the following calculation: f l = arg   min f l  ∑  ∑ k i   W float i - W  ( bw , f l ) i   wherein W is the weight matrix of one layer, W (bw, f1) represents the fixed-point format of W under the given bw and f1, i represents one bit out of bw bits, ki represents the weight of said bit i. 10. The method of claim 1, the step of data quantization further comprises: n = ∑ i = 0 bw - 1  B i · 2 - f l · 2 i using the above expression to denote a fixed-point number representing the data of feature map, wherein bw is the bit width of the number, f1 is the fractional length which can be negative fraction, deciding the optimal f1 for data in each feature map set output by the CONV layers and FC layers of the ANN. 11. The method of claim 10, wherein the step of deciding the optimal f1 comprises: estimating the floating-number range of data of one feature map set, designating an initial value for f1, searching for an optimal f1 in the adjacent domains of the initial value based on the following calculation: f l = arg   min f l  ∑  x float + - x +  ( bw , f l )  wherein x+=A·x, A represents the operation applied by one of the CONV layers and FC layers of the ANN, x represents the input of one layer, x+ represents the output of said layer. 12. The method of claim 10, wherein the step of deciding the optimal f1 comprises: estimating the floating-number range of data of one feature map set, designating an initial value for f1, searching for an optimal f1 in the adjacent domains of the initial value based on the following calculation: f l = arg   min f l  ∑  ∑ N  k i   X float i + - X +  ( bw , f l ) i   wherein x+=A·x, A represents the operation applied by one of the CONV layers and FC layers of the ANN, x represents the input of one layer, x+ represents the output of said layer, i represents one bit out of bw bits, ki represents the weight of said bit i. 13. The method of claim 1, the fixed-point quantization further comprises: conducting weight quantization for all CONV layers and FC layers of the ANN; on the basis of all the quantized CONV layers and FC layers, conducting data quantization for each feature map set. 14. The method of claim 1, the fixed-point quantization further comprises: performing weight quantization and data quantization in an alternative manner, including: conducting weight quantization for said CONV layers and FC layers one layer by one layer in sequence, and after conducting weight quantization for the present layer of said CONV layers and FC layers, before conducting weight quantization for next layer of said CONV layers and FC layers, conducting data quantization of feature map set output from said present layer. 15. The method of claim 1, wherein said fixed-point quantization further comprises: receiving a bit width bw from the ANN accelerator; converting floating-point numbers into fixed-point numbers of said bit width bw. 16. The method of claim 1, wherein the compiling step further comprises: serializing step, for serializing the CONV layers and FC layers of ANN in sequence; tiling step, for tiling the input data based on the computation complexity of each layer of said ANN, computation and memory resources of said ANN accelerator; data reusing step, for reusing the tiled data in operations of CONV layers and FC layers; instruction generating step, for deciding data to be loaded and operations to be conducted on the basis of the tiling and data reusing steps, and generating instructions to be executed by said ANN accelerator. 17. The method of claim 1, wherein the tiling step further comprising: tiling the input data by factors Tr, Tc in row and column, wherein Tr and Tc are decided based on computation and memory resources of said ANN accelerator. 18. The method of claim 17, wherein the computation and memory resources of said ANN accelerator includes at least one of the following: number of PEs (Processing Element) in the accelerator, number of convolvers in each PE, or size of convolver. 19. The method of claim 16, wherein the data reusing step further comprising: loading the tiled data into buffers of said ANN accelerator, reusing said tiled data loaded in buffers for convolutional operations in relation to the tiled data. 20. The method of claim 16, the instruction generation step further comprising: transforming a coarse-grained instruction into fine-grained instructions on the basis at least one of the following design parameters: number of PEs (Processing Element) in the accelerator, number of convolvers in each PE, size of convolver. 21. The method of claim 1, wherein the ANN receives a benchmark data set as input of said ANN in order to perform the fixed-point quantization step.