Convolutional neural network feature map data compression method and device
Through the combined method of feature map channel reconstruction and zero-value bitmap encoding, the contradiction between hardware complexity and compression rate in convolutional neural network feature map data compression is solved, and efficient feature map data transmission and storage are achieved.
Patent Information
- Application Number
- CN202110367961.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-06
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-04-06
AI Technical Summary
In the existing technology for convolutional neural network feature map data compression, although zero-value bitmap encoding has a high compression rate, the hardware complexity is high, and the feature map data generated by the LeakyReLU activation function does not have high sparsity and lacks suitable The efficient compression method makes it difficult to balance hardware energy consumption and complexity.
The feature map channel reconstruction stage is used to improve the sparsity of the feature map through one-dimensional discrete cosine transform and low-pass filtering, and then compressed using zero-value bitmap encoding, stored in the off-chip memory of the hardware accelerator, and combined with the feature map to restore the inverse transformation Decompression and reconstruction are performed in stages to reduce hardware complexity.
It significantly improves the compression rate, while minimizing hardware complexity, improving the sparsity and compression potential of feature map data, and is suitable for the transmission and storage of feature map data in convolutional neural networks.
Smart Images

Figure CN112906874B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of convolutional neural network, and in particular to a method and device for compressing feature graph data of a convolutional neural network. Background Art
[0002] In the field of machine vision, the network architecture using convolutional neural networks as feature extractors has excellent accuracy and high computational efficiency. Convolutional neural networks are composed of several or even hundreds of convolution operation layers stacked together, and are based on two-dimensional plane convolution calculations to extract features from images and obtain feature map data.
[0003] In practical applications, convolutional neural networks are usually deployed in hardware accelerators or other low-power devices. After the feature map data is generated by the activation function in the convolutional neural network, it is transmitted to the off-chip memory of the hardware accelerator. The activation function includes ReLU activation function, LeakyReLU activation function, etc. The hardware accelerator is limited by the chip storage space during calculation and cannot load all feature map data completely. Since the amount of feature map data is very large, it will be repeatedly read on the hardware accelerator chip during the transmission process. This not only puts certain requirements on the bandwidth of the interaction between the hardware accelerator's own computing system and its own memory, but also brings more energy consumption.
[0004] Since the feature map data generated by the ReLU activation function has a certain sparsity, that is, a large number of values are 0, before the feature map data is transmitted to the off-chip memory of the hardware accelerator, a zero-value bitmap encoding method is usually used to store non-zero values and use a binary bitmap to record its position to achieve compression of the feature map data. The compressed feature map data is used as direct data for interaction between the computing system and the memory, which can reduce the amount of data processing and reduce the energy consumption of the hardware accelerator.
[0005] Zero-value bitmap coding has the advantage of high compression rate, but it also makes the hardware more complex. In addition, a small number of hardware accelerators provide the implementation of activation functions such as LeakyReLU. The feature map data generated by this type of activation function does not have a high sparsity and is not suitable for data compression using the aforementioned zero-value bitmap coding method. At the same time, there is currently no applicable, particularly hardware-efficient compression method. Some available complex coding compression schemes such as LZW coding and Huffman coding have high hardware overhead and are not suitable for hardware implementation. Therefore, how to achieve a higher compression rate while minimizing hardware complexity has become a problem that needs to be solved urgently by those skilled in the art. Summary of the invention
[0006] In order to improve the compression rate while minimizing the hardware complexity, the present application discloses a convolutional neural network feature map data compression method and device through the following embodiments.
[0007] The first aspect of the present application discloses a convolutional neural network feature map data compression method, including a feature map channel reconstruction stage and a zero-value bitmap encoding compression stage;
[0008] The feature map channel reconstruction stage includes the following steps:
[0009] The channel dimension of the original feature map is changed from three-dimensional to two-dimensional to obtain a new feature map;
[0010] Performing matrix multiplication of a preset one-dimensional discrete cosine transform matrix and the tensor in the new feature map to obtain a frequency domain feature map;
[0011] Performing low-pass filtering on the frequency domain feature map to obtain a sparse feature map;
[0012] The zero-value bitmap encoding compression stage comprises the following steps:
[0013] Obtaining the sparse feature map;
[0014] The sparse feature map is compressed by zero-value bitmap coding to obtain final compressed data of the original feature map, and the final compressed data of the original feature map will be stored in the off-chip memory of the hardware accelerator.
[0015] Optionally, the method further comprises a zero-value bitmap decompression stage and a feature map restoration inverse transformation stage;
[0016] The zero-value bitmap decompression stage comprises the following steps:
[0017] Reading the final compressed data of the original feature map in the off-chip memory of the hardware accelerator;
[0018] Performing zero-value bitmap decompression on the final compressed data of the original feature map to obtain the sparse feature map;
[0019] The feature map restoration inverse transformation stage comprises the following steps:
[0020] Performing matrix multiplication of the transposed matrix of the one-dimensional discrete cosine transform matrix and the tensor in the sparse feature map to obtain a two-dimensional feature map;
[0021] The channel dimension of the two-dimensional feature map is converted into three dimensions to obtain restored data of the original feature map.
[0022] Optionally, the method further includes:
[0023] During the training process of the convolutional neural network, the feature map channel reconstruction phase and the feature map restoration inverse transformation phase are trained to reconstruct the network weights.
[0024] Optionally, performing low-pass filtering on the frequency domain feature map to obtain a sparse feature map includes:
[0025] A preset frequency domain filter is used to perform a broadcast Hadamard product on the frequency domain feature map to implement low-pass filtering of the frequency domain feature map to obtain the sparse feature map.
[0026] Optionally, the one-dimensional discrete cosine transform matrix is a real orthogonal matrix, and the one-dimensional discrete cosine transform matrix satisfies the following conditions:
[0027]
[0028] Among them, A ij represents the element with coordinates [i, j] in the one-dimensional discrete cosine transform matrix, and N represents the size of the one-dimensional discrete cosine transform matrix.
[0029] Optionally, the frequency domain filter satisfies the following conditions:
[0030]
[0031] Wherein, M represents the frequency domain filter, m represents the bandwidth of the frequency domain filter, and N represents the size of the one-dimensional discrete cosine transform matrix.
[0032] Optional, the value of N is 8.
[0033] The second aspect of the present application discloses a convolutional neural network feature map data compression device, which is applied to the convolutional neural network feature map data compression method described in the first aspect of the present application, and the convolutional neural network feature map data compression device includes: a feature map channel reconstruction module and a zero-value bitmap encoding compression module;
[0034] The feature map channel reconstruction module is used to perform the following steps:
[0035] The channel dimension of the original feature map is changed from three-dimensional to two-dimensional to obtain a new feature map;
[0036] Performing matrix multiplication of a preset one-dimensional discrete cosine transform matrix and the tensor in the new feature map to obtain a frequency domain feature map;
[0037] Performing low-pass filtering on the frequency domain feature map to obtain a sparse feature map;
[0038] The zero-value bitmap encoding compression module is used to perform the following steps:
[0039] Obtaining the sparse feature map;
[0040] The sparse feature map is compressed by zero-value bitmap coding to obtain final compressed data of the original feature map, and the final compressed data of the original feature map will be stored in the off-chip memory of the hardware accelerator.
[0041] Optionally, the device further comprises: a zero-value bitmap decompression module and a feature map restoration inverse transformation module;
[0042] The zero-value bitmap decompression module is used to perform the following steps:
[0043] Reading the final compressed data of the original feature map in the off-chip memory of the hardware accelerator;
[0044] Performing zero-value bitmap decompression on the final compressed data of the original feature map to obtain the sparse feature map;
[0045] The feature map restoration inverse transformation module is used to perform the following steps:
[0046] Performing matrix multiplication of the transposed matrix of the one-dimensional discrete cosine transform matrix and the tensor in the sparse feature map to obtain a two-dimensional feature map;
[0047] The channel dimension of the two-dimensional feature map is converted into three dimensions to obtain restored data of the original feature map.
[0048] The third aspect of the present application discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is processed and executed, the steps of the convolutional neural network feature map data compression method as described in the first aspect of the present application are implemented.
[0049] The embodiment of the present application discloses a method and device for compressing feature map data of a convolutional neural network, which includes a feature map channel reconstruction stage and a zero-value bitmap coding compression stage; in the feature map channel reconstruction stage, the feature map channel dimension is reconstructed using a one-dimensional discrete cosine transform, and high-frequency information filtering is implemented using a frequency domain filter to obtain a sparse feature map with a higher sparsity than the original feature map, and then the sparse feature map is compressed in the zero-value bitmap coding compression stage to obtain the final compressed data of the original feature map. The above method utilizes the channel redundancy of the convolutional neural network to reconstruct a channel group with certain frequency domain characteristics together, improve the sparsity of the data to be transmitted, and then improve the potential for compression, and then use the zero-value bitmap coding compression to compress the sparse feature map, thereby improving the compression rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] 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.
[0051] Figure 1 A schematic diagram of a flow chart of a convolutional neural network feature map data compression method provided in an embodiment of the present application;
[0052] Figure 2 A schematic diagram of a flow chart of another convolutional neural network feature map data compression method provided in an embodiment of the present application;
[0053] Figure 3 A schematic diagram of the structure of a convolutional neural network feature map data compression device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] In order to improve the compression rate while minimizing the hardware complexity, the present application discloses a convolutional neural network feature map data compression method and device through the following embodiments.
[0055] The first embodiment of the present application discloses a convolutional neural network feature map data compression method, including a feature map channel reconstruction stage and a zero-value bit map encoding compression stage.
[0056] The feature map channel reconstruction stage includes the following steps:
[0057] The channel dimension of the original feature map is changed from three-dimensional to two-dimensional to obtain a new feature map.
[0058] The original feature map is X∈R C×H×W , where X represents the tensor in the original feature map, R represents the real number field, and the channel dimension of the original feature map is three-dimensional, namely C, H, and W. C represents the number of channels of the original feature map, H represents the height of the original feature map, that is, how many pixels there are in the vertical direction, and W represents the width of the original feature map, that is, how many pixels there are in the horizontal direction.
[0059] Convert the channel dimension of the original feature map from three dimensions to two dimensions, and the new feature map is X reshape ∈R N×(C*H*W / N) , the channel dimension of the new feature map is two-dimensional, namely N and (C*H*W / N), where N is the size of the one-dimensional discrete cosine transform matrix.
[0060] Apply a one-dimensional discrete cosine transform (DCT) to the tensor in the new feature map in the channel dimension to convert the channel dimension of the new feature map into a frequency domain expression. Specifically, a preset one-dimensional discrete cosine transform matrix is matrix-multiplied with the tensor in the new feature map to obtain a frequency domain feature map.
[0061] The one-dimensional discrete cosine transform matrix is a real orthogonal matrix, represented by A. The one-dimensional discrete cosine transform matrix satisfies the following conditions:
[0062]
[0063] Among them, A ij represents the element with coordinates [i, j] in the one-dimensional discrete cosine transform matrix, and N represents the size of the one-dimensional discrete cosine transform matrix.
[0064] The matrix multiplication of the one-dimensional discrete cosine transform matrix and the tensor in the new feature map can be expressed by the following formula:
[0065] X freq-domain =AX reshape .
[0066] Among them, X freq-domain Represents the frequency domain feature map, X reshape Represents the new feature map.
[0067] The frequency domain feature map is low-pass filtered to obtain a sparse feature map.
[0068] Specifically, a preset frequency domain filter is used to perform a broadcast Hadamard product on the frequency domain feature map to filter out high-frequency information, thereby implementing low-pass filtering on the frequency domain feature map to obtain the sparse feature map.
[0069] The frequency domain filter satisfies the following conditions:
[0070]
[0071] Wherein, M represents the frequency domain filter, m represents the bandwidth of the frequency domain filter, and N represents the size of the one-dimensional discrete cosine transform matrix.
[0072] The frequency domain feature map is broadcasted using the preset frequency domain filter, which can be expressed by the following formula:
[0073] X comopress =M☉X freq-domain .
[0074] Among them, X comopress represents the sparse feature map, ☉ is the Hadamard product symbol, and the operation method is to multiply the corresponding positions of matrices of the same size point to point. M is broadcasted in advance, so the size is the same as X freq-domain are the same.
[0075] Since a matrix of 8×8 is usually used in the method involving one-dimensional discrete cosine transform in the field of image processing technology, as an example, the value of N mentioned above is 8. In special cases or pre-calculations, if it is known in advance that a certain application model or convolution calculation layer has the characteristics of high redundancy of the output feature map channel dimension or a large channel dimension (such as 1024 or more), a matrix of N=16, 32 or 64 can be used.
[0076] In a deep convolutional neural network, the feature map generated by the ReLU activation function has the characteristics of redundant values and multiple blank values in the channel dimension. The feature map channel reconstruction stage provided in this embodiment combines the one-dimensional discrete cosine transform (DCT) method to reconstruct the feature map channel dimension, and uses a frequency domain filter to filter high-frequency information, thereby increasing the sparsity of the feature map data. The resulting sparse feature map has a higher compression potential.
[0077] The zero-value bitmap encoding compression stage comprises the following steps:
[0078] The sparse feature map is obtained.
[0079] The sparse feature map is compressed by zero-value bitmap coding to obtain final compressed data of the original feature map, and the final compressed data of the original feature map will be stored in the off-chip memory of the hardware accelerator.
[0080] The feature map channel reconstruction stage disclosed in the above embodiment is deployed in the training process of the convolutional neural network. The feature map channel reconstruction process is applied during the training process, which can make better use of the channel redundancy of the convolutional neural network, reconstruct the channel group with certain frequency domain characteristics together, improve the sparsity of the data to be transmitted, and thus improve the potential for compression. Subsequently, the sparse feature map is compressed using zero-value bitmap coding compression, and its compression rate is significantly better than the compression rate of the zero-value bitmap coding compression method used in the prior art. Moreover, the feature map data compression method disclosed in the above embodiment improves the spatial frequency domain transformation into channel dimension frequency domain transformation and filtering, which is essentially a conversion from solving the two-dimensional data compression problem to solving the channel dimension redundant compression problem. The transformation method is also changed from two-dimensional transformation to one-dimensional transformation. At the same time, redundant quantization tables and run-length coding processes that require the transmission of additional data are removed, and the hardware friendliness is improved. Without increasing the hardware complexity, the compression rate is greatly improved.
[0081] Correspondingly, the method also includes a zero-value bitmap decompression stage and a feature map restoration inverse transformation stage.
[0082] The zero-value bitmap decompression stage comprises the following steps:
[0083] The final compressed data of the original feature map in the off-chip memory of the hardware accelerator is read.
[0084] The final compressed data of the original feature map is decompressed using a zero-value bitmap to obtain the sparse feature map.
[0085] The feature map restoration inverse transformation stage comprises the following steps:
[0086] The transposed matrix of the one-dimensional discrete cosine transform matrix is matrix-multiplied with the tensor in the sparse feature map (i.e., an inverse DCT operation, also called an iDCT operation) to obtain a two-dimensional feature map.
[0087] The channel dimension of the two-dimensional feature map is converted into three dimensions to obtain restored data of the original feature map.
[0088] Figure 1 The flowchart of the convolutional neural network feature map data compression method provided in this embodiment shows the process of feature map data compression-transmission-decompression, which includes the feature map channel reconstruction stage, the zero-value bit map encoding compression stage, the zero-value bit map decompression stage and the feature map restoration inverse transformation stage. When N is 8, the convolutional neural network feature map data compression process disclosed in this embodiment can be found in Figure 2 shown.
[0089] The following is a specific example to illustrate the convolutional neural network feature map data compression method disclosed in the above embodiment:
[0090] The dark light enhancement task is a pixel-level task. The task goal is to use machine learning methods to simulate scenes under high-brightness lighting conditions for image enhancement under low-light conditions. The input is a RAW grayscale file generated by the camera sensor, and the output is an enhanced RGB domain or grayscale image. When deploying inference tasks, the input image is usually high-pixel, and the feature map that is transmitted to and from the memory in the model also occupies a large space, up to the order of GB. Therefore, compressing the feature map during transmission is a task with great practical application significance. This example uses the See-In-the-Dark (SID) convolutional neural network as the backbone model. The model is based on the U-Net[8] structure. When applied to the hardware accelerator, the feature map data that needs to interact with the memory is generated by the ReLU activation function. The feature map channel dimension is set to C×H×W, where C=32, H and W are half the height and width of the input image, so the feature map tensor dimension shape is [32,H,W] during operation.
[0091] The compression process is as follows: First, the channel dimension of the feature map is split and transformed, and the channel dimension of the feature map data is changed to [8, H*4*W]. Then, a one-dimensional DCT transform of size 8 is applied in batches along the first dimension, and the Hadamard product is used to perform a low-pass filter with a bandwidth of m. This transformation and filtering step improves the sparsity of the data to be transmitted. At this time, the data is a tensor with high static sparsity and a certain degree of dynamic sparsity. The shape is still [8, H*4*W], but only the [m, H*4*W] part contains non-zero values. Then, this part of the data is compressed using zero-value bitmap encoding. The compression module divides the new data into two parts, namely, a binary bitmap of non-zero value positions and a non-zero value with an 8-bit width. These two parts of data are the compressed data, where the bitmap is 1-bit data of size [m, H*4*W] and the non-zero value is 8-bit data of indefinite length. In the SID model experiment, the average space occupied by the compressed data is about 36% of the tensor before compression.
[0092] After that, the compressed data is used as direct data for interaction between the memory and the computing module, and the amount of data transmission is significantly reduced. When this part of the feature map is used again and read from the memory, the two sets of compressed data are first decompressed as zero-value bitmaps and decoded into valid data tensors of [m, H*4*W]. Then, the inverse DCT transform is performed, skipping the calculation of 0 values, to obtain data of shape [8, H*4*W]. Then, it is deformed and restored to [32, H, W] to the original feature map shape. At this point, the decompression and recovery part of the lossy compressed data is completed, and then the feature map can be input into the next computing module for corresponding operations.
[0093] In this embodiment, considering that there will be some data changes and information missing problems after the feature map data is compressed and reconstructed, this embodiment introduces retraining, and deploys the feature map channel reconstruction stage and the feature map restoration inverse transformation stage in the training process of the convolutional neural network. The feature map channel reconstruction stage and the feature map restoration inverse transformation stage are trained to reconstruct the network weights, simulate the data changes of lossy compression, and make up for the decrease in the overall model accuracy caused by information missing.
[0094] By utilizing the redundancy in the feature map channel dimension during the training process, applying a one-dimensional discrete cosine transform to the feature map channel dimension and then filtering the high-frequency components, it is possible to maintain a small data compression error and improve the data compression rate. The feature map data compression method disclosed in this embodiment can be applied to a wider range of task scenarios and feature map locations than the existing zero-value bitmap encoding method.
[0095] In one implementation of the present application, the inverse DCT transform in the feature map restoration inverse transform stage can be integrated into the subsequent convolution kernel matrix as a one-dimensional linear transformation matrix, so that no additional related operations can be added to the inference model. Specifically, the compressed sparse feature map data is directly fed into the next convolution module, and at the same time, the one-dimensional inverse transform is directly integrated into the convolution matrix as a linear transformation.
[0096] Taking a slice of a channel as an example, decompress it using the zero-value bitmap to get Y freq-domain ∈R N*1*1 , A is a one-dimensional discrete cosine transform matrix, and the inverse DCT transform operation is Y reshape =A T Y freq-domain , assuming that the convolution kernel operation weight matrix Output Y out =BY reshape , because the one-dimensional discrete cosine transform matrix A is unchanged, we can let B * =BA T , when the training is completed, the convolution weights are saved, and then during inference, the decompression and convolution operations of the feature map are directly completed without adding additional operations.
[0097] The following table shows the feature map compression ratio and accuracy of this scheme in 8-bit fixed-point quantization compared with the advanced transform-based feature map compression method JPEG-ACT for completing image recognition tasks.
[0098] Model Type Accuracy / loss (%) Compression ratio (times) Original Model 95.08 1.0 JPEG-ACT -0.68 1.9 This solution (parameter I) -0.39 2.9 This solution (parameter II) -0.71 4.4
[0099] Parameters I and II are two sets of temporary parameters obtained through multiple experiments to improve compression rate and maintain accuracy for specific tasks. The parameter information includes the length of DCT transform and the different bandwidth data of low-pass filter M used in different fusion modules. In actual application, it is necessary to re-evaluate and set according to the goals, tasks and experimental results. As can be seen from the above table, the compression rate of the convolutional neural network feature map data compression method provided by this scheme is significantly better than that of JPEG-ACT.
[0100] The following is an apparatus embodiment provided by the present application, which is used to execute the above method embodiment. For details not disclosed in the apparatus embodiment, please refer to the above method embodiment.
[0101] The second embodiment of the present application discloses a convolutional neural network feature map data compression device, which is applied to the convolutional neural network feature map data compression method described in the first embodiment of the present application, see Figure 3The convolutional neural network feature map data compression device includes: a feature map channel reconstruction module 10 and a zero-value bit map encoding compression module 20.
[0102] The feature map channel reconstruction module is used to perform the following steps:
[0103] The channel dimension of the original feature map is changed from three-dimensional to two-dimensional to obtain a new feature map.
[0104] The preset one-dimensional discrete cosine transform matrix is matrix-multiplied with the tensor in the new feature map to obtain a frequency domain feature map.
[0105] The frequency domain feature map is low-pass filtered to obtain a sparse feature map.
[0106] The zero-value bitmap encoding compression module is used to perform the following steps:
[0107] The sparse feature map is obtained.
[0108] The sparse feature map is compressed by zero-value bitmap coding to obtain final compressed data of the original feature map, and the final compressed data of the original feature map will be stored in the off-chip memory of the hardware accelerator.
[0109] The zero-value bitmap coding compression module is a public dedicated hardware module as a hardware structure of the compression-transmission-decompression part. This structure is used in multiple feature map compression technologies or developed as its basis. Through the compression part of this module, the target encoding scheme can be completed for sparse data and stored in a format that is easy to transmit; when decompressing data, the designed data flow can support the efficient operation of sparse data hardware structure.
[0110] Furthermore, the device also includes: a zero-value bitmap decompression module 30 and a feature map restoration inverse transformation module 40.
[0111] The zero-value bitmap decompression module is used to perform the following steps:
[0112] The final compressed data of the original feature map in the off-chip memory of the hardware accelerator is read.
[0113] The final compressed data of the original feature map is decompressed using a zero-value bitmap to obtain the sparse feature map.
[0114] The feature map restoration inverse transformation module is used to perform the following steps:
[0115] The transposed matrix of the one-dimensional discrete cosine transform matrix is matrix-multiplied with the tensor in the sparse feature map to obtain a two-dimensional feature map.
[0116] The channel dimension of the two-dimensional feature map is converted into three dimensions to obtain restored data of the original feature map.
[0117] Figure 3 This is a schematic diagram of the structure of the convolutional neural network feature map data compression device disclosed in this embodiment. The device is completed in two parts in specific applications. First, the feature map channel reconstruction module and the feature map restoration inverse transformation module are added to the neural network training model to simulate the lossy compressed data changes, and at the same time, the purpose of training a model with a higher sparsity after the feature map is transformed by this scheme is achieved. Secondly, in the inference stage when the trained model is deployed to a low-power device, in addition to the feature map channel reconstruction module and the feature map restoration inverse transformation module, a zero-value bitmap encoding compression module and a zero-value bitmap decompression module are added to complete the deployment of the entire scheme at the inference end.
[0118] The third embodiment of the present application discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is processed and executed, the steps of the convolutional neural network feature map data compression method as described in the first embodiment of the present application are implemented.
[0119] The present application is described in detail above in conjunction with specific implementation methods and exemplary examples, but these descriptions cannot be understood as limiting the present application. Those skilled in the art understand that, without departing from the spirit and scope of the present application, a variety of equivalent replacements, modifications or improvements can be made to the technical solution of the present application and its implementation methods, all of which fall within the scope of the present application. The scope of protection of the present application shall be subject to the attached claims.
Claims
1. A convolutional neural network feature map data compression method, characterized in that: It includes a feature map channel reconstruction stage and a zero-value bitmap coding compression stage; Input the RAW grayscale file generated by the camera sensor and extract the original feature map from it; The feature map channel reconstruction stage includes the following steps: The channel dimension of the original feature map is changed from three-dimensional to two-dimensional to obtain a new feature map; Performing matrix multiplication of a preset one-dimensional discrete cosine transform matrix and the tensor in the new feature map to obtain a frequency domain feature map; Performing low-pass filtering on the frequency domain feature map to obtain a sparse feature map; The zero-value bitmap encoding compression stage comprises the following steps: Obtaining the sparse feature map; Performing zero-value bitmap encoding compression on the sparse feature map to obtain final compressed data of the original feature map, and the final compressed data of the original feature map will be stored in an off-chip memory of the hardware accelerator; It also includes a zero-value bitmap decompression stage and a feature map restoration inverse transformation stage; The zero-value bitmap decompression stage comprises the following steps: Reading the final compressed data of the original feature map in the off-chip memory of the hardware accelerator; Performing zero-value bitmap decompression on the final compressed data of the original feature map to obtain the sparse feature map; The feature map restoration inverse transformation stage comprises the following steps: Performing matrix multiplication of the transposed matrix of the one-dimensional discrete cosine transform matrix and the tensor in the sparse feature map to obtain a two-dimensional feature map; Convert the channel dimension of the two-dimensional feature map into three dimensions to obtain restored data of the original feature map; During the training process of the convolutional neural network, the feature map channel reconstruction phase and the feature map restoration inverse transformation phase are trained to reconstruct the network weights.
2. The convolutional neural network feature graph data compression method according to claim 1, characterized in that: The step of low-pass filtering the frequency domain feature map to obtain a sparse feature map includes: A preset frequency domain filter is used to perform a broadcast Hadamard product on the frequency domain feature map to implement low-pass filtering of the frequency domain feature map to obtain the sparse feature map.
3. The convolutional neural network feature graph data compression method according to claim 2, characterized in that: The one-dimensional discrete cosine transform matrix is a real orthogonal matrix, and the one-dimensional discrete cosine transform matrix satisfies the following conditions: Among them, A ij represents the element with coordinates [i, j] in the one-dimensional discrete cosine transform matrix, and N represents the size of the one-dimensional discrete cosine transform matrix.
4. The convolutional neural network feature map data compression method according to claim 2, characterized in that: The frequency domain filter satisfies the following conditions: Wherein, M represents the frequency domain filter, m represents the bandwidth of the frequency domain filter, and N represents the size of the one-dimensional discrete cosine transform matrix.
5. The convolutional neural network feature map data compression method according to claim 3 or 4, characterized in that: The value of N is 8.
6. A convolutional neural network feature map data compression device, characterized in that: The convolutional neural network feature map data compression device is applied to the convolutional neural network feature map data compression method according to any one of claims 1 to 5, and the convolutional neural network feature map data compression device comprises: a feature map channel reconstruction module and a zero-value bitmap encoding compression module; Input the RAW grayscale file generated by the camera sensor and extract the original feature map from it; The feature map channel reconstruction module is used to perform the following steps: The channel dimension of the original feature map is changed from three-dimensional to two-dimensional to obtain a new feature map; Performing matrix multiplication of a preset one-dimensional discrete cosine transform matrix and the tensor in the new feature map to obtain a frequency domain feature map; Performing low-pass filtering on the frequency domain feature map to obtain a sparse feature map; The zero-value bitmap encoding compression module is used to perform the following steps: Obtaining the sparse feature map; The sparse feature map is compressed by zero-value bitmap coding to obtain final compressed data of the original feature map, and the final compressed data of the original feature map will be stored in the off-chip memory of the hardware accelerator.
7. The convolutional neural network feature map data compression device according to claim 6, characterized in that: The device further comprises: a zero-value bitmap decompression module and a feature map restoration inverse transformation module; The zero-value bitmap decompression module is used to perform the following steps: Reading the final compressed data of the original feature map in the off-chip memory of the hardware accelerator; Performing zero-value bitmap decompression on the final compressed data of the original feature map to obtain the sparse feature map; The feature map restoration inverse transformation module is used to perform the following steps: Performing matrix multiplication of the transposed matrix of the one-dimensional discrete cosine transform matrix and the tensor in the sparse feature map to obtain a two-dimensional feature map; The channel dimension of the two-dimensional feature map is converted into three dimensions to obtain restored data of the original feature map.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is processed and executed, the steps of the convolutional neural network feature map data compression method as described in any one of claims 1 to 5 are implemented.
