Machine vision-oriented image coding, decoding and compressing method and system
Through the combination of space-frequency modulation coding network and entropy model, the shortcomings of image compression models in the prior art for machine vision are solved, more efficient information extraction and redundancy reduction are achieved, and the accuracy performance of image classification tasks is improved.
Patent Information
- Application Number
- CN202411009925.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-07-26
AI Technical Summary
The existing deep learning-based image compression model cannot meet the machine vision-oriented image storage and transmission needs, and the prompt learning-based method has shortcomings in computing overhead and downstream task performance.
Using a space-frequency modulation coding network, by quantizing and modeling the feature maps of the image to be encoded into a Gaussian distribution, using the entropy model to predict mean and variance for arithmetic encoding and decoding, reducing information redundancy, improving image compression code rate and downstream task accuracy .
With the same code rate overhead, the accuracy performance of image classification tasks is improved, and the information redundancy is significantly reduced. It is suitable for existing end-to-end image compression codec networks, with good flexibility and generalization.
Smart Images

Figure CN119011858A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image processing, and in particular, relates to an image encoding, decoding and compression method and system for machine vision in an end-to-end image compression method. Background Art
[0002] Recently, the number of images used for machine vision (such as image classification, object detection, and instance segmentation) has increased dramatically. Theoretically, the nonlinear transformation in deep learning-based image compression models provides a more adaptive quantization unit for the multidimensional quantizer, which can surpass the construction limitations of traditional transform coding schemes. However, previous deep learning-based image compression models are usually oriented towards human vision and cannot meet the new scenario of image storage and transmission for machine vision. Therefore, in order to reduce the bit rate after image encoding and improve the accuracy of downstream tasks for machine vision, image compression for machine vision has become a new and important topic.
[0003] After searching the literature on the existing technology, it was found that "Scalable Image Coding for Humans and Machines" published by Hyomin Choi et al. in the 2022 IEEE Transactions on Image Processing journal used scalable coding to truncate the bitstream, so that different bitstreams can correspond to different tasks, such as human vision and machine vision. However, this method requires training multiple tasks and multiple decoders at the same time, which greatly increases the burden of training and model storage.
[0004] To solve this problem, recent studies have adopted hint learning and Transformer, such as "TransTIC: Transferring Transformer-based Image Compression from Human Perception to Machine Perception" published by Yi-Hsin Chen et al. at the 2023 Proceedings of the IEEE / CVF International Conference on Computer Vision. By adding hints at the codec end to migrate the pre-trained compression model for human vision, it can be used for image compression for machine vision, achieving higher efficiency in training cost and model storage.
[0005] However, the cue learning-based method can only be used in the Transformer-based end-to-end image compression model, and still introduces significant additional computational overhead, the performance of downstream tasks is still poor, and the practicality is weak. Summary of the invention
[0006] In response to the above-mentioned problems, the present invention proposes an image encoding, decoding and compression method and system for machine vision, which can efficiently extract the information that machine vision needs more while reducing redundant information for machine vision. It can reduce the image compression bit rate overhead while effectively improving the accuracy of downstream tasks, and can also be applied to any existing end-to-end image compression codec network and entropy model.
[0007] A first aspect of the present invention provides an image encoding method for machine vision, comprising:
[0008] Obtaining a first feature map of the image to be encoded by a space-frequency modulation coding network, wherein the first feature map is a three-dimensional feature map, and the dimensions include a channel dimension, a height dimension, and a width dimension;
[0009] quantizing each eigenvalue in the first feature map into an integer to obtain a second feature map;
[0010] The distribution parameter of the second feature map is modeled as a Gaussian distribution, and the mean and variance of the Gaussian distribution are predicted using an entropy model;
[0011] Probability estimation is performed on the features of the second feature map according to the predicted mean and variance of the Gaussian distribution, and arithmetic coding is performed according to the estimated probability to obtain a compressed image binary code stream.
[0012] Optionally, obtaining a first feature map of the image to be encoded by using a space-frequency modulation coding network includes:
[0013] The space-frequency modulation coding network is composed of multiple space-frequency modulation coding units, the input of the first space-frequency modulation coding unit is the image to be encoded, the input of the th space-frequency modulation coding unit is the output of the th-1st space-frequency modulation coding unit The output of the last space-frequency modulation encoding unit is the first feature map of the image to be encoded;
[0014] The space-frequency modulation coding unit is composed of a basic coding subunit, a first space-domain modulation subunit, and a first frequency-domain modulation subunit, wherein:
[0015] For the ,th space-frequency modulation coding unit, the input Through the basic coding subunit, the basic coding feature map x is obtained. j ;
[0016] The basic encoding feature map xj As the input of the first spatial modulation subunit, the first spatial modulation feature map SMA is obtained j (x j );
[0017] The basic encoding feature map x j As the input of the first frequency domain modulation subunit, the first frequency domain modulation feature map FMA is obtained j (x j );
[0018] Combine the basic encoding feature map x j , the first spatial modulation feature map SMA j (x j ) and the first frequency domain modulation feature map FMA j (x j ), obtain the first space-frequency modulation characteristic diagram As the output of the jth space-frequency modulation coding unit.
[0019] Optionally, the basic coding feature map x j As the input of the first spatial modulation subunit, the first spatial modulation feature map SMA is obtained j (x j ),include:
[0020] The basic encoding feature map x j Input coefficient is The first linear layer of the transformed spatial domain features is obtained
[0021] Will The input coefficient is The second linear layer is used, and the output of the second linear layer is the first depth-separable convolution layer DW_Conv5×5 to obtain the spatial modulation matrix
[0022] Will Through the first ReLU nonlinear mapping layer σ, for For each element of , if the value is greater than 0, Returns the same value, otherwise returns 0;
[0023] Will and Perform Hada code multiplication to multiply the elements of the corresponding positions of the two vectors to obtain the spatial domain modulation result
[0024] Will The input coefficient is The third linear layer obtains the spatial modulation feature map SMA j (x j).
[0025] Optionally, the basic coding feature map x j As the input of the first frequency domain modulation subunit, the first frequency domain modulation feature map FMA is obtained j (x j ),include:
[0026] The basic encoding feature map x j Input coefficient is The fourth linear layer is used, and Fourier transform is performed to obtain frequency domain features
[0027] Will It passes through the second depth-separable convolution layer DW_Conv3×3, the second ReLU nonlinear mapping layer, and another coefficient The fifth linear layer obtains the frequency domain modulation matrix
[0028] Will Through the third ReLU nonlinear mapping layer, and Perform Hada code multiplication to obtain the frequency domain modulation result
[0029] right Perform inverse Fourier transform and pass the coefficients The sixth linear layer of is used to obtain the frequency domain modulation feature map.
[0030] A second aspect of the present invention provides a machine vision-oriented image decoding method, which is used to decode the code obtained by the above-mentioned image encoding method, comprising:
[0031] Obtain the compressed image binary code stream;
[0032] Use the entropy model network to predict the mean and variance of the Gaussian model for the second feature map;
[0033] Performing arithmetic decoding on the characteristic binary code stream according to the mean and variance of the Gaussian model to obtain the second characteristic map;
[0034] The second feature map is passed through a space-frequency modulation decoding network to obtain a reconstructed image for downstream tasks oriented to machine vision.
[0035] Optionally, the space frequency modulation decoding network has the same structure as the space frequency modulation encoding network. The space frequency modulation decoding network is composed of multiple space frequency modulation decoding units, the input of the first space frequency modulation decoding unit is the image to be decoded, and the input of the jth space frequency modulation decoding unit is the output of the j-1th space frequency modulation decoding unit. The output of the last space-frequency modulation decoding unit is the first feature map of the image to be decoded;
[0036] The space-frequency modulation decoding unit is composed of a basic decoding subunit, a second space-domain modulation subunit, and a second frequency-domain modulation subunit, wherein:
[0037] For the j-th space-frequency modulation decoding unit, input is passed through the basic decoding subunit to obtain a basic decoding feature map;
[0038] Using the basic decoding feature map as the input of the second spatial modulation subunit to obtain a second spatial modulation feature map;
[0039] Using the basic decoding feature map as the input of the second frequency domain modulation subunit to obtain a second frequency domain modulation feature map;
[0040] The basic decoding feature map, the second spatial domain modulation feature map and the second frequency domain modulation feature map are combined to obtain a second space-frequency modulation feature map as the output of the j-th space-frequency modulation decoding unit.
[0041] A third aspect of the present invention provides an image compression method for machine vision, comprising:
[0042] Obtain the image to be compressed;
[0043] Based on the above-mentioned image encoding method, a compressed image binary code stream is obtained from the image to be encoded;
[0044] Based on the above-mentioned image decoding method, a reconstructed image for machine vision tasks is obtained from the compressed image binary code stream.
[0045] A fourth aspect of the present invention provides an image compression system, the image compression system comprising an encoder and a decoder, including:
[0046] Encoder: Based on the above image encoding method, obtain a compressed image binary code stream from the image to be encoded;
[0047] Decoder: Based on the above image decoding method, a reconstructed image for machine vision tasks is obtained from the compressed image binary code stream.
[0048] According to a fifth aspect of the present invention, an image compression device is provided, the image compression device comprising a memory and a processor, the memory storing a program executable by the processor, and the processor executing the program can perform any of the following methods:
[0049] - the above-mentioned image coding method for machine vision, or,
[0050] - the above-mentioned image decoding method for machine vision, or,
[0051] -The above-mentioned image compression method for machine vision.
[0052] Compared with the prior art, the embodiments of the present invention have at least one of the following beneficial effects:
[0053] The above-mentioned machine vision-oriented image encoding, decoding and compression method of the present invention utilizes space-frequency modulation to achieve feature optimization, and can significantly reduce information redundancy in the space domain and the frequency domain.
[0054] Compared with the latest methods, the above-mentioned machine vision-oriented image encoding, decoding and compression methods of the present invention can improve the accuracy of reconstructed images for image classification tasks by 30% under the premise of the same bit rate overhead, thereby improving the task accuracy performance.
[0055] The image compression method for machine vision in the embodiment of the present invention can be applied to any existing end-to-end learning image compression codec and entropy encoder, has good flexibility and generalization, and improves the accuracy of reconstructed images for downstream tasks for machine vision. The present invention has extremely strong practical application value, can be applied to different downstream tasks for machine vision, and has low training cost and model storage overhead. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0057] Figure 1 The figure is a flowchart of a machine vision-oriented image encoding method in one embodiment of the present invention.
[0058] Figure 2 The figure is a flowchart of a machine vision-oriented image encoding method in a preferred embodiment of the present invention.
[0059] Figure 3 The figure is a flowchart of a machine vision-oriented image decoding method in a preferred embodiment of the present invention.
[0060] Figure 4 This is a module diagram of image compression for machine vision in one embodiment of the present invention.
[0061] Figure 5 The figure is a flow chart of an image compression method for machine vision in a preferred embodiment of the present invention. DETAILED DESCRIPTION
[0062] The present invention is described in detail below in conjunction with specific embodiments and accompanying drawings. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several variations and improvements may be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.
[0063] Reference Figure 1 FIG. 1 is a flowchart of a method for image encoding for machine vision in an embodiment of the present invention. This embodiment provides a method for image encoding for machine vision, including steps S100-S400. Specifically:
[0064] S100, obtaining a first feature map of an image to be encoded through a space-frequency modulation coding network;
[0065] In this step, the image to be encoded is first determined, and then the first feature map of the image to be encoded is obtained through the space-frequency modulation coding network. Specifically, the space-frequency modulation coding network is composed of multiple space-frequency modulation coding units to extract the first feature map; the space-frequency modulation coding unit is composed of a basic coding subunit, a spatial domain modulation subunit, and a frequency domain modulation subunit; preferably, the basic coding subunit can be implemented by a cascade of a convolutional layer with downsampling and a nonlinear unit.
[0066] In this step, the first feature map obtained is a three-dimensional feature map, and the three-dimensional dimensions include channel dimension, height dimension and width dimension.
[0067] S200, quantizing each eigenvalue in the first feature map into an integer to obtain a second feature map;
[0068] S300, parameterizing the probability distribution of each element of the second feature map into a Gaussian distribution, and using an entropy model network to predict a mean and a variance of the Gaussian distribution;
[0069] Each element of the second feature map is each eigenvalue of the second feature map. The probability distribution of each element is also the probability distribution corresponding to each element in the second feature map, and each element corresponds to a Gaussian distribution.
[0070] In this step, the entropy model can adopt any existing entropy model, such as a hyper-prior entropy model, a spatial autoregressive entropy model, and a channel autoregressive entropy model, etc. Thus, the whole method can be applied to any existing end-to-end image compression codec network and entropy model.
[0071] Preferably, the entropy model network can be implemented using a super-prior network. For example, the second feature map is sequentially passed through a super-encoding neural network to obtain a super-prior feature binary code stream. Further, the super-prior feature binary code stream is passed through a super-decoding neural network to obtain super-prior information.
[0072] S400, performing probability estimation on features of the second feature map according to the predicted mean and variance of the Gaussian distribution, performing arithmetic coding according to the estimated probability, and obtaining a feature binary code stream.
[0073] In the above embodiments of the present invention, by adopting a space-frequency modulation coding network, the information more needed by machine vision can be efficiently extracted, while reducing redundant information for machine vision, which can reduce the image compression bit rate overhead while effectively improving the accuracy of downstream tasks.
[0074] Of course, the above embodiment is not required to strictly follow the above-mentioned super-prior entropy model and the basic coding unit based on the convolution kernel nonlinear unit. For example, the purpose of the present invention can be achieved by using a basic coding unit based on Transformer and an entropy model based on autoregression.
[0075] On the basis of the above embodiment, in order to significantly reduce information redundancy in the spatial domain and the frequency domain, the space-frequency modulation coding unit is composed of a basic coding subunit, a spatial domain modulation subunit, and a frequency domain modulation subunit. The input of the first space-frequency modulation coding unit is the image to be encoded, and the input of the jth space-frequency modulation coding unit is the output of the j-1th space-frequency modulation coding unit. .
[0076] In some preferred embodiments, the space frequency modulation encoding unit performs the following operations:
[0077] For the jth space-frequency modulation coding unit, the input Through the basic encoding subunit, the basic encoding feature map x is obtained j ;
[0078] The basic encoding feature map x j As the input of the spatial modulation subunit, the spatial modulation feature map SMA is obtained j (x j );
[0079] The basic encoding feature map x j As the input of the frequency domain modulation subunit, the frequency domain modulation feature map FMA is obtained j (x j );
[0080] Combined base encoding feature map x j , Spatial Modulation Feature Map SMA j (x j ) and frequency domain modulation signature FMA j (x j ), obtain the space-frequency modulation characteristic diagram As the output of the jth space-frequency modulation coding unit.
[0081] In some preferred embodiments, the basic encoding feature map x j As the input of the spatial modulation subunit, the spatial modulation feature map SMA is obtained j (x j ),include:
[0082] The basic encoding feature map x j Input coefficient is The linear layer obtains the transformed spatial features The formula is:
[0083]
[0084] Will Enter another coefficient as The linear layer and the output of the linear layer are input into the depth-separable convolutional layer DW_Conv 5×5 , and obtain the spatial modulation matrix The formula is:
[0085]
[0086] The above depth separable convolution layer DW_Conv 5×5 The kernel size is preferably 5×5, but of course, it may be other sizes in other embodiments.
[0087] Will Through the ReLU nonlinear mapping layer σ, for For each element of , if the value is greater than 0, Returns the same value, otherwise returns 0;
[0088] Will and Perform Hada code multiplication to multiply the elements of the corresponding positions of the two vectors to obtain the spatial domain modulation result The formula is:
[0089]
[0090] Among them, ⊙ represents the Hadamard multiplication;
[0091] Will Enter another coefficient as The linear layer of the spatial modulation feature map SMA is obtained j (x j ), the formula is:
[0092]
[0093] The basic encoding feature map x jAs the input of the frequency domain modulation subunit, the frequency domain modulation feature map FMA is obtained j (x j ),include:
[0094] The basic encoding feature map x j Input coefficient is The linear layer is transformed into frequency domain features by Fourier transform. The formula is:
[0095]
[0096] in, is Fourier transform;
[0097] Will Sequentially pass through the depth-wise separable convolutional layer DW_Conv 3×3 , ReLU nonlinear mapping layer σ, and another coefficient is The linear layer of the frequency domain modulation matrix The formula is:
[0098]
[0099] The above depth separable convolution layer DW_Conv 3×3 The kernel size is preferably 3×3, but of course, it may be other sizes in other embodiments.
[0100] Will Through the ReLU nonlinear mapping layer σ, and Perform Hada code multiplication to obtain the frequency domain modulation result The formula is:
[0101]
[0102] right Perform an inverse Fourier transform and pass it through another coefficient The linear layer obtains the frequency domain modulation feature map FMA j (x j ), the formula is:
[0103]
[0104] in, is the inverse Fourier transform.
[0105] In the above embodiment of the present invention, for the jth space frequency modulation coding unit, the input Through the basic encoding subunit, the basic encoding feature map x is obtained jThe basic coding subunit can be a coding unit of any existing end-to-end image compression method, including but not limited to a convolutional layer, a residual block, and a Transformer block. Therefore, the embodiment of the present invention can be applied to any existing end-to-end image compression codec network and entropy model network.
[0106] Figure 2 Flow chart of a method for machine vision-oriented image coding in a preferred embodiment of the present invention. In this preferred embodiment, the method for machine vision-oriented image coding may include steps S101-S108, specifically:
[0107] S101, three-dimensional feature extraction: The image to be encoded is passed through the space-frequency modulation coding network to obtain a feature map, the feature map is a three-dimensional feature, and the three-dimensional dimensions include channel dimension, height dimension and width dimension; the space-frequency modulation coding network can refer to the detailed description in the above embodiment.
[0108] S102, super prior feature extraction and quantization: using a super coding neural network to obtain a super prior feature for the three-dimensional feature; rounding off the super prior feature and quantizing it to an integer;
[0109] S103, super a priori feature encoding: establishing a distribution estimate for the super a priori features that is independent of each other, and using the distribution estimate to perform arithmetic encoding on the super a priori features to obtain a super a priori feature binary code stream;
[0110] S104, super-prior feature decoding: performing arithmetic decoding on the super-prior feature binary code stream to obtain restored super-prior features; using a super-decoding neural network to obtain super-prior information on the restored super-prior features;
[0111] S105, quantization: rounding off the three-dimensional features into integers;
[0112] S106: Probabilistic entropy modeling: parameterize the distribution of each feature of the three-dimensional feature into a Gaussian distribution, and use hyper-prior information to predict the mean and variance of the Gaussian distribution;
[0113] S107, three-dimensional feature coding: performing probability estimation on each of the three-dimensional features according to the predicted mean and variance of the Gaussian distribution, performing arithmetic coding according to the estimated probability, and obtaining a feature binary code stream of the three-dimensional feature;
[0114] S108, code stream synthesis: further merging the feature binary code stream with the super-a priori feature binary code stream to obtain a compressed image binary code stream.
[0115] In the above embodiment of the present invention, by optimizing the features of space-frequency modulation, it is possible to efficiently extract the information that is more needed by machine vision, while reducing the redundant information for machine vision, thereby reducing the image compression bitrate overhead and effectively improving the accuracy of downstream tasks. Figure 1 The description in the illustrated embodiment.
[0116] Corresponding to the above-mentioned image encoding method for machine vision, another embodiment of the present invention provides an image decoding method for machine vision, which is used to decode the code obtained by the above-mentioned image encoding method for machine vision. Specifically, the image decoding method for machine vision includes:
[0117] M101, obtain the compressed image binary code stream;
[0118] M102, uses the entropy model network to predict the mean and variance of the Gaussian model for the second feature map;
[0119] M103, performing arithmetic decoding on the characteristic binary code stream according to the mean and variance of the Gaussian model to obtain the second characteristic graph;
[0120] M104, passing the second feature map through a space-frequency modulation decoding network to obtain a reconstructed image for downstream tasks oriented to machine vision.
[0121] In the above-mentioned image decoding method for machine vision, the space-frequency modulation decoding network has the same structure as the space-frequency modulation encoding network, and the specific implementation technology is also the same.
[0122] For example, the spatial modulation subunit and frequency modulation subunit of the space-frequency modulation decoding network are completely consistent with the space-frequency modulation encoding network. Specifically, the space-frequency modulation decoding network is composed of multiple space-frequency modulation decoding units. The input of the first space-frequency modulation decoding unit is the image to be decoded, and the input of the jth space-frequency modulation decoding unit is the output of the j-1th space-frequency modulation decoding unit. The output of the last space-frequency modulation decoding unit is the first feature map of the image to be decoded.
[0123] Furthermore, the space-frequency modulation decoding unit is composed of a basic decoding sub-unit, a spatial domain modulation sub-unit, and a frequency domain modulation sub-unit, wherein: for the j-th space-frequency modulation decoding unit, the input is passed through the basic decoding sub-unit to obtain a basic decoding feature map; the basic decoding feature map is used as the input of the spatial domain modulation sub-unit to obtain a spatial domain modulation feature map; the basic decoding feature map is used as the input of the frequency domain modulation sub-unit to obtain a frequency domain modulation feature map; the basic decoding feature map, the spatial domain modulation feature map and the frequency domain modulation feature map are combined to obtain a space-frequency modulation feature map as the output of the j-th space-frequency modulation decoding unit.
[0124] For the parts not described in detail in the above-mentioned space-frequency modulation decoding unit and its basic decoding subunit, space-domain modulation subunit, and frequency-domain modulation subunit, please refer to Figure 1 The corresponding description of the space-frequency modulation coding network in the illustrated embodiment will not be repeated here.
[0125] Figure 3 FIG. 1 is a flow chart of a method for image decoding for machine vision in a preferred embodiment of the present invention. Figure 3 As shown, in this preferred embodiment, the image decoding method includes steps S201-S205:
[0126] S201, code stream decomposition: decomposing the compressed image binary code stream to obtain a feature binary code stream and a super-a priori feature binary code stream;
[0127] S202, super-prior feature decoding: performing arithmetic decoding on the super-prior feature binary code stream to obtain restored super-prior features; using a super-decoding neural network on the restored super-prior features to obtain super-prior information;
[0128] S203, Probabilistic Entropy Modeling: The structure and parameter values of this module are similar to Figure 2 The probability entropy modeling in the preferred embodiment shown is exactly the same. In which, the mean and variance of the Gaussian model used to decode each feature in the second feature map can be predicted by super prior information.
[0129] S204, three-dimensional feature decoding: performing arithmetical decoding on the feature binary code stream according to the mean and variance of the Gaussian model to obtain quantized three-dimensional features.
[0130] S205, image reconstruction: The reconstructed quantized three-dimensional features are decoded through a space-frequency modulation network to obtain a reconstructed image for downstream tasks oriented to machine vision.
[0131] The machine vision-oriented image decoding method of this embodiment is used to correspond to Figure 2 The image coding method for machine vision shown in the figure uses hyper-prior information to predict the mean and variance of the Gaussian model; the three-dimensional features are decoded through a space-frequency modulation network to obtain a reconstructed image for downstream tasks for machine vision, effectively improving the accuracy of downstream tasks.
[0132] Based on the above-mentioned image encoding method and decoding method for machine vision, in another embodiment of the present invention, a method for image compression for machine vision is also provided, comprising:
[0133] M201, obtain the image to be compressed;
[0134] M202, based on the image encoding method of the above embodiment, obtaining a compressed image binary code stream from the image to be encoded;
[0135] M203, based on the image decoding method of the above embodiment, obtain a reconstructed image for machine vision tasks from the compressed image binary code stream.
[0136] In the above-mentioned embodiments M201-M203, the image encoding method and the image decoding method are based on a space-frequency modulation encoding network and a space-frequency modulation decoding network, and both include a space-domain modulation subunit, a frequency-domain modulation subunit, and a basic encoding subunit or a basic decoding subunit. The basic decoding unit and the basic decoding subunit may be decoding units of any existing end-to-end image compression method, including but not limited to a convolutional layer, a residual block, and a Transformer block; at the same time, an entropy model is used to predict the mean and variance of the Gaussian distribution, and the entropy model may be any entropy model, such as a hyper-prior entropy model, a spatial autoregressive entropy model, and a channel autoregressive entropy model.
[0137] In some embodiments, the parameters of the basic encoding subunit in the image encoding method, the basic decoding subunit in the image decoding method, and the entropy model are obtained through rate-distortion optimization:
[0138]
[0139] Among them, distortion x is the image to be compressed, is the reconstructed image, λ1>0 is a preset parameter for balancing distortion and bit rate, and the bit rate R1 is calculated based on the Gaussian distribution of each element (each eigenvalue) of the second feature map:
[0140]
[0141] in, is the feature of the kth element, is the predicted distribution of the kth element, θ k ={φ k , ψ k} is a set of learnable parameters.
[0142] Optionally, parameters of the first spatial domain modulation subunit, the first frequency domain modulation subunit in the image encoding method and the second spatial domain modulation subunit, the second frequency domain modulation subunit in the image decoding method are obtained by optimizing the code rate and task accuracy:
[0143]
[0144] in, The loss function related to the accuracy of the downstream task, λ2>0 is a preset parameter for balancing distortion and task accuracy, and the bit rate R2 is calculated in the same way as the bit rate R1.
[0145] Corresponding to the above-mentioned image compression method for machine vision, another embodiment of the present invention further provides an image compression device for machine vision, referring to Figure 4 As described above, 50,000 images with a resolution of 256×256 in the ImageNet-val test set are compressed, including:
[0146] S301 acquisition module: sequentially obtain the images to be compressed;
[0147] S302 Encoder: Encode the image to be compressed according to steps S101-S108 to obtain a compressed image binary code stream.
[0148] Exemplarily, the space-frequency modulation coding network is composed of 4 basic coding sub-units, 3 spatial domain modulation sub-units, and 3 frequency domain modulation sub-units alternately cascaded, and the number of channels of the extracted three-dimensional features is 192, the height is 16, and the width is 16.
[0149] S303 decoder: decompress the compressed image binary code stream according to S201-S205 to obtain a reconstructed image for downstream image classification tasks.
[0150] The number of channels, height and width of the three-dimensional features are exactly the same as those of the encoder. The space-frequency modulation decoding network consists of four basic decoding units, three space-domain modulation sub-units and three frequency-domain modulation sub-units in alternating cascade.
[0151] The compression method in the above embodiment of the present invention is based on Figure 1 , 2 Image coding method for machine vision and Figure 3 The image encoding method for machine vision shown in the figure is implemented. For the parts not described in detail above, reference can be made to the corresponding description in the above embodiments and will not be repeated here.
[0152] The compression method in the above embodiment of the present invention can efficiently extract the information that is more needed for machine vision, while reducing redundant information for machine vision, and can reduce the image compression bit rate overhead while effectively improving the accuracy of downstream tasks.
[0153] Based on the same technical concept of the above-mentioned image compression device for machine vision, another embodiment of the present invention provides an image compression method, including:
[0154] Obtain the image to be compressed;
[0155] Using the machine vision-oriented image encoding method in any of the above embodiments to obtain a compressed image binary code stream;
[0156] The compressed image binary code stream is decompressed using the machine vision-oriented image decoding method in any of the above embodiments to obtain a reconstructed image for machine vision-oriented downstream tasks.
[0157] For the above-mentioned image compression method, the compression effect can be improved by training the model. For example, the training set consists of one million natural images in the ImageNet-train dataset, and the trained model can be used to implement image encoding and decoding for machine vision.
[0158] Specifically, Figure 5 As shown, in a preferred embodiment, the image compression method includes:
[0159] S401, three-dimensional feature extraction: randomly crop the images in the training set into images with a resolution of 256×256, and input them into the space-frequency modulation coding network to obtain three-dimensional features, wherein: the space-frequency modulation coding network is composed of a basic coding subunit, a combination of a spatial modulation subunit and a frequency domain modulation subunit, a basic coding unit, a combination of a spatial modulation subunit and a frequency domain modulation subunit, a basic coding unit, a combination of a spatial modulation subunit and a frequency domain modulation subunit, and a basic coding unit in cascade sequence; wherein the basic coding subunit is composed of a convolutional layer with downsampling and a ReLU nonlinear unit in cascade; the number of three-dimensional feature channels is 192, and the height and width are both 16; of course, the above-mentioned image resolution size and three-dimensional feature parameters in this embodiment can be adjusted according to actual conditions, and are not limited to those described in this step, and the parameters in the following steps are also the same. Correspondingly, the basic coding subunit in the space-frequency modulation coding network can also adopt other network structures, such as Transformer and residual block, etc., and are not limited to the basic coding unit in this step.
[0160] S402, super-prior feature extraction and noise addition: input the three-dimensional features into the super-prior coding neural network to obtain the super-prior features. In order to avoid the gradient being 0 everywhere caused by the quantization operation, a uniformly distributed noise of -0.5 to 0.5 is added to the super-prior features to simulate the actual quantization, wherein: the super-prior coding neural network is composed of three cascaded convolutional layers; of course, the super-prior coding neural network can also be other network structures, such as three cascaded residual modules, etc., and is not limited to the super-prior coding neural network in this step.
[0161] S403, super a priori feature bit rate estimation: establishing a distribution estimation between the super a priori features that is independent of each other, and using the distribution estimation to obtain the super a priori feature bit rate estimation;
[0162] S404, obtaining super-prior information: inputting the super-prior features after adding noise into the super-prior decoding neural network to obtain super-prior information, wherein: the super-prior decoding neural network is composed of three convolutional layers in cascade;
[0163] S405, feature noise addition: to avoid the gradient being zero everywhere due to the quantization operation, a uniformly distributed noise of -0.5 to 0.5 is added to the three-dimensional feature to simulate actual quantization;
[0164] S406, Gaussian distribution probability modeling: The structure of this module is Figure 2 The probability entropy modeling in the illustrated embodiment is exactly the same; the hyper-prior information is used to predict the mean and variance of the Gaussian distribution; of course, the entropy model network may also be in other forms, such as a spatial context-based autoregressive model and a reconstruction context-based autoregressive model.
[0165] S407, characteristic code rate estimation: obtaining characteristic code rate estimation according to the mean and variance of the predicted Gaussian distribution;
[0166] S408, total bit rate estimation: adding the super a priori characteristic bit rate estimation and the characteristic bit rate estimation to obtain a total bit rate estimation;
[0167] S409, image reconstruction: input the three-dimensional features after adding noise into the decoding neural network to obtain a reconstructed image, wherein: the space-frequency modulation decoding network is composed of a basic coding subunit, a combination of a spatial modulation subunit and a frequency domain modulation subunit, a basic coding subunit, a combination of a spatial modulation subunit and a frequency domain modulation subunit, a basic coding subunit, a combination of a spatial modulation subunit and a frequency domain modulation subunit, and a basic coding subunit in cascade sequence; wherein the basic coding subunit is a convolutional layer with upsampling and a ReLU nonlinear unit in cascade; in some possible implementations, the above-mentioned image compression method for machine vision can be used as an image compression model, which can be further optimized in stages using the stochastic gradient descent method. In the first stage, the spatial modulation subunit and the frequency domain modulation subunit are disabled by short-circuiting, and only the basic coding subunit, the basic decoding subunit and the entropy encoder are optimized. The loss function of the first stage is:
[0168]
[0169] Among them, distortion x is the image to be compressed, is the reconstructed image, λ1>0 is a preset parameter for balancing distortion and bit rate, and the bit rate R1 is calculated according to the Gaussian distribution of each element of the second feature map:
[0170]
[0171] in, is the feature of the kth element, is the predicted distribution of the kth element, θ k ={φ k , ψ k} is a set of learnable parameters.
[0172] In the second stage, the basic coding subunit, the basic decoding subunit and the entropy encoder are fixed, and the spatial modulation subunit and the frequency modulation subunit are inserted into the codec, and their parameters are optimized by the following formula:
[0173]
[0174] in, The loss function related to the accuracy of the downstream task, λ2>0 is a preset parameter used to balance distortion and task accuracy. The bit rate R2 is calculated in the same way as the bit rate R1 described in the first stage.
[0175] In another embodiment of the present invention, an image compression system is provided, wherein the image compression system includes an encoder and a decoder, including:
[0176] Encoder: Based on the image encoding method in any one of the above embodiments, obtain a compressed image binary code stream from the image to be encoded;
[0177] Decoder: Based on the image decoding method in any of the above embodiments, a reconstructed image for machine vision tasks is obtained from the compressed image binary code stream.
[0178] It should be noted that the above method and system may correspond to each other. Since the principles of the method and system are similar, the implementation process of the system and the method may refer to each other and will not be described in detail here.
[0179] In another embodiment of the present invention, an image compression device is provided, the image compression device comprising a memory and a processor, the memory storing a program executable by the processor, and the processor can perform any of the following methods when executing the program:
[0180] - the image encoding method for machine vision in any of the above embodiments, or,
[0181] - the image decoding method for machine vision in any of the above embodiments, or,
[0182] -The image compression method for machine vision in any of the above embodiments.
[0183] Implementation effect:
[0184] In the above embodiment, the ImageNet dataset is used to train the image compression model for machine vision. In the first stage, λ is set to 0.0018, 0.0035, 0.0067, and 0.0130, respectively, corresponding to four image compression models with different bit rates. The Adam optimizer is used for 2,000,000 steps of optimization. The initial 1,800,000 steps of learning rate is set to 10 -4 , then dropped to 3*10 -5 , and finally dropped to 10 at 1950000 steps -5 In the second stage, λ is set to 0.0018, 0.0035, 0.0067, and 0.0130, corresponding to four different bit rates, respectively. The Adam optimizer is used for 500,000 steps of optimization, and the learning rate is set to 10 -4 .
[0185] In the above embodiment, the image encoders of the six machine vision-oriented image compression models were used to compress 50,000 images with a resolution of 256×256 in the ImageNet-val test set. The average bit rates of the compressed images were 0.0774bpp, 0.1306bpp, 0.2068bpp, and 0.339bpp, respectively; In the above embodiment, the image encoders of the four machine vision-oriented image compression models were used to compress 50,000 images with a resolution of 256×256 in the ImageNet-val test set to obtain reconstructed images for visual tasks. The reconstructed images were used for downstream image classification tasks based on ResNet-50, and the classification accuracies were 64.50%, 69.59%, 72.44%, and 74.59%, respectively.
[0186] Compared with the method using the benchmark neural network, the image compression method for machine vision provided in the above embodiment of the present invention has better rate-distortion performance. Specifically, under the premise of the same bit rate overhead, the accuracy of the reconstructed image for image classification tasks can be improved by 30%, thereby improving the rate task accuracy performance.
[0187] The image compression method for machine vision in the embodiment of the present invention can be applied to any existing end-to-end learning image compression codec and entropy encoder, has good flexibility and generalization, and improves the accuracy of reconstructed images for downstream tasks for machine vision. The present invention has extremely strong practical application value, can be applied to different downstream tasks for machine vision, and has low training cost and model storage overhead.
[0188] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0189] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0190] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0191] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0192] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various modifications or variations within the scope of the claims, which does not affect the essence of the present invention. The above preferred features can be used in any combination without conflicting with each other.
Claims
1. A method for image coding for machine vision, characterized in that: include: Obtaining a first feature map of the image to be encoded by a space-frequency modulation coding network, wherein the first feature map is a three-dimensional feature map, and the dimensions include a channel dimension, a height dimension, and a width dimension; quantizing each eigenvalue in the first feature map into an integer to obtain a second feature map; The distribution parameter of the second feature map is modeled as a Gaussian distribution, and the mean and variance of the Gaussian distribution are predicted using an entropy model; Probability estimation is performed on the features of the second feature map according to the predicted mean and variance of the Gaussian distribution, and arithmetic coding is performed according to the estimated probability to obtain a compressed image binary code stream.
2. The machine vision-oriented image coding method according to claim 1, characterized in that: The step of obtaining a first feature map of an image to be encoded by using a space-frequency modulation encoding network includes: The space-frequency modulation coding network is composed of multiple space-frequency modulation coding units, the input of the first space-frequency modulation coding unit is the image to be coded, the input of the jth space-frequency modulation coding unit is the output of the j-1th space-frequency modulation coding unit The output of the last space-frequency modulation encoding unit is the first feature map of the image to be encoded; The space-frequency modulation coding unit is composed of a basic coding subunit, a first space-domain modulation subunit, and a first frequency-domain modulation subunit, wherein: For the jth space-frequency modulation coding unit, the input Through the basic coding subunit, the basic coding feature map x is obtained. j ; The basic encoding feature map x j As the input of the first spatial modulation subunit, the first spatial modulation feature map SMA is obtained j (x j ); The basic encoding feature map x j As the input of the first frequency domain modulation subunit, the first frequency domain modulation feature map FMA is obtained j (x j ); Combine the basic encoding feature map x j , the first spatial modulation feature map SMA j (x j ) and the first frequency domain modulation feature map FMA j (x j ), obtain the first space-frequency modulation characteristic diagram As the output of the jth space-frequency modulation coding unit.
3. The image coding method for machine vision according to claim 2, characterized in that: The basic encoding feature map x j As the input of the first spatial modulation subunit, the first spatial modulation feature map SMA is obtained j (x j ),include: The basic encoding feature map x j Input coefficient is The first linear layer of the transformed spatial domain features is obtained Will The input coefficient is The second linear layer is constructed, and the output of the second linear layer is input into the first depth-separable convolutional layer to obtain the spatial modulation matrix Will Through the first ReLU nonlinear mapping layer σ, for For each element of , if the value is greater than 0, Returns the same value, otherwise returns 0; Will and Perform Hada code multiplication to multiply the elements of the corresponding positions of the two vectors to obtain the spatial domain modulation result Will The input coefficient is The third linear layer obtains the spatial modulation feature map SMA j (x j ).
4. The machine vision-oriented image coding method according to claim 2, characterized in that: The basic encoding feature map x j As the input of the first frequency domain modulation subunit, the first frequency domain modulation feature map FMA is obtained j (x j ),include: The basic encoding feature map x j Input coefficient is The fourth linear layer is used, and Fourier transform is performed to obtain frequency domain features Will It passes through the second depth-wise separable convolutional layer, the second ReLU nonlinear mapping layer, and another coefficient The fifth linear layer obtains the frequency domain modulation matrix Will Through the third ReLU nonlinear mapping layer, and Perform Hada code multiplication to obtain the frequency domain modulation result right Perform inverse Fourier transform and pass the coefficients The sixth linear layer of is used to obtain the frequency domain modulation feature map.
5. The machine vision-oriented image coding method according to claim 2, characterized in that: The basic coding subunit is a coding unit of any end-to-end image compression method.
6. The machine vision-oriented image coding method according to any one of claims 1 to 5, characterized in that: The entropy model is any one of a hyper-priori entropy model, a spatial autoregressive entropy model and a channel autoregressive entropy model.
7. A machine vision-oriented image decoding method, used for decoding the code obtained in any one of claims 1 to 6, characterized in that: include: Obtain the compressed image binary code stream; Use the entropy model network to predict the mean and variance of the Gaussian model for the second feature map; Performing arithmetic decoding on the characteristic binary code stream according to the mean and variance of the Gaussian model to obtain the second characteristic map; The second feature map is passed through a space-frequency modulation decoding network to obtain a reconstructed image for downstream tasks oriented to machine vision.
8. The method for image decoding for machine vision according to claim 7, characterized in that: The space-frequency modulation decoding network is composed of multiple space-frequency modulation decoding units. The input of the first space-frequency modulation decoding unit is the image to be decoded, and the input of the jth space-frequency modulation decoding unit is the output of the j-1th space-frequency modulation decoding unit. The output of the last space-frequency modulation decoding unit is the first feature map of the image to be decoded; The space-frequency modulation decoding unit is composed of a basic decoding subunit, a second space-domain modulation subunit, and a second frequency-domain modulation subunit. Composition, of which: For the j-th space-frequency modulation decoding unit, input is passed through the basic decoding subunit to obtain a basic decoding feature map; Using the basic decoding feature map as the input of the second spatial modulation subunit to obtain a second spatial modulation feature map; Using the basic decoding feature map as the input of the second frequency domain modulation subunit to obtain a second frequency domain modulation feature map; The basic decoding feature map, the second spatial domain modulation feature map and the second frequency domain modulation feature map are combined to obtain a second space-frequency modulation feature map as the output of the j-th space-frequency modulation decoding unit.
9. The method for image decoding for machine vision according to claim 7, characterized in that: The basic decoding unit is a decoding unit of any existing end-to-end image compression method.
10. An image compression method for machine vision, characterized in that: include: Obtain the image to be compressed; Based on the image encoding method according to any one of claims 1 to 6, a compressed image binary code stream is obtained from the image to be encoded; Based on the image decoding method described in any one of claims 7 to 9, a reconstructed image for machine vision tasks is obtained from the compressed image binary code stream.
11. The machine vision-oriented image compression method according to claim 10, characterized in that: The parameters of the basic encoding subunit in the image encoding method, the basic decoding subunit in the image decoding method, and the entropy model are obtained through rate-distortion optimization: Among them, distortion x is the image to be compressed, is the reconstructed image, λ1>0 is a preset parameter for balancing distortion and bit rate, and the bit rate R1 is calculated according to the Gaussian distribution of each element of the second feature map: in, is the feature of the kth element, is the predicted distribution of the kth element, θ k ={φ k ,ψ k } is a set of learnable parameters.
12. The image compression method for machine vision according to claim 10, characterized in that: The parameters of the first spatial domain modulation subunit, the first frequency domain modulation subunit in the image encoding method and the second spatial domain modulation subunit, the second frequency domain modulation subunit in the image decoding method are obtained by optimizing the code rate and task accuracy: in, The loss function related to the accuracy of the downstream task, λ2>0 is a preset parameter for balancing distortion and task accuracy, and the bit rate R2 is consistent with the bit rate calculation method described in claim 11.
13. An image compression system, comprising an encoder and a decoder, characterized in that: include: Encoder: Based on the image encoding method according to any one of claims 1 to 6, obtain a compressed image binary code stream from the image to be encoded; Decoder: Based on the image decoding method described in any one of claims 7 to 9, a reconstructed image for machine vision tasks is obtained from the compressed image binary code stream.
14. An image compression device, comprising a memory and a processor, wherein the memory stores a program executable by the processor, wherein: When executing the program, the processor may perform any of the following methods: - the image encoding method according to any one of claims 1 to 6, or, - the image decoding method according to any one of claims 7 to 9, or, -The image compression method according to any one of claims 10 to 12.
Citation Information
Patent Citations
Imaging acceleration method and device for space-frequency spectrum multi-dimensional joint modulation
CN111698435A
Image coding, decoding and compression method based on frequency domain feature perception learning
CN117354523A
Method and system for evaluating anti-interference effect of multi-dimensional communication pair
CN117811686A
KR20230031808A
