Convolutional neural network accelerator and acceleration method

By preset dimension division and global average pooling operations on the feature map in the convolutional neural network accelerator, combined with zero-filling rules and scaling factor correction, the problem of dimension limitation of global average pooling layer is solved, and the characteristics of different dimensions are realized The support and efficient processing of the diagram improves the flexibility and accuracy of the hardware.

CN119272815APending Publication Date: 2025-01-07NANJING UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411463921.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

The global average pooling layer usually only supports finite input dimensions and cannot meet the diverse input feature map requirements of different image and task requirements, increasing the complexity of hardware implementation and resource consumption.

Method used

A convolutional neural network accelerator is designed to perform preset dimension division and global average pooling operations on the feature map through the kernel module. If the dimension does not meet the target dimension, it will be re-execute until the target dimension is reached, and the zero-filling rule is used to adapt to different Dimensional feature map, combined with scaling factor to correct the output results.

Benefits of technology

It significantly improves the flexibility and area efficiency of the global average pooling layer, supports feature map processing of arbitrary shapes, reduces the complexity and resource consumption of hardware implementation, and ensures the accuracy of output results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119272815A_ABST
    Figure CN119272815A_ABST
Patent Text Reader

Abstract

The invention provides a convolutional neural network accelerator and an acceleration method, and the convolutional neural network accelerator comprises a main buffer which is configured to obtain and store a feature map; the kernel module is in communication connection with the main buffer and is configured to divide the feature map according to a preset dimension, and calculate a global average pooling output result of the feature map by using a global average pooling layer algorithm to obtain an intermediate feature map; if the dimension of the intermediate feature map does not reach the target dimension, re-executing the step of obtaining the intermediate feature map; obtaining a target feature map until the dimension of the intermediate feature map reaches a target dimension; and based on the target feature map, calculating target output and storing the target output to the main buffer so as to solve the problem that the global average pooling layer cannot meet the requirements of input feature maps of different dimensions due to the fact that the current global average pooling layer generally only supports limited input dimensions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of neural network technology, and in particular to a convolutional neural network accelerator and an acceleration method. Background Art

[0002] As an important model in the field of deep learning, convolutional neural network (CNN) has achieved remarkable results in tasks such as image recognition, object detection, and semantic segmentation. CNN extracts features from images through convolutional layers, and these features are crucial for subsequent classification and recognition tasks. However, the computational complexity of the convolutional layer is huge, which not only increases the difficulty of model training, but also increases the complexity of hardware implementation. Therefore, most previous studies have focused on how to optimize the computational efficiency and performance of the convolutional layer, including algorithm improvement, hardware acceleration, and other aspects.

[0003] Although the convolution layer is the core part of CNN, the global average pooling layer (GAP) plays an important role as a key technology for dimensionality reduction in CNN. The global average pooling layer can significantly reduce the number of network parameters while retaining important feature information by performing a global average operation on the feature map. This dimensionality reduction method not only helps to reduce the amount of calculation, but also improves the generalization ability of the network. However, compared with the convolution layer, the hardware implementation research of the global average pooling layer is relatively lacking.

[0004] Currently, the global average pooling layer usually only supports limited input dimensions. This limitation affects the flexibility and adaptability of the neural network to a certain extent. In practical applications, different images and tasks may require input feature maps of different dimensions, and the global average pooling layer often cannot meet such diverse needs. In addition, since the global average operation requires traversing and calculating the entire feature map, it increases the complexity and resource consumption of hardware implementation. Therefore, how to reduce the hardware implementation cost of the global average pooling layer while ensuring performance also needs to be considered. Summary of the invention

[0005] The present application provides a convolutional neural network accelerator and acceleration method to solve the technical problem that the current global average pooling layer usually only supports limited input dimensions, while different images and tasks require input feature maps of different dimensions, resulting in the global average pooling layer being unable to meet the requirements of input feature maps of different dimensions.

[0006] The first aspect of the present application provides a convolutional neural network accelerator, comprising:

[0007] A primary buffer, the primary buffer being configured as:

[0008] Get the feature map and store it;

[0009] A kernel module, the kernel module being communicatively connected to the primary buffer and configured to:

