Data processing method and device
By combining technical means of convolutional neural network, entropy coding and prediction models during the data compression process, the problem of low data compression efficiency in the existing technology is solved, and efficient and good-quality data compression effect is achieved.
Patent Information
- Application Number
- CN202411434036.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-14
- Publication Date
- 2025-02-07
AI Technical Summary
The prior art is difficult to improve data compression efficiency while ensuring data quality.
By inputting the data to be compressed into the convolutional neural network for feature extraction, entropy encoding processing, and inputting the results into the prediction model for prediction processing, and finally encoding and processing based on the residual information between the prediction results and the data to achieve the data Highly efficient compression.
While maintaining data quality, data compression efficiency is significantly improved. Compared with directly using entropy encoding or prediction models for compression, it can achieve higher efficiency at the same compression ratio.
Smart Images

Figure CN119402014A_ABST
Abstract
Description
Technical Field
[0001] This document relates to the field of data processing technology, and in particular to a data processing method and device. Background Art
[0002] With the rapid development of electronic technology and Internet technology, the amount of data transmitted in the network has exploded, bringing great challenges to data management. As a key data management method, data compression technology plays a vital role in reducing storage costs and increasing data transmission speed.
[0003] In practical applications, some of the data to be compressed has relatively high requirements on data quality. In order to ensure its data quality, it may be necessary to use a data compression method with relatively low data processing efficiency. Therefore, the issue of how to improve data compression efficiency has received great attention. Summary of the invention
[0004] An object of an embodiment of the present specification is to provide a data processing method and device to solve the problem of how to improve data compression efficiency.
[0005] To solve the above technical problems, an embodiment of this specification is implemented as follows: In a first aspect, an embodiment of the present specification provides a data processing method, including: Inputting the first data to be compressed into a convolutional neural network for feature extraction processing to obtain a first feature vector of the first data; Performing entropy coding on the first feature vector to obtain a second feature vector of the first data; Inputting the second feature vector into a prediction model for prediction processing to obtain a prediction result of the second feature vector; Encoding is performed according to residual information between the second eigenvector and the prediction result to obtain compressed first data.
[0006] In a second aspect, another embodiment of the present specification provides a data processing device, including: An extraction unit, used for inputting the first data to be compressed into a convolutional neural network for feature extraction processing to obtain a first feature vector of the first data; A first encoding unit, configured to perform entropy encoding processing on the first feature vector to obtain a second feature vector of the first data; A prediction unit, configured to input the second feature vector into a prediction model for prediction processing to obtain a prediction result of the second feature vector; The second encoding unit is used to perform encoding processing according to residual information between the second eigenvector and the prediction result to obtain compressed first data.
[0007] In a third aspect, another embodiment of the present specification provides an electronic device, comprising: a memory, a processor, and computer executable instructions stored in the memory and executable on the processor, wherein the computer executable instructions, when executed by the processor, implement the steps of the data processing method as described in the first aspect above.
[0008] In a fourth aspect, another embodiment of the present specification provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store computer-executable instructions, and when the computer-executable instructions are executed by a processor, the steps of the data processing method described in the first aspect above are implemented.
[0009] In one embodiment of the present specification, first, the first data to be compressed is input into a convolutional neural network for feature extraction processing to obtain a first feature vector of the first data; then, the first feature vector is entropy encoded to obtain a second feature vector of the first data; then, the second feature vector is input into a prediction model for prediction processing to obtain a prediction result of the second feature vector; finally, the residual information between the second feature vector and the prediction result is encoded to obtain the compressed first data. Through the data processing method provided by this embodiment, feature extraction through a convolutional neural network is conducive to reducing the amount of data to be processed in subsequent encoding steps while retaining the important features of the first data. The entropy encoding technology can achieve data compression and retain important information in the process of encoding the first feature vector into the second feature vector. And, by inputting the second feature vector into the prediction model for prediction processing and encoding according to the residual information between the second feature vector and the prediction result, the second feature vector can be further compressed. In this way, in the entire data processing process, when the same compression ratio is achieved, the data compression efficiency can be significantly improved compared with directly using entropy coding for data compression or directly using prediction for data compression. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in one or more embodiments of the present specification, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0011] Figure 1 A flowchart of a data processing method provided by an embodiment of this specification; Figure 2A data processing flow of a convolutional neural network used in a data processing method provided in one embodiment of this specification; Figure 3A An example diagram of a standard convolution operation in a data processing method provided in one embodiment of this specification; Figure 3B An example diagram of a spatially separable convolution operation in a data processing method provided in one embodiment of this specification; Figure 4A An example diagram of an average pooling operation in a data processing method provided in one embodiment of this specification; Figure 4B An example diagram of a maximum pooling operation in a data processing method provided in one embodiment of this specification; Figure 5 Another flowchart of a data processing method provided by an embodiment of this specification; Figure 6 A schematic diagram of the module composition of a data processing device provided in one embodiment of this specification; Figure 7 A schematic diagram of the structure of an electronic device provided in one embodiment of this specification. DETAILED DESCRIPTION
[0012] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the following will be combined with the drawings in one or more embodiments of this specification to clearly and completely describe the technical solutions in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.
[0013] Figure 1 A flowchart of a data processing method provided by an embodiment of this specification.
[0014] The data processing method provided in this embodiment can be applied to a computer, a mobile terminal, or other electronic devices not listed one by one, etc. The following description will be made by taking the mobile terminal as an example of the execution subject of the data processing method. Other electronic devices are similar to the mobile terminal and will not be described in detail.
[0015] Step S102: input the first data to be compressed into a convolutional neural network for feature extraction processing to obtain a first feature vector of the first data.
[0016] In this specification, ordinal numbers such as first and second are used to distinguish different technical features and have no actual meaning, so they will not be elaborated below.
[0017] The first data may be any data that requires data compression.
[0018] The first data may be multimedia data, which refers to data containing one or more media forms, including but not limited to text, image, audio, video, etc. These data forms may exist alone or be combined together to form a rich information expression method.
[0019] For example, the first data includes one or more of the following: text data, image data, audio data, video data, and the like.
[0020] For another example, the first data may be program code.
[0021] Program code is a type of text data. Program code is a set of instructions written in a programming language. These instructions are expressed in text form and usually include elements such as keywords, variables, functions, operators, and comments. The text nature of program code allows it to be read and processed by software tools such as editors, compilers, and interpreters. In the context of data compression, program code can be regarded as a special type of text data. Since program code may contain redundant information such as repeated code blocks, comments, and blank characters, data compression technology can be used to reduce its storage space.
[0022] Before executing step S102, some preprocessing operations may be performed on the original data including the first data to remove redundant information, normalize, crop, denoise, etc., and convert the data into a format suitable for deep learning model processing.
[0023] Preprocessing operations include but are not limited to the following steps: (a1) Remove redundant information, analyze the original data structure, identify and remove irrelevant variables or duplicate data. For example, for image data, all transparent pixels or duplicate frames can be removed.
[0024] (a2) Normalization, converting the data to a uniform range (e.g., between 0 and 1) to fit the deep learning model. This can be achieved by linear transformation.
[0025] For example, when processing image data, the offline cosine transform may be implemented by the FDCT (Forward Discrete Cosine Transform) formula shown below: (1) in, is an element in the frequency coefficient matrix. is the pixel value in the image block. and is the normalization coefficient. The definition is as follows: (2) The definition is as follows: (3) The above definition can be understood as In the case of The value of is ,otherwise, The value of is 1; In the case of The value of is ,otherwise, The value of is 1.
[0026] The basic principle of FDCT is to convert an NxN image block into an NxN frequency coefficient matrix. FDCT calculates the product of each pixel value in the image block and a set of cosine functions to generate a set of frequency coefficients that represent the energy distribution of the image block at different frequencies. N can be an integer greater than 1.
[0027] (a3) Cropping: cropping data according to specific requirements to remove edges or irrelevant parts. Taking the first data as image data as an example, before processing the image data using the data processing method provided in the embodiments of this specification, the image data may be cropped into blocks of fixed size.
[0028] (a4) Denoising: Apply denoising techniques, such as Gaussian filtering, mean filtering or convolutional neural network autoencoder, to reduce the impact of noise in the data and improve data quality.
[0029] (a5) Format conversion: converting data into tensors or feature vectors, usually formatted using tools provided in the deep learning framework so that subsequent deep learning models can directly process them.
[0030] After the preprocessing is completed, the preprocessed first data may be applied to step S102, and the important features in the preprocessed first data may be extracted using deep learning technology to construct a feature vector.
[0031] CNN (Convolutional Neural Network) is a deep learning model suitable for processing data with grid structure.
[0032] It should be noted that the processing flow of the convolutional neural network on input data adopted in one or more embodiments of this specification is reversible, that is, the first feature vector of the first data can be extracted from the first data through the convolutional neural network, and the first feature vector can theoretically be restored to the first data.
[0033] A convolutional neural network can include the following structures: convolutional layer, pooling layer, and fully connected layer.
[0034] The convolution layer extracts the features of the input data through convolution operations. The convolution operation uses a set of small matrices called filters (or convolution kernels) to slide over the input data and perform dot product operations to generate feature maps. Each filter can capture specific features in the input data, such as edges, textures, etc.
[0035] The pooling layer is used to reduce the dimension of the feature map, reduce the amount of computation, and enhance the translation invariance of the model.
[0036] After the convolution and pooling layers, one or more fully connected layers are usually connected to map the extracted features to the final output categories or values. Each neuron in the fully connected layer is connected to all neurons in the previous layer.
[0037] The first feature vector may be a data feature extracted from the first data through a convolutional neural network, and the data feature is represented in a vector form.
[0038] A convolutional neural network can include multiple convolutional layers, where each convolutional layer can adopt a pyramid structure, such as FPN (Feature Pyramid Network) to capture multi-scale features. Feature fusion can be achieved by connecting feature maps at different levels using upsampling and downsampling operations.
[0039] FPN is a deep learning architecture for object detection and semantic segmentation, which aims to solve the problem of multi-scale object detection. FPN builds a multi-scale feature pyramid, which enables the model to detect objects at different scales, thereby improving the accuracy and robustness of detection.
[0040] Convolutional neural networks can also include activation functions. Activation functions are a key component in neural networks that are used to introduce nonlinear characteristics, allowing neural networks to learn and represent complex nonlinear relationships. Activation functions are usually applied to each neuron of a neural network, introducing nonlinear transformations between the input and output of the neuron.
[0041] For example, applying a ReLU activation function after each layer in a convolutional neural network can introduce nonlinear changes.
[0042] In addition, the convolutional neural network can be trained using labeled datasets to adjust the hyperparameters of the convolutional neural network, such as learning rate, batch size, etc., to optimize the performance of the convolutional neural network.
[0043] The following can be combined Figure 2 The specific implementation process of inputting the first data to be compressed into a convolutional neural network for feature extraction processing to obtain a first feature vector of the first data is exemplified.
[0044] Figure 2 The data processing flow of the convolutional neural network used in the data processing method provided in one embodiment of this specification. Figure 2 A multi-layer convolutional neural network is shown as an example.
[0045] In one embodiment of the present specification, the first data to be compressed can be input as follows: Figure 2 The multi-layer convolutional neural network shown in FIG. performs feature extraction processing to obtain a first feature vector of the first data. The first data to be compressed may be a face image, that is, Figure 2 The face image 202 in FIG.
[0046] like Figure 2 As shown, the multi-layer convolutional neural network includes a convolutional layer 1, a pooling layer, a convolutional layer 2, a convolutional layer 3, and a fully connected layer 212 which are connected in series in sequence.
[0047] In the process of inputting the first data to be compressed into the multi-layer convolutional neural network for feature extraction processing to obtain the first feature vector of the first data, the following steps (b1) to (b5) are performed: (b1) The face image 202 is input into the convolution layer 1, and the convolution layer 1 performs convolution processing on the face image 202 to obtain a feature map 204.
[0048] For example, the size information of the feature map 204 can be represented by 20@24x24, where the "20" before the "@" means that the number of channels of the feature map 204 is 20, and the "24x24" after the "@" means that the width and height of the feature map 204 are 24, respectively.
[0049] Here is a brief introduction to the definition of size information: Width refers to the number of pixels in the feature map in the horizontal direction. Width can be used to indicate the resolution of the feature map in the horizontal direction. Height refers to the number of pixels in the feature map in the vertical direction. Height can be used to indicate the resolution of the feature map in the vertical direction. The number of channels is used to indicate the number of filters (convolution kernels) in the convolution layer. Each filter generates a feature map, so the number of channels is equal to the number of filters. The number of channels is also called the depth of the feature map or the number of feature maps.
[0050] (b2) The feature map 204 is input into the pooling layer, and the feature map 204 is pooled by the pooling layer to obtain the feature map 206.
[0051] The pooling layer may be a spatial pooling layer (Spatial_Pooling).
[0052] For example, the size information of the feature map 206 can be represented by 20@12x12, where the "20" before the "@" means that the number of channels of the feature map 206 is 20, and the "12x12" after the "@" means that the width and height of the feature map 206 are 12 respectively.
[0053] (b3) The feature map 206 is input into the convolution layer 2, and the feature map 206 is convolved by the convolution layer 2 to obtain the feature map 208.
[0054] For example, the size information of the feature map 208 can be represented by 50@8x8, where the "50" before the "@" means that the number of channels of the feature map 208 is 50, and the "8x8" after the "@" means that the width and height of the feature map 208 are 8, respectively.
[0055] (b4) The feature map 208 is input into the convolution layer 3, and the feature map 208 is pooled by the convolution layer 3 to obtain the feature map 210.
[0056] For example, the size information of the feature map 210 can be represented by 50@4x4, where the "50" before the "@" means that the number of channels of the feature map 210 is 50, and the "4x4" after the "@" means that the width and height of the feature map 210 are 4, respectively.
[0057] It should be noted that pooling can be understood as feature dimensionality reduction. Specifically, the feature map can be reduced through pooling. By pre-configuring the model parameters of the convolution layer, the convolution layer can have the ability to reduce the feature map. Therefore, the convolution layer 3 can be used to perform pooling processing on the feature map 208 to obtain the feature map 210.
[0058] (b5) The feature map 210 is input into the fully connected layer 212 , and the feature map 210 is mapped by the fully connected layer 212 to obtain a first feature vector 214 of the face image 202 .
[0059] In summary, if Figure 2 The input data of the multi-layer convolutional neural network shown is the face image 202, and the output data of the multi-layer convolutional neural network is the first feature vector 214 of the face image 202. For other first data to be compressed that are not listed, reference can be made to the corresponding description of the feature extraction process of the face image 202.
[0060] In a specific implementation, the convolutional neural network includes a separable convolutional layer and an adaptive pooling layer; the first data to be compressed is input into the convolutional neural network for feature extraction processing to obtain a first feature vector of the first data, including: inputting the first data into the separable convolutional layer for deep convolution processing to obtain first intermediate data, and performing point-by-point convolution processing on the first intermediate data to obtain second intermediate data; inputting the second intermediate data into the adaptive pooling layer for pooling processing to obtain the first feature vector.
[0061] The separable convolution layer can be used to perform a depth-wise separable convolution operation on the input data, or it can be used to perform a spatially separable convolution operation on the input data.
[0062] The depthwise separable convolution operation can be viewed as decomposing the standard convolution operation into two steps: depthwise convolution and pointwise convolution.
[0063] Among them, the depth convolution performs convolution operations on each channel of the input feature map separately, and each channel uses a separate convolution kernel. This means that the number of convolution kernels is equal to the number of channels of the input feature map. The number of channels of the output feature map of the depth convolution is the same as the number of channels of the input feature map.
[0064] Point-wise convolution uses a 1x1 convolution kernel to perform a convolution operation on the output feature map of the depthwise convolution. The purpose of point-wise convolution is to map the number of channels of the output feature map of the depthwise convolution to the required number of output channels. The number of convolution kernels of point-wise convolution is equal to the required number of output channels.
[0065] The first data is input into a separable convolution layer for depth convolution processing to obtain first intermediate data, and the first intermediate data is subjected to point-by-point convolution processing to obtain second intermediate data.
[0066] Intermediate data refers to temporary data generated during data processing, calculation or analysis, which is used and processed before the final result is generated. Intermediate data is usually the output of the intermediate steps in the calculation process, which is used for further processing or analysis until the final result is generated.
[0067] Specifically in this implementation, the first intermediate data and the second intermediate data are two different intermediate data generated in the process of inputting the first data to be compressed into the convolutional neural network for feature extraction processing to obtain the first feature vector of the first data, wherein the first intermediate data is obtained by performing deep convolution processing on the first data through a separable convolution layer, and the second intermediate data is obtained by performing point-by-point convolution processing on the first intermediate data through a separable convolution layer.
[0068] The spatially separable convolution operation can be viewed as decomposing a standard convolution kernel into two smaller convolution kernels and then performing the convolution operation through the two smaller convolution kernels in sequence. For example, a 3x3 convolution kernel can be decomposed into a 3x1 convolution kernel and a 1x3 convolution kernel.
[0069] In this implementation, the following steps can be used to replace "inputting the first data into a separable convolution layer for deep convolution processing to obtain first intermediate data, and performing point-by-point convolution processing on the first intermediate data to obtain second intermediate data": inputting the first data into a separable convolution layer to perform convolution processing on the first data through a first convolution kernel to obtain first intermediate data, and performing convolution processing on the first intermediate data through a second convolution kernel to obtain second intermediate data.
[0070] Spatially separable convolution operations can be combined Figure 3A and Figure 3B An exemplary description is given. Figure 3A An example diagram of a standard convolution operation in a data processing method provided in one embodiment of this specification; Figure 3B An example diagram of a spatially separable convolution operation in a data processing method provided in one embodiment of the present specification.
[0071] like Figure 3A As shown, in the process of inputting the first data 302 into the convolution layer for convolution processing to obtain the second intermediate data 304, a 3x3 convolution kernel is used to perform the convolution operation.
[0072] For example, the 3x3 convolution kernel can be represented by the following matrix: .
[0073] like Figure 3B As shown, the first data 302 is input into the separable convolution layer, and a convolution operation is performed using a 3x1 convolution kernel to obtain first intermediate data 306, and a convolution operation is performed using a 1x3 convolution kernel to obtain second intermediate data 304.
[0074] Among them, the 3x1 convolution kernel is the first convolution kernel decomposed from the 3x3 convolution kernel, and the 1x3 convolution kernel is the second convolution kernel decomposed from the 3x3 convolution kernel.
[0075] For example, the 3x1 convolution kernel can be represented by the following matrix: , the 1x3 convolution kernel can be represented by the following matrix: .
[0076] Using a separable convolutional layer to replace the standard convolutional layer is more conducive to reducing the number of parameters and computational cost, thereby improving the data processing efficiency of extracting features from the first data.
[0077] After the second intermediate data is obtained, the second intermediate data may be input into an adaptive pooling layer for pooling processing to obtain a first feature vector.
[0078] The adaptive pooling layer is a special pooling layer that allows the user to specify the size of the output feature map without manually setting the size and stride of the pooling window. The adaptive pooling layer automatically adjusts the size and stride of the pooling window according to the size of the input feature map to ensure that the size of the output feature map meets the user-specified requirements.
[0079] Pooling can be done by using either maximum pooling or average pooling.
[0080] Max pooling is a nonlinear downsampling method that selects the maximum value in the pooling window as the output. Specifically, in the process of performing the max pooling process, a fixed-size pooling window can be defined, for example, a 2x2 pooling window, which slides on the feature map; in each pooling window, the maximum value in the window is selected as the output; the maximum values of all pooling windows are combined into a new feature map, and the width and height of the feature map are the width and height of the original feature map divided by the size of the pooling window.
[0081] By inputting the second intermediate data into the adaptive pooling layer for maximum pooling processing to obtain the first feature vector, the pooling window size can be automatically adjusted to adapt to the size of the input feature content, ensuring that the size of the output feature map is consistent, which is convenient for subsequent processing.
[0082] For example, select the pixel with the largest value from a certain area sub-block of the input feature map as the maximum pooling result. Take the maximum value of the pixels in the area covered by the pooling window to get the pixel value of the output feature map. When the pooling window slides on the image, the entire output feature map will be obtained.
[0083] Average pooling is a nonlinear downsampling method that calculates the average value within a pooling window as output. Specifically, in the process of performing average pooling, a fixed-size pooling window can be defined, for example, a 2x2 pooling window, which slides on the feature map; in each pooling window, the average value of all values in the window is calculated as output; the average values of all pooling windows are combined into a new feature map, and the width and height of the feature map are the width and height of the original feature map divided by the size of the pooling window.
[0084] Figure 4A An example diagram of an average pooling operation in a data processing method provided in one embodiment of this specification; Figure 4B An example diagram of a maximum pooling operation in a data processing method provided in one embodiment of this specification.
[0085] like Figure 4AAs shown, a 2x2 pooling window is defined and slides on the feature map.
[0086] In each pooling window, the average of all values in the window is calculated as the output. For example, the pooling window includes 1, 2, 5, and 6, and the average of 1, 2, 5, and 6 is calculated to get 3.5; the pooling window includes 3, 4, 7, and 8, and the average of 3, 4, 7, and 8 is calculated to get 5.5; the pooling window includes 9, 10, 13, and 14, and the average of 9, 10, 13, and 14 is calculated to get 11.5; the pooling window includes 11, 12, 15, and 16, and the average of 11, 12, 15, and 16 is calculated to get 13.5.
[0087] Combine the average values of all pooling windows into a new feature map consisting of: 3.5, 5.5, 11.5, 13.5.
[0088] like Figure 4B As shown, a 2x2 pooling window is defined and slides on the feature map.
[0089] In each pooling window, the maximum value in the window is selected as the output. For example, the pooling windows include 1, 2, 5, and 6, and the maximum value 6 in the window is selected; the pooling windows include 3, 4, 7, and 8, and the maximum value 8 in the window is selected; the pooling windows include 9, 10, 13, and 14, and the maximum value 14 in the window is selected; the pooling windows include 11, 12, 15, and 16, and the maximum value 16 in the window is selected.
[0090] Combine the maximum values of all pooling windows into a new feature map, which includes: 6, 8, 14, 16.
[0091] The convolutional neural network may also include a fully connected layer. In some implementations, the fully connected layer can also be replaced by a global average pooling layer to reduce model parameters and reduce the risk of overfitting.
[0092] In a specific implementation, the feature extraction process includes: performing convolution processing on the first data to obtain third intermediate data; performing residual calculation processing based on the first data and the third intermediate data to obtain a first feature vector.
[0093] A convolutional neural network can include one or more residual blocks.
[0094] Exemplarily, each residual block contains two convolutional layers and one residual connection.
[0095] The residual block is the basic building block in deep residual networks. By introducing residual connections, the input is directly added to the output of the network to form a residual map.
[0096] Taking a convolutional neural network including a convolution layer and a residual block as an example, the process of feature extraction processing is exemplified as follows: the first data is convolved through the convolution layer to obtain third intermediate data; the residual calculation is performed based on the first data and the third intermediate data through the residual block to obtain a first feature vector.
[0097] The input of the convolution layer is the first data, and the output of the convolution layer is the third intermediate data. The input of the convolution layer can be directly added to the output of the convolution layer through the residual connection in the residual block to form a residual map. In addition, considering that the size information of the input and the output must match in order to add the input of the convolution layer to the output of the convolution layer, the first data can be convolved through one or more convolution layers in the residual block to change the size information of the first data. In this way, the size information of the third intermediate data can match the size information of the first data after the convolution process.
[0098] In a convolutional neural network, the number of convolutional layers can be one or more, and the number of residual blocks can be one or more. Reference can be made to the example in which the convolutional neural network includes one convolutional layer and one residual block.
[0099] Configuring a residual block in a convolutional neural network and using the residual block to add the input of the convolutional layer to the output of the convolutional layer has the following advantages: through the residual connection, the residual block enables the gradient to be directly propagated to the previous layer, thereby alleviating the gradient vanishing problem and enabling the network to train deeper layers; the residual block introduces residual mapping, which simplifies the network optimization process. Residual mapping makes it easier for the network to learn the identity mapping, making it easier to optimize; the residual block enables the network to train deeper layers, which is beneficial to improving model performance.
[0100] In a specific implementation, before the first data to be compressed is input into a convolutional neural network for feature extraction processing to obtain a first feature vector of the first data, the method also includes: obtaining a first file to be compressed; dividing the first file to obtain multiple first data; and assigning a thread to each of the multiple first data in multiple parallel threads.
[0101] The first file may be any file that has a data compression requirement. The first file may be divided into a plurality of first data.
[0102] In the process of dividing the first file to obtain a plurality of first data, an average division method may be adopted, or the division may be performed according to the structural information of the file, or any self-configured division method may be adopted.
[0103] For example, the first file is a text file with a capacity of C. By dividing the text file, N first data can be obtained. Among the N first data, each first data has the same capacity and each first data is a text data with a capacity of c, and the sum of the capacities of the N text data (N*c) is equal to the capacity C of the text file. Wherein, N is an integer greater than 1, C and c are both positive real numbers, and c is less than C.
[0104] For another example, the first file is a video file with a capacity of D. By dividing the video file, N first data can be obtained. Among the N first data, the first first data is a video data with a capacity of d1, the second first data is a video data with a capacity of d2, ..., the Nth first data is a video data with a capacity of dN, and the sum of the capacities of the N video data (d1+d2+...+dN) is equal to the capacity D of the video file. Wherein, N is an integer greater than 1, D, d1, d2, ..., dN are all positive real numbers, any two of d1, d2, ..., dN may be the same or different, and any one of d1, d2, ..., dN is less than D.
[0105] In the multiple parallel threads, one thread is allocated to each of the multiple first data. Furthermore, each thread independently processes the allocated first data through the data processing method provided in the embodiments of this specification.
[0106] That is, in the process of executing the data processing method provided in the embodiments of this specification, a parallel processing mechanism can be used to divide the first file into multiple first data and process them in parallel on different threads. The use of a parallel processing mechanism is conducive to improving the speed of compression and decompression.
[0107] In some implementations, GPU (Graphics Processing Unit) acceleration can also be used. GPU is a hardware device specially designed for processing graphics and image-related calculations. Compared with CPU (Central Processing Unit), GPU has more processing cores and higher parallel computing capabilities, and is particularly suitable for processing large-scale parallel computing tasks, such as graphics rendering, scientific computing, and deep learning. Using GPU for convolutional neural network training and reasoning is conducive to speeding up feature extraction.
[0108] In some implementations, distributed computing can also be used to achieve data distribution and parallel processing on a cluster, dynamically allocate tasks according to network load, and improve the overall compression and decompression speed.
[0109] Step S104: perform entropy coding on the first eigenvector to obtain a second eigenvector of the first data.
[0110] Entropy coding is a lossless data compression technology used to reduce redundant information in data, thereby achieving data compression. Entropy coding encodes data into shorter bit sequences based on the statistical characteristics of the data, so that the encoded data has a lower average bit rate.
[0111] The basic principle of entropy coding is to assign an optimal bit sequence to each symbol based on the statistical characteristics of the data, so that the encoded data has the minimum average bit rate. The core idea of entropy coding is to use the probability distribution of symbol occurrence to assign shorter bit sequences to symbols with high probability of occurrence and longer bit sequences to symbols with low probability of occurrence.
[0112] Specifically in one or more embodiments of the present specification, in the process of performing entropy coding on the first eigenvector to obtain the second eigenvector of the first data, Huffman coding or arithmetic coding may be used.
[0113] Huffman coding is a variable-length coding method based on the probability of symbol occurrence. Huffman coding assigns a unique bit sequence to each symbol by constructing a Huffman tree. Symbols with high probability of occurrence are assigned shorter bit sequences, and symbols with low probability of occurrence are assigned longer bit sequences.
[0114] Arithmetic coding is a continuous coding method based on the probability of symbol occurrence. Arithmetic coding generates a unique real number code by mapping the symbol sequence to a real number interval. The length of the bit sequence of arithmetic coding can be dynamically adjusted according to the probability distribution of the symbol sequence, thereby achieving higher compression efficiency.
[0115] Compared with directly entropy encoding the first data, as shown in one or more embodiments of the present specification, the first data is firstly feature extracted through a convolutional neural network, and then the first feature vector extracted from the first data is entropy encoded, which is more conducive to speeding up data compression.
[0116] In a specific implementation, entropy coding is performed on a first feature vector to obtain a second feature vector of the first data, including: determining a first element in the first feature vector; calculating the frequency of occurrence of the first element in the first feature vector to obtain frequency information of the first element; constructing a multi-branch tree based on the frequency information of the first element; performing coding allocation processing on each node in the multi-branch tree to obtain coding information of the multi-branch tree; and generating a second feature vector based on the coding information of the multi-branch tree.
[0117] The first feature vector may include multiple elements, each of which may be used to represent the value of the first data on a specific feature. If the value of an element in the first feature vector is unique, the element may be regarded as a first element; if the first feature vector includes multiple elements with the same value, the multiple elements with the same value may be regarded as the same first element.
[0118] For example, the first eigenvector includes the following elements: x1, x2, x3, x2, x4, x2, x3, etc. It can be determined that the first element in the first eigenvector includes: x1, x2, x3, x4, and so on.
[0119] Calculating the frequency of the first element in the first eigenvector to obtain the frequency information of the first element may be performed by counting the number of elements in the first eigenvector to obtain a first number, counting the number of times the first element appears in the first eigenvector to obtain a second number, calculating the ratio of the second number to the first number, and using the ratio as the frequency information of the first element.
[0120] The frequency information of the first element can be used to construct a Huffman tree. A Huffman tree, also known as an optimal binary tree, is a tree structure used for data compression. The Huffman tree constructs an optimal binary tree to assign a unique binary code to each symbol, so that symbols with high frequency have shorter codes and symbols with low frequency have longer codes, thereby achieving lossless compression of data.
[0121] Specifically in this implementation, the Huffman tree with a binary tree structure can be changed into a Huffman tree with a multi-tree structure, that is, a multi-tree is constructed according to the frequency information of the first element. By optimizing the construction process of the Huffman tree and adjusting the structure of the Huffman tree, the height of the Huffman tree can be reduced, which is conducive to improving coding efficiency and reducing coding length.
[0122] In addition, the Huffman tree can be dynamically updated during the encoding process to adapt to changes in data distribution.
[0123] Step S106: input the second feature vector into the prediction model for prediction processing to obtain a prediction result of the second feature vector.
[0124] The second feature vector is input into the prediction model for time series prediction to obtain the prediction result of the second feature vector. Through time series prediction, the mutual relationship between the local features of the first data can be captured.
[0125] Exemplarily, the prediction model may be a model such as LSTM (Long Short-Term Memory) or GRU (Gated Recurrent Unit), or any other unlisted model with time series prediction capability.
[0126] In the process of inputting the second eigenvector into the prediction model for prediction processing to obtain the prediction result of the second eigenvector, the following steps may also be performed: the second eigenvector is evaluated, and when the evaluation result of the second eigenvector satisfies the preset evaluation condition, the second eigenvector is input into the prediction model for prediction processing to obtain the prediction result of the second eigenvector. The purpose of evaluating the second eigenvector is to determine whether the compression degree and / or compression quality of the second eigenvector obtained after processing the first data through the aforementioned steps S102 and S104 meets the expectations. If the expectations are met, it can be determined not to compress anymore, or the data can be further compressed through the prediction model. If the expectations are not met, other compression methods can be switched.
[0127] The evaluation process for the second feature vector may be to compare the size information of the second feature vector with a preset size threshold, and determine the evaluation result of the second feature vector according to the comparison result.
[0128] For example, the size information of the first data is X1, the size information of the second eigenvector is X2, the first preset size threshold is X3, and the second preset size threshold is X4. If X2 is less than X3, it means that the size of the second eigenvector is small enough and no further compression is needed. The second eigenvector can be used as the compressed first data; if X2 is greater than or equal to X3 and X2 is less than X4, it means that the compression degree of the second eigenvector obtained after processing the first data through the aforementioned steps S102 and S104 is relatively satisfactory, but the second eigenvector can be further compressed by executing steps S106 and S108; if X2 is greater than or equal to X4, it means that the compression degree of the second eigenvector obtained after processing the first data through the aforementioned steps S102 and S104 does not meet expectations, and even further compression cannot ultimately meet the compression target of the first data, and other compression methods can be switched.
[0129] The second eigenvector may be evaluated or restored to obtain restored data, and the restored data may be compared with the first data to determine the evaluation result of the second eigenvector based on the comparison result.
[0130] For example, data restoration is performed on the second eigenvector of the first data to obtain restored data, the similarity between the restored data and the first data is calculated, and the similarity is compared with a preset similarity threshold. If the similarity is greater than the preset similarity threshold, it can be determined that the compression quality of the second eigenvector obtained after processing the first data through the aforementioned steps S102 and S104 meets the expectations, and data compression can be further performed.
[0131] In a specific implementation, the second feature vector includes N second elements; the prediction result of the second feature vector includes the prediction result of each second element in the N second elements; the prediction processing includes: performing prediction processing according to a preset null value to obtain the prediction result of the first second element in the N second elements; performing prediction processing according to the first i second elements in the N second elements to obtain the prediction result of the i+1th element in the N second elements; i is an integer greater than 0.
[0132] In this implementation, N may be an integer greater than 0. The second feature vector may include N second elements, and each second element may be used to represent a value of the first data on a specific feature.
[0133] It should be emphasized that there is a clear difference between the second element and the first element. When the second eigenvector includes multiple elements with the same value, each of the multiple elements with the same value is regarded as a second element, rather than multiple elements with the same value being regarded as the same second element.
[0134] The preset empty value can be the initial value of a custom configuration.
[0135] Prediction processing is performed based on a preset null value to obtain a prediction result of the first second element among N second elements; prediction processing is performed based on the first second element among N second elements to obtain a prediction result of the second second element among N second elements; prediction processing is performed based on the first two second elements among N second elements to obtain a prediction result of the third second element among N second elements; prediction processing is performed based on the first three second elements among N second elements to obtain a prediction result of the fourth second element among N second elements; ...; prediction processing is performed based on the first (N-1) second elements among N second elements to obtain a prediction result of the Nth second element among N second elements.
[0136] Step S108: performing encoding processing according to residual information between the second eigenvector and the prediction result to obtain compressed first data.
[0137] The residual information between the second eigenvector and the prediction result is encoded to obtain the compressed first data. The residual information between the second eigenvector and the prediction result can be determined based on the second eigenvector and the prediction result, and the residual information is encoded to obtain the compressed first data.
[0138] Taking the second eigenvector including N second elements as an example, the prediction result of the second eigenvector may include the prediction result of each second element in the N second elements, and the residual information of the i-th second element may be determined according to the prediction results of the i-th second element and the i-th second element in the N second elements. By encoding the residual information of each second element in the N second elements, the compressed first data may be obtained.
[0139] Encoding is performed based on residual information between the second eigenvector and the prediction result to obtain compressed first data. Encoding can also be performed based on residual information between the second eigenvector and the prediction result to obtain fourth intermediate data, and the capacity of the fourth intermediate data is compared with a preset capacity threshold: if the capacity of the fourth intermediate data is less than or equal to the preset capacity threshold, the fourth intermediate data is determined to be the compressed first data; if the capacity of the fourth intermediate data is greater than the preset capacity threshold, the fourth intermediate data is further compressed using other pre-customized candidate compression methods to obtain the compressed first data.
[0140] By executing step S106 and step S108, adaptive predictive coding can be performed on the second feature vector of the first data, and the second feature vector can be further compressed by the adaptive predictive coding technology.
[0141] In a specific implementation, after the second eigenvector is input into the prediction model for prediction processing and the prediction result of the second eigenvector is obtained, the data processing method further includes: generating a training loss of the prediction model according to the second eigenvector and the prediction result, and adjusting the model parameters of the prediction model according to the training loss.
[0142] Taking the example that the second eigenvector includes N second elements, the prediction result of the second eigenvector may include the prediction result of each second element among the N second elements. According to the prediction results of the i-th second element and the i-th second element among the N second elements, the training loss of the prediction model can be generated, and the training loss can be used to adjust the model parameters of the prediction model.
[0143] In the process of executing the data processing method provided by one or more embodiments of the present specification, the prediction model can be dynamically updated according to the changes in the input stream. In this way, the more data the prediction model processes, the more accurate the prediction will be, which is beneficial to improving the accuracy of the encoding. A more accurate prediction will reduce the value of the residual information between the second eigenvector and the prediction result, which is more conducive to reducing the capacity of the compressed first data.
[0144] In such Figure 1 In the embodiment shown, first, the first data to be compressed is input into the convolutional neural network for feature extraction processing to obtain the first feature vector of the first data; then, the first feature vector is entropy encoded to obtain the second feature vector of the first data; then, the second feature vector is input into the prediction model for prediction processing to obtain the prediction result of the second feature vector; finally, the residual information between the second feature vector and the prediction result is encoded to obtain the compressed first data. Through the data processing method provided by this embodiment, feature extraction through the convolutional neural network is conducive to reducing the amount of data to be processed in the subsequent encoding step while retaining the important features of the first data. The entropy encoding technology can make it possible to achieve data compression and retain important information in the process of encoding the first feature vector into the second feature vector. And, by inputting the second feature vector into the prediction model for prediction processing and encoding according to the residual information between the second feature vector and the prediction result, the second feature vector can be further compressed. In this way, in the entire data processing process, under the condition of achieving the same compression ratio, compared with directly using entropy coding for data compression or directly using prediction for data compression, the data compression efficiency can be significantly improved.
[0145] Figure 5 Another flowchart of a data processing method provided by an embodiment of this specification.
[0146] like Figure 5 As shown, the data processing method may include three stages: a preprocessing stage, a first compression stage, and a second compression stage.
[0147] The preprocessing stage includes: step S502 to step S516.
[0148] In the first compression stage, it includes: step S518-step S522; In the second compression stage, it includes: step S524-step S528.
[0149] Specifically, in the preprocessing stage: Step S502, file reading.
[0150] Step S504: file segmentation. Quantization Step S506, removing redundancy.
[0151] Step S508, normalization.
[0152] Step S510, cropping.
[0153] Step S512: forward discrete cosine transform.
[0154] Step S514, quantization.
[0155] Step S516, coefficient encoding.
[0156] Specifically, in the first compression stage: Step S518, model construction.
[0157] A convolutional neural network is constructed, where the convolutional neural network is used to extract a first eigenvector of the first data from the first data, and the data processing flow of the convolutional neural network is reversible, that is, the first eigenvector can be restored to the first data.
[0158] Step S520: feature extraction.
[0159] For this step, reference may be made to the corresponding description of the aforementioned step S102.
[0160] Step S522, constructing feature vector.
[0161] For this step, reference may be made to the corresponding description of the aforementioned step S104.
[0162] Specifically, in the second compression stage: Step S524: adaptive coding prediction.
[0163] This step may refer to the corresponding description of the aforementioned steps S106 to S108.
[0164] Step S526, quantization table.
[0165] Step S528, code table.
[0166] Since the technical concept is the same, the description of this embodiment is relatively simple, and reference may be made to the corresponding description part of the aforementioned method embodiment.
[0167] Figure 6 The following is a schematic diagram of the module composition of a data processing device provided in one embodiment of this specification. Figure 6 As shown, the data processing device includes: An extraction unit 602 is used to input the first data to be compressed into a convolutional neural network for feature extraction processing to obtain a first feature vector of the first data; A first encoding unit 604 is used to perform entropy encoding processing on the first feature vector to obtain a second feature vector of the first data; A prediction unit 606, configured to input the second feature vector into a prediction model for prediction processing to obtain a prediction result of the second feature vector; The second encoding unit 608 is used to perform encoding processing according to the residual information between the second feature vector and the prediction result to obtain compressed first data.
[0168] Optionally, the convolutional neural network includes a separable convolution layer and an adaptive pooling layer; the extraction unit 602 is specifically used to: Inputting the first data into the separable convolution layer for depth convolution processing to obtain first intermediate data, and performing point-by-point convolution processing on the first intermediate data to obtain second intermediate data; The second intermediate data is input into the adaptive pooling layer for pooling processing to obtain the first feature vector.
[0169] Optionally, the first encoding unit 604 is specifically configured to: determining a first element in the first eigenvector; Calculating the frequency of occurrence of the first element in the first eigenvector to obtain frequency information of the first element; Constructing a multi-branch tree according to the frequency information of the first element; Performing coding allocation processing on each node in the multi-branch tree to obtain coding information of the multi-branch tree; The second feature vector is generated according to the encoding information of the multi-branch tree.
[0170] Optionally, the second feature vector includes N second elements; the prediction result of the second feature vector includes the prediction result of each second element in the N second elements; the prediction unit 606 is specifically used to: Perform prediction processing according to the preset null value to obtain a prediction result of the first second element among the N second elements; Prediction processing is performed on the first i second elements among the N second elements to obtain a prediction result of the i+1th element among the N second elements; wherein i is an integer greater than 0.
[0171] Optionally, the extraction unit 602 is specifically configured to: Performing convolution processing on the first data to obtain third intermediate data; Residual calculation processing is performed based on the first data and the third intermediate data to obtain the first eigenvector.
[0172] Optionally, the device further comprises: An acquisition unit, used for acquiring a first file to be compressed; A division unit, used for performing division processing on the first file to obtain a plurality of first data; The allocation unit is used to allocate a thread to each first data in the plurality of first data in the plurality of parallel threads.
[0173] Optionally, the device further comprises: A training unit is used to generate a training loss of the prediction model according to the second feature vector and the prediction result, and adjust a model parameter of the prediction model according to the training loss.
[0174] In one embodiment of the present specification, an extraction unit is used to input the first data to be compressed into a convolutional neural network for feature extraction processing to obtain a first feature vector of the first data; a first encoding unit is used to perform entropy encoding processing on the first feature vector to obtain a second feature vector of the first data; a prediction unit is used to input the second feature vector into a prediction model for prediction processing to obtain a prediction result of the second feature vector; and a second encoding unit is used to perform encoding processing according to the residual information between the second feature vector and the prediction result to obtain the compressed first data. Through the data processing method provided by this embodiment, feature extraction through a convolutional neural network is conducive to reducing the amount of data to be processed in subsequent encoding steps while retaining the important features of the first data. The entropy encoding technology can enable the first feature vector to be encoded into the second feature vector. In the process of encoding, both data compression and important information are retained without loss, and the second feature vector can be further compressed by inputting the second feature vector into the prediction model for prediction processing and encoding processing according to the residual information between the second feature vector and the prediction result. In this way, in the entire data processing process, under the condition of achieving the same compression ratio, compared with directly using entropy coding for data compression or directly using prediction for data compression, the data compression efficiency can be significantly improved.
[0175] The data processing device provided in one embodiment of this specification can implement each process in the aforementioned data processing method embodiment and achieve the same functions and effects, which will not be repeated here.
[0176] Furthermore, an embodiment of the present specification also provides an electronic device, Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification, such as Figure 7As shown, the device includes: a memory 701, a processor 702, a bus 703 and a communication interface 704. The memory 701, the processor 702 and the communication interface 704 communicate through the bus 703, and the communication interface 704 may include an input and output interface, which includes but is not limited to a keyboard, a mouse, a display, a microphone, a loudspeaker, etc.
[0177] Figure 7 In the embodiment, the memory 701 stores computer executable instructions that can be run on the processor 702. When the computer executable instructions are executed by the processor 702, the following process is implemented: Inputting the first data to be compressed into a convolutional neural network for feature extraction processing to obtain a first feature vector of the first data; Performing entropy coding on the first feature vector to obtain a second feature vector of the first data; Inputting the second feature vector into a prediction model for prediction processing to obtain a prediction result of the second feature vector; Encoding is performed according to residual information between the second eigenvector and the prediction result to obtain compressed first data.
[0178] Optionally, the convolutional neural network includes a separable convolution layer and an adaptive pooling layer; when the computer executable instruction is executed by the processor 702, the first data to be compressed is input into the convolutional neural network for feature extraction processing to obtain a first feature vector of the first data, including: Inputting the first data into the separable convolution layer for depth convolution processing to obtain first intermediate data, and performing point-by-point convolution processing on the first intermediate data to obtain second intermediate data; The second intermediate data is input into the adaptive pooling layer for pooling processing to obtain the first feature vector.
[0179] Optionally, when the computer executable instruction is executed by the processor 702, performing entropy coding on the first feature vector to obtain a second feature vector of the first data includes: determining a first element in the first eigenvector; Calculating the frequency of occurrence of the first element in the first eigenvector to obtain frequency information of the first element; Constructing a multi-branch tree according to the frequency information of the first element; Performing coding allocation processing on each node in the multi-branch tree to obtain coding information of the multi-branch tree; The second feature vector is generated according to the encoding information of the multi-branch tree.
[0180] Optionally, the second feature vector includes N second elements; the prediction result of the second feature vector includes the prediction result of each second element in the N second elements; when the computer executable instruction is executed by the processor 702, the prediction process includes: Perform prediction processing according to the preset null value to obtain a prediction result of the first second element among the N second elements; Prediction processing is performed on the first i second elements among the N second elements to obtain a prediction result of the i+1th element among the N second elements; wherein i is an integer greater than 0.
[0181] Optionally, when the computer executable instruction is executed by the processor 702, the feature extraction process includes: Performing convolution processing on the first data to obtain third intermediate data; Residual calculation processing is performed based on the first data and the third intermediate data to obtain the first eigenvector.
[0182] Optionally, when the computer executable instruction is executed by the processor 702, before inputting the first data to be compressed into the convolutional neural network for feature extraction processing to obtain the first feature vector of the first data, the following process is further performed: Obtaining a first file to be compressed; Dividing the first file to obtain a plurality of first data; Among the multiple parallel threads, one thread is allocated to each first data in the multiple first data.
[0183] Optionally, when the computer executable instruction is executed by the processor 702, after inputting the second feature vector into the prediction model for prediction processing and obtaining the prediction result of the second feature vector, the following process is further executed: A training loss of the prediction model is generated according to the second feature vector and the prediction result, and a model parameter of the prediction model is adjusted according to the training loss.
[0184] In one embodiment of the present specification, first, the first data to be compressed is input into a convolutional neural network for feature extraction processing to obtain a first feature vector of the first data; then, the first feature vector is entropy encoded to obtain a second feature vector of the first data; then, the second feature vector is input into a prediction model for prediction processing to obtain a prediction result of the second feature vector; finally, the residual information between the second feature vector and the prediction result is encoded to obtain the compressed first data. Through the data processing method provided by this embodiment, feature extraction through a convolutional neural network is conducive to reducing the amount of data to be processed in subsequent encoding steps while retaining the important features of the first data. The entropy encoding technology can achieve data compression and retain important information in the process of encoding the first feature vector into the second feature vector. And, by inputting the second feature vector into the prediction model for prediction processing and encoding according to the residual information between the second feature vector and the prediction result, the second feature vector can be further compressed. In this way, in the entire data processing process, when the same compression ratio is achieved, the data compression efficiency can be significantly improved compared with directly using entropy coding for data compression or directly using prediction for data compression.
[0185] The electronic device provided in one embodiment of this specification can implement each process in the aforementioned data processing method embodiment and achieve the same functions and effects, which will not be repeated here.
[0186] Furthermore, another embodiment of the present specification also provides a computer-readable storage medium, the computer-readable storage medium is used to store computer-executable instructions, and when the computer-executable instructions are executed by a processor, the following process is implemented: Inputting the first data to be compressed into a convolutional neural network for feature extraction processing to obtain a first feature vector of the first data; Performing entropy coding on the first feature vector to obtain a second feature vector of the first data; Inputting the second feature vector into a prediction model for prediction processing to obtain a prediction result of the second feature vector; Encoding is performed according to residual information between the second eigenvector and the prediction result to obtain compressed first data.
[0187] Optionally, the convolutional neural network includes a separable convolutional layer and an adaptive pooling layer; when the computer executable instruction is executed by the processor 702, the first data to be compressed is input into the convolutional neural network for feature extraction processing to obtain a first feature vector of the first data, including: Inputting the first data into the separable convolution layer for depth convolution processing to obtain first intermediate data, and performing point-by-point convolution processing on the first intermediate data to obtain second intermediate data; The second intermediate data is input into the adaptive pooling layer for pooling processing to obtain the first feature vector.
[0188] Optionally, when the computer executable instruction is executed by the processor 702, performing entropy coding on the first feature vector to obtain a second feature vector of the first data includes: determining a first element in the first eigenvector; Calculating the frequency of occurrence of the first element in the first eigenvector to obtain frequency information of the first element; Constructing a multi-branch tree according to the frequency information of the first element; Performing coding allocation processing on each node in the multi-branch tree to obtain coding information of the multi-branch tree; The second feature vector is generated according to the encoding information of the multi-branch tree.
[0189] Optionally, the second feature vector includes N second elements; the prediction result of the second feature vector includes the prediction result of each second element in the N second elements; when the computer executable instruction is executed by the processor 702, the prediction process includes: Perform prediction processing according to the preset null value to obtain a prediction result of the first second element among the N second elements; Prediction processing is performed on the first i second elements among the N second elements to obtain a prediction result of the i+1th element among the N second elements; wherein i is an integer greater than 0.
[0190] Optionally, when the computer executable instruction is executed by the processor 702, the feature extraction process includes: Performing convolution processing on the first data to obtain third intermediate data; Residual calculation processing is performed based on the first data and the third intermediate data to obtain the first eigenvector.
[0191] Optionally, when the computer executable instruction is executed by the processor 702, before inputting the first data to be compressed into the convolutional neural network for feature extraction processing to obtain the first feature vector of the first data, the following process is further performed: Obtaining a first file to be compressed; Dividing the first file to obtain a plurality of first data; Among the multiple parallel threads, one thread is allocated to each first data in the multiple first data.
[0192] Optionally, when the computer executable instruction is executed by the processor 702, after inputting the second feature vector into the prediction model for prediction processing and obtaining the prediction result of the second feature vector, the following process is further executed: A training loss of the prediction model is generated according to the second feature vector and the prediction result, and a model parameter of the prediction model is adjusted according to the training loss.
[0193] In one embodiment of the present specification, first, the first data to be compressed is input into a convolutional neural network for feature extraction processing to obtain a first feature vector of the first data; then, the first feature vector is entropy encoded to obtain a second feature vector of the first data; then, the second feature vector is input into a prediction model for prediction processing to obtain a prediction result of the second feature vector; finally, the residual information between the second feature vector and the prediction result is encoded to obtain the compressed first data. Through the data processing method provided by this embodiment, feature extraction through a convolutional neural network is conducive to reducing the amount of data to be processed in subsequent encoding steps while retaining the important features of the first data. The entropy encoding technology can achieve data compression and retain important information in the process of encoding the first feature vector into the second feature vector. And, by inputting the second feature vector into the prediction model for prediction processing and encoding according to the residual information between the second feature vector and the prediction result, the second feature vector can be further compressed. In this way, in the entire data processing process, when the same compression ratio is achieved, the data compression efficiency can be significantly improved compared with directly using entropy coding for data compression or directly using prediction for data compression.
[0194] The computer-readable storage medium includes a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0195] The computer-readable storage medium provided in one embodiment of this specification can implement each process in the aforementioned data processing method embodiment and achieve the same functions and effects, which will not be repeated here.
[0196] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0197] The above description is only an embodiment of this specification and is not intended to limit this document. For those skilled in the art, the embodiments of this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this document should be included in the scope of the claims of this document.
Claims
1. A data processing method, characterized in that: include: Inputting the first data to be compressed into a convolutional neural network for feature extraction processing to obtain a first feature vector of the first data; Performing entropy coding on the first feature vector to obtain a second feature vector of the first data; Inputting the second feature vector into a prediction model for prediction processing to obtain a prediction result of the second feature vector; Encoding is performed according to residual information between the second eigenvector and the prediction result to obtain compressed first data.
2. The method according to claim 1, characterized in that The convolutional neural network includes a separable convolutional layer and an adaptive pooling layer; the first data to be compressed is input into the convolutional neural network for feature extraction processing to obtain a first feature vector of the first data, including: Inputting the first data into the separable convolution layer for depth convolution processing to obtain first intermediate data, and performing point-by-point convolution processing on the first intermediate data to obtain second intermediate data; The second intermediate data is input into the adaptive pooling layer for pooling processing to obtain the first feature vector.
3. The method according to claim 1, characterized in that The performing entropy coding on the first feature vector to obtain a second feature vector of the first data includes: determining a first element in the first eigenvector; Calculating the frequency of occurrence of the first element in the first eigenvector to obtain frequency information of the first element; Constructing a multi-branch tree according to the frequency information of the first element; Performing coding allocation processing on each node in the multi-branch tree to obtain coding information of the multi-branch tree; The second feature vector is generated according to the encoding information of the multi-branch tree.
4. The method according to claim 1, characterized in that: The second feature vector includes N second elements; the prediction result of the second feature vector includes the prediction result of each second element in the N second elements; the prediction process includes: Perform prediction processing according to the preset null value to obtain a prediction result of the first second element among the N second elements; Prediction processing is performed on the first i second elements among the N second elements to obtain a prediction result of the i+1th element among the N second elements; wherein i is an integer greater than 0.
5. The method according to claim 1, characterized in that The feature extraction process comprises: Performing convolution processing on the first data to obtain third intermediate data; Residual calculation processing is performed based on the first data and the third intermediate data to obtain the first eigenvector.
6. The method according to claim 1, characterized in that Before inputting the first data to be compressed into the convolutional neural network for feature extraction processing to obtain a first feature vector of the first data, the method further includes: Obtaining a first file to be compressed; Dividing the first file to obtain a plurality of first data; Among the multiple parallel threads, one thread is allocated to each first data in the multiple first data.
7. The method according to claim 1, characterized in that After inputting the second feature vector into a prediction model for prediction processing to obtain a prediction result of the second feature vector, the method further includes: A training loss of the prediction model is generated according to the second feature vector and the prediction result, and a model parameter of the prediction model is adjusted according to the training loss.
8. A data processing device, characterized in that: include: An extraction unit, used for inputting the first data to be compressed into a convolutional neural network for feature extraction processing to obtain a first feature vector of the first data; A first encoding unit, configured to perform entropy encoding processing on the first feature vector to obtain a second feature vector of the first data; A prediction unit, configured to input the second feature vector into a prediction model for prediction processing to obtain a prediction result of the second feature vector; The second encoding unit is used to perform encoding processing according to residual information between the second eigenvector and the prediction result to obtain compressed first data.
9. The device according to claim 8, characterized in that The convolutional neural network includes a separable convolution layer and an adaptive pooling layer; the extraction unit is specifically used for: Inputting the first data into the separable convolution layer for depth convolution processing to obtain first intermediate data, and performing point-by-point convolution processing on the first intermediate data to obtain second intermediate data; The second intermediate data is input into the adaptive pooling layer for pooling processing to obtain the first feature vector.
10. The device according to claim 8, characterized in that The first encoding unit is specifically used for: determining a first element in the first eigenvector; Calculating the frequency of occurrence of the first element in the first eigenvector to obtain frequency information of the first element; Constructing a multi-branch tree according to the frequency information of the first element; Performing coding allocation processing on each node in the multi-branch tree to obtain coding information of the multi-branch tree; The second feature vector is generated according to the encoding information of the multi-branch tree.
11. The device according to claim 8, characterized in that The second feature vector includes N second elements; the prediction result of the second feature vector includes the prediction result of each second element in the N second elements; the prediction unit is specifically used to: Perform prediction processing according to the preset null value to obtain a prediction result of the first second element among the N second elements; Prediction processing is performed on the first i second elements among the N second elements to obtain a prediction result of the i+1th element among the N second elements; wherein i is an integer greater than 0.
12. The device according to claim 8, characterized in that The extraction unit is specifically used for: Performing convolution processing on the first data to obtain third intermediate data; Residual calculation processing is performed based on the first data and the third intermediate data to obtain the first eigenvector.
13. The device according to claim 8, characterized in that The device also includes: An acquisition unit, used for acquiring a first file to be compressed; A division unit, used for performing division processing on the first file to obtain a plurality of first data; The allocation unit is used to allocate a thread to each first data in the plurality of first data in the plurality of parallel threads.
14. The device according to claim 8, characterized in that The device also includes: A training unit is used to generate a training loss of the prediction model according to the second feature vector and the prediction result, and adjust a model parameter of the prediction model according to the training loss.