JPEG image recompression and decompression model and method based on neural network
Through the neural network-based JPEG image recompression and decompression model, the problem of high storage and transmission costs of JPEG images is solved, and efficient compression and decompression of standard JPEG images of different sizes and pixel blocks are achieved, reducing hardware costs and maintaining image quality.
Patent Information
- Application Number
- CN202411774702.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2044-12-05
AI Technical Summary
With the increasing number of JPEG images in the medical industry, the hardware cost for storing and transmitting JPEG images has risen sharply, and a new compression method is urgently needed to reduce the cost.
A neural network-based JPEG image recompression and decompression model is adopted, including a data preprocessing module, a convolutional network and spatial pyramid module, and a variational reasoning and arithmetic coding module. Image recompression and decompression are achieved by performing color space conversion, frequency domain processing, quantization, Huffman coding, and variational reasoning arithmetic coding on JPEG images.
It effectively reduces the transmission and storage costs of JPEG images while maintaining image quality, improves the generalization ability of image compression, and can process JPEG images of different sizes and pixel block standards.
Smart Images

Figure CN119583815B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a JPEG image recompression and decompression model and method based on a neural network. Background Art
[0002] Since the advent of the JPEG (Joint Photographic Experts Group) algorithm, the medical industry has accumulated a large number of compressed images with the suffix ".jpg" or ".jpeg." Due to its high compression ratio and good compatibility, the JPEG format is often used to store medical images such as X-rays, CT scans, and MRI images. These images maintain high image quality after compression, making them easy to store and transmit. In scenarios such as telemedicine and medical imaging transmission, JPEG images have become a common transmission format due to their small file size and good image quality. This helps doctors quickly share and view medical images between different locations, improving the efficiency and quality of medical services. JPEG images are also often used as teaching materials in medical education and training. By displaying high-quality medical images, doctors and students can better understand and learn the characteristics and diagnostic methods of various diseases.
[0003] However, with the increasing number of medical-related JPEG images in recent years, the hardware cost for storing and transmitting JPEG images has skyrocketed. Therefore, a new compression method is urgently needed to reduce the transmission and storage costs of JPEG images. Summary of the Invention
[0004] The embodiments of the present application provide a neural network-based JPEG image recompression and decompression model and method, which can reduce the transmission and storage costs of JPEG images.
[0005] The embodiment of the present application provides a JPEG image recompression and decompression model based on a neural network, including a data preprocessing module, a convolutional network and spatial pyramid module, and a variational reasoning and arithmetic coding module;
[0006] The data preprocessing module is used to preprocess the input JPEG image with an RGB color space to generate a JPEG frequency domain image with a YCbCr color space and a 4:2:0 format, wherein the JPEG image with an RGB color space is a JPEG image of any image size and any pixel block standard, and the preprocessing includes Huffman encoding and Huffman decoding;
[0007] The convolutional network and spatial pyramid module are used to process the JPEG frequency domain image with a YCbCr color space and a 4:2:0 format, and output a vector of fixed length, wherein the convolutional network in the convolutional network and spatial pyramid module is an improved ResNet-34 network, and the improved ResNet-34 network includes a chromatic aberration deconvolution layer and a chromatic aberration luminance splicing layer, and does not include a global pooling layer and a fully connected layer of an existing ResNet-34 network;
[0008] The variational reasoning and arithmetic coding module is used to process the fixed-length vector, generate the probability distribution of the latent variables, and perform arithmetic coding on the sampled latent variables to complete the recompression of the JPEG image.
[0009] The neural network-based JPEG image recompression and decompression model described in the embodiment of the present application further includes a deconvolution network decoding module;
[0010] The deconvolution network decoding module is used to restore the data obtained by arithmetic coding to the latent variables and decode them into frequency images of brightness and color difference to complete the decompression of the JPEG image.
[0011] The present application also provides a neural network-based JPEG image recompression and decompression method, which is used in the neural network-based JPEG image recompression and decompression model described in the above embodiment. The method includes:
[0012] Preprocessing the input JPEG image in RGB color space by a data preprocessing module to generate a JPEG frequency domain image in YCbCr color space and 4:2:0 format, wherein the JPEG image in RGB color space is a JPEG image of any image size and any pixel block standard;
[0013] The JPEG frequency domain image with a YCbCr color space and a 4:2:0 format is processed by a convolutional network and a spatial pyramid module, and the output is a vector of a fixed length, wherein the convolutional network in the convolutional network and the spatial pyramid module is an improved ResNet-34 network, and the improved ResNet-34 network includes a chromatic aberration deconvolution layer and a chromatic aberration luminance splicing layer, and does not include a global pooling layer and a fully connected layer of an existing ResNet-34 network;
[0014] The fixed-length vector is processed by a variational reasoning and arithmetic coding module to generate a probability distribution of latent variables, and the sampled latent variables are arithmetically coded to complete the recompression of the JPEG image.
[0015] In the neural network-based JPEG image recompression and decompression method described in an embodiment of the present application, the fixed-length vector is processed by the variational inference and arithmetic coding module to generate a probability distribution of latent variables, and the sampled latent variables are arithmetic coded. After completing the recompression of the JPEG image, the method further includes:
[0016] The data obtained by arithmetic coding is restored to the latent variables through the deconvolution network decoding module and decoded into frequency images of brightness and color difference to complete the decompression of the JPEG image.
[0017] In the neural network-based JPEG image recompression and decompression method described in an embodiment of the present application, the deconvolution network decoding module restores the data obtained by arithmetic coding to the latent variables and decodes them into frequency images of brightness and color difference to complete the decompression of the JPEG image, including:
[0018] Restoring the value of the latent variable according to the arithmetic coding information and quantization coefficients contained in the recompressed data;
[0019] The restored latent variables are sent to the deconvolution network decoding module, and the deconvolution network decoding module outputs the brightness frequency image and the color difference frequency image to complete the decompression of the JPEG image.
[0020] In the neural network-based JPEG image recompression and decompression method described in an embodiment of the present application, the restored latent variables are fed into the deconvolution network decoding module, and the deconvolution network decoding module outputs a luminance frequency image and a color difference frequency image. After the JPEG image is decompressed, the method further includes:
[0021] Use discrete cosine transform method to convert frequency image into time domain image;
[0022] Use bidirectional interpolation to interpolate the color difference data of the YCbCr color space;
[0023] Convert the YCbCr color space into RGB space to generate a visually observable image.
[0024] In the neural network-based JPEG image recompression and decompression method described in an embodiment of the present application, the data preprocessing module preprocesses the input JPEG image in RGB color space to generate a JPEG frequency domain image in YCbCr color space and 4:2:0 format, including:
[0025] The data preprocessing module performs image conversion on the input JPEG image with RGB color space, and converts the time domain image into a frequency domain image;
[0026] quantizing the frequency domain data of the frequency domain image to obtain a plurality of frequency domain quantization values;
[0027] The plurality of frequency domain quantization values are sorted according to a Z-shaped path, and the frequency domain quantization values are processed successively by Huffman encoding and Huffman decoding to generate a JPEG frequency domain image with a YCbCr color space and a 4:2:0 format.
[0028] In the neural network-based JPEG image recompression and decompression method described in an embodiment of the present application, the frequency domain data of the frequency domain image is quantized to obtain multiple frequency domain quantization values, including:
[0029] Obtaining a brightness measurement table corresponding to a brightness pixel block and a color difference measurement table corresponding to a color difference pixel block;
[0030] The frequency domain data of the frequency domain image is quantized based on the brightness measurement table and the color difference measurement table to generate a plurality of frequency domain quantization values.
[0031] In the neural network-based JPEG image recompression and decompression method described in an embodiment of the present application, the JPEG frequency domain image with a YCbCr color space and a 4:2:0 format is processed by the convolutional network and the spatial pyramid module, and the output is a vector of fixed length, including:
[0032] The convolutional network in the convolutional network and spatial pyramid module deconvolves the color difference frequency domain image in the JPEG frequency domain image with a color space of YCbCr and a format of 4:2:0 to the size of brightness, then splices the color difference and brightness into three-channel data and feeds it into the ResNet-34 improved network, and outputs it as a fixed-length vector through the spatial pyramid in the convolutional network and spatial pyramid module.
[0033] In the neural network-based JPEG image recompression and decompression method described in an embodiment of the present application, the fixed-length vector is processed by the variational inference and arithmetic coding module to generate a probability distribution of latent variables, and the sampled latent variables are arithmetic-coded to complete the recompression of the JPEG image, including:
[0034] Processing the fixed-length vector through a multi-layer perceptron in a variational inference and arithmetic coding module to generate a probability distribution of latent variables;
[0035] The sampled latent variables are arithmetically encoded through the arithmetic encoder in the variational reasoning and arithmetic coding module to complete the recompression of the JPEG image.
[0036] The neural network-based JPEG image recompression and decompression model provided in the embodiment of the present application includes a data preprocessing module, a convolutional network and spatial pyramid module, and a variational reasoning and arithmetic coding module; the data preprocessing module is used to preprocess the input JPEG image with an RGB color space to generate a JPEG frequency domain image with a YCbCr color space and a 4:2:0 format, wherein the JPEG image with an RGB color space is a JPEG image of any image size and any pixel block standard; the convolutional network and spatial pyramid module is used to preprocess the input JPEG image with an YCbCr color space to generate a JPEG frequency domain image with a YCbCr color space and a 4:2:0 format. r and JPEG frequency domain images in the format of 4:2:0 are processed and output as fixed-length vectors, wherein the convolutional network in the convolutional network and spatial pyramid module is an improved ResNet-34 network, which includes a color difference deconvolution layer and a color difference brightness splicing layer, and does not include the global pooling layer and fully connected layer of the existing ResNet-34 network; the variational reasoning and arithmetic coding module is used to process the fixed-length vectors, generate the probability distribution of the latent variables, and perform arithmetic coding on the sampled latent variables to complete the recompression of the JPEG image. Through this model, the embodiment of the present application can reduce the transmission and storage costs of JPEG images. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] To more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present application. Those skilled in the art can also derive other drawings based on these drawings without inventive effort.
[0038] Figure 1 A schematic diagram of the structure of a neural network-based JPEG image recompression and decompression model provided in an embodiment of the present application.
[0039] Figure 2 A schematic diagram of the 4:2:0 sampling mode of YCbCr provided in an embodiment of the present application.
[0040] Figure 3 Schematic diagram of the Z-shaped path of low-frequency to high-frequency signals of a pixel block provided in an embodiment of the present application.
[0041] Figure 4 A schematic diagram of Huffman coding provided in an embodiment of the present application.
[0042] Figure 5 Schematic diagram of the convolutional network provided in the embodiment of the present application.
[0043] Figure 6 A schematic diagram of the spatial pyramid structure provided in an embodiment of the present application.
[0044] Figure 7 Schematic diagram of image recompression based on variational reasoning provided in an embodiment of the present application.
[0045] Figure 8 This is a flowchart of the deconvolution network decoding provided in an embodiment of the present application.
[0046] Figure 9 A flowchart of a neural network-based JPEG image recompression and decompression method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the embodiments described are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0048] The present invention provides a JPEG image recompression and decompression model based on a neural network. Figure 1 The neural network-based JPEG image recompression and decompression model includes a data preprocessing module, a convolutional network and spatial pyramid module, and a variational reasoning and arithmetic coding module.
[0049] The data preprocessing module is used to preprocess the input JPEG image with an RGB color space to generate a JPEG frequency domain image with a YCbCr color space and a 4:2:0 format, wherein the JPEG image with an RGB color space is a JPEG image of any image size and any pixel block standard.
[0050] The preprocessing includes the conversion of YCbCr time domain image to frequency domain image, frequency domain data quantization, Z-shaped path sorting, Huffman encoding and Huffman decoding described below.
[0051] The convolutional network and spatial pyramid module are used to process the JPEG frequency domain image with a YCbCr color space and a 4:2:0 format, and the output is a vector of fixed length. The convolutional network in the convolutional network and spatial pyramid module is an improved ResNet-34 network, and the improved ResNet-34 network includes a chromatic aberration deconvolution layer and a chromatic aberration brightness splicing layer, and does not include the global pooling layer and the fully connected layer of the existing ResNet-34 network.
[0052] The variational reasoning and arithmetic coding module is used to process the fixed-length vector, generate the probability distribution of the latent variables, and perform arithmetic coding on the sampled latent variables to complete the recompression of the JPEG image.
[0053] The specific functions of the data preprocessing module, variational reasoning and arithmetic coding module, convolutional network and spatial pyramid module are as follows:
[0054] 1. Data preprocessing module
[0055] Dividing the original image into multiple pixel blocks is one of the key steps in building the JPEG algorithm. The advantages of large-size pixel blocks are:
[0056] i) Reduce the number of blocks, thereby reducing the computational complexity of the algorithm and increasing processing speed;
[0057] ii) When performing frequency domain analysis such as discrete cosine transform (DCT), it can better capture the global characteristics of the image, which is beneficial to the overall compression effect of the image;
[0058] iii) Reduce the blocking effect caused by block processing and make the image visually smoother.
[0059] The advantages of small pixel blocks are:
[0060] i) It can capture image details more precisely, which is conducive to maintaining high image fidelity;
[0061] ii) It can better adapt to the changes in image details, so that the compressed image can maintain good quality in different areas.
[0062] The advantages of large and small pixel blocks indicate that the application scenario determines the pixel block size. However, since the advent of the JPEG algorithm in 1992, JPEG has uniformly used an 8x8 pixel block size, with the goal of standardizing the pixel block size and promoting the JPEG algorithm. As personalized application scenarios gradually become mainstream, the present invention foresees the emergence of JPEG algorithms based on various pixel block sizes. The medical industry will be flooded with JPEG images generated using different pixel block sizes, and the JPEG images themselves will also vary in size. Currently, there are no known recompression algorithms for JPEG images generated using varying pixel block sizes, both domestically and internationally. Therefore, the present invention proposes a neural network encoding structure with a spatial pyramid. This encoding structure allows JPEG images of varying image sizes and pixel block sizes to be input into the same encoder, without requiring changes to the encoder and decoder architectures. The trained neural network-based JPEG image recompression and decompression model thus possesses high generalization capabilities. It can not only perform recompression and decompression for existing pixel block sizes, but also for previously unseen pixel block sizes and image sizes.
[0063] When training a neural network-based JPEG image recompression and decompression model, since existing JPEG frequency domain images only have 8x8 pixel standard single-compression samples (JPEG images), it is necessary to generate 2x2, 4x4, 16x16 pixel standard single-compression samples (JPEG images). To this end, the corresponding production steps are as follows:
[0064] i) Convert YCbCr time domain image to frequency domain image
[0065] Commonly used color spaces include YCbCr and RGB. For YCbCr, Y represents brightness, Cb represents blue chrominance signal, and Cr represents red chrominance signal; for RGB, R represents red, G represents green, and B represents blue. This invention uses the YCbCr color space. For RGB images, the following formula is used to convert them to the YCbCr space:
[0066] Y=0.299R+0.587G+0.114B;
[0067] Cb=0.615R-0.515G-0.100B;
[0068] Cr=-0.147R-0.289G+0.436B;
[0069] The most commonly used YCbCr format is 4:2:0, and its sampling mode is as follows Figure 2 As shown. Specifically, for each scanning line (horizontally), the brightness must be collected at 100%, and the color difference must be collected at 50%; for the longitudinal direction, the brightness must be collected at 100%, and each color difference must be collected at 50%. In this way, for the same picture, the number of color differences collected is 25% of the original image, which greatly reduces the transmission cost. Since the human eye is very sensitive to brightness and not sensitive to color difference, the reduction in the sampling frequency of color difference does not affect human visual perception. The heavy compression (secondary compression) and decompression algorithm of the present invention requires a compressed sample (JPEG image) corresponding to pixel blocks of various sizes. Since the most commonly used YCbCr color space mode of the JPEG algorithm corresponding to the 8x8 pixel block is 4:2:0, the compressed samples (JPEG images) corresponding to all pixel sizes produced by the present invention are all based on the YCbCr color space of the 4:2:0 mode. Assume that the height, width and number of channels of the original image are H, W and 3 respectively, and convert the image color space to the YCbCr color space with the mode of 4:2:0. Then the height, width and number of channels of the brightness Y are H, W and 1 respectively; the height, width and number of channels of the color difference Cb and Cr are 、 and 1, The function is the ceiling function. Then set the brightness Y, color difference Cb and color difference Cr to use the size of and Thus, the brightness Y is divided into pixel blocks; the color difference Cb is divided into pixel blocks; the color difference Cr is divided into The above function causes the part beyond the image to be filled with 0 value. For each pixel block mentioned above, the discrete cosine transform method is used to convert the time domain value into the frequency domain value, that is, ;
[0070]
[0071] in Represents the time domain window coordinates The time domain value at ; Represents frequency domain coordinates The frequency domain value at ; ; Indicates the height of the pixel block; Indicates the width of the pixel block; According to the frequency domain coordinates, it can be expanded into the frequency domain matrix as follows: ;
[0072] in, is the DC component in the frequency domain, is the AC component, where and The larger the value of The higher the AC frequency, the higher the frequency component is usually related to the noise interference of the image. Removing the high-frequency component can not only remove the noise, but also help reduce the transmission cost.
[0073] ii) Frequency domain data quantization
[0074] The JPEG algorithm corresponding to the 8x8 pixel block provides a standard brightness measurement table and a standard color difference measurement table as shown in the following table.
[0075]
[0076] in the above table and The shape of is 8x8, obtained using 8x8 standard pixel blocks The size of is also 8x8. Each pixel block of brightness Y corresponds to (frequency domain image of brightness) and Divide by element position to get (the value after scaling of the frequency domain image), and then Round off each element value of to get the frequency quantized value ,Right now ;
[0077] in Similarly, the quantized values of the frequency of each color block corresponding to the blue color difference Cb and the red color difference Cr can be obtained respectively. The brightness and color difference measurement tables corresponding to other pixel block sizes are carried out according to the following rules: the values of the part of the pixel block size that does not exceed the range of 8x8 are the same as and The same, the part beyond the 8x8 range, or Based on the above, the Newton bidirectional interpolation method is first used to obtain the brightness and chromaticity scales corresponding to pixel blocks of other sizes, and then the subsequent frequency quantization is performed.
[0078] iii) Z-shaped path sorting and Huffman coding
[0079] Depend on It can be seen from the formula that The larger the value of The higher the frequency, The path morphology of the low-frequency to high-frequency order is similar to Z ( Figure 3 ), in other words, according to Figure 3 The Z-shaped path can be used to map the pixel blocks to the corresponding Sort by frequency in ascending order. After being divided by the brightness and chromaticity scales and rounded off, the sorted frequency quantization values are more likely to have the same value in the high frequency band and less likely to have the same value in the low frequency band, which provides data preparation for Huffman coding. The Huffman coding steps are:
[0080] a) Arrange the source message symbols in ascending order of their probability of occurrence;
[0081] b) Take the two letters with the lowest probability and assign them to the code elements 0 and 1 respectively, and add these two probabilities to form the probability of a new letter, and re-align it with the letters of the unassigned binary symbols;
[0082] c) Repeat step (b) for the two rearranged symbols with the lowest probability;
[0083] d) Continue the above process until the last two symbols are matched with 0 and 1;
[0084] e) Starting from the last level, go back forward to obtain the code element sequence corresponding to each source symbol, that is, the corresponding code word.
[0085] Assuming that the values and probabilities after frequency quantization are as follows, the corresponding Huffman coding is as follows Figure 4 shown.
[0086]
[0087] Obviously, the encoding length of the highest frequency value "0" is 1 bit, and the encoding length of the lowest frequency values "10" and "8" is 4 bits. The purpose of Huffman coding is to encode high-frequency values using short binary and low-frequency values using long binary. This can reduce the average encoding length of fixed-length signal sources and reduce transmission costs.
[0088] After completing steps i) to iii) above, a compressed sample (JPEG image) with variable pixel block size can be produced, and the JPEG image contains information such as brightness and chromaticity scales, Huffman coding, and image height and width. The input of the aforementioned coding convolutional network is the frequency domain image corresponding to brightness Y, color difference Cb, and color difference Cr. However, the produced sample does not directly contain frequency domain image information. The embodiment of the present application can reversely calculate the frequency domain image information corresponding to each pixel block through information such as brightness and color difference scales, Huffman coding, and image height and width. Specifically, the frequency quantization value is first obtained through Huffman decoding, and then the frequency domain image of a certain block is reversely calculated based on the brightness and color difference scales. In this way, the frequency domain images of all blocks that make up the image can be calculated. The frequency domain images of all blocks are spliced together in sequence to obtain the overall frequency domain images of the image brightness and color difference.
[0089] 2. Convolutional Network and Spatial Pyramid Module
[0090] Since the YCbCr color space mode is 4:2:0, the height and width of the color difference frequency domain image corresponding to the picture are half of the height and width of the brightness frequency domain image, so in the convolutional network ( Figure 5 ) first deconvolves the color difference frequency domain image to the brightness dimension, then concatenates the color difference and brightness into three-channel data before feeding it into the improved ResNet-34 network. The improved ResNet-34 network removes the original global pooling layer and fully connected layers, adds a color difference deconvolution layer and a color difference brightness concatenation layer, and adds semantic layers 2 to 17 to enhance the encoding module's ability to extract both overall and detailed features of the frequency domain image. In "convT2,2, / 2", "convT2" represents a two-dimensional deconvolution kernel, meaning that the deconvolution kernel can slide along both the height and width dimensions. "2" indicates that the number of channels after deconvolution is 2, and " / 2" indicates that the deconvolution has a sliding stride of 2 in both the height and width directions. In "7×7conv2, 64, / 2," "conv2" represents a two-dimensional convolution kernel, meaning it can slide along two dimensions. "7×7" indicates the kernel has a height of 7 and a width of 7. "64" indicates the number of two-dimensional feature maps output by this convolution layer is 64. " / 2" indicates the kernel slides with a stride of 2 in both the height and width directions. In "Pool2, / 2," a pooling operation is performed with a stride of 2 in both the height and width directions. The meanings of the remaining two-dimensional convolution layers can be derived similarly.
[0091] The semantics 1~17 of the convolutional network are input to the spatial pyramid ( Figure 6 ), for any channel feature map of any semantics, the first schemes, divided equally into rectangles, and then calculate the mean value in each rectangle respectively, and arrange the mean values in all rectangles of all solutions into a row vector, which is the spatial pyramid output corresponding to a channel. Obviously, when the variable size channel feature map uses 0~ After the rectangular division scheme, the number of outputs of the spatial pyramid is ;
[0092] That is to say, the size of the feature map does not affect the vector length of the spatial pyramid output. When using variable-size brightness and color difference frequency images as convolutional network input, the vector length of the spatial pyramid output remains fixed. In this way, when training and testing the recompression and decompression models, JPEG images of variable image sizes and variable pixel block sizes can be used as training and test samples, greatly improving the generalization ability and application range of the model. When all 17 feature semantics participate in model training, the vector length of the spatial pyramid output is ;
[0093] in Indicates the The number of feature channels for each semantic. In fact, not all 17 semantics are used. Semantic 1 must be used, and semantics 2 to 17 can be used according to the actual needs of the model.
[0094] 3. Variational Inference and Arithmetic Coding Module
[0095] Usually, the vector output by the spatial pyramid is fed into a multi-layer perceptron and an arithmetic or Huffman encoder to complete the image recompression. However, the present invention uses a variational inference algorithm to obtain the latent variable The probability distribution of the latent variable instead of directly obtaining the latent variable The objectives of this approach are: 1) Image data often contains a large amount of redundancy and uncertainty, and probability distributions can better describe these characteristics, thereby improving compression efficiency and reconstruction quality. 2) When some data is lost or damaged, the information in the probability distribution can be used to recover or compensate for these losses, thereby improving the robustness of the system. 3) Probability distributions can intuitively reflect the distribution characteristics and uncertainty of data, better understanding data changes during compression, and probability distribution models are also easier to extend and integrate into other systems.
[0096] Figure 7 Demonstrates that the invention uses variational inference to calculate latent variables Key details of probability distribution. The combination of spatial pyramid and multi-layer perceptron can output vectors of arbitrary length. The general formula for variational inference is: ;
[0097] in Indicates the samples; Represents the parameters in the convolutional backbone network, spatial pyramid and multi-layer perceptron; Indicates that when the encoding network parameters are , the input is The probability of The encoding network parameters are And the input is When the hidden variable The probability distribution of Usually difficult to solve; is a distribution with a known analytical expression, which is used to approximate , We can take the normal distribution as its distribution, represents the parameters of the known analytical distribution; express and The relative entropy of and The higher the degree of approximation; represents the lower bound of the evidence for variational inference, The value of is constant, as long as the maximum , It will get smaller, and The more similar they are, the more you can use Alternative Evidence for a lower bound The formula is ;
[0098] in Indicates that when the encoding network parameters are When the hidden variable The prior probability distribution of ; Indicates that when the encoding network parameters are When the hidden variable is When the input is probability; express exist The present invention uses normal distribution to represent The analytical expression of ;
[0099] in It means that when the input sample is When , the output of the multilayer perceptron in the encoding network is . In order to obtain the value, it is necessary to get the value from the normal distribution However, direct sampling operation will cause the algorithm model to be unable to use the gradient back propagation algorithm, and the recompression and decompression algorithms will not be able to iterate. In order to solve this problem, the present invention adopts the following resampling strategy, namely ;
[0100] It is sampled from the standard normal distribution N(0,1), then and The direct sampling of the same distribution, the present invention assumes that only one standard normal distribution sampling is performed to obtain .Will Bring in , the loss function is ;
[0101] in Indicates the number of latent variables; the mean square error of brightness indicates the value obtained by subtracting the corresponding elements of the actual frequency image of brightness from the generated frequency image, taking the square of the difference and then dividing it by the total number of image elements; similarly, the mean square error of the blue and red color differences is obtained. By gradient descent, the loss value By back propagating, the hyperparameters of the recompression and decompression models can be completed. When the model is trained, the frequency images of brightness and color difference can be mapped to Among the hidden variables, The latent variable is multiplied by the quantization coefficient After rounding, this The numerical value of the latent variable is quantized to the interval Then use arithmetic coding to convert the quantized The latent variable is encoded as a decimal . Give an example to illustrate the arithmetic coding process, assuming that the quantized The latent variables are "3,3,1,3,1,5,3,1,3,1", then P(3)=0.5; P(1)=0.4; P(5)=0.1. Then the arithmetic coding will divide the interval from 0 to 1, that is, "3": [0, 0.5), "1": [0.5, 0.9), "5": [0.9, 1). The first character of "3,3,1,3,1,5,3,1,3,1" is "3", so the interval of "3" [0, 0.5) is selected as the new target interval. For this new target interval, it is further divided according to the probability of "3", "1", and "5", that is, "3": [0, 0.25), "1": [0.25, 0.45), "5": [0.45, 0.5). The second character of the pattern "3,3,1,3,1,5,3,1,3,1" is "3", so the interval [0, 0.25] for "3" is selected as the new target interval. This new target interval is further divided according to the probability of "3", "1", and "5", that is, "3": [0, 0.125), "1": [0.125, 0.225), "5": [0.225, 0.25). The third character of the pattern "3,3,1,3,1,5,3,1,3,1" is "1", so the interval [0.125, 0.225] for "1" is selected as the new target interval. The new target range is then divided according to the probability of "3," "1," and "5," i.e., "3": [0.125, 0.175), "1": [0.175, 0.215), "5": [0.215, 0.225]. Repeating this process until the last character yields a target range of [0.1686, 0.16868). A random decimal from this range is then arithmetic-coded as "3, 3, 1, 3, 1, 5, 3, 1, 3, 1." The goal of arithmetic coding is to find the shortest binary decimal within the target range as the final code. Therefore, the larger the target range, the greater the probability of a short decimal being selected. To maximize the target range, the encoding process assigns a space based on the probability of each character appearing.
[0102] In some embodiments, the neural network-based JPEG image recompression and decompression model also includes a deconvolution network decoding module; the deconvolution network decoding module is used to restore the data obtained by arithmetic coding to the latent variables and decode them into frequency images of brightness and color difference to complete the decompression of the JPEG image.
[0103] Among them, the specific functions of the deconvolution network decoding module are as follows:
[0104] After arithmetic coding encodes the quantized latent variables, the JPEG image is actually recompressed. The compressed data will occupy a smaller physical space than the uncompressed JPEG, and the corresponding transmission cost will also be reduced. When the user needs to restore the JPEG image, it needs to be decompressed. First, the arithmetic coding information and quantization coefficients contained in the recompressed data are used to calculate the image size. The restored hidden variable value is of course affected by rounding, and the restored hidden variable value has a certain error from the true value. The latent variables are fed into the deconvolution network decoding module ( Figure 8 ), for "axa convT2,1, / 1", "axa" represents the size of the deconvolution kernel, and the value of "a" is equal to Figure 5 The height and width of the feature map of the convolutional network semantic 1 in the deconvolution network are included in the compressed file for use during decompression; "convT2" means deconvolution in both height and width directions, "1" means the number of channels is 1, and " / 1" means the step size is 1. Therefore, the deconvolution network decoding module first passes each latent variable through a deconvolution layer with a convolution kernel of 7x7 and a step size of 1 to generate a feature map of size 7x7, and then The feature maps generated by the latent variables are stacked in the channel direction, and the size of the stacked feature map set is , and then the feature atlas is fed into the subsequent layers. The final output of the deconvolution network is a luminance frequency image and a color difference frequency image. The height and width of the luminance frequency image are twice that of the color difference frequency image, so the final three channels are split into two parts, one of which is used to generate the luminance frequency image, and the other two channels are used to generate the color difference frequency images. Of course, this deconvolution decoding only generates a frequency image. If you want to generate a YCbCr color space in 4:2:0 mode, you also need to use the discrete cosine transform method to convert the frequency image into a time domain image, and then use the bidirectional interpolation method to interpolate the color difference data of the YCbCr color space. Finally, convert the YCbCr color space into RGB space to obtain a visually observable image.
[0105] The following is a detailed training and performance evaluation of the neural network-based JPEG image recompression and decompression model of the embodiment of the present application:
[0106] 1. Dataset Introduction
[0107] 1) Pre-training dataset preparation
[0108] a) Create a dataset based on the ImageNet database
[0109] The ImageNet database contains more than 14 million images, covering 1,000 different categories. The invention randomly selects 100,000 images from them, and based on the selected images, uses cropping, scaling and stretching to limit the height and width of each image to between 185 and 256, obtaining 200,000 images in RGB color space. The obtained RGB color space images are sent to the data preprocessing module to obtain frequency domain images of 200,000 images. The pixel block standard used is: the height and width of the pixel block are equal, and the value is in the range of 8 to 40.
[0110] b) Create a dataset based on the Wikipedia library
[0111] Using a basic Python crawler framework, we crawled 200,000 color images from Wikipedia. We used cropping, scaling, and stretching to limit the height and width of each image to between 150 and 185 pixels, resulting in 200,000 RGB color space images. These RGB color space images were fed into a data preprocessing module to obtain frequency domain images of the 200,000 images. The pixel block standard used was that the height and width of the pixel blocks were equal, and their values ranged from 2 to 8.
[0112] 2) Model fine-tuning dataset preparation
[0113] We used 30,445 lung image samples from 9,225 patients recorded between January 1, 2013, and December 31, 2018, from the MIMIC-IV1.4 database. These images were saved in JPEG format and cropped, scaled, and stretched to limit the height and width of each image to between 150 and 256. This yielded 30,445 RGB color space images. These RGB color space images were fed into a data preprocessing module to generate frequency domain images of the 30,445 images. The pixel block standard used was that the height and width of the pixel blocks were equal, with values ranging from 2 to 40.
[0114] 3) Preparation of external validation dataset for the model
[0115] This study used 30,000 lung image samples from 9,225 patients recorded at a tertiary hospital in Beijing between January 1, 2016, and December 31, 2022. These images were saved in JPEG format, with their height and width restricted to 150–256. These images were then fed into a data preprocessing module to obtain 30,000 frequency domain images. The pixel block standard used was that the height and width of the pixel blocks were equal, with values ranging from 2 to 40.
[0116] 2. Model training and evaluation
[0117] The input of the spatial pyramid is fed into the multi-layer perceptron, which generates and ( and Represent the mean and standard deviation of the Gaussian distribution of the latent variable respectively). The present invention uses a two-layer perceptron structure. The number of neurons in the input layer is equal to the vector length of the spatial pyramid output, and the number of neurons in the output layer is equal to twice the number of latent variables. Half of the neurons are used to generate , and the other half of the neurons are used to generate . Set this The numerical value of the latent variable is quantized to the interval within, among them . The 400,000 frequency domain images produced based on the ImageNet database and the Wikipedia library are not images of the medical industry, so the present invention uses all of them for pre-training of the differential compression and decompression model. The compression and decompression accuracy of the pre-trained model for medical industry images is low, so the present invention uses 30,445 frequency images of lung images in MIMIC-IV1.4 to complete the fine-tuning optimization of the model parameters. The fine-tuned model has high compression and decompression accuracy for lung images. In order to verify the relationship between the average word length and mean square error of the fine-tuned model, the present invention uses 30,000 lung image frequency samples from a tertiary hospital in Beijing to complete the test of model performance. The following table shows the results of the model performance test using only the convolutional network ( Figure 5 ) External validation results of the recompression and decompression model created using semantics 1. The fields in the table are as follows: Average word length / information entropy represents the average ratio of the average word length to information entropy of all samples. The closer this average is to 1, the higher the compression ratio. Relative error percentage represents the average relative error percentage between the generated luminance and chrominance of all samples and the true luminance and chrominance. A smaller relative error percentage indicates a more accurate generated sample. The number of pyramid levels is determined by the spatial pyramid structure. A one-level pyramid outputs a scalar value; a two-level pyramid outputs a vector of length 5; a three-level pyramid outputs a vector of length 21.
[0118] [Semantic 1] Corresponding model external verification results
[0119]
[0120] As can be seen from the above table, the latent variable The larger the value, the smaller the value of "information entropy / average word length"; as the number of latent variables increases, the value of "relative error percentage%" first decreases and then increases. When the number of pyramid layers increases, the value of "Relative Error Percentage%" is low; as the number of pyramid layers increases, the value of "Relative Error Percentage%" decreases first and then increases. When the number of pyramid layers is two, the value is low. In summary, when only semantic 1 is used and the number of latent variables is When the number of pyramid layers is two, the value of “Relative Error Percentage%” is 4%, which is the lowest. The selection of the number of pyramid levels also requires consideration of the "information entropy / average word length" value. The values for "information entropy / average word length" and "relative error percentage" should be selected based on the specific scenario. Similarly, the performance evaluation of compression and decompression models for other semantic combinations can be completed.
[0121] As can be seen from the above, the present invention uses an improved ResNet-34 network to construct a recompression and decompression algorithm, introduces variational reasoning into the image recompression and decompression algorithm, and ensures the accuracy of the generated image by sampling the latent variables multiple times and taking the average. The spatial pyramid structure is used to uniformly output the variable-size JPEG frequency domain images as a fixed-length vector, greatly improving the robustness of the recompression and decompression model. The model of the present application can not only complete the recompression and decompression of existing pixel block standards and image sizes, but also complete the recompression and decompression of pixel blocks and image sizes that have never been encountered.
[0122] All of the above optional technical solutions can be combined in any way to form optional embodiments of the present application, and will not be described in detail here.
[0123] During specific implementation, the present application is not limited by the execution order of the various steps described. If no conflict occurs, some steps can be performed in other orders or simultaneously.
[0124] As can be seen from the above, the neural network-based JPEG image recompression and decompression model provided in the embodiment of the present application includes a data preprocessing module, a convolutional network and spatial pyramid module, and a variational reasoning and arithmetic coding module; the data preprocessing module is used to preprocess the input JPEG image with an RGB color space to generate a JPEG frequency domain image with a YCbCr color space and a 4:2:0 format, wherein the JPEG image with an RGB color space is a JPEG image of any image size and any pixel block standard; the convolutional network and spatial pyramid module is used to preprocess the input JPEG image with an YCbCr color space to generate a JPEG frequency domain image with a YCbCr color space and a 4:2:0 format. bCr and 4:2:0 format JPEG frequency domain images are processed and output as fixed-length vectors, wherein the convolutional network in the convolutional network and spatial pyramid module is an improved ResNet-34 network, which includes a color difference deconvolution layer and a color difference brightness splicing layer, and does not include the global pooling layer and fully connected layer of the existing ResNet-34 network; the variational reasoning and arithmetic coding module is used to process the fixed-length vectors, generate the probability distribution of the latent variables, and perform arithmetic coding on the sampled latent variables to complete the recompression of the JPEG image. Through this model, the embodiment of the present application can reduce the transmission and storage costs of JPEG images.
[0125] The present application also provides a JPEG image recompression and decompression method based on a neural network. Figure 9 , Figure 9 This is a flow chart of a neural network-based JPEG image recompression and decompression method provided in an embodiment of the present application. This method is used in the neural network-based JPEG image recompression and decompression model described in the above embodiment. The method includes the following steps:
[0126] Step 101: Preprocess the input JPEG image in RGB color space through a data preprocessing module to generate a JPEG frequency domain image in YCbCr color space and 4:2:0 format, wherein the JPEG image in RGB color space is a JPEG image of any image size and any pixel block standard.
[0127] In some embodiments, preprocessing the input JPEG image in RGB color space by the data preprocessing module to generate a JPEG frequency domain image in YCbCr color space and 4:2:0 format includes:
[0128] The data preprocessing module performs image conversion on the input JPEG image with RGB color space, and converts the time domain image into a frequency domain image;
[0129] quantizing the frequency domain data of the frequency domain image to obtain a plurality of frequency domain quantization values;
[0130] The plurality of frequency domain quantization values are sorted according to a Z-shaped path, and the frequency domain quantization values are processed successively by Huffman encoding and Huffman decoding to generate a JPEG frequency domain image with a YCbCr color space and a 4:2:0 format.
[0131] The specific technical details of this step can be found in the data preprocessing module content section in the neural network-based JPEG image recompression and decompression model.
[0132] In some embodiments, the quantizing the frequency domain data of the frequency domain image to obtain a plurality of frequency domain quantized values includes:
[0133] Obtaining a brightness measurement table corresponding to a brightness pixel block and a color difference measurement table corresponding to a color difference pixel block;
[0134] The frequency domain data of the frequency domain image is quantized based on the brightness measurement table and the color difference measurement table to generate a plurality of frequency domain quantization values.
[0135] The specific technical details of this step can be found in the data preprocessing module content section in the neural network-based JPEG image recompression and decompression model.
[0136] Step 102: Process the JPEG frequency domain image in YCbCr color space and 4:2:0 format through a convolutional network and a spatial pyramid module, and output it as a vector of fixed length, wherein the convolutional network in the convolutional network and the spatial pyramid module is an improved ResNet-34 network, and the improved ResNet-34 network includes a chromatic aberration deconvolution layer and a chromatic aberration luminance splicing layer, and does not include a global pooling layer and a fully connected layer of the existing ResNet-34 network.
[0137] In some embodiments, the processing of the JPEG frequency domain image in the YCbCr color space and the 4:2:0 format by the convolutional network and the spatial pyramid module, and outputting the fixed-length vector, includes:
[0138] The convolutional network in the convolutional network and spatial pyramid module deconvolves the color difference frequency domain image in the JPEG frequency domain image with a color space of YCbCr and a format of 4:2:0 to the size of brightness, then splices the color difference and brightness into three-channel data and feeds it into the ResNet-34 improved network, and outputs it as a fixed-length vector through the spatial pyramid in the convolutional network and spatial pyramid module.
[0139] The specific technical details of this embodiment can be found in the convolutional network and spatial pyramid module content section in the neural network-based JPEG image recompression and decompression model.
[0140] Step 103 : Process the fixed-length vector through a variational inference and arithmetic coding module to generate a probability distribution of latent variables, and perform arithmetic coding on the sampled latent variables to complete the recompression of the JPEG image.
[0141] In some embodiments, the processing of the fixed-length vector by the variational inference and arithmetic coding module to generate a probability distribution of latent variables, and arithmetic coding of the sampled latent variables to complete the recompression of the JPEG image includes:
[0142] Processing the fixed-length vector through a multi-layer perceptron in a variational inference and arithmetic coding module to generate a probability distribution of latent variables;
[0143] The sampled latent variables are arithmetically encoded through the arithmetic encoder in the variational reasoning and arithmetic coding module to complete the recompression of the JPEG image.
[0144] Among them, the specific technical details of this embodiment can be found in the variational reasoning and arithmetic coding module content part discussed above in the neural network-based JPEG image recompression and decompression model.
[0145] In some embodiments, after processing the fixed-length vector by the variational inference and arithmetic coding module to generate a probability distribution of latent variables and performing arithmetic coding on the sampled latent variables to complete the recompression of the JPEG image, the method further includes:
[0146] The data obtained by arithmetic coding is restored to the latent variables through the deconvolution network decoding module and decoded into frequency images of brightness and color difference to complete the decompression of the JPEG image.
[0147] This embodiment mainly decompresses the recompressed JPEG image. The specific decompression process can be seen in the deconvolution network decoding module content part of the neural network-based JPEG image recompression and decompression model mentioned above.
[0148] In some embodiments, the deconvolution network decoding module restores the data obtained by arithmetic coding to the latent variables and decodes them into frequency images of brightness and color difference to complete the decompression of the JPEG image, including:
[0149] Restoring the value of the latent variable according to the arithmetic coding information and quantization coefficients contained in the recompressed data;
[0150] The restored latent variables are sent to the deconvolution network decoding module, and the deconvolution network decoding module outputs the brightness frequency image and the color difference frequency image to complete the decompression of the JPEG image.
[0151] Among them, the specific technical details of this embodiment can be found in the deconvolution network decoding module content part discussed above in the neural network-based JPEG image recompression and decompression model.
[0152] In some embodiments, the restored latent variables are fed into the deconvolution network decoding module, and the deconvolution network decoding module outputs a luminance frequency image and a color difference frequency image. After decompression of the JPEG image is completed, the method further includes:
[0153] Use discrete cosine transform method to convert frequency image into time domain image;
[0154] Use bidirectional interpolation to interpolate the color difference data of the YCbCr color space;
[0155] Convert the YCbCr color space into RGB space to generate a visually observable image.
[0156] Among them, the specific technical details of this embodiment can be found in the deconvolution network decoding module content part discussed above in the neural network-based JPEG image recompression and decompression model.
[0157] All of the above optional technical solutions can be combined in any way to form optional embodiments of the present application, and will not be described in detail here.
[0158] During specific implementation, the present application is not limited by the execution order of the various steps described. If no conflict occurs, some steps can be performed in other orders or simultaneously.
[0159] From the above, it can be seen that the neural network-based JPEG image recompression and decompression method provided in the embodiment of the present application preprocesses the input JPEG image with an RGB color space through a data preprocessing module to generate a JPEG frequency domain image with a YCbCr color space and a 4:2:0 format. The JPEG frequency domain image with a YCbCr color space and a 4:2:0 format is then processed through a convolutional network and a spatial pyramid module, and the output is a vector of a fixed length. The fixed-length vector is then processed through a variational inference and arithmetic coding module to generate a probability distribution of latent variables, and the sampled latent variables are arithmetically encoded to complete the recompression of the JPEG image, thereby being able to reduce the transmission and storage costs of the JPEG image.
[0160] The above is a detailed introduction to the neural network-based JPEG image recompression and decompression model and method provided in the embodiments of this application. Specific examples are used herein to illustrate the principles and implementation methods of this application. The description of the above embodiments is only intended to help understand the method and core concept of this application. At the same time, for those skilled in the art, based on the concept of this application, there may be changes in the specific implementation methods and application scope. In summary, the contents of this specification should not be understood as limiting this application.
Claims
1. A JPEG image recompression and decompression model based on neural network, characterized in that: Including data preprocessing module, convolutional network and spatial pyramid module and variational reasoning and arithmetic coding module; The data preprocessing module is used to preprocess the input JPEG image with an RGB color space to generate a JPEG frequency domain image with a YCbCr color space and a 4:2:0 format, wherein the JPEG image with an RGB color space is a JPEG image of any image size and any pixel block standard; The convolutional network and spatial pyramid module are used to process the JPEG frequency domain image with a YCbCr color space and a 4:2:0 format, and output a vector of fixed length, wherein the convolutional network in the convolutional network and spatial pyramid module is an improved ResNet-34 network, and the improved ResNet-34 network includes a chromatic aberration deconvolution layer and a chromatic aberration luminance splicing layer, and does not include a global pooling layer and a fully connected layer of an existing ResNet-34 network; The variational reasoning and arithmetic coding module is used to process the fixed-length vector, generate the probability distribution of the latent variables, and perform arithmetic coding on the sampled latent variables to complete the recompression of the JPEG image.
2. The neural network-based JPEG image recompression and decompression model according to claim 1, wherein: It also includes a deconvolutional network decoding module; The deconvolution network decoding module is used to restore the data obtained by arithmetic coding to the latent variables and decode them into frequency images of brightness and color difference to complete the decompression of the JPEG image.
3. A neural network-based JPEG image recompression and decompression method, used in the neural network-based JPEG image recompression and decompression model according to claim 2, characterized in that: The method comprises: Preprocessing the input JPEG image in RGB color space by a data preprocessing module to generate a JPEG frequency domain image in YCbCr color space and 4:2:0 format, wherein the JPEG image in RGB color space is a JPEG image of any image size and any pixel block standard; The JPEG frequency domain image with a YCbCr color space and a 4:2:0 format is processed by a convolutional network and a spatial pyramid module, and the output is a vector of a fixed length, wherein the convolutional network in the convolutional network and the spatial pyramid module is an improved ResNet-34 network, and the improved ResNet-34 network includes a chromatic aberration deconvolution layer and a chromatic aberration luminance splicing layer, and does not include a global pooling layer and a fully connected layer of an existing ResNet-34 network; The fixed-length vector is processed by a variational reasoning and arithmetic coding module to generate a probability distribution of latent variables, and the sampled latent variables are arithmetically coded to complete the recompression of the JPEG image.
4. The neural network-based JPEG image recompression and decompression method according to claim 3, wherein: The fixed-length vector is processed by the variational inference and arithmetic coding module to generate a probability distribution of latent variables, and the sampled latent variables are arithmetic-coded to complete the recompression of the JPEG image, further comprising: The data obtained by arithmetic coding is restored to the latent variables through the deconvolution network decoding module and decoded into frequency images of brightness and color difference to complete the decompression of the JPEG image.
5. The neural network-based JPEG image recompression and decompression method according to claim 4, wherein: The deconvolution network decoding module restores the data obtained by arithmetic coding to the latent variables and decodes them into frequency images of brightness and color difference to complete the decompression of the JPEG image, including: Restoring the value of the latent variable according to the arithmetic coding information and quantization coefficients contained in the recompressed data; The restored latent variables are sent to the deconvolution network decoding module, and the deconvolution network decoding module outputs the brightness frequency image and the color difference frequency image to complete the decompression of the JPEG image.
6. The neural network-based JPEG image recompression and decompression method according to claim 5, wherein: The restored latent variables are fed into the deconvolution network decoding module, and the deconvolution network decoding module outputs a luminance frequency image and a color difference frequency image. After decompression of the JPEG image is completed, the method further includes: Use discrete cosine transform method to convert frequency image into time domain image; Use bidirectional interpolation to interpolate the color difference data of the YCbCr color space; Convert the YCbCr color space into RGB space to generate a visually observable image.
7. The neural network-based JPEG image recompression and decompression method according to claim 3, wherein: The data preprocessing module preprocesses the input JPEG image in RGB color space to generate a JPEG frequency domain image in YCbCr color space and 4:2:0 format, including: The data preprocessing module performs image conversion on the input JPEG image with RGB color space, and converts the time domain image into a frequency domain image; quantizing the frequency domain data of the frequency domain image to obtain a plurality of frequency domain quantization values; The plurality of frequency domain quantization values are sorted according to a Z-shaped path, and the frequency domain quantization values are processed successively by Huffman encoding and Huffman decoding to generate a JPEG frequency domain image with a YCbCr color space and a 4:2:0 format.
8. The neural network-based JPEG image recompression and decompression method according to claim 7, wherein: The quantizing of the frequency domain data of the frequency domain image to obtain a plurality of frequency domain quantization values includes: Obtaining a brightness measurement table corresponding to a brightness pixel block and a color difference measurement table corresponding to a color difference pixel block; The frequency domain data of the frequency domain image is quantized based on the brightness measurement table and the color difference measurement table to generate a plurality of frequency domain quantization values.
9. The neural network-based JPEG image recompression and decompression method according to claim 3, wherein: The convolutional network and the spatial pyramid module are used to process the JPEG frequency domain image in the YCbCr color space and the 4:2:0 format, and the output is a vector of fixed length, including: The convolutional network in the convolutional network and spatial pyramid module deconvolves the color difference frequency domain image in the JPEG frequency domain image with a color space of YCbCr and a format of 4:2:0 to the size of brightness, then splices the color difference and brightness into three-channel data and feeds it into the ResNet-34 improved network, and outputs it as a fixed-length vector through the spatial pyramid in the convolutional network and spatial pyramid module.
10. The neural network-based JPEG image recompression and decompression method according to claim 3, wherein: The fixed-length vector is processed by the variational reasoning and arithmetic coding module to generate a probability distribution of latent variables, and the sampled latent variables are arithmetic-coded to complete the recompression of the JPEG image, including: Processing the fixed-length vector through a multi-layer perceptron in a variational inference and arithmetic coding module to generate a probability distribution of latent variables; The sampled latent variables are arithmetically encoded through the arithmetic encoder in the variational reasoning and arithmetic coding module to complete the recompression of the JPEG image.