[0010] Dividing the feature map according to a preset dimension, and using a global average pooling layer algorithm to calculate a global average pooling output result of the feature map to obtain an intermediate feature map;

[0011] If the dimension of the intermediate feature map does not reach the target dimension, re-execute the step of obtaining the intermediate feature map;

[0012] Until the dimension of the intermediate feature map reaches the target dimension, a target feature map is obtained;

[0013] Based on the target feature map, a target output is calculated and stored in the main buffer.

[0014] In some embodiments, the kernel module is further configured to:

[0015] The feature map is divided according to a preset dimension. If the number of blocks in the split region of the feature map cannot meet the preset dimension, a blank block is filled into the split region so that the split region meets the preset dimension; the feature value of the blank block is 0;

[0016] Using a global average pooling layer algorithm, a global average pooling output result of the feature map is calculated to obtain an intermediate feature map;

[0017] If the dimension of the intermediate feature map does not reach the target dimension, the step of obtaining the intermediate feature map is re-executed; if the number of blocks in the split region of the intermediate feature map cannot meet the preset dimension, the blank blocks are filled into the split region so that the split region meets the preset dimension;

[0018] Until the dimension of the intermediate feature map reaches the target dimension, a target feature map is obtained.

[0019] In some embodiments, the global average pooling layer algorithm is determined by the following formula:

[0020]

[0021] In the formula, GAP(x) c represents the global average pooling output of the cth channel; N is the number of features in each channel; x i,c is the value of the i-th feature in the c-th channel.

[0022] In some embodiments, the preset dimension size is 2×2, and the target dimension size is 1×1.

[0023] In some embodiments, the step of calculating the target output based on the target feature map is further configured as follows:

[0024] Obtaining a feature dimension and a dimension to be divided of the feature graph;

[0025] Obtaining a scaling factor based on the feature dimension and the dimension to be divided;

[0026] Based on the target feature map and the scaling factor, a target output is calculated.

[0027] In some embodiments, the primary buffer is further configured to:

[0028] Get weight data and store it;

[0029] The convolutional neural network accelerator also includes:

[0030] A weight buffer, the weight buffer is communicatively connected with the main buffer and the kernel module, and is used to store the weight data;

[0031] A feature buffer is communicatively connected with the main buffer and the kernel module, and is used for storing feature map data.

[0032] In some embodiments, the kernel module includes: a demultiplexer component, a pooling unit, and a multiplexer component; the demultiplexer component is communicatively connected with the pooling unit and the multiplexer component;

[0033] The demultiplexer component is used to obtain the feature map;

[0034] The pooling unit is configured as follows:

[0035] Based on the feature map, a target feature map is obtained by using a global average pooling layer algorithm;

[0036] Based on the target feature map, calculating the target output;

[0037] The multiplexer component is used to send the target output to the feature buffer.

[0038] In some embodiments, the kernel module further comprises: a PE unit, the PE unit being communicatively connected with the demultiplexer component and the multiplexer component;

[0039] The demultiplexer component is also used to obtain weight data and input feature maps;

[0040] The PE unit is configured as:

[0041] Using the input feature map and weight data, a convolution operation is performed to obtain a feature map;

[0042] The multiplexer component is further configured to send the feature map data to the feature buffer.

[0043] A second aspect of the present application provides a convolutional neural network accelerator acceleration method, which is applied to a convolutional neural network accelerator described in any one of the first aspects above, comprising:

[0044] The feature map is divided according to a preset dimension. If the number of blocks in the split region of the feature map cannot meet the preset dimension, a blank block is filled into the split region so that the split region meets the preset dimension; the feature value of the blank block is 0;

[0045] Using a global average pooling layer algorithm, a global average pooling output result of the feature map is calculated to obtain an intermediate feature map;

[0046] If the dimension of the intermediate feature map does not reach the target feature, the step of obtaining the intermediate feature map is re-executed; if the number of blocks in the split region of the intermediate feature map cannot meet the preset dimension, the blank blocks are filled into the split region so that the split region meets the preset dimension;

[0047] Until the dimension of the intermediate feature map reaches the target feature, a target feature map is obtained;

[0048] Based on the target feature map, a target output is calculated and stored in the main buffer.

[0049] In some embodiments, the step of calculating the target output based on the target feature map includes:

[0050] Obtaining a feature dimension and a dimension to be divided of the feature graph;

[0051] Obtaining a scaling factor based on the feature dimension and the dimension to be divided;

[0052] Based on the target feature map and the scaling factor, a target output is calculated.

[0053] The present application provides a convolutional neural network accelerator and an acceleration method, the convolutional neural network accelerator comprising: a main buffer, the main buffer being configured to: obtain and store a feature map; a kernel module, the kernel module being communicatively connected to the main buffer and configured to: divide the feature map according to a preset dimension, and using a global average pooling layer algorithm to calculate a global average pooling output result of the feature map to obtain an intermediate feature map; if the dimension of the intermediate feature map does not reach a target dimension, re-execute the step of obtaining the intermediate feature map; until the dimension of the intermediate feature map reaches the target dimension, a target feature map is obtained; based on the target feature map, a target output is calculated and stored in the main buffer, so as to solve the problem that the current global average pooling layer generally only supports a limited input dimension, resulting in the global average pooling layer being unable to meet the requirements of input feature maps of different dimensions. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the embodiments are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0055] Figure 1 This is a schematic diagram of the structure of the convolutional neural network accelerator in this application;

[0056] Figure 2 This is a schematic diagram of the structure of the kernel module in this application;

[0057] Figure 3 This is a flowchart of the kernel module performing average pooling operation in this application;

[0058] Figure 4 This is the flow chart of the traditional average pooling operation;

[0059] Figure 5 This is a comparison chart of the error analysis during average pooling operation;

[0060] Figure 6 This is a comparison chart of the accuracy of average pooling operation under a model;

[0061] Figure 7 This is a comparison chart of the accuracy of average pooling operation under another model.

[0062] Description of reference numerals:

[0063] 1-main buffer; 2-kernel module; 21-demultiplexer component; 22-PE unit; 23-pooling unit; 24-multiplexer component; 3-weight buffer; 4-feature buffer. DETAILED DESCRIPTION

[0064] In order to enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.

[0065] In some technologies, the global average pooling layer currently usually only supports limited input dimensions. However, different images and tasks require input feature maps of different dimensions, which results in the global average pooling layer being unable to meet the requirements of input feature maps of different dimensions. In order to solve this technical problem, the present application provides a convolutional neural network accelerator and an acceleration method. The convolutional neural network accelerator and the acceleration method are described below:

[0066] For example, unlike the traditional average pooling layer that only calculates the average value of a local 2×2 or 3×3 area, the global average pooling layer expands its area to the entire feature map and performs a global average operation. The shape of the global average pooling layer is closely related to the input shape of the model, and these input shapes vary due to the resolution of different cameras; this leads to the diversity of the shape of the global average pooling layer, which poses a challenge to the flexible application of hardware design.

[0067] Depend on Figure 1 It can be seen that in view of the above problems, the first aspect of the present application provides a convolutional neural network accelerator, including: a main buffer 1, the main buffer 1 is configured to: obtain and store a feature map; a kernel module 2, the kernel module 2 is communicatively connected to the main buffer 1, and is configured to:

[0068] The feature map is divided according to a preset dimension, and a global average pooling layer algorithm is used to calculate the global average pooling output result of the feature map to obtain an intermediate feature map; the preset dimension size is 2×2; for example, if the dimension of the obtained feature map is 4×4, the feature map is divided into 4 split areas according to the preset dimension, and the output result of each area can be obtained by the following formula, thereby obtaining an intermediate feature map;

[0069] The global average pooling layer algorithm is determined by the following formula:

[0070]

[0071] In the formula, GAP(x) c represents the global average pooling output of the cth channel; N is the number of features in each channel; x i,c is the value of the i-th feature in the c-th channel.

[0072] If the dimension of the intermediate feature map does not reach the target dimension, the step of obtaining the intermediate feature map is performed again; the target dimension is 1×1; until the dimension of the intermediate feature map reaches the target dimension, the target feature map is obtained; for example, if the dimension of the intermediate feature map obtained after the above preset dimension division is 2×2, then the dimension of the feature map obtained after the preset dimension division is exactly 1×1, and no further dimension division is required to obtain the target feature map; based on the target feature map, the target output is calculated and stored in the main buffer 1. The output result in the target feature map, i.e., the target output, is calculated using the above global average pooling layer algorithm, thereby completing the global average pooling operation of the feature map.

[0073] In this embodiment, the kernel module 2 is further configured to: divide the feature map according to a preset dimension; if the number of blocks in the split area in the feature map cannot meet the preset dimension, fill the split area with blank blocks so that the split area meets the preset dimension; the feature value of the blank block is 0; use the global average pooling layer algorithm to calculate the global average pooling output result of the feature map to obtain an intermediate feature map; if the dimension of the intermediate feature map does not reach the target dimension, re-execute the step of obtaining the intermediate feature map; if the number of blocks in the split area in the intermediate feature map cannot meet the preset dimension, fill the split area with blank blocks so that the split area meets the preset dimension; until the dimension of the intermediate feature map reaches the target dimension, the target feature map is obtained.

[0074] Specifically, the present application implements support for global average pooling layers of various shapes by iteratively using 2×2 dimensional partitioning and adjusted filling rules on feature maps through kernel module 2, thereby significantly improving area efficiency. Take an irregular 3×5 dimensional feature map input as an example, Figure 3 As shown, the specific process is as follows:

[0075] First, the feature map is divided into 2×2 small blocks from top to bottom and from left to right; for the part that is not enough to form a complete 2×2 block, it is supplemented to 2×2 size by zero padding, that is, the part that is not enough to form a 2×2 block is filled with a blank block with an eigenvalue of 0. Then, the output result of the feature map is obtained by using the global average pooling layer algorithm for the divided 2×2 matrix blocks to generate the output result of the first round. If the dimension of the output feature map is not 1×1, continue the previous step until the dimension of the output feature map is 1×1, where the part that is not enough to form a complete 2×2 block is supplemented to 2×2 size by zero padding. Finally, the target feature map is obtained, that is, a feature map with a dimension of 1×1.

[0076] In this embodiment, the step of calculating the target output based on the target feature map is further configured as follows: obtaining the feature dimension and the dimension to be divided of the feature map; obtaining the scaling factor based on the feature dimension and the dimension to be divided; and calculating the target output based on the target feature map and the scaling factor. It is understandable that since zero-filling is introduced in the calculation process, that is, blank blocks with a feature value of 0 are added, the final calculated result, i.e., the target output, will have a certain deviation from the true value. In order to correct this deviation, the accuracy of the target output is adjusted by setting a scaling factor in the embodiment of the present application, so as to calculate the target output. The specific method is as follows: for example, if the dimension of the feature map is 3×5, first obtain the dimension to be divided through the dimension of the feature map, and the dimension to be divided is the closest square with a side length of the power of 2, wherein the side length of the square needs to be greater than or equal to the dimension of the feature map, so the closest square with the minimum side length of the power of 2 corresponding to the feature map with a dimension of 3×5 is a square of 8×8, then the scaling factor is the division dimension of the feature map ÷ the dimension of the feature map, that is, 8×8÷(3×5); finally, the target output can be obtained by multiplying the output result corresponding to the target feature map by the scaling factor, thereby realizing that the global average pooling layer can adapt to feature maps of various shapes and ensuring the accuracy of the output results.

[0077] In this embodiment, the main buffer 1 is also configured to: obtain and store weight data; the convolutional neural network accelerator also includes: a weight buffer 3, the weight buffer 3 is connected to the main buffer 1 and the kernel module 2 for storing the weight data; the weight buffer 3 is a 64KB dedicated weight buffer; a feature buffer 4, the feature buffer 4 is connected to the main buffer 1 and the kernel module 2 for storing the target output. The feature buffer 4 is a 64KB feature mapping buffer used to replace the double buffer architecture in the traditional average pooling layer, which not only improves the efficiency of the buffer, but also enhances the flexibility of the system. The weight buffer 3 is used for obtaining and storing weight data and for sending weight data to the kernel module 2; the feature buffer 4 is used for obtaining and storing feature map data and for sending target features to the main buffer 1 and for sending feature maps to the kernel module 2; the feature map data includes: input feature map, feature map, intermediate feature map, target feature map and target output; thanks to the fact that both input and output feature maps are stored in the same buffer, continuous high-density layers can be processed directly on the chip without frequently accessing external memory to exchange feature map data between layers, thereby improving the operating speed of the convolutional neural network accelerator.

[0078] Depend on Figure 2It can be seen that the kernel module 2 includes: a demultiplexer component 21, a pooling unit 23, and a multiplexer component 24; the demultiplexer component 21 is communicatively connected with the pooling unit 23 and the multiplexer component 24; the pooling unit 23 can process eight pooling cores at the same time, and is suitable for 3×3 and 2×2 pooling layers; the demultiplexer component 21 is used to obtain the feature map; the pooling unit 23 is configured to: based on the feature map, use the global average pooling layer algorithm to obtain the target feature map; based on the target feature map, calculate the target output.

[0079] Depend on Figure 2 It can be seen that the kernel module 2 also includes: a PE unit 22, the PE unit 22 is in communication with the demultiplexer component 21 and the multiplexer component 24; wherein the PE unit 22 and the pooling unit 23 are encapsulated into the kernel module 2 through the multiplexer component 21; the PE unit 22 is a 4×4×4 PE array, which can calculate four input channels, four rows and four output channels in parallel; by reusing the PE array and forcing the cross-channel weights to be zero, deep convolution is supported. The addition layer is also supported by reusing the shift and accumulation submodules of the PE array; the demultiplexer component 21 is also used to obtain weight data and input feature maps; the PE unit 22 is configured to: use the input feature map and weight data to perform convolution operations to obtain feature maps; the multiplexer component 24 is used to send the feature map data to the feature buffer 4. The specific operation process of the convolutional neural network accelerator is as follows: the main buffer 1 obtains weight data and input feature maps, and first sends the weight data and input feature maps to the weight buffer 3 and the feature buffer 4 respectively in turn. The PE unit 22 continuously obtains the weight data and the input feature map through the weight buffer 3 and the feature buffer 4, calculates the feature map, and stores it in the feature buffer 4 and the main buffer 1; secondly, the pooling unit 23 obtains the feature map through the feature buffer 4 to perform a global average pooling operation, obtains the target output and stores it in the main buffer 1 for subsequent application.

[0080] For example, compared with the average pooling operation using zero padding in this application, the filling rule of the traditional average pooling operation will make the edge value have a greater contribution than the center value. The specific flow chart is as follows: Figure 4As shown, it is understandable that even if each split area can be filled into 2×2 sub-areas through 2×2 average pooling, the filling rule of the conventional pooling operator does not fill the block with a feature of 0, which will cause the edge value contribution of the feature map to be greater than the center value. At present, there is also a dedicated global average pooling operation. For example, a global average pooling operation is performed on a 3×5-dimensional feature map. By independently setting a pooling module for the 3×5 feature map, this module has high calculation accuracy and fast calculation speed when calculating the 3×5 feature map. However, the disadvantage is that it has poor versatility and can only calculate feature maps of 3×5 dimensions, but feature maps of other dimensions cannot be calculated. It has certain limitations in application and is very inconvenient.

[0081] Compared to directly using a dedicated global average pooling layer module to calculate the final output in one go, iteratively using a 2×2 average pooling module for calculation may lead to some additional errors. In order to evaluate the error, the impact of the proposed iterative method on the accuracy is comprehensively analyzed from both the operator level and the model level.

[0082] First, we measure the error at the operator level: the input of the global average pooling layer is quantized to 16 bits, and 10,000 tests are performed for different input sizes from 7×7 to 32×32. The test data is a random array created by numpy, and the corresponding quantization error is calculated. The quantization error is expressed in terms of peak signal-to-noise ratio (PSNR), which is determined by the following formula:

[0083]

[0084] Where N, MAX, Y fl and Y represent the number of output channels, the maximum value, the floating-point result, and the fixed-point result, respectively. The smaller the quantization error, the greater the PSNR.

[0085] The PSNR error analysis results are as follows: Figure 5 As shown in the figure, dedicated global average pooling shows high and stable PSNR values ​​at various input sizes. Forced average pooling, i.e., the global average pooling operation adopted in this application, performs similarly to dedicated global average pooling in most cases, but its PSNR value is slightly lower than that of dedicated global average pooling. Traditional average pooling can achieve the accuracy of forced average pooling at certain specific input sizes, but at most other sizes, the error it produces is relatively large.

[0086] For example, the error of the above pooling operation is evaluated at the model level; using the ImageNet dataset, the inference operations of dedicated global average pooling, traditional average pooling, and forced average pooling are performed on the MobileNet V2 and ResNet34 models, and their final accuracy is evaluated. The generated accuracy comparison chart is as follows: Figure 6 and Figure 7 As shown in the accuracy comparison chart, dedicated global average pooling and forced average pooling maintain the same accuracy, while traditional average pooling is less accurate than global average pooling and forced average pooling. Figure 6 and Figure 7 It can be seen that forced average pooling shows stable algorithm accuracy, and is on par with the dedicated global average pooling layer in terms of top-1 classification accuracy.

[0087] In TSMC 28nm production, a convolutional neural network accelerator with dedicated global average pooling, traditional average pooling, and forced average pooling processing global average pooling layers was implemented at a frequency of 250MHz. The comprehensive results are shown in the following table:

[0088]

[0089] Compared with dedicated global average pooling, forced average pooling reduces the number of gates of the pooling layer by 45.1% and improves the overall area efficiency by 13.2%. Although the area efficiency of traditional average pooling is further improved by 0.9% compared with forced average pooling, it will have a non-negligible impact on the accuracy of the algorithm. In summary, the convolutional neural network accelerator provided in this application can support global average pooling layers of arbitrary shapes, has high reconfigurability, and improves the area efficiency of the entire convolutional neural network accelerator.

[0090] The second aspect of the present application provides an acceleration method for a convolutional neural network accelerator, which is applied to a convolutional neural network accelerator described in any of the above embodiments, including: dividing the feature map according to a preset dimension, if the number of blocks in the split area in the feature map cannot meet the preset dimension, then filling the blank block into the split area so that the split area meets the preset dimension; the feature value of the blank block is 0; using the global average pooling layer algorithm, the global average pooling output result of the feature map is calculated to obtain an intermediate feature map; if the dimension of the intermediate feature map does not reach the target feature, the step of obtaining the intermediate feature map is re-executed; if the number of blocks in the split area in the intermediate feature map cannot meet the preset dimension, then filling the blank block into the split area so that the split area meets the preset dimension; until the dimension of the intermediate feature map reaches the target feature, a target feature map is obtained; based on the target feature map, the target output is calculated and stored in the main buffer. The effects of the above method embodiments can refer to the effects of the above system embodiments, which will not be repeated here.

[0091] In this embodiment, the step of calculating the target output based on the target feature map includes: obtaining the feature dimension and the dimension to be divided of the feature map; obtaining the scaling factor based on the feature dimension and the dimension to be divided; and calculating the target output based on the target feature map and the scaling factor. The effects of the above method embodiment can be referred to the effects of the above system embodiment, which will not be described in detail here.

[0092] The above specific implementation methods further explain in detail the purpose, technical solutions and beneficial effects of the embodiments of the present application. It should be understood that the above are only specific implementation methods of the embodiments of the present application and are not used to limit the protection scope of the embodiments of the present application. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of the embodiments of the present application should be included in the protection scope of the embodiments of the present application.

Claims

1. A convolutional neural network accelerator, characterized in that: include: A main buffer (1), wherein the main buffer (1) is configured as: Get the feature map and store it; A kernel module (2), the kernel module (2) being in communication with the main buffer (1) and configured as follows: Dividing the feature map according to a preset dimension, and using a global average pooling layer algorithm to calculate a global average pooling output result of the feature map to obtain an intermediate feature map; If the dimension of the intermediate feature map does not reach the target dimension, re-execute the step of obtaining the intermediate feature map; Until the dimension of the intermediate feature map reaches the target dimension, a target feature map is obtained; Based on the target feature map, a target output is calculated and stored in the main buffer (1).

2. A convolutional neural network accelerator according to claim 1, characterized in that: The kernel module (2) is further configured as follows: Divide the feature map according to a preset dimension, and if the number of blocks in the split region of the feature map cannot meet the preset dimension, fill the split region with blank blocks so that the split region meets the preset dimension; The characteristic value of the blank block is 0; Using a global average pooling layer algorithm, a global average pooling output result of the feature map is calculated to obtain an intermediate feature map; If the dimension of the intermediate feature map does not reach the target dimension, the step of obtaining the intermediate feature map is re-executed; if the number of blocks in the split region of the intermediate feature map cannot meet the preset dimension, the blank blocks are filled into the split region so that the split region meets the preset dimension; Until the dimension of the intermediate feature map reaches the target dimension, a target feature map is obtained.

3. A convolutional neural network accelerator according to claim 1, characterized in that: The global average pooling layer algorithm is determined by the following formula: In the formula, GAP(x) c represents the global average pooling output of the cth channel; N is the number of features in each channel; x i,c is the value of the i-th feature in the c-th channel.

4. A convolutional neural network accelerator according to claim 1, characterized in that: The preset dimension size is 2×2, and the target dimension size is 1×1.

5. A convolutional neural network accelerator according to claim 1, characterized in that: The step of calculating the target output based on the target feature map is further configured as follows: Obtaining a feature dimension and a dimension to be divided of the feature graph; Obtaining a scaling factor based on the feature dimension and the dimension to be divided; Based on the target feature map and the scaling factor, a target output is calculated.

6. A convolutional neural network accelerator according to claim 1, characterized in that: The main buffer (1) is further configured as: Get weight data and store it; The convolutional neural network accelerator also includes: A weight buffer (3), the weight buffer (3) being communicatively connected with the main buffer (1) and the kernel module (2) and being used for storing the weight data; A feature buffer (4), the feature buffer (4) is communicatively connected with the main buffer (1) and the kernel module (2), and is used for storing feature map data.

7. A convolutional neural network accelerator according to claim 6, characterized in that: The core module (2) comprises: a demultiplexer component (21), a pooling unit (23), and a multiplexer component (24); the demultiplexer component (21) is communicatively connected with the pooling unit (23) and the multiplexer component (24); The demultiplexer component (21) is used to obtain the feature map; The pooling unit (23) is configured as follows: Based on the feature map, a target feature map is obtained by using a global average pooling layer algorithm; Based on the target feature map, a target output is calculated.

8. A convolutional neural network accelerator according to claim 7, characterized in that: The kernel module (2) further comprises: a PE unit (22), wherein the PE unit (22) is communicatively connected with the demultiplexer component (21) and the multiplexer component (24); The demultiplexer component (21) is also used to obtain weight data and input feature maps; The PE unit (22) is configured as follows: Using the input feature map and weight data, a convolution operation is performed to obtain a feature map; The multiplexer component (24) is used to send the feature map data to the feature buffer (4).

9. A method for accelerating a convolutional neural network accelerator, applied to a convolutional neural network accelerator as claimed in any one of claims 1 to 8, characterized in that: include: Divide the feature map according to a preset dimension, and if the number of blocks in the split region of the feature map cannot meet the preset dimension, fill the split region with blank blocks so that the split region meets the preset dimension; The characteristic value of the blank block is 0; Using a global average pooling layer algorithm, a global average pooling output result of the feature map is calculated to obtain an intermediate feature map; If the dimension of the intermediate feature map does not reach the target feature, the step of obtaining the intermediate feature map is re-executed; if the number of blocks in the split region of the intermediate feature map cannot meet the preset dimension, the blank blocks are filled into the split region so that the split region meets the preset dimension; Until the dimension of the intermediate feature map reaches the target feature, a target feature map is obtained; Based on the target feature map, a target output is calculated and stored in the main buffer.

10. The acceleration method of a convolutional neural network accelerator according to claim 9, characterized in that: The step of calculating the target output based on the target feature map comprises: Obtaining a feature dimension and a dimension to be divided of the feature graph; Obtaining a scaling factor based on the feature dimension and the dimension to be divided; Based on the target feature map and the scaling factor, a target output is calculated.