WO2021169408A1 - Image processing method and apparatus, and electronic device and storage medium - Google Patents

Image processing method and apparatus, and electronic device and storage medium Download PDF

Info

Publication number
WO2021169408A1
WO2021169408A1 PCT/CN2020/128207 CN2020128207W WO2021169408A1 WO 2021169408 A1 WO2021169408 A1 WO 2021169408A1 CN 2020128207 W CN2020128207 W CN 2020128207W WO 2021169408 A1 WO2021169408 A1 WO 2021169408A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
instruction
processing
parameter
compressed
Prior art date
Application number
PCT/CN2020/128207
Other languages
French (fr)
Chinese (zh)
Inventor
王晶
白博
葛运英
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2021169408A1 publication Critical patent/WO2021169408A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • G06T9/007Transform coding, e.g. discrete cosine transform
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • G06T9/005Statistical coding, e.g. Huffman, run length coding

Definitions

  • the embodiments of the present application relate to the field of image processing technology in the field of computer vision technology in the field of artificial intelligence, and specifically, to an image processing method, device, electronic device, and storage medium.
  • Image compression is extremely important for data storage and transmission. Uncompressed images will take up a huge amount of storage space and at the same time will bring huge pressure on transmission. The reason why the image can be compressed is because there is redundant information in the image.
  • the redundant information mainly includes: spatial redundancy caused by the correlation between adjacent pixels in the image, and spectrum caused by the correlation between different color planes or spectrum bands. Redundancy, etc.
  • the purpose of image compression is to reduce the number of bits required to represent the image by removing these redundant information.
  • bit rate refers to the amount of compressed data of the picture displayed per second, so , How to achieve a compression model corresponding to multiple code rates while ensuring the compression effect is a problem that researchers need to solve.
  • the purpose of the embodiments of the present application is to provide an image processing method, device, electronic device, and storage medium to solve the problem of how to achieve a compression model corresponding to multiple code rates while ensuring the compression effect.
  • an embodiment of the present application provides an image processing method.
  • the image processing method includes: acquiring an original image; in response to an operation on the original image, determining a target strategy from a plurality of preset strategies, of which at least two The code rate of the compressed data corresponding to the preset strategy is different; according to the target strategy, the original image is preprocessed to obtain the image to be compressed; the preset deep learning image compression framework is used to perform the compression on the image to be compressed.
  • Compressed to obtain the compressed data wherein the compressed data is used to obtain a restored image by decompressing through a preset deep learning image decompression framework, and the restored image is used to perform a restoration based on the reverse strategy of the target strategy
  • the reverse processing of the preprocessing obtains a reconstructed image corresponding to the original image.
  • the image processing method provided by the embodiment of this application first sets up a pre-processing link, including multiple preset strategies. When compressing, select a target strategy from the multiple preset strategies to preprocess the original image, and then perform pre-processing on the obtained image to be compressed.
  • the selected target strategy is different, and the code rate of the compressed data will be different, so as to achieve the purpose of one compression model corresponding to multiple code rates;
  • the deep learning image compression framework is used for compression to improve the compression performance;
  • the compressed data is used for decompression, first use the deep learning image decompression framework to decompress the compressed data, and then use the reverse strategy of the target strategy to do the reverse processing of the preprocessing of the obtained restored image, so that the reconstructed image
  • the visual quality is basically unchanged. Therefore, the embodiments of the present application can realize that one compression model corresponds to multiple code rates while ensuring the compression effect.
  • different first instructions and first parameters are used to preprocess the original image, and the corresponding compressed data has different code rates.
  • the first instruction includes a global zoom instruction
  • the first parameter includes a global zoom factor and a zoom kernel
  • the original image is preprocessed according to the first instruction and the first parameter
  • the step of obtaining the image to be compressed includes: performing global scaling on the original image in accordance with the global scaling instruction, global scaling factor, and scaling kernel to obtain the image to be compressed.
  • the first command is a global zoom command
  • different global zoom coefficients are used to perform global zoom on the original image, and the code rates of the corresponding compressed data are different.
  • the first instruction includes an adaptive scaling instruction
  • the first parameter includes a block parameter
  • the original image is preprocessed according to the first instruction and the first parameter to obtain
  • the step of the image to be compressed includes: dividing the original image according to the block parameters to obtain a plurality of image blocks; according to the adaptive scaling instruction and the image characteristics of each image block, each Each of the image blocks is adaptively scaled to obtain the image block to be compressed corresponding to each of the image blocks, wherein the image to be compressed includes a plurality of image blocks to be compressed, and the image feature is used to determine the image The zoom factor of the block.
  • the adaptive zoom instruction refers to a method of adaptively zooming the original image.
  • Adaptive scaling of the original image refers to the image feature of the original image (for example, color feature, texture feature, shape feature, etc.), the area with different image features is scaled to different degrees, for example, the background area is more zoomed. The foreground area is less zoomed.
  • Performing adaptive scaling for each image block refers to determining the scaling factor of each image block according to the image characteristics corresponding to each image block, and then performing block reduction or block enlargement according to the respective scaling factors.
  • the image block with more image features has a larger scaling factor; the image block with fewer image features has a smaller scaling factor. That is, smooth image blocks are scaled more, and unsmooth image blocks are scaled less.
  • the first instruction is an adaptive scaling instruction
  • an image block with more image features has a larger scaling factor
  • an image block with fewer image features has a smaller scaling factor.
  • the first instruction includes a blur processing instruction
  • the first parameter includes a blur kernel
  • the original image is preprocessed according to the first instruction and the first parameter to obtain the
  • the step of the image to be compressed includes: performing blur processing on the original image according to the blur processing instruction and the blur kernel to obtain the image to be compressed.
  • the first instruction is a fuzzy processing instruction
  • the fuzzy kernel by adjusting the fuzzy kernel, compression of different code rates can be realized.
  • the first instruction includes an image degradation instruction
  • the first parameter includes an image degradation parameter
  • the original image is preprocessed according to the first instruction and the first parameter to obtain the
  • the step of the image to be compressed includes: performing image degradation on the original image according to the image degradation instruction and the image degradation parameter to obtain the image to be compressed.
  • the first instruction is an image degradation instruction
  • the image degradation parameter by adjusting the image degradation parameter, compression at different code rates can be realized.
  • the larger the image degradation parameter the smaller the bit rate of the compressed data.
  • the first instruction includes an image separation instruction and a first post-processing instruction
  • the first parameter includes an image separation parameter corresponding to the image separation instruction and an image separation parameter corresponding to the first post-processing instruction
  • the first post-stage processing parameter; the step of preprocessing the original image according to the first instruction and the first parameter to obtain the image to be compressed includes: according to the image separation instruction and the The image separation parameter is used to perform image separation on the original image to obtain an edge image and a texture image; according to the first post-processing instruction and the first post-processing parameter, the edge image and the texture image are At least one of global scaling, adaptive scaling, blur processing, and image degradation is performed to obtain an edge image to be compressed and a texture image to be compressed, wherein the image to be compressed includes the edge image to be compressed and the edge image to be compressed Texture image.
  • the first instruction is an image separation instruction and a first post-processing instruction
  • the image separation parameter and the first post-processing parameter by adjusting the image separation parameter and the first post-processing parameter, compression at different bit rates can be realized.
  • the first instruction includes an image segmentation instruction and a second post-processing instruction
  • the first parameter includes a segmentation category corresponding to the image segmentation instruction and a second post-processing instruction corresponding to the second post-processing instruction.
  • Two post-stage processing parameters; the step of preprocessing the original image according to the first instruction and the first parameter to obtain the image to be compressed includes: following the image segmentation instruction and the Segmentation category, image segmentation is performed on the original image to obtain multiple image regions; according to the second post-processing instruction and the second post-processing parameters, the multiple image regions are globally zoomed and automatically At least one of scaling, blur processing, and image degradation is adapted to obtain a to-be-compressed image area corresponding to each of the image areas, where the to-be-compressed image includes a plurality of to-be-compressed image areas.
  • the first instruction is an image segmentation instruction and a second post-stage processing instruction
  • the segmentation category and the second post-stage processing parameter by adjusting the segmentation category and the second post-stage processing parameter, compression at different code rates can be realized.
  • the deep learning image compression framework includes a first deep neural network, a quantization model, and an entropy coding model; the step of compressing the image to be compressed using a preset deep learning image compression framework to obtain compressed data , Including: using the first deep neural network to perform feature extraction on the image to be compressed to obtain image features; using the quantization model to quantize the image features to obtain compressed features; using the entropy coding model to Entropy coding is performed on the compressed feature to obtain the compressed data.
  • an embodiment of the present application further provides an image processing method, the image processing method includes: obtaining compressed data, wherein the compressed data is obtained by compressing an image to be compressed using a preset deep learning image compression framework, The image to be compressed is obtained by preprocessing the original image according to a target strategy, and the target strategy is determined from a plurality of preset strategies in response to an operation on the original image, and at least two of the preset strategies correspond to The code rate of the compressed data is different; the compressed data is decompressed using a preset deep learning image decompression framework to obtain a restored image; the reverse strategy corresponding to the target strategy is obtained; according to the reverse strategy Performing the reverse processing of the pre-processing on the restored image to obtain a reconstructed image corresponding to the original image.
  • the step of obtaining a reverse strategy corresponding to the target strategy includes: obtaining the target strategy, the target strategy including a first instruction and a first parameter corresponding to the first instruction; The corresponding relationship between the first instruction and the preset instruction determines the second instruction; the second parameter is determined according to the first parameter and the preset parameter calculation rule, wherein the reverse strategy includes the second instruction and the The second parameter corresponding to the second instruction.
  • the step of performing reverse processing of the preprocessing on the restored image according to the reverse strategy to obtain a reconstructed image corresponding to the original image includes: following the second instruction and the The second parameter is to perform reverse processing of the pre-processing on the restored image to obtain a reconstructed image corresponding to the original image.
  • the first instruction includes a global zoom instruction
  • the first parameter includes a global zoom factor and a zoom core
  • the second instruction includes a global zoom instruction
  • the second parameter includes the reciprocal of the global zoom factor and zoom Core
  • the step of performing the pre-processing reverse processing on the restored image according to the second instruction and the second parameter to obtain a reconstructed image corresponding to the original image includes: according to the The global zoom instruction, the reciprocal of the global zoom coefficient, and the zoom kernel perform global zoom on the restored image to obtain the reconstructed image.
  • the first instruction includes an adaptive scaling instruction
  • the first parameter includes a block parameter
  • the second instruction includes an adaptive scaling instruction
  • the second parameter includes a splicing associated with the block parameter.
  • the restored image includes a plurality of restored image blocks;
  • the restored image is subjected to the reverse processing of the pre-processing in accordance with the second instruction and the second parameter to obtain a corresponding to the original image
  • the step of reconstructing the image includes: performing adaptive scaling on each restored image block according to the adaptive scaling instruction and the image characteristics of each restored image block, to obtain a corresponding to each restored image block
  • the image block to be reconstructed wherein the image feature is used to determine the scaling factor of the restored image block; and a plurality of image blocks to be reconstructed are spliced according to the splicing parameter to obtain the reconstructed image.
  • the first instruction includes a fuzzy processing instruction, and the first parameter includes a fuzzy core;
  • the second instruction includes a deblurring processing instruction, and the second parameter includes a deblurring core corresponding to the fuzzy core;
  • the step of performing the reverse processing of the pre-processing on the restored image according to the second instruction and the second parameter to obtain a reconstructed image corresponding to the original image includes: according to the deblurring The processing instruction and the deblurring kernel perform deblurring processing on the restored image to obtain the reconstructed image.
  • the first instruction includes an image degradation instruction
  • the first parameter includes an image degradation parameter
  • the second instruction includes an image enhancement instruction
  • the second parameter includes an image enhancement parameter
  • the second instruction and the second parameter, the step of performing the reverse processing of the pre-processing on the restored image to obtain a reconstructed image corresponding to the original image includes: following the image enhancement instruction and the image enhancement Parameter, performing the image enhancement on the restored image to obtain the reconstructed image.
  • the first instruction includes an image separation instruction and a first post-processing instruction
  • the first parameter includes an image separation parameter corresponding to the image separation instruction and an image separation parameter corresponding to the first post-processing instruction
  • the second instruction includes the reverse instruction of the image separation instruction and the reverse instruction of the first post-processing instruction
  • the second parameter includes the reverse instruction of the image separation instruction
  • the restored image includes a restored edge image And a restored texture image
  • the step of performing the reverse processing of the pre-processing on the restored image according to the second instruction and the second parameter to obtain a reconstructed image corresponding to the original image includes: According to the reverse instruction of the first post-stage processing instruction and the reverse parameter of the first post-stage processing parameter, both the restored edge image and the restored texture image are subjected to the reverse processing of global scaling and adaptive At least one of the reverse
  • the first instruction includes an image segmentation instruction and a second post-processing instruction
  • the first parameter includes a segmentation category corresponding to the image segmentation instruction and a second post-processing instruction corresponding to the second post-processing instruction.
  • Two post-stage processing parameters the second instruction includes a reverse instruction of the image segmentation instruction and a reverse instruction of the second post-stage processing instruction, and the second parameter includes the same as the second post-processing instruction
  • the restored image includes a plurality of restored image areas and the position coordinates of each restored image area;
  • the second instruction and The second parameter, the step of performing the reverse processing of the pre-processing on the restored image to obtain a reconstructed image corresponding to the original image includes: a reverse instruction according to the second post-processing instruction and
  • the inverse parameter of the second post-stage processing parameter performs at least one of global scaling inverse processing, adaptive scaling inverse processing, deblurring processing, and image enhancement for each of the
  • the deep learning image decompression framework includes a second deep neural network, an inverse quantization model, and an entropy decoding model; the preset deep learning image decompression framework is used to decompress the compressed data to obtain restoration
  • the image step includes: using the entropy decoding model to perform entropy decoding on the compressed data to obtain compressed features; using the inverse quantization model to dequantize the compressed features to obtain image features; and using the second depth
  • the neural network restores the image features to obtain the restored image.
  • the image processing method further includes: using at least one of a super-resolution algorithm, a deblurring algorithm, a dehazing algorithm, and a denoising algorithm to process the reconstructed image, so as to improve the vision of the reconstructed image. Effect.
  • an embodiment of the present application also provides an image processing method.
  • the image processing method includes: acquiring an original image; in response to an operation on the original image, determining a target strategy from a plurality of preset strategies, wherein at least two The code rates of the compressed data corresponding to each of the preset strategies are different; according to the target strategy, the original image is preprocessed to obtain the image to be compressed; the preset deep learning image compression framework is used for the image to be compressed Perform compression to obtain the compressed data; use a preset deep learning image decompression framework to decompress the compressed data to obtain a restored image; obtain the reverse strategy corresponding to the target strategy; The restored image is subjected to the reverse processing of the pre-processing to obtain a reconstructed image corresponding to the original image.
  • an embodiment of the present application also provides an image processing device, the image processing device includes: an image acquisition module for acquiring an original image; a response module for responding to an operation on the original image, from multiple presets
  • the target strategy is determined in the strategy, wherein at least two of the preset strategies have different code rates for the compressed data;
  • the preprocessing module is used to preprocess the original image according to the preset strategy to obtain the image to be compressed
  • Compression module used to compress the image to be compressed using a preset deep learning image compression framework to obtain the compressed data, wherein the compressed data is used to decompress the preset deep learning image decompression framework
  • a restored image is obtained by compression, and the restored image is used to perform reverse processing of the pre-processing based on the reverse strategy of the preset strategy to obtain a reconstructed image corresponding to the original image.
  • an embodiment of the present application also provides an image processing device.
  • the image processing device includes a sequence obtaining module for obtaining compressed data, wherein the compressed data is processed using a preset deep learning image compression framework.
  • the compressed image is obtained by compression, the image to be compressed is obtained by preprocessing the original image according to a target strategy, and the target strategy is determined from a plurality of preset strategies in response to an operation on the original image, and at least two The code rate of the compressed data corresponding to the preset strategy is different; a decompression module for decompressing the compressed data using a preset deep learning image decompression framework to obtain a restored image; a reverse strategy obtaining module , Used to obtain the reverse strategy corresponding to the target strategy; a post-processing module, used to perform the pre-processing reverse processing on the restored image according to the reverse strategy to obtain a reconstruction corresponding to the original image image.
  • an embodiment of the present application also provides an image processing device, the image processing device includes: an image acquisition module for acquiring an original image; a response module for responding to an operation on the original image, from multiple presets
  • the target strategy is determined in the strategy, wherein at least two of the preset strategies have different code rates for the compressed data;
  • the preprocessing module is used to preprocess the original image according to the preset strategy to obtain the image to be compressed
  • Compression module used to compress the image to be compressed using a preset deep learning image compression framework to obtain the compressed data
  • decompression module use a preset deep learning image decompression framework to perform compression on the compressed data Decompress to obtain a restored image
  • a reverse strategy obtaining module for obtaining a reverse strategy corresponding to the target strategy;
  • a post-processing module for performing the reverse of the preprocessing on the restored image according to the reverse strategy To obtain a reconstructed image corresponding to the original image.
  • an embodiment of the present application also provides an electronic device, the electronic device includes: one or more processors; a memory, used to store one or more programs, when the one or more programs are When executed by one or more processors, the one or more processors implement the image processing method of the first aspect or the second aspect or the third aspect.
  • an embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the image processing method of the first aspect or the second aspect or the third aspect is implemented.
  • the embodiments of the present application also provide a computer program product, including instructions, which when run on a computer, cause the computer to execute the image processing method of the first aspect or the second aspect or the third aspect.
  • an embodiment of the present application further provides a chip system.
  • the chip system includes a processor and may also include a memory for implementing the image processing method of the first aspect or the second aspect or the third aspect.
  • the chip system can be composed of chips, or it can include chips and other discrete devices.
  • Fig. 1 is a schematic diagram of a JPEG image compression framework provided by the prior art.
  • FIG. 2 is a schematic diagram of an image compression framework based on Auto-encoder provided by the prior art.
  • Fig. 3 is a schematic diagram of an image compression framework based on RNN provided by the prior art.
  • FIG. 4 is a schematic diagram of an overall flow of an image processing method provided by an embodiment of the application.
  • FIG. 5 is a schematic flowchart of an image processing method provided by an embodiment of the application.
  • FIG. 6 is a schematic flowchart of step S103 in the image processing method provided in FIG. 5.
  • FIG. 7 is a schematic diagram of another overall flow of an image processing method provided by an embodiment of the application.
  • FIG. 8 is an example diagram of a compression curve corresponding to the image processing method provided by an embodiment of the application.
  • FIG. 9 is a schematic diagram of another overall flow of an image processing method provided by an embodiment of the application.
  • FIG. 10 is a schematic diagram of another overall flow of an image processing method provided by an embodiment of the application.
  • FIG. 11 is a schematic diagram of another overall flow of an image processing method provided by an embodiment of the application.
  • FIG. 12 is a schematic diagram of another overall flow of an image processing method provided by an embodiment of the application.
  • FIG. 13 is a schematic diagram of another overall flow of an image processing method provided by an embodiment of the application.
  • FIG. 14 is a schematic flowchart of step S104 in the image processing method provided in FIG. 5.
  • FIG. 15 is a schematic flowchart of another image processing method provided by an embodiment of the application.
  • FIG. 16 is a schematic flowchart of step S202 in the image processing method provided in FIG. 15.
  • FIG. 17 is a schematic flowchart of step S203 in the image processing method provided in FIG. 15.
  • FIG. 18 is a schematic flowchart of step S204 in the image processing method provided in FIG. 15.
  • FIG. 19 is a schematic flowchart of another image processing method provided by an embodiment of the application.
  • FIG. 20 is a schematic flowchart of another image processing method provided by an embodiment of the application.
  • FIG. 21 is a schematic diagram of an application of the image processing method provided by an embodiment of the application.
  • FIG. 22 is a schematic diagram of another application of the image processing method provided by an embodiment of the application.
  • FIG. 23 is a schematic diagram of another application of the image processing method provided by an embodiment of the application.
  • FIG. 24 is a schematic diagram of a composition of an image processing device provided by an embodiment of the application.
  • FIG. 25 is a schematic diagram of another composition of an image processing apparatus provided by an embodiment of the application.
  • FIG. 26 is a schematic diagram of another composition of an image processing apparatus provided by an embodiment of the application.
  • FIG. 27 is a schematic diagram of the composition of an electronic device provided by an embodiment of the application.
  • Image compression is mainly divided into two categories: lossy compression and lossless compression.
  • Lossless compression is mainly used in scenes that require very precise image details, such as authentication signature image processing, archive image processing, and part of medical image processing.
  • Lossy compression utilizes the human eye’s insensitivity to high-frequency signals, and coarsely quantizes high-frequency components in transform coding.
  • the surrounding pixel values can be used to predict the current pixel value, which greatly reduces the amount of data that needs to be encoded.
  • the image compression described is all lossy compression.
  • JPEG JPEG2000, BPG, etc.
  • JPEG compression takes JPEG compression as an example to introduce the traditional image compression methods.
  • FIG. 1 shows a schematic diagram of a JPEG image compression framework.
  • the compression framework includes two parts: an encoding process and a decoding process.
  • the encoding process includes: First, the original image (for example, RGB three-channel image) undergoes Discrete Cosine Transform (DCT) to transform the image features into the frequency domain space, so that the low-frequency information in the image that has a significant impact on the image quality Separate it from high-frequency information to reduce data redundancy; then, through quantization to remove high-frequency information that has less impact on image quality, reducing storage space; and then Huffman encoding the quantized integer to obtain an encoded JPEG stream.
  • DCT Discrete Cosine Transform
  • the decoding process is opposite to the encoding process, including: the encoded JPEG code stream is entropy-decoded and dequantized to obtain a floating-point number, and then the floating-point number is transformed from the frequency domain space to the pixel space through inverse discrete cosine transform to obtain a reconstructed image.
  • image compression methods based on deep learning can jointly optimize codec, quantization, and entropy estimation on the one hand, so that the overall performance of compression is optimal; on the other hand, it can provide diversified codecs.
  • the method can realize intelligent coding and decoding for different tasks, thereby effectively improving the compression performance of the image.
  • Image compression methods based on deep learning mainly include: Auto-encoder-based methods and Recurrent Neural Network (RNN)-based methods. The two methods are briefly introduced below.
  • FIG. 2 shows a schematic diagram of an image compression framework based on Auto-encoder.
  • the original image is input to the encoding network, undergoes spatial transformation, and obtains encoded data through quantization, and then obtains compressed data through entropy encoding.
  • the compressed data is subjected to entropy decoding and dequantization, and then input to the decoding network, and the data is converted back to the image space through the decoding network to obtain a reconstructed image.
  • the encoding network and the decoding network are both Convolutional Neural Networks (CNN), and the two constitute an Auto-encoder.
  • CNN Convolutional Neural Networks
  • the coding network and the decoding network can be jointly optimized, and the reconstructed Loss can be obtained by comparing the original image and the reconstructed image; the code rate Loss can be obtained by estimating the entropy of the encoded data; the bit rate Loss can be adjusted and the reconstruction
  • the weight of Loss is used to train models with different bit rates. Therefore, after the training is completed, a model is only applicable to one bit rate. That is, only one code rate of compressed data can be output for a kind of input image. If multiple code rates of compressed data need to be output, multiple models must be trained, which severely limits the application. Because there are various bandwidth and storage requirements in practical applications, outputting compressed data with various code rates is very important for practical applications.
  • the above-mentioned code rate is also called compression rate, which refers to the code length required for unit pixel coding.
  • compression rate refers to the code length required for unit pixel coding.
  • FIG. 3 shows a schematic diagram of an image compression framework based on RNN.
  • the compression framework is a cyclic compression framework based on residual input, that is, in the first cycle, the encoder (Encoder) inputs the original image, and the decoder (Decoder) outputs the first reconstructed image.
  • the encoder inputs the residuals between the original image and the first reconstructed image, and the decoder outputs the compressed residuals, which are superimposed with the reconstructed image output from the previous time to obtain the second reconstructed image.
  • each time the cyclic encoder inputs the residual of the previous reconstructed image and the original image.
  • the code rate is proportional to the number of cycles, so the code rate can be controlled by controlling the number of cycles, and one model can be applied to multiple code rates.
  • the residual is not conducive to compression, so the RNN-based method has poor compression effect.
  • the Auto-encoder-based method has a good compression effect, but a model is only suitable for one bit rate.
  • the RNN-based method can realize that one model is suitable for multiple code rates, but the compression effect is not good.
  • the embodiment of the present application adds a pre-processing link in the encoding process, and correspondingly, a post-processing link in the decoding process.
  • Post-processing refers to the process of reasoning with pre-processing as prior knowledge, that is, the reverse processing of pre-processing, so that the visual quality of the reconstructed image is basically unchanged.
  • multiple preset strategies are set in advance in the preprocessing step, and the target strategy is selected from the multiple preset strategies for preprocessing during encoding.
  • the selected target strategy is different, the code rate of the compressed data will be different.
  • the reverse strategy of the target strategy is used to do the reverse processing of preprocessing. In this way, while ensuring the compression effect, one compression model corresponds to multiple code rates.
  • FIG. 5 is a schematic flowchart of an image processing method provided by an embodiment of the application.
  • the image processing method is applied to the encoding end, for example, it may be an electronic device with encoding function, and the image processing method may include the following steps:
  • the original image can be image data that needs to be compressed in order to save storage space or meet bandwidth transmission requirements.
  • the raw data of the video stream output by the camera inside the camera the pictures in the terminal album, the pictures in the cloud album, etc.
  • the original image refers to uncompressed image data
  • the data format of the original image can be RGB, YUV, CMYK.
  • the compression task corresponds to compressed image data (e.g., JPEG image)
  • the corresponding decoder e.g., JPEG decoder
  • the compressed image data e.g., JPEG image
  • S102 In response to an operation on the original image, determine a target strategy from a plurality of preset strategies, where at least two preset strategies correspond to different code rates of compressed data.
  • the encoding process of the embodiment of the present application adds a pre-processing step, and the pre-processing step has a plurality of preset strategies set in advance, and the preset strategies include methods and parameters for pre-processing the original image. For example, methods and parameters for global scaling of the original image, methods and parameters for blurring the original image, and methods and parameters for image enhancement of the original image.
  • Different preset strategies can be set to correspond to different code rates, that is, if different preset strategies are used to preprocess the original image, the code rates of the compressed data obtained may be different.
  • different preset strategies may correspond to the same bit rate.
  • the method and parameters for global scaling of the original image and the method and parameters for blurring the original image are preprocessed according to the two preset strategies.
  • the bit rate of the compressed data obtained after compression may be the same. That is, these two preset strategies correspond to the same bit rate. Therefore, in actual applications, it is only necessary to ensure that the code rates of the compressed data corresponding to at least two preset strategies are different.
  • the target strategy refers to any one of a plurality of preset strategies, and the target strategy is related to the user's operation on the original image.
  • the user's operation on the original image refers to the user's selection operation on the original image.
  • the association relationship between the selection operation and the preset strategy can be preset, that is, one selection operation is preset to be associated with at least one preset strategy.
  • the relationship between the selection operation and the preset strategy is shown in Table 1 below:
  • Select operation 1 Preset strategy 1, Preset strategy 2, Preset strategy 3... Select operation 2 Preset strategy 1, Preset strategy 2, Preset strategy 3... Select operation 3 Preset strategy 1, Preset strategy 2, Preset strategy 3...
  • each selection operation corresponds to a series of preset strategies, for example, the preset strategy for global zooming of the original image, the preset strategy for blurring the original image, etc., which are only different from different selection operations (for example, Selection operation 1, selection operation 2) are associated with different parameters of the same preset strategy (for example, preset strategy 1).
  • an option is set for the user to select, and an option represents a user's compression requirement.
  • setting the "high”, “medium”, and “low” options respectively represents the compression quality desired by the user as high, medium, and low.
  • the user selects an option it makes a selection operation.
  • the user selects the "high” option it makes a selection operation with high compression quality. For example, for the raw data of the video stream output by the camera's internal camera, if the user wants high compression quality, they can pre-select the "high” option before taking a picture.
  • the preset strategy associated with the selection operation can be used as the target strategy according to the association relationship between the selection operation and the preset strategy. If the selection operation is associated with multiple preset strategies, then one of the multiple preset strategies will be found as the target strategy with the best effect.
  • the original image can be preprocessed and compressed according to each preset strategy, and then a compressed data with the best effect can be selected, and the preset strategy corresponding to the compressed data with the best effect can be used as the target strategy.
  • the selection operation includes the default operation, which means that the user did not select any option.
  • the default operation When the user's operation on the original image is the default operation, one of the preset strategies associated with the default operation is found as the target strategy with the best effect. For example, if the default operation is high compression quality, then one of the preset strategies associated with high compression quality will be found as the target strategy with the best effect.
  • S103 Preprocess the original image according to the target strategy to obtain the image to be compressed.
  • the target strategy can be, but is not limited to, global scaling methods and parameters, block scaling methods and parameters, global blur methods and parameters, block blur methods and parameters, global enhancement methods and parameters, and block enhancement methods And one or more of the parameters.
  • the preprocessing may be, but is not limited to, one or more of global scaling, block scaling, global blur, block blur, global enhancement, block enhancement, and the like. For example, if the target strategy is the method and parameters of global scaling and the method and parameters of block blur, the preprocessing is global scaling and block blur.
  • the image to be compressed refers to the image obtained after preprocessing the original image according to the target strategy.
  • S104 Compress the image to be compressed using a preset deep learning image compression framework to obtain compressed data, where the compressed data is used to decompress the preset deep learning image decompression framework to obtain a restored image, and the restored image is used to obtain a restored image based on the target.
  • the reverse strategy of the strategy performs the reverse processing of the preprocessing to obtain the reconstructed image corresponding to the original image.
  • Compressed data refers to the code stream obtained after the original image is preprocessed and compressed.
  • the target strategy and compressed data can be stored or transmitted as a file.
  • When it is necessary to decode compressed data into an image first use the deep learning image decompression framework to decompress the compressed data into a restored image, and then infer the reverse strategy of the target strategy according to the target strategy used in preprocessing in the encoding process, and follow The reverse strategy of the target strategy performs reverse processing of preprocessing on the restored image, and finally generates a reconstructed image corresponding to the original image.
  • the aforementioned deep learning image compression framework and deep learning image decompression framework can be the Auto-encoder-based image compression framework shown in Figure 1, or the RNN-based image compression framework shown in Figure 2, or the field Other image compression frameworks based on deep learning that technicians may use.
  • S103 may include the following detailed steps:
  • S1031 Preprocess the original image according to the first instruction and the first parameter to obtain the image to be compressed.
  • the target strategy includes a first instruction and a first parameter corresponding to the first instruction.
  • the first instruction refers to a method for preprocessing the original image
  • the first parameter refers to a parameter corresponding to the method for preprocessing the original image.
  • the first instruction may be, but is not limited to, one or more of methods such as global scaling, block scaling, global blur, block blur, global enhancement, and block enhancement of the original image.
  • the first parameter may be, but is not limited to, one or more of global scaling parameters, block scaling parameters, global blur parameters, block blur parameters, global enhancement parameters, block enhancement parameters and other parameters.
  • the original image can be preprocessed by using traditional image processing algorithms, for example, traditional image interpolation algorithms, Gaussian filtering, and so on. It is also possible to pre-process the original image with a pre-trained deep learning network, for example, a deep convolutional neural network, a convolutional layer, a pooling layer, and so on.
  • a pre-trained deep learning network for example, a deep convolutional neural network, a convolutional layer, a pooling layer, and so on.
  • the preprocessing is global zoom
  • the process of preprocessing the original image to obtain the image to be compressed may include:
  • the global zoom instruction the global zoom factor and the zoom kernel, the original image is globally zoomed to obtain the image to be compressed.
  • the global zoom instruction refers to a method of global zooming of the original image.
  • Global zooming is to reduce or enlarge the image as a whole.
  • the preprocessing of the encoding process is just the opposite of the postprocessing of the decoding process.
  • the encoding process is: first reduce the original image and then compress, then the decoding process is: first decompress and then enlarge the restored image.
  • the global zoom factor is the number of times that the image is reduced or enlarged as a whole, and the global zoom factor can be represented by n. If n ⁇ 1, it means that the entire image is reduced; if n>1, it means that the entire image is enlarged.
  • the scaling kernel includes linear interpolation, bilinear interpolation, and so on.
  • the image is reduced by downsampling during the encoding process.
  • the input is the original image
  • the output is the long An image to be compressed whose sum width is n (n ⁇ 1) times the original image size.
  • MS-SSIM Multi-Scale-Structural Similarity Index, multi-scale structural similarity
  • MS-SSIM Multi-Scale-Structural Similarity Index, multi-scale structural similarity
  • the image compression quality evaluation index is used to evaluate the image quality of the compressed image.
  • it also includes PSNR (Peak Signal to Noise Ratio) and SSIM (structural similarity index, structural similarity) Wait.
  • PSNR Peak Signal to Noise Ratio
  • SSIM structural similarity index, structural similarity
  • the bit rate of the corresponding compressed data will also be different. That is, using the same compression model, multiple code rate compression can be achieved only by adjusting the global scaling factor. The smaller the n, the smaller the scale of the image to be compressed, and the smaller the code rate of the compressed data; the larger the n, the larger the scale of the image to be compressed, and the larger the code rate of the compressed data.
  • the left image is the experimental result of the Kodak data set
  • the right image is the experimental result of the CLIC data set.
  • the vertical axis is MS-SSIM
  • the horizontal axis is BPP (bits per pixel), which represents the number of bits consumed by each pixel. The smaller the BPP, the smaller the bit rate.
  • the curve corresponding to GSM-org is the initial compression curve.
  • GSM-newMSSSIM, GSM-newMSSSIM-0.25, and GSM-newMSSSIM-0.5 represent the compression curves with global compression coefficients of 1, 0.25, and 0.5, respectively. It can be clearly seen from the figure that using the same compression model, by adjusting the global scaling factor (1, 0.25, 0.5), the compression of 3 code rates can be achieved under the premise of ensuring the compression performance.
  • the preprocessing is to block first and then adaptive scaling
  • the process of preprocessing the original image to obtain the image to be compressed may include:
  • each image block is adaptively scaled to obtain the image block to be compressed corresponding to each image block, where the image to be compressed includes multiple images to be compressed Block, the image feature is used to determine the scaling factor of the image block.
  • the block parameter is a parameter used to characterize how to divide the original image.
  • the block parameter can be represented by M ⁇ N, where M is the horizontal block parameter, and N is the vertical block parameter. For example, if the block parameter is 3 ⁇ 3, it means that the original image is divided into 9 image blocks of 3 ⁇ 3.
  • each image block after block division has a corresponding position vector (i, j), i represents the i-th image block in the horizontal direction, and j represents the j-th image block in the horizontal direction.
  • the image feature of the image block may be one or more of the color feature, texture feature, and shape feature of the image block.
  • the color feature and texture feature are used to describe the surface properties of the object corresponding to the image block.
  • the shape feature includes the contour feature and the area feature.
  • the contour feature includes the outer boundary feature of the object, and the area feature includes the shape and area feature of the object.
  • the adaptive zoom command refers to a method of adaptively zooming the original image. Based on the image characteristics of the original image (for example, color characteristics, texture characteristics, shape characteristics, etc.), areas with different image characteristics can be scaled to different degrees, such as , The background area is zoomed more, and the foreground area is zoomed less.
  • image characteristics of the original image for example, color characteristics, texture characteristics, shape characteristics, etc.
  • Adaptive scaling for each image block means to determine the scaling factor of each image block according to the corresponding image feature (for example, color feature, texture feature, shape feature, etc.) of each image block, and then according to the respective scaling
  • the coefficient performs block reduction or block enlargement.
  • image blocks with more image features for example, color, texture, etc.
  • image blocks with fewer image features for example, color, texture, etc.
  • smooth image blocks are scaled more, and unsmooth image blocks are scaled less.
  • each image block is determined according to the image characteristics (for example, color, texture, etc.)
  • the zoom factor of each image block For example, according to the texture of the (2,2)th image block and the (1,1)th image block, the scaling factor of the (2,2)th image block is determined to be 1, the (2,2)th image block
  • the zoom factor is 0.25.
  • the preprocessing is fuzzy processing
  • the process of preprocessing the original image to obtain the image to be compressed may include:
  • the original image is subjected to blur processing to obtain the image to be compressed.
  • the blur processing instruction refers to a method of performing blur processing on the original image.
  • the blur processing instruction can be, but is not limited to, a median function, an average function, a Gaussian function, and the like.
  • the blur processing can be, but is not limited to, median blur, mean blur, Gaussian blur, and the like.
  • the fuzzy kernel can be, but is not limited to, a median template, an average template, a Gaussian template, and the like.
  • the blur kernel is a kind of convolution kernel, which is actually a matrix. The original image and the blur kernel are convolved to blur the original image.
  • blurring is performed before compression.
  • Figure 10 to perform Gaussian filtering on the original image and then compress it.
  • Gaussian function can be used for smoothing filtering.
  • the input is the original image and the output is the filtered image to be compressed.
  • the larger the scale of the fuzzy kernel for example, Gaussian template
  • the smaller the scale of the fuzzy kernel for example, the Gaussian template
  • the bit rate is also larger.
  • the initial code rate and compression performance of the model are as follows:
  • the new code rate and compression performance are as follows:
  • the Gaussian template scale is 3: BPP: 0.3100, PSNR: 26.8661, MS-SSIM: 0.9593;
  • the Gaussian template scale is 5: BPP: 0.3657, PSNR: 26.8711, MS-SSIM: 0.9667.
  • the preprocessing is image degradation
  • the process of preprocessing the original image to obtain the image to be compressed may include:
  • the image degradation instruction and the image degradation parameter perform image degradation on the original image to obtain the image to be compressed.
  • the image degradation instruction refers to the method of degrading the original image.
  • the image degradation is performed before compression in the encoding process.
  • the original image is degraded and then compressed.
  • the input is the original image, and the output is the degraded image.
  • the image to be compressed is the image to be compressed.
  • the first parameter is an image separation parameter corresponding to the image separation instruction and a first post-processing instruction corresponding to the first post-processing instruction
  • the pre-processing is image separation first and then the first post-processing
  • the process of preprocessing the original image to obtain the image to be compressed may include:
  • At least one of global scaling, adaptive scaling, blur processing, and image degradation is performed on the edge image and the texture image to obtain the edge image to be compressed and the edge image to be compressed.
  • Compressed texture image where the image to be compressed includes edge image to be compressed and texture image to be compressed.
  • the image separation instruction refers to the method of image separation of the original image.
  • Image separation can be to separate the original image into edge image and texture image according to the texture characteristics of the original image, and then perform the first post-processing on the edge image and texture image respectively .
  • the first post-stage processing can be one or more of global scaling, adaptive scaling, blur processing, and image degradation.
  • the detailed process of global zooming, adaptive zooming, blur processing, and image degradation can be referred to the foregoing description, and will not be repeated here.
  • the first post-processing instruction refers to the method of performing the first post-processing on the original image.
  • the first post-processing instruction can be one or more of the global zoom instruction, the adaptive zoom instruction, the blur processing instruction, and the image degradation instruction. kind.
  • the first post-stage processing parameter may be one or more of the global zoom factor and zoom kernel, block parameter, blur kernel, and image degradation parameter.
  • the encoding process is the first stage of image separation, then the first stage of processing and then compression.
  • first the image is separated into edge images and texture images, and then Gaussian filtering is performed on the edge images and texture images respectively.
  • the Gaussian template scale of the texture image can be smaller, and the Gaussian template scale of the edge image can be larger, to obtain the edge image to be compressed and the texture image to be compressed.
  • the first instruction is an image segmentation instruction and a second post-processing instruction
  • the first parameter is the segmentation category corresponding to the image segmentation instruction and the second post-processing instruction corresponding to the second post-processing instruction
  • the preprocessing is first image segmentation and then the second post-processing stage
  • the process of preprocessing the original image to obtain the image to be compressed may include:
  • the second post-processing instruction and the second post-processing parameters at least one of global scaling, adaptive scaling, blur processing, and image degradation is performed on multiple image regions to obtain the corresponding image region
  • the image area to be compressed, where the image to be compressed includes a plurality of image areas to be compressed.
  • the image segmentation instruction refers to the method of image segmentation of the original image.
  • Image segmentation is the technology and process of dividing the image into a number of specific and unique areas and proposing objects of interest.
  • Image segmentation can be based on the segmentation category, the original image is divided into several image areas, each image area has a corresponding location coordinates (x, y).
  • the position coordinates can be the coordinates of each edge point of the corresponding image area, or the coordinates of the center point of the corresponding image area.
  • the segmentation categories can be foreground and background, or categories of all targets in the foreground, such as humans, animals, plants, and so on.
  • the image segmentation method can be, but is not limited to, threshold-based segmentation, region-based segmentation, edge-based segmentation, and so on.
  • the original image can be divided into multiple image regions (for example, foreground and background) according to the segmentation category, and then the second post-processing is performed on each image region separately.
  • the second post-stage processing can be one or more of global scaling, adaptive scaling, blur processing, and image degradation.
  • the detailed process of global zooming, adaptive zooming, blur processing, and image degradation can be referred to the foregoing description, and will not be repeated here.
  • the second post-processing instruction refers to the method of performing the second post-processing on the original image.
  • the second post-processing instruction can be one or more of global scaling instructions, adaptive scaling instructions, blur processing instructions, and image degradation instructions. kind.
  • the second post-stage processing parameter may be one or more of the global zoom factor and zoom kernel, block parameter, blur kernel, and image degradation parameter.
  • the encoding process is to segment the image first, then process the second stage and then compress it.
  • the image is first segmented into the foreground (ie flies) and the background, and then Gaussian filtering is performed on the foreground and the background respectively.
  • the Gaussian template scale of the foreground can be smaller, and the Gaussian template scale of the background can be larger, to obtain the foreground to be compressed and the background to be compressed.
  • the deep learning image compression framework includes the first deep neural network, quantization model and entropy coding model.
  • S104 may include the following detailed steps:
  • S1041 Perform feature extraction on the compressed image using the first deep neural network to obtain image features.
  • the first deep neural network may be a fully connected neural network, CNN, CNN variants, RNN, RNN variants, etc., or may be other deep neural networks that may be used by those skilled in the art.
  • the variants of CNN can be DCNN (Dilated Convolutions Neural Network), IDCNN (Iteration Dilated Convolutions Neural Network), etc.
  • RNN variants can be LSTM (Long Short-Term Memory), GRU (Gated Recurrent Unit), etc.
  • the first deep neural network is used for feature extraction of the image to be compressed to obtain image features.
  • S1042 Use the quantization model to quantize the image feature to obtain the compressed feature.
  • the quantization model is used to discretize the compressed features to save storage space and facilitate further entropy coding.
  • S1043 Entropy coding the compressed feature using the entropy coding model to obtain compressed data.
  • the entropy coding model can use arithmetic coding and so on.
  • FIG. 15 shows another schematic flowchart of an image processing method provided by an embodiment of the present application.
  • the image processing method is applied to the decoding end, for example, it may be an electronic device with a decoding function, and the image compression method may include the following steps:
  • S201 Obtain compressed data, where the compressed data is obtained by compressing a to-be-compressed image using a preset deep learning image compression framework, and the to-be-compressed image is obtained by preprocessing the original image according to a target strategy, and the target strategy is a response to the original image
  • the operation is determined from a plurality of preset strategies, and the code rates of the compressed data corresponding to at least two preset strategies are different.
  • the terminal or the cloud When a user wants to view or send a picture of a terminal album, or view or download a picture of a cloud album, the terminal or the cloud will decompress the corresponding compressed data into a restored image. At the same time, in order to make the reconstructed image and the original image as consistent as possible, it is necessary to process the restored image according to the reverse processing of preprocessing.
  • S202 Decompress the compressed data using a preset deep learning image decompression framework to obtain a restored image.
  • S204 Perform reverse processing of pre-processing on the restored image according to the reverse strategy to obtain a reconstructed image corresponding to the original image.
  • the aforementioned deep learning image decompression framework includes a second deep neural network, an inverse quantization model, and an entropy decoding model.
  • S202 may include the following detailed steps:
  • S2021 Entropy decoding the compressed data using the entropy decoding model to obtain compression features.
  • the second deep neural network is used to transform and learn image features, so as to restore the frequency domain information to the pixel domain without loss, and obtain a restored image.
  • the second deep neural network may be a fully connected neural network, CNN, CNN variants, RNN, RNN variants, etc., or other deep neural networks that may be used by those skilled in the art.
  • the CNN variants can be DCNN, IDCNN, etc.
  • the RNN variants can be LSTM, GRU, etc.
  • S203 may include the following detailed steps:
  • S2031 Obtain a target strategy, where the target strategy includes a first instruction and a first parameter corresponding to the first instruction.
  • S2032 Determine the second command according to the corresponding relationship between the first command and the preset command.
  • S2033 Determine a second parameter according to the first parameter and a preset parameter calculation rule, where the reverse strategy includes a second instruction and a second parameter corresponding to the second instruction.
  • the correspondence between the first instruction and the second instruction can be preset to determine the second instruction according to the first instruction.
  • the global zoom instruction corresponds to the global zoom instruction
  • the blur processing instruction corresponds to the deblur processing instruction
  • the corresponding relationship between the first parameter and the second parameter is preset to determine the second parameter according to the first parameter.
  • the first parameter is the global scaling factor and the scaling kernel
  • the second parameter is the global scaling factor. The reciprocal and zoom kernel etc.
  • S204 may include the following detailed steps:
  • S2041 Perform reverse processing of preprocessing on the restored image according to the second instruction and the second parameter to obtain a reconstructed image corresponding to the original image.
  • the second instruction refers to a reverse processing method of preprocessing the restored image
  • the second parameter refers to a parameter corresponding to the reverse processing method of preprocessing the original image
  • Traditional image processing algorithms can be used to perform reverse processing of the restored image, for example, traditional image interpolation algorithms, Gaussian filtering, super-resolution algorithms, etc. It is also possible to use a pre-trained deep learning network to perform reverse processing of preprocessing the restored image.
  • the first instruction is a global scaling instruction
  • the first parameter is a global scaling factor and a scaling kernel
  • the preprocessing is global scaling
  • the second instruction is a global scaling instruction
  • the second parameter is the reciprocal of the global scaling factor.
  • zooming core the reverse processing of pre-processing is global zooming
  • the reverse process of preprocessing the restored image to obtain the reconstructed image corresponding to the original image may include:
  • the reciprocal of the global zoom factor and the zoom kernel the restored image is globally zoomed to obtain a reconstructed image.
  • an up-sampling method is used to enlarge the image, the input is a restored image, and the output is a reconstructed image whose length and width are the same size as the original image.
  • the super-resolution algorithm can also be used to perform the reverse processing of the preprocessing of the restored image to obtain the reconstructed image.
  • the first instruction is an adaptive scaling instruction
  • the first parameter is a block parameter
  • the preprocessing is to block first and then adaptive scaling
  • the second instruction is an adaptive scaling instruction
  • the second parameter is The splicing parameters related to the block parameters
  • the reverse processing of the pre-processing is first adaptive scaling and then splicing
  • the reverse process of preprocessing the restored image to obtain the reconstructed image corresponding to the original image may include:
  • each restored image block is adaptively scaled to obtain the image block to be reconstructed corresponding to each restored image block, where the image feature is used to determine the restoration The zoom factor of the image block;
  • the multiple image blocks to be reconstructed are spliced according to the splicing parameters to obtain a reconstructed image.
  • the stitching parameter is associated with the block parameter, including the position vector (i, j) corresponding to each image block after the block, that is, the position vector (i, j) corresponding to each restored image block.
  • the zoom factor of each restored image block is determined according to the image characteristics (for example, color, texture, etc.) of each restored image block, and then the position vector corresponding to each restored image block ( i, j) Perform splicing and output the reconstructed image.
  • the first instruction is a fuzzy processing instruction
  • the first parameter is a fuzzy kernel
  • the preprocessing is a fuzzy processing
  • the second instruction is a de-blurring instruction
  • the second parameter is a de-blurring kernel corresponding to the fuzzy kernel.
  • the reverse processing of pre-processing is de-blurring processing
  • the reverse process of preprocessing the restored image to obtain the reconstructed image corresponding to the original image may include:
  • the restored image is deblurred to obtain the reconstructed image.
  • the deblurring processing can be, but is not limited to, edge detection, image sharpening, deep learning image restoration, etc.; correspondingly, the deblurring kernel can be a sharpening kernel and the like.
  • the decoding process performs deblurring after decompression.
  • deblurring after decompression.
  • the input is the restored image, and the sharpened reconstructed image is output.
  • the first instruction is an image degradation instruction
  • the first parameter is an image degradation parameter
  • the preprocessing is image degradation
  • the second instruction is the image enhancement instruction
  • the second parameter is an image enhancement parameter
  • the reverse process of preprocessing the restored image to obtain the reconstructed image corresponding to the original image may include:
  • image enhancement is performed on the restored image to obtain a reconstructed image.
  • image enhancement is to improve the visual effect of the image, or to convert the image into a form more suitable for human observation and machine analysis and recognition, so as to obtain more useful information from the image.
  • the image enhancement method may be, but is not limited to, histogram equalization, contrast enhancement, gamma transformation, noise smoothing, sharpening, and the like.
  • the image enhancement instructions can be, but are not limited to, transformation functions, Laplacian operators, and so on.
  • the decoding process performs image enhancement after decompression.
  • the decoding process is first decompression and then image enhancement. Deep learning network post-processing can be used. The input is a restored image and the output is a reconstructed image.
  • the first parameter is an image separation parameter corresponding to the image separation instruction and an image separation parameter corresponding to the first post-processing instruction.
  • the first post-stage processing parameter, the preprocessing is the image separation first and then the first post-stage processing;
  • the second instruction is the reverse instruction of the image separation instruction and the reverse instruction of the first post-processing instruction, and the second parameter is the image separation instruction.
  • the reverse parameter of the image separation parameter corresponding to the reverse instruction of the separation instruction and the reverse parameter of the first post-processing parameter corresponding to the reverse instruction of the first post-processing instruction, the reverse processing of the preprocessing is first first Reverse processing and image fusion of post-processing;
  • the reverse process of preprocessing the restored image to obtain the reconstructed image corresponding to the original image may include:
  • both the restored edge image and the restored texture image are subjected to the reverse processing of global scaling, the reverse processing of adaptive scaling, At least one of deblurring and image enhancement to obtain an edge image to be reconstructed and a texture image to be reconstructed;
  • image fusion is performed on the edge image to be reconstructed and the texture image to be reconstructed to obtain a reconstructed image.
  • the reverse command of the first post-stage processing command may be one or more of the reverse command of the global zoom command, the reverse command of the adaptive zoom command, the deblur processing command, and the image enhancement command.
  • the first post-stage processing parameter may be one or more of the reciprocal of the global zoom factor and zoom kernel, stitching parameter, deblurring kernel, and image enhancement parameter.
  • the decoding process is the reverse processing of first decompression and then the first post-stage processing and then image fusion.
  • image sharpening is performed on the decompressed restored edge image and the restored texture image respectively, and then the two sharpened images are image fused and output as a reconstructed image.
  • the first instruction is an image segmentation instruction and a second post-processing instruction
  • the first parameter is the segmentation category corresponding to the image segmentation instruction and the second post-processing instruction corresponding to the second post-processing instruction Parameter
  • the preprocessing is first image segmentation and then the second post-stage processing
  • the second instruction is the reverse instruction of the image segmentation instruction and the reverse instruction of the second post-stage processing instruction
  • the second parameter is the same as the second post-stage processing instruction
  • the reverse instruction corresponding to the reverse parameter of the second post-stage processing parameter, the reverse processing of the pre-processing is the reverse processing of the second post-processing first and then splicing
  • the restored image includes multiple restored image regions and each restored image The location coordinates of the area
  • the reverse process of preprocessing the restored image to obtain the reconstructed image corresponding to the original image may include:
  • each restored image area is subjected to the reverse processing of the global zoom, the reverse processing of the adaptive zoom, and the deblurring At least one of processing and image enhancement to obtain the image area to be reconstructed corresponding to each restored image area;
  • the decoding process is first decompression and then reverse processing of the second post-stage processing and then splicing.
  • the decompressed restored foreground and restored background are respectively sharpened, and then the two sharpened image regions are spliced and output as a reconstructed image.
  • FIG. 19 is a schematic flowchart of another image processing method provided by an embodiment of the application. Referring to FIG. 19, after S204, the image processing method may further include the following steps:
  • S205 Use at least one of a super-resolution algorithm, a deblurring algorithm, a dehazing algorithm, and a denoising algorithm to process the reconstructed image, so as to improve the visual effect of the reconstructed image.
  • FIG. 20 shows another schematic flowchart of an image processing method provided by an embodiment of the present application.
  • the image processing method is applied to the encoding and decoding end, for example, it may be an electronic device with encoding and decoding functions, and the image processing method may include the following steps:
  • S302 In response to an operation on the original image, determine a target strategy from a plurality of preset strategies, where at least two preset strategies have different code rates for the compressed data.
  • S303 Perform preprocessing on the original image according to the target strategy to obtain the image to be compressed.
  • S304 Compress the image to be compressed using a preset deep learning image compression framework to obtain compressed data.
  • S305 Decompress the compressed data using a preset deep learning image decompression framework to obtain a restored image.
  • S307 Perform reverse processing of preprocessing the restored image according to the reverse strategy to obtain a reconstructed image corresponding to the original image.
  • FIG. 21 The user uses the terminal camera to take a picture. Before taking the picture, you can set the compression quality of the camera. For example, select "Compression Quality (9/10)". There are 10 levels of compression quality, 1 means the worst, 10 means the best, 9/10 means the compression quality is 9, if not selected, it is the default compression quality, and "compression quality (10/10)" in the figure is the default compression quality . Then the camera takes pictures, and the camera outputs the raw data of the video stream. Since the compression level selected by the user is "compression quality (9/10)", it can automatically change from the one corresponding to the "compression quality (9/10)" according to the raw data of the video stream.
  • the target strategy with the best effect is found out of the series of preset strategies, and the raw video stream data is preprocessed and compressed according to the target strategy, and a compressed file including the compressed data and the target strategy is generated and stored to save the storage space of the terminal.
  • the terminal will compress the file and display it after decoding.
  • the user uploads the picture of the terminal album to the cloud album, and can select the compression quality before uploading, for example, select “Compression quality (9/10)", the same as above, if you do not select It is the default compression quality, and "compression quality (10/10)" in the figure is the default compression quality.
  • the cloud After uploading the picture to the cloud, if the picture in the terminal album is compressed (for example, a .jpg file), the cloud must first parse the picture into an original image (for example, in YUV format).
  • the cloud automatically finds the target strategy with the best compression effect according to the compression level selected by the user "compression quality (9/10)" and the picture, and compresses the original image after preprocessing according to the target strategy, and generates a compression including the compressed data and the target strategy File and store to save cloud storage space.
  • the cloud When a user wants to download or preview a certain picture of a cloud album, the cloud obtains the compressed file, which is decoded for the user to download or preview.
  • the picture uploaded by the user is a file in a specific format, for example, a .jpg file
  • the cloud will process the reconstructed image into a specific format for the user to download or preview.
  • the cloud can also provide a corresponding decoder, and the user directly downloads the compressed file, and then decodes it with the decoder provided by the cloud after downloading.
  • the user sends a picture of the terminal album (for example, picture A) to other terminals, and can select the compression quality before sending, for example, select "compression quality (9/10)" , Same as above, if not selected, it is the default compression quality, and "compression quality (10/10)" in the figure is the default compression quality.
  • the sender terminal automatically selects and finds the target strategy with the best compression effect according to the compression level "compression quality (9/10)" selected by the user and the selected picture, and preprocesses the picture according to the target strategy and compresses it to generate compressed data and
  • the compressed file of the target strategy is transmitted to the receiving terminal to save transmission bandwidth.
  • the sender terminal must first parse the picture into an original image (for example, YUV format) before preprocessing and compression.
  • an original image for example, YUV format
  • the receiver terminal obtains the compressed file, which is decoded for the user to download.
  • FIG. 24 is a schematic diagram of the composition of an image processing apparatus 100 according to an embodiment of the application.
  • the image processing apparatus 100 is applied to the encoding end, and may be, for example, an electronic device with encoding function.
  • the image processing device 100 includes an image acquisition module 101, a response module 102, a preprocessing module 103, and a compression module 104.
  • the image acquisition module 101 is used to acquire an original image.
  • the response module 102 is configured to determine a target strategy from a plurality of preset strategies in response to an operation on the original image, wherein the code rates of the compressed data corresponding to at least two preset strategies are different.
  • the preprocessing module 103 is used to preprocess the original image according to the target strategy to obtain the image to be compressed.
  • the compression module 104 is configured to compress the image to be compressed using a preset deep learning image compression framework to obtain compressed data, where the compressed data is used to decompress the preset deep learning image decompression framework to obtain a restored image, and restore the image Reverse processing for preprocessing based on the reverse strategy of the target strategy obtains the reconstructed image corresponding to the original image.
  • the target strategy includes a first instruction and a first parameter corresponding to the first instruction
  • the preprocessing module 103 is specifically configured to preprocess the original image according to the first instruction and the first parameter to obtain the image to be compressed.
  • the first instruction includes a global zoom instruction
  • the first parameter includes a global zoom factor and a zoom kernel
  • the preprocessing module 103 executes the preprocessing of the original image according to the first instruction and the first parameter to obtain the image to be compressed, which may include: global scaling of the original image according to the global scaling instruction, the global scaling factor and the scaling kernel, Get the image to be compressed.
  • the first instruction includes an adaptive scaling instruction, and the first parameter includes a block parameter;
  • the preprocessing module 103 executes the preprocessing of the original image according to the first instruction and the first parameter to obtain the image to be compressed, which may include: dividing the original image according to the block parameters to obtain multiple image blocks; The zoom instruction and the image feature of each image block are adaptively scaled for each image block to obtain the image block to be compressed corresponding to each image block.
  • the image to be compressed includes multiple image blocks to be compressed, and the image feature is used for To determine the zoom factor of the image block.
  • the first instruction includes a fuzzy processing instruction, and the first parameter includes a fuzzy kernel;
  • the preprocessing module 103 performs preprocessing on the original image according to the first instruction and the first parameter to obtain the image to be compressed, which may include: performing blur processing on the original image according to the blur processing instruction and blur kernel to obtain the image to be compressed .
  • the first instruction includes an image degradation instruction, and the first parameter includes an image degradation parameter;
  • the pre-processing module 103 performs pre-processing on the original image according to the first instruction and the first parameter to obtain the image to be compressed, which may include: performing image degradation on the original image according to the image degradation instruction and image degradation parameters to obtain the image to be compressed. image.
  • the first instruction includes an image separation instruction and a first post-processing instruction
  • the first parameter includes an image separation parameter corresponding to the image separation instruction and a first post-processing parameter corresponding to the first post-processing instruction
  • the preprocessing module 103 performs preprocessing on the original image according to the first instruction and the first parameter to obtain the image to be compressed, which may include: performing image separation on the original image according to the image separation instruction and image separation parameters to obtain the edge image And texture images; according to the first post-processing instructions and first post-processing parameters, perform at least one of global scaling, adaptive scaling, blur processing, and image degradation on both the edge image and the texture image to obtain the edge image to be compressed And the texture image to be compressed, where the image to be compressed includes the edge image to be compressed and the texture image to be compressed.
  • the first instruction includes an image segmentation instruction and a second post-processing instruction
  • the first parameter includes a segmentation category corresponding to the image segmentation instruction and a second post-processing parameter corresponding to the second post-processing instruction
  • the preprocessing module 103 executes preprocessing of the original image according to the first instruction and the first parameter to obtain the image to be compressed, which may include: image segmentation of the original image according to the image segmentation instruction and segmentation category to obtain multiple images Area; according to the second post-processing instruction and the second post-processing parameters, at least one of global scaling, adaptive scaling, blur processing, and image degradation is performed on multiple image regions, to obtain the corresponding to each image region A compressed image area, where the image to be compressed includes a plurality of image areas to be compressed.
  • the deep learning image compression framework includes a first deep neural network, a quantization model, and an entropy coding model
  • the compression module 104 is specifically configured to use the first deep neural network to perform feature extraction on the compressed image to obtain the image feature; use the quantization model to quantize the image feature to obtain the compressed feature; use the entropy coding model to entropy encode the compressed feature to obtain the compression data.
  • FIG. 25 is a schematic diagram of the composition of an image processing apparatus 200 according to an embodiment of the application.
  • the image processing apparatus 200 is applied to a decoding end, and may be, for example, an electronic device with a decoding function.
  • the image processing device 200 includes a sequence obtaining module 201, a decompression module 202, a reverse strategy obtaining module 203, and a post-processing module 204.
  • the sequence obtaining module 201 is used to obtain compressed data, where the compressed data is obtained by compressing the image to be compressed using a preset deep learning image compression framework, and the image to be compressed is obtained by preprocessing the original image according to the target strategy.
  • the target strategy is It is determined from a plurality of preset strategies in response to the operation on the original image, that the code rates of the compressed data corresponding to at least two preset strategies are different.
  • the decompression module 202 is configured to decompress the compressed data using a preset deep learning image decompression framework to obtain a restored image.
  • the reverse strategy obtaining module 203 is used to obtain the reverse strategy corresponding to the target strategy.
  • the post-processing module 204 is configured to perform reverse processing of preprocessing the restored image according to the reverse strategy to obtain a reconstructed image corresponding to the original image.
  • the deep learning image decompression framework includes a second deep neural network, an inverse quantization model, and an entropy decoding model;
  • the decompression module 202 is specifically configured to: use the entropy decoding model to entropy decode the compressed data to obtain compressed features; use the inverse quantization model to dequantize the compressed features to obtain image features; use the second deep neural network to restore the image features, Get the restored image.
  • the reverse strategy obtaining module 203 is specifically configured to: obtain a target strategy, the target strategy including a first instruction and a first parameter corresponding to the first instruction; Two instructions; the second parameter is determined according to the first parameter and the preset parameter calculation rule, wherein the reverse strategy includes the second instruction and the second parameter corresponding to the second instruction.
  • the post-processing module 204 is specifically configured to perform reverse processing of pre-processing on the restored image according to the second instruction and the second parameter to obtain a reconstructed image corresponding to the original image.
  • the first instruction includes a global zoom instruction
  • the first parameter includes a global zoom factor and a zoom core
  • the second instruction includes a global zoom instruction
  • the second parameter includes the reciprocal of the global zoom factor and the zoom core
  • the post-processing module 204 executes the reverse processing of preprocessing the restored image according to the second instruction and the second parameter to obtain the reconstructed image corresponding to the original image, including: following the global scaling instruction, the inverse of the global scaling factor, and scaling Core, global zoom the restored image to obtain the reconstructed image.
  • the first instruction includes an adaptive scaling instruction
  • the first parameter includes a block parameter
  • the second instruction includes an adaptive scaling instruction
  • the second parameter includes a splicing parameter associated with the block parameter
  • the restored image includes a plurality of restored image blocks ;
  • the post-processing module 204 executes the reverse process of preprocessing the restored image according to the second instruction and the second parameter to obtain the reconstructed image corresponding to the original image, including: following the adaptive scaling instruction and each restored image block Image feature, each restored image block is adaptively scaled to obtain the image block to be reconstructed corresponding to each restored image block, where the image feature is used to determine the scaling factor of the restored image block; multiple to be reconstructed according to the stitching parameters The image blocks are stitched together to obtain a reconstructed image.
  • the first instruction includes a fuzzy processing instruction, and the first parameter includes a fuzzy kernel;
  • the second instruction includes a deblurring processing instruction, and the second parameter includes a deblurring kernel corresponding to the fuzzy kernel;
  • the post-processing module 204 executes the reverse process of preprocessing the restored image according to the second instruction and the second parameter to obtain the reconstructed image corresponding to the original image, including: according to the deblurring processing instruction and the deblurring kernel, the restoration The image is deblurred to obtain a reconstructed image.
  • the first instruction includes an image degradation instruction, and the first parameter includes an image degradation parameter;
  • the second instruction includes an image enhancement instruction, and the second parameter includes an image enhancement parameter;
  • the post-processing module 204 performs the reverse processing of preprocessing the restored image according to the second instruction and the second parameter to obtain the reconstructed image corresponding to the original image, including: according to the image enhancement instruction and the image enhancement parameter, the restored image Perform image enhancement to obtain a reconstructed image.
  • the first instruction includes an image separation instruction and a first post-processing instruction
  • the first parameter includes an image separation parameter corresponding to the image separation instruction and a first post-processing parameter corresponding to the first post-processing instruction
  • the second instruction includes the reverse instruction of the image separation instruction and the reverse instruction of the first post-stage processing instruction
  • the second parameter includes the reverse parameter of the image separation parameter corresponding to the reverse instruction of the image separation instruction and the reverse instruction of the first post-stage
  • the inverse instruction of the processing instruction corresponds to the inverse parameter of the first post-stage processing parameter; restoring the image includes restoring the edge image and restoring the texture image;
  • the post-processing module 204 executes the reverse processing of preprocessing the restored image according to the second instruction and the second parameter to obtain the reconstructed image corresponding to the original image, including: the reverse instruction and the reverse instruction according to the first post-processing instruction
  • the inverse parameter of the first post-processing parameter is to perform at least one of global scaling inverse processing, adaptive scaling inverse processing, deblurring processing, and image enhancement on both the restored edge image and the restored texture image to obtain the The edge image and the texture image to be reconstructed are reconstructed; according to the reverse instruction of the image separation instruction and the reverse parameter of the image separation parameter, the edge image to be reconstructed and the texture image to be reconstructed are image fused to obtain the reconstructed image.
  • the first instruction includes an image segmentation instruction and a second post-processing instruction
  • the first parameter includes a segmentation category corresponding to the image segmentation instruction and a second post-processing parameter corresponding to the second post-processing instruction
  • the second instruction includes the reverse instruction of the image segmentation instruction and the reverse instruction of the second post-processing instruction, and the second parameter includes the reverse parameter of the second post-processing parameter corresponding to the reverse instruction of the second post-processing instruction ;
  • the restored image includes multiple restored image areas and the position coordinates of each restored image area;
  • the post-processing module 204 executes the reverse processing of preprocessing the restored image according to the second instruction and the second parameter to obtain the reconstructed image corresponding to the original image, including: the reverse instruction and the reverse instruction according to the second post-processing instruction
  • the second post-processing parameter is the inverse parameter, and each restored image area is subjected to at least one of the inverse processing of global scaling, the inverse processing of adaptive scaling, the deblurring processing, and the image enhancement to obtain each restored image area.
  • the image area to be reconstructed corresponding to the image area; according to the reverse instruction of the image segmentation instruction and the position coordinates of each restored image area, a plurality of image areas to be reconstructed are spliced to obtain the reconstructed image.
  • the post-processing module 204 is further configured to process the reconstructed image using at least one of a super-resolution algorithm, a deblurring algorithm, a dehazing algorithm, and a denoising algorithm to improve the visual effect of the reconstructed image.
  • FIG. 26 is a schematic diagram of the composition of an image processing apparatus 300 according to an embodiment of the application.
  • the image processing device 300 is applied to the encoding and decoding end, and may be, for example, an electronic device with encoding and decoding functions.
  • the image processing device 300 includes an image acquisition module 301, a response module 302, a preprocessing module 303, a compression module 304, a decompression module 305, a reverse strategy acquisition module 306, and a post-processing module 307.
  • the image acquisition module 301 is used to acquire the original image.
  • the response module 302 is configured to determine a target strategy from a plurality of preset strategies in response to an operation on the original image, wherein the code rates of the compressed data corresponding to at least two preset strategies are different.
  • the preprocessing module 303 is used to preprocess the original image according to the target strategy to obtain the image to be compressed.
  • the compression module 304 is configured to compress the image to be compressed using a preset deep learning image compression framework to obtain compressed data.
  • the decompression module 305 is configured to decompress the compressed data using a preset deep learning image decompression framework to obtain a restored image.
  • the reverse strategy obtaining module 306 is used to obtain the reverse strategy corresponding to the target strategy.
  • the post-processing module 307 is configured to perform reverse processing of preprocessing the restored image according to the reverse strategy to obtain a reconstructed image corresponding to the original image.
  • FIG. 27 is a schematic diagram of the composition of an electronic device 10 provided by an embodiment of the application.
  • the electronic device 10 may be a terminal, a server, etc.
  • the electronic device 10 includes a processor 11, a memory 12, and a bus 13.
  • the processor 11 passes through the bus. 13 is connected to the memory 12.
  • the memory 12 is used to store programs.
  • the image processing device 100 shown in FIG. 24 includes at least one operating system that can be stored in the memory 12 in the form of software or firmware or solidified in the electronic device 10 , The software function module in the OS).
  • the processor 11 executes the program to implement the image processing method applied to the encoding end disclosed in the foregoing embodiment.
  • the memory 12 may include a high-speed random access memory (Random Access Memory, RAM), and may also include a non-volatile memory (NVM).
  • RAM Random Access Memory
  • NVM non-volatile memory
  • the processor 11 may be an integrated circuit chip with signal processing capabilities. In the implementation process, the steps of the above method can be completed by an integrated logic circuit of hardware in the processor 11 or instructions in the form of software.
  • the aforementioned processor 11 may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a microcontroller unit (Microcontroller Unit, MCU), a complex programmable logic device (Complex Programmable Logic Device, CPLD), and an on-site programmable logic device (CPLD). Programmable gate array (Field-Programmable Gate Array, FPGA), embedded ARM and other chips.
  • CPU Central Processing Unit
  • MCU microcontroller Unit
  • CPLD Complex Programmable Logic Device
  • CPLD on-site programmable logic device
  • Programmable gate array Field-Programmable Gate Array, FPGA
  • embedded ARM embedded ARM
  • the embodiments of the present application also provide a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the image processing method disclosed in the above-mentioned embodiments is implemented.
  • the embodiments of the present application also provide a computer program product, including instructions, which when run on a computer, cause the computer to execute the image processing method disclosed in the above embodiments.
  • the embodiments of the present application provide a chip system.
  • the chip system includes a processor and may also include a memory for implementing the image processing method disclosed in the foregoing embodiments.
  • the chip system can be composed of chips, or it can include chips and other discrete devices.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Discrete Mathematics (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)

Abstract

The embodiments of the present application relate to the technical field of image processing in the technical field of computer vision in the field of artificial intelligence. Provided are an image processing method and apparatus, and an electronic device and a storage medium. A pre-processing link including a plurality of preset strategies is provided, wherein during encoding, a target strategy is selected from among the plurality of preset strategies to pre-process an original image, and then, an obtained image to be compressed is compressed; if a different target strategy is selected, the bit rate of obtained compressed data is also different, thereby achieving the aim of one compression model corresponding to a plurality of bit rates; and compression is carried out by using a deep learning image compression framework, and the compression performance is improved. In addition, a reverse processing link of pre-processing is provided, wherein during decoding, compressed data is decompressed first, and then, reverse processing of the pre-processing is carried out on an obtained restored image by using a reverse strategy of the target strategy, such that the visual quality of a reconstructed image is basically unchanged. Therefore, by means of the embodiments of the present application, one compression model corresponding to a plurality of bit rates can be realized while a compression effect is ensured.

Description

图像处理方法、装置、电子设备及存储介质Image processing method, device, electronic equipment and storage medium
本申请要求于2020年02月26日提交国家知识产权局、申请号为202010120792.1、申请名称为“图像处理方法、装置、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the State Intellectual Property Office on February 26, 2020, the application number is 202010120792.1, and the application name is "Image processing methods, devices, electronic equipment and storage media", the entire content of which is incorporated by reference Incorporated in this application.
技术领域Technical field
本申请实施例涉及人工智能领域计算机视觉技术领域的图像处理技术领域,具体而言,涉及一种图像处理方法、装置、电子设备及存储介质。The embodiments of the present application relate to the field of image processing technology in the field of computer vision technology in the field of artificial intelligence, and specifically, to an image processing method, device, electronic device, and storage medium.
背景技术Background technique
图像压缩对于数据存储和传输具有极为重要的意义,未经压缩的图像会占用庞大的存储空间,同时会给传输带来巨大压力。而图像之所以能被压缩,是因为图像中存在冗余信息,冗余信息主要包括:图像中相邻像素间的相关性引起的空间冗余、不同彩色平面或频谱带的相关性引起的频谱冗余等,图像压缩的目的就是通过去除这些冗余信息,来减少表示图像所需的比特数。Image compression is extremely important for data storage and transmission. Uncompressed images will take up a huge amount of storage space and at the same time will bring huge pressure on transmission. The reason why the image can be compressed is because there is redundant information in the image. The redundant information mainly includes: spatial redundancy caused by the correlation between adjacent pixels in the image, and spectrum caused by the correlation between different color planes or spectrum bands. Redundancy, etc. The purpose of image compression is to reduce the number of bits required to represent the image by removing these redundant information.
在实际应用中,除了对压缩效果有要求,需要保证图片视觉质量基本不变外,不同的应用场合要求的码率可能也不同,码率是指每秒显示的图片压缩后的数据量,因此,如何在保证压缩效果的同时实现一个压缩模型对应多个码率,是研究人员需要解决的问题。In practical applications, in addition to the requirements for the compression effect and the need to ensure that the visual quality of the picture is basically unchanged, the bit rate required by different applications may also be different. The bit rate refers to the amount of compressed data of the picture displayed per second, so , How to achieve a compression model corresponding to multiple code rates while ensuring the compression effect is a problem that researchers need to solve.
发明内容Summary of the invention
本申请实施例的目的在于提供一种图像处理方法、装置、电子设备及存储介质,用以解决如何在保证压缩效果的同时实现一个压缩模型对应多个码率的问题。The purpose of the embodiments of the present application is to provide an image processing method, device, electronic device, and storage medium to solve the problem of how to achieve a compression model corresponding to multiple code rates while ensuring the compression effect.
第一方面,本申请实施例提供一种图像处理方法,所述图像处理方法包括:获取原始图像;响应对原始图像的操作,从多个预设策略中确定出目标策略,其中,至少两个所述预设策略对应的压缩数据的码率不同;按照所述目标策略,对所述原始图像进行预处理,得到待压缩图像;利用预设的深度学习图像压缩框架对所述待压缩图像进行压缩,得到所述压缩数据,其中,所述压缩数据用于通过预设的深度学习图像解压缩框架进行解压缩得到还原图像,所述还原图像用于基于所述目标策略的反向策略进行所述预处理的反向处理得到与所述原始图像对应的重建图像。In a first aspect, an embodiment of the present application provides an image processing method. The image processing method includes: acquiring an original image; in response to an operation on the original image, determining a target strategy from a plurality of preset strategies, of which at least two The code rate of the compressed data corresponding to the preset strategy is different; according to the target strategy, the original image is preprocessed to obtain the image to be compressed; the preset deep learning image compression framework is used to perform the compression on the image to be compressed. Compressed to obtain the compressed data, wherein the compressed data is used to obtain a restored image by decompressing through a preset deep learning image decompression framework, and the restored image is used to perform a restoration based on the reverse strategy of the target strategy The reverse processing of the preprocessing obtains a reconstructed image corresponding to the original image.
本申请实施例提供的图像处理方法,首先设置了预处理环节,包含多个预设策略,压缩时,从多个预设策略中选择目标策略对原始图像做预处理,再对得到的待压缩图像做压缩,选择的目标策略不同,得到的压缩数据的码率也会不同,从而达到一个压缩模型对应多个码率的目的;其次,采用深度学习图像压缩框架做压缩,提高了压缩性能;同时,压缩数据用于解压缩时,先采用深度学习图像解压缩框架对压缩数据做解压缩,再采用目标策略的反向策略对得到的还原图像做预处理的反向处理,使得重建图像的视觉质量基本不变。因此,本申请实施例能够在保证压缩效果的同时,实现一个压缩模型对应多个码率。The image processing method provided by the embodiment of this application first sets up a pre-processing link, including multiple preset strategies. When compressing, select a target strategy from the multiple preset strategies to preprocess the original image, and then perform pre-processing on the obtained image to be compressed. For image compression, the selected target strategy is different, and the code rate of the compressed data will be different, so as to achieve the purpose of one compression model corresponding to multiple code rates; secondly, the deep learning image compression framework is used for compression to improve the compression performance; At the same time, when the compressed data is used for decompression, first use the deep learning image decompression framework to decompress the compressed data, and then use the reverse strategy of the target strategy to do the reverse processing of the preprocessing of the obtained restored image, so that the reconstructed image The visual quality is basically unchanged. Therefore, the embodiments of the present application can realize that one compression model corresponds to multiple code rates while ensuring the compression effect.
可选地,所述目标策略包括第一指令和与所述第一指令对应的第一参数;所述按 照所述目标策略,对所述原始图像进行预处理,得到待压缩图像的步骤,包括:按照所述第一指令和所述第一参数,对所述原始图像进行预处理,得到所述待压缩图像。Optionally, the target strategy includes a first instruction and a first parameter corresponding to the first instruction; the step of preprocessing the original image according to the target strategy to obtain the image to be compressed includes : Preprocess the original image according to the first instruction and the first parameter to obtain the image to be compressed.
本申请实施例中,采用不同的第一指令和第一参数对原始图像做预处理,对应压缩数据的码率不同。In the embodiment of the present application, different first instructions and first parameters are used to preprocess the original image, and the corresponding compressed data has different code rates.
可选地,所述第一指令包括全局缩放指令,所述第一参数包括全局缩放系数和缩放核;所述按照所述第一指令和所述第一参数,对所述原始图像进行预处理,得到所述待压缩图像的步骤,包括:按照所述全局缩放指令、全局缩放系数和缩放核,对所述原始图像进行全局缩放,得到所述待压缩图像。Optionally, the first instruction includes a global zoom instruction, and the first parameter includes a global zoom factor and a zoom kernel; and the original image is preprocessed according to the first instruction and the first parameter , The step of obtaining the image to be compressed includes: performing global scaling on the original image in accordance with the global scaling instruction, global scaling factor, and scaling kernel to obtain the image to be compressed.
本申请实施例中,当第一指令为全局缩放指令时,采用不同的全局缩放系数对原始图像进行全局缩放,对应压缩数据的码率不同。全局缩放系数越小,压缩数据的码率也越小。In the embodiment of the present application, when the first command is a global zoom command, different global zoom coefficients are used to perform global zoom on the original image, and the code rates of the corresponding compressed data are different. The smaller the global scaling factor, the smaller the bit rate of compressed data.
可选地,所述第一指令包括自适应缩放指令,所述第一参数包括分块参数;所述按照所述第一指令和所述第一参数,对所述原始图像进行预处理,得到所述待压缩图像的步骤,包括:按照所述分块参数对所述原始图像进行划分,得到多个图像块;按照所述自适应缩放指令和每个所述图像块的图像特征,对每个所述图像块均进行自适应缩放,得到每个所述图像块对应的待压缩图像块,其中,所述待压缩图像包括多个待压缩图像块,所述图像特征用于确定所述图像块的缩放系数。Optionally, the first instruction includes an adaptive scaling instruction, and the first parameter includes a block parameter; and the original image is preprocessed according to the first instruction and the first parameter to obtain The step of the image to be compressed includes: dividing the original image according to the block parameters to obtain a plurality of image blocks; according to the adaptive scaling instruction and the image characteristics of each image block, each Each of the image blocks is adaptively scaled to obtain the image block to be compressed corresponding to each of the image blocks, wherein the image to be compressed includes a plurality of image blocks to be compressed, and the image feature is used to determine the image The zoom factor of the block.
本申请实施例中,自适应缩放指令,是指对原始图像做自适应缩放的方法。对原始图像做自适应缩放,是指基于原始图像的图像特征(例如,颜色特征、纹理特征、形状特征等),对图像特征不同的区域进行不同程度的缩放,例如,背景区域多缩放一些,前景区域少缩放一些。In the embodiment of the present application, the adaptive zoom instruction refers to a method of adaptively zooming the original image. Adaptive scaling of the original image refers to the image feature of the original image (for example, color feature, texture feature, shape feature, etc.), the area with different image features is scaled to different degrees, for example, the background area is more zoomed. The foreground area is less zoomed.
对每个图像块均进行自适应缩放,是指按照每个图像块对应的图像特征,确定每个图像块的缩放系数,再按照各自的缩放系数进行分块缩小或分块放大。图像特征越多的图像块,缩放系数越大;图像特征越少的图像块,缩放系数越小。也就是,平滑的图像块多缩放一些,不平滑的图像块少缩放一些。Performing adaptive scaling for each image block refers to determining the scaling factor of each image block according to the image characteristics corresponding to each image block, and then performing block reduction or block enlargement according to the respective scaling factors. The image block with more image features has a larger scaling factor; the image block with fewer image features has a smaller scaling factor. That is, smooth image blocks are scaled more, and unsmooth image blocks are scaled less.
当第一指令为自适应缩放指令时,为了保证压缩性能,图像特征越多的图像块,缩放系数越大,图像特征越少的图像块,缩放系数越小。通过调整分块参数,即可实现一个压缩模型对应多个码率的目的。When the first instruction is an adaptive scaling instruction, in order to ensure compression performance, an image block with more image features has a larger scaling factor, and an image block with fewer image features has a smaller scaling factor. By adjusting the block parameters, one compression model can correspond to multiple code rates.
可选地,所述第一指令包括模糊处理指令,所述第一参数包括模糊核;所述按照所述第一指令和所述第一参数,对所述原始图像进行预处理,得到所述待压缩图像的步骤,包括:按照所述模糊处理指令和所述模糊核,对所述原始图像进行模糊处理,得到所述待压缩图像。Optionally, the first instruction includes a blur processing instruction, and the first parameter includes a blur kernel; and the original image is preprocessed according to the first instruction and the first parameter to obtain the The step of the image to be compressed includes: performing blur processing on the original image according to the blur processing instruction and the blur kernel to obtain the image to be compressed.
本申请实施例中,当第一指令为模糊处理指令时,通过调整模糊核,可以实现不同码率的压缩。模糊核尺度越大,压缩数据的码率越小。In the embodiment of the present application, when the first instruction is a fuzzy processing instruction, by adjusting the fuzzy kernel, compression of different code rates can be realized. The larger the fuzzy kernel scale, the smaller the bit rate of compressed data.
可选地,所述第一指令包括图像退化指令,所述第一参数包括图像退化参数;所述按照所述第一指令和所述第一参数,对所述原始图像进行预处理,得到所述待压缩图像的步骤,包括:按照所述图像退化指令和所述图像退化参数,对所述原始图像进行图像退化,得到所述待压缩图像。Optionally, the first instruction includes an image degradation instruction, and the first parameter includes an image degradation parameter; and the original image is preprocessed according to the first instruction and the first parameter to obtain the The step of the image to be compressed includes: performing image degradation on the original image according to the image degradation instruction and the image degradation parameter to obtain the image to be compressed.
本申请实施例中,当第一指令为图像退化指令时,通过调整图像退化参数,可以 实现不同码率的压缩。图像退化参数越大,压缩数据的码率越小。In the embodiment of the present application, when the first instruction is an image degradation instruction, by adjusting the image degradation parameter, compression at different code rates can be realized. The larger the image degradation parameter, the smaller the bit rate of the compressed data.
可选地,所述第一指令包括图像分离指令和第一后阶段处理指令,所述第一参数包括与所述图像分离指令对应的图像分离参数和与所述第一后阶段处理指令对应的第一后阶段处理参数;所述按照所述第一指令和所述第一参数,对所述原始图像进行预处理,得到所述待压缩图像的步骤,包括:按照所述图像分离指令和所述图像分离参数,对所述原始图像进行图像分离,得到边缘图像和纹理图像;按照所述第一后阶段处理指令和所述第一后阶段处理参数,对所述边缘图像和所述纹理图像均进行全局缩放、自适应缩放、模糊处理以及图像退化中的至少一种,得到待压缩边缘图像和待压缩纹理图像,其中,所述待压缩图像包括所述待压缩边缘图像和所述待压缩纹理图像。Optionally, the first instruction includes an image separation instruction and a first post-processing instruction, and the first parameter includes an image separation parameter corresponding to the image separation instruction and an image separation parameter corresponding to the first post-processing instruction The first post-stage processing parameter; the step of preprocessing the original image according to the first instruction and the first parameter to obtain the image to be compressed includes: according to the image separation instruction and the The image separation parameter is used to perform image separation on the original image to obtain an edge image and a texture image; according to the first post-processing instruction and the first post-processing parameter, the edge image and the texture image are At least one of global scaling, adaptive scaling, blur processing, and image degradation is performed to obtain an edge image to be compressed and a texture image to be compressed, wherein the image to be compressed includes the edge image to be compressed and the edge image to be compressed Texture image.
本申请实施例中,当第一指令为图像分离指令和第一后阶段处理指令时,通过调整图像分离参数和第一后阶段处理参数,可以实现不同码率的压缩。In the embodiment of the present application, when the first instruction is an image separation instruction and a first post-processing instruction, by adjusting the image separation parameter and the first post-processing parameter, compression at different bit rates can be realized.
可选地,所述第一指令包括图像分割指令和第二后阶段处理指令,所述第一参数包括与所述图像分割指令对应的分割类别和与所述第二后阶段处理指令对应的第二后阶段处理参数;所述按照所述第一指令和所述第一参数,对所述原始图像进行预处理,得到所述待压缩图像的步骤,包括:按照所述图像分割指令和所述分割类别,对所述原始图像进行图像分割,得到多个图像区域;按照所述第二后阶段处理指令和所述第二后阶段处理参数,对所述多个图像区域均进行全局缩放、自适应缩放、模糊处理以及图像退化中的至少一种,得到每个所述图像区域对应的待压缩图像区域,其中,所述待压缩图像包括多个待压缩图像区域。Optionally, the first instruction includes an image segmentation instruction and a second post-processing instruction, and the first parameter includes a segmentation category corresponding to the image segmentation instruction and a second post-processing instruction corresponding to the second post-processing instruction. Two post-stage processing parameters; the step of preprocessing the original image according to the first instruction and the first parameter to obtain the image to be compressed includes: following the image segmentation instruction and the Segmentation category, image segmentation is performed on the original image to obtain multiple image regions; according to the second post-processing instruction and the second post-processing parameters, the multiple image regions are globally zoomed and automatically At least one of scaling, blur processing, and image degradation is adapted to obtain a to-be-compressed image area corresponding to each of the image areas, where the to-be-compressed image includes a plurality of to-be-compressed image areas.
本申请实施例中,当第一指令为图像分割指令和第二后阶段处理指令时,通过调整分割类别和第二后阶段处理参数,可以实现不同码率的压缩。In the embodiment of the present application, when the first instruction is an image segmentation instruction and a second post-stage processing instruction, by adjusting the segmentation category and the second post-stage processing parameter, compression at different code rates can be realized.
可选地,所述深度学习图像压缩框架包括第一深度神经网络、量化模型和熵编码模型;所述利用预设的深度学习图像压缩框架对所述待压缩图像进行压缩,得到压缩数据的步骤,包括:利用所述第一深度神经网络对所述待压缩图像进行特征提取,得到图像特征;利用所述量化模型对所述图像特征进行量化,得到压缩特征;利用所述熵编码模型对所述压缩特征进行熵编码,得到所述压缩数据。Optionally, the deep learning image compression framework includes a first deep neural network, a quantization model, and an entropy coding model; the step of compressing the image to be compressed using a preset deep learning image compression framework to obtain compressed data , Including: using the first deep neural network to perform feature extraction on the image to be compressed to obtain image features; using the quantization model to quantize the image features to obtain compressed features; using the entropy coding model to Entropy coding is performed on the compressed feature to obtain the compressed data.
第二方面,本申请实施例还提供一种图像处理方法,所述图像处理方法包括:获得压缩数据,其中,所述压缩数据为利用预设的深度学习图像压缩框架对待压缩图像进行压缩得到,所述待压缩图像为按照目标策略对原始图像进行预处理得到,所述目标策略是响应对所述原始图像的操作从多个预设策略中确定出的,至少两个所述预设策略对应的所述压缩数据的码率不同;利用预设的深度学习图像解压缩框架对所述压缩数据进行解压缩,得到还原图像;获得所述目标策略对应的反向策略;按照所述反向策略对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像。In a second aspect, an embodiment of the present application further provides an image processing method, the image processing method includes: obtaining compressed data, wherein the compressed data is obtained by compressing an image to be compressed using a preset deep learning image compression framework, The image to be compressed is obtained by preprocessing the original image according to a target strategy, and the target strategy is determined from a plurality of preset strategies in response to an operation on the original image, and at least two of the preset strategies correspond to The code rate of the compressed data is different; the compressed data is decompressed using a preset deep learning image decompression framework to obtain a restored image; the reverse strategy corresponding to the target strategy is obtained; according to the reverse strategy Performing the reverse processing of the pre-processing on the restored image to obtain a reconstructed image corresponding to the original image.
可选地,所述获得所述目标策略对应的反向策略的步骤,包括:获得所述目标策略,所述目标策略包括第一指令和与所述第一指令对应的第一参数;依据所述第一指令及预设的指令对应关系确定第二指令;依据所述第一参数及预设的参数计算规则确定第二参数,其中,所述反向策略包括所述第二指令和与所述第二指令对应的所述第二参数。Optionally, the step of obtaining a reverse strategy corresponding to the target strategy includes: obtaining the target strategy, the target strategy including a first instruction and a first parameter corresponding to the first instruction; The corresponding relationship between the first instruction and the preset instruction determines the second instruction; the second parameter is determined according to the first parameter and the preset parameter calculation rule, wherein the reverse strategy includes the second instruction and the The second parameter corresponding to the second instruction.
可选地,所述按照所述反向策略对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像的步骤,包括:按照所述第二指令和所述第二参数,对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像。Optionally, the step of performing reverse processing of the preprocessing on the restored image according to the reverse strategy to obtain a reconstructed image corresponding to the original image includes: following the second instruction and the The second parameter is to perform reverse processing of the pre-processing on the restored image to obtain a reconstructed image corresponding to the original image.
可选地,所述第一指令包括全局缩放指令,所述第一参数包括全局缩放系数和缩放核;所述第二指令包括全局缩放指令,所述第二参数包括全局缩放系数的倒数和缩放核;所述按照所述第二指令和所述第二参数,对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像的步骤,包括:按照所述全局缩放指令、全局缩放系数的倒数和缩放核,对所述还原图像进行全局缩放,得到所述重建图像。Optionally, the first instruction includes a global zoom instruction, the first parameter includes a global zoom factor and a zoom core; the second instruction includes a global zoom instruction, and the second parameter includes the reciprocal of the global zoom factor and zoom Core; the step of performing the pre-processing reverse processing on the restored image according to the second instruction and the second parameter to obtain a reconstructed image corresponding to the original image includes: according to the The global zoom instruction, the reciprocal of the global zoom coefficient, and the zoom kernel perform global zoom on the restored image to obtain the reconstructed image.
可选地,所述第一指令包括自适应缩放指令,所述第一参数包括分块参数;所述第二指令包括自适应缩放指令,所述第二参数包括所述分块参数关联的拼接参数;所述还原图像包括多个还原图像块;所述按照所述第二指令和所述第二参数,对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像的步骤,包括:按照所述自适应缩放指令和每个所述还原图像块的图像特征,对每个所述还原图像块均进行自适应缩放,得到每个所述还原图像块对应的待重建图像块,其中,所述图像特征用于确定所述还原图像块的缩放系数;按照所述拼接参数对多个待重建图像块进行拼接,得到所述重建图像。Optionally, the first instruction includes an adaptive scaling instruction, the first parameter includes a block parameter; the second instruction includes an adaptive scaling instruction, and the second parameter includes a splicing associated with the block parameter. Parameters; the restored image includes a plurality of restored image blocks; the restored image is subjected to the reverse processing of the pre-processing in accordance with the second instruction and the second parameter to obtain a corresponding to the original image The step of reconstructing the image includes: performing adaptive scaling on each restored image block according to the adaptive scaling instruction and the image characteristics of each restored image block, to obtain a corresponding to each restored image block The image block to be reconstructed, wherein the image feature is used to determine the scaling factor of the restored image block; and a plurality of image blocks to be reconstructed are spliced according to the splicing parameter to obtain the reconstructed image.
可选地,所述第一指令包括模糊处理指令,所述第一参数包括模糊核;所述第二指令包括去模糊处理指令,所述第二参数包括所述模糊核对应的去模糊核;所述按照所述第二指令和所述第二参数,对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像的步骤,包括:按照所述去模糊处理指令和所述去模糊核,对所述还原图像进行去模糊处理,得到所述重建图像。Optionally, the first instruction includes a fuzzy processing instruction, and the first parameter includes a fuzzy core; the second instruction includes a deblurring processing instruction, and the second parameter includes a deblurring core corresponding to the fuzzy core; The step of performing the reverse processing of the pre-processing on the restored image according to the second instruction and the second parameter to obtain a reconstructed image corresponding to the original image includes: according to the deblurring The processing instruction and the deblurring kernel perform deblurring processing on the restored image to obtain the reconstructed image.
可选地,所述第一指令包括图像退化指令,所述第一参数包括图像退化参数;所述第二指令包括图像增强指令,所述第二参数包括图像增强参数;所述按照所述第二指令和所述第二参数,对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像的步骤,包括:按照所述图像增强指令和所述图像增强参数,对所述还原图像进行所述图像增强,得到所述重建图像。Optionally, the first instruction includes an image degradation instruction, the first parameter includes an image degradation parameter; the second instruction includes an image enhancement instruction, and the second parameter includes an image enhancement parameter; The second instruction and the second parameter, the step of performing the reverse processing of the pre-processing on the restored image to obtain a reconstructed image corresponding to the original image includes: following the image enhancement instruction and the image enhancement Parameter, performing the image enhancement on the restored image to obtain the reconstructed image.
可选地,所述第一指令包括图像分离指令和第一后阶段处理指令,所述第一参数包括与所述图像分离指令对应的图像分离参数和与所述第一后阶段处理指令对应的第一后阶段处理参数;所述第二指令包括所述图像分离指令的反向指令和所述第一后阶段处理指令的反向指令,所述第二参数包括与所述图像分离指令的反向指令对应的所述图像分离参数的反向参数和与所述第一后阶段处理指令的反向指令对应的所述第一后阶段处理参数的反向参数;所述还原图像包括还原边缘图像和还原纹理图像;所述按照所述第二指令和所述第二参数,对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像的步骤,包括:按照所述第一后阶段处理指令的反向指令和所述第一后阶段处理参数的反向参数,对所述还原边缘图像和所述还原纹理图像均进行全局缩放的反向处理、自适应缩放的反向处理、去模糊处理以及图像增强中的至少一种,得到待重建边缘图像和待重建纹理图像;按照所述图像分离指令的反向指令和所述图像分离参数的反向参数,对所述待重建边缘图像和所述待重建纹理图像进行图像融合,得到所述重建图像。Optionally, the first instruction includes an image separation instruction and a first post-processing instruction, and the first parameter includes an image separation parameter corresponding to the image separation instruction and an image separation parameter corresponding to the first post-processing instruction The first post-processing parameter; the second instruction includes the reverse instruction of the image separation instruction and the reverse instruction of the first post-processing instruction, and the second parameter includes the reverse instruction of the image separation instruction The reverse parameter of the image separation parameter corresponding to the direction instruction and the reverse parameter of the first post-processing parameter corresponding to the reverse instruction of the first post-processing instruction; the restored image includes a restored edge image And a restored texture image; the step of performing the reverse processing of the pre-processing on the restored image according to the second instruction and the second parameter to obtain a reconstructed image corresponding to the original image includes: According to the reverse instruction of the first post-stage processing instruction and the reverse parameter of the first post-stage processing parameter, both the restored edge image and the restored texture image are subjected to the reverse processing of global scaling and adaptive At least one of the reverse processing of scaling, deblurring processing, and image enhancement to obtain the edge image to be reconstructed and the texture image to be reconstructed; according to the reverse instruction of the image separation instruction and the reverse parameter of the image separation parameter, Image fusion is performed on the edge image to be reconstructed and the texture image to be reconstructed to obtain the reconstructed image.
可选地,所述第一指令包括图像分割指令和第二后阶段处理指令,所述第一参数包括与所述图像分割指令对应的分割类别和与所述第二后阶段处理指令对应的第二后阶段处理参数;所述第二指令包括所述图像分割指令的反向指令和所述第二后阶段处理指令的反向指令,所述第二参数包括与所述第二后阶段处理指令的反向指令对应的所述第二后阶段处理参数的反向参数;所述还原图像包括多个还原图像区域及每个所述还原图像区域的位置坐标;所述按照所述第二指令和所述第二参数,对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像的步骤,包括:按照所述第二后阶段处理指令的反向指令和所述第二后阶段处理参数的反向参数,对每个所述还原图像区域均进行全局缩放的反向处理、自适应缩放的反向处理、去模糊处理以及图像增强中的至少一种,得到每个所述还原图像区域对应的待重建图像区域;按照所述图像分割指令的反向指令和每个所述还原图像区域的位置坐标,对多个待重建图像区域进行拼接,得到所述重建图像。Optionally, the first instruction includes an image segmentation instruction and a second post-processing instruction, and the first parameter includes a segmentation category corresponding to the image segmentation instruction and a second post-processing instruction corresponding to the second post-processing instruction. Two post-stage processing parameters; the second instruction includes a reverse instruction of the image segmentation instruction and a reverse instruction of the second post-stage processing instruction, and the second parameter includes the same as the second post-processing instruction The reverse instruction corresponding to the reverse parameter of the second post-stage processing parameter; the restored image includes a plurality of restored image areas and the position coordinates of each restored image area; the second instruction and The second parameter, the step of performing the reverse processing of the pre-processing on the restored image to obtain a reconstructed image corresponding to the original image includes: a reverse instruction according to the second post-processing instruction and The inverse parameter of the second post-stage processing parameter performs at least one of global scaling inverse processing, adaptive scaling inverse processing, deblurring processing, and image enhancement for each of the restored image regions, Obtain the to-be-reconstructed image area corresponding to each of the restored image areas; according to the reverse instruction of the image segmentation instruction and the position coordinates of each of the restored image areas, stitch the multiple to-be-reconstructed image areas to obtain the Reconstruct the image.
可选地,所述深度学习图像解压缩框架包括第二深度神经网络、反量化模型和熵解码模型;所述利用预设的深度学习图像解压缩框架对所述压缩数据进行解压缩,得到还原图像的步骤,包括:利用所述熵解码模型对所述压缩数据进行熵解码,得到压缩特征;利用所述反量化模型对所述压缩特征进行反量化,得到图像特征;利用所述第二深度神经网络对所述图像特征进行还原,得到所述还原图像。Optionally, the deep learning image decompression framework includes a second deep neural network, an inverse quantization model, and an entropy decoding model; the preset deep learning image decompression framework is used to decompress the compressed data to obtain restoration The image step includes: using the entropy decoding model to perform entropy decoding on the compressed data to obtain compressed features; using the inverse quantization model to dequantize the compressed features to obtain image features; and using the second depth The neural network restores the image features to obtain the restored image.
可选地,所述图像处理方法还包括:利用超分辨率算法、去模糊算法、去雾算法以及去噪算法中的至少一种对所述重建图像进行处理,以改善所述重建图像的视觉效果。Optionally, the image processing method further includes: using at least one of a super-resolution algorithm, a deblurring algorithm, a dehazing algorithm, and a denoising algorithm to process the reconstructed image, so as to improve the vision of the reconstructed image. Effect.
第三方面,本申请实施例还提供一种图像处理方法,所述图像处理方法包括:获取原始图像;响应对原始图像的操作,从多个预设策略中确定出目标策略,其中,至少两个所述预设策略对应的压缩数据的码率不同;按照所述目标策略,对所述原始图像进行预处理,得到待压缩图像;利用预设的深度学习图像压缩框架对所述待压缩图像进行压缩,得到所述压缩数据;利用预设的深度学习图像解压缩框架对所述压缩数据进行解压缩,得到还原图像;获得所述目标策略对应的反向策略;按照反向策略对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像。In a third aspect, an embodiment of the present application also provides an image processing method. The image processing method includes: acquiring an original image; in response to an operation on the original image, determining a target strategy from a plurality of preset strategies, wherein at least two The code rates of the compressed data corresponding to each of the preset strategies are different; according to the target strategy, the original image is preprocessed to obtain the image to be compressed; the preset deep learning image compression framework is used for the image to be compressed Perform compression to obtain the compressed data; use a preset deep learning image decompression framework to decompress the compressed data to obtain a restored image; obtain the reverse strategy corresponding to the target strategy; The restored image is subjected to the reverse processing of the pre-processing to obtain a reconstructed image corresponding to the original image.
第四方面,本申请实施例还提供一种图像处理装置,所述图像处理装置包括:图像获取模块,用于获取原始图像;响应模块,用于响应对原始图像的操作,从多个预设策略中确定出目标策略,其中,至少两个所述预设策略对应的压缩数据的码率不同;预处理模块,用于按照预设策略,对所述原始图像进行预处理,得到待压缩图像;压缩模块,用于利用预设的深度学习图像压缩框架对所述待压缩图像进行压缩,得到所述压缩数据,其中,所述压缩数据用于通过预设的深度学习图像解压缩框架进行解压缩得到还原图像,所述还原图像用于基于所述预设策略的反向策略进行所述预处理的反向处理得到与所述原始图像对应的重建图像。In a fourth aspect, an embodiment of the present application also provides an image processing device, the image processing device includes: an image acquisition module for acquiring an original image; a response module for responding to an operation on the original image, from multiple presets The target strategy is determined in the strategy, wherein at least two of the preset strategies have different code rates for the compressed data; the preprocessing module is used to preprocess the original image according to the preset strategy to obtain the image to be compressed Compression module, used to compress the image to be compressed using a preset deep learning image compression framework to obtain the compressed data, wherein the compressed data is used to decompress the preset deep learning image decompression framework A restored image is obtained by compression, and the restored image is used to perform reverse processing of the pre-processing based on the reverse strategy of the preset strategy to obtain a reconstructed image corresponding to the original image.
第五方面,本申请实施例还提供一种图像处理装置,所述图像处理装置包括:序列获得模块,用于获得压缩数据,其中,所述压缩数据为利用预设的深度学习图像压缩框架对待压缩图像进行压缩得到,所述待压缩图像为按照目标策略对原始图像进行预处理得到,所述目标策略是响应对所述原始图像的操作从多个预设策略中确定出的, 至少两个所述预设策略对应的所述压缩数据的码率不同;解压缩模块,用于利用预设的深度学习图像解压缩框架对所述压缩数据进行解压缩,得到还原图像;反向策略获得模块,用于获得所述目标策略对应的反向策略;后处理模块,用于按照所述反向策略对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像。In a fifth aspect, an embodiment of the present application also provides an image processing device. The image processing device includes a sequence obtaining module for obtaining compressed data, wherein the compressed data is processed using a preset deep learning image compression framework. The compressed image is obtained by compression, the image to be compressed is obtained by preprocessing the original image according to a target strategy, and the target strategy is determined from a plurality of preset strategies in response to an operation on the original image, and at least two The code rate of the compressed data corresponding to the preset strategy is different; a decompression module for decompressing the compressed data using a preset deep learning image decompression framework to obtain a restored image; a reverse strategy obtaining module , Used to obtain the reverse strategy corresponding to the target strategy; a post-processing module, used to perform the pre-processing reverse processing on the restored image according to the reverse strategy to obtain a reconstruction corresponding to the original image image.
第六方面,本申请实施例还提供一种图像处理装置,所述图像处理装置包括:图像获取模块,用于获取原始图像;响应模块,用于响应对原始图像的操作,从多个预设策略中确定出目标策略,其中,至少两个所述预设策略对应的压缩数据的码率不同;预处理模块,用于按照预设策略,对所述原始图像进行预处理,得到待压缩图像;压缩模块,用于利用预设的深度学习图像压缩框架对所述待压缩图像进行压缩,得到所述压缩数据;解压缩模块,利用预设的深度学习图像解压缩框架对所述压缩数据进行解压缩,得到还原图像;反向策略获得模块,用于获得所述目标策略对应的反向策略;后处理模块,用于按照所述反向策略对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像。In a sixth aspect, an embodiment of the present application also provides an image processing device, the image processing device includes: an image acquisition module for acquiring an original image; a response module for responding to an operation on the original image, from multiple presets The target strategy is determined in the strategy, wherein at least two of the preset strategies have different code rates for the compressed data; the preprocessing module is used to preprocess the original image according to the preset strategy to obtain the image to be compressed Compression module, used to compress the image to be compressed using a preset deep learning image compression framework to obtain the compressed data; decompression module, use a preset deep learning image decompression framework to perform compression on the compressed data Decompress to obtain a restored image; a reverse strategy obtaining module for obtaining a reverse strategy corresponding to the target strategy; a post-processing module for performing the reverse of the preprocessing on the restored image according to the reverse strategy To obtain a reconstructed image corresponding to the original image.
第七方面,本申请实施例还提供一种电子设备,所述电子设备包括:一个或多个处理器;存储器,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行时,使得所述一个或多个处理器实现第一方面或者第二方面或者第三方面的图像处理方法。In a seventh aspect, an embodiment of the present application also provides an electronic device, the electronic device includes: one or more processors; a memory, used to store one or more programs, when the one or more programs are When executed by one or more processors, the one or more processors implement the image processing method of the first aspect or the second aspect or the third aspect.
第八方面,本申请实施例还提供一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现第一方面或者第二方面或者第三方面的图像处理方法。In an eighth aspect, an embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the image processing method of the first aspect or the second aspect or the third aspect is implemented.
第九方面,本申请实施例中还提供一种计算机程序产品,包括指令,当其在计算机上运行时,使得计算机执行第一方面或者第二方面或者第三方面的图像处理方法。In a ninth aspect, the embodiments of the present application also provide a computer program product, including instructions, which when run on a computer, cause the computer to execute the image processing method of the first aspect or the second aspect or the third aspect.
第十方面,本申请实施例还提供一种芯片系统,该芯片系统包括处理器,还可以包括存储器,用于实现第一方面或者第二方面或者第三方面的图像处理方法。该芯片系统可以由芯片构成,也可以包含芯片和其他分立器件。In a tenth aspect, an embodiment of the present application further provides a chip system. The chip system includes a processor and may also include a memory for implementing the image processing method of the first aspect or the second aspect or the third aspect. The chip system can be composed of chips, or it can include chips and other discrete devices.
上述第二方面至第十方面及其实现方式的有益效果可以参考对第一方面的方法及其实现方式的有益效果的描述。For the beneficial effects of the above-mentioned second aspect to the tenth aspect and the implementation manners thereof, reference may be made to the description of the beneficial effects of the method and implementation manners of the first aspect.
附图说明Description of the drawings
图1为现有技术提供的一种JPEG图像压缩框架的示意图。Fig. 1 is a schematic diagram of a JPEG image compression framework provided by the prior art.
图2为现有技术提供的一种基于Auto-encoder的图像压缩框架的示意图。FIG. 2 is a schematic diagram of an image compression framework based on Auto-encoder provided by the prior art.
图3为现有技术提供的一种基于RNN的图像压缩框架的示意图。Fig. 3 is a schematic diagram of an image compression framework based on RNN provided by the prior art.
图4为本申请实施例提供的图像处理方法的一种整体流程示意图。FIG. 4 is a schematic diagram of an overall flow of an image processing method provided by an embodiment of the application.
图5为本申请实施例提供的一种图像处理方法的流程示意图。FIG. 5 is a schematic flowchart of an image processing method provided by an embodiment of the application.
图6为图5提供的图像处理方法中步骤S103的流程示意图。FIG. 6 is a schematic flowchart of step S103 in the image processing method provided in FIG. 5.
图7为本申请实施例提供的图像处理方法的另一种整体流程示意图。FIG. 7 is a schematic diagram of another overall flow of an image processing method provided by an embodiment of the application.
图8为本申请实施例提供的图像处理方法对应的压缩曲线示例图。FIG. 8 is an example diagram of a compression curve corresponding to the image processing method provided by an embodiment of the application.
图9为本申请实施例提供的图像处理方法的另一种整体流程示意图。FIG. 9 is a schematic diagram of another overall flow of an image processing method provided by an embodiment of the application.
图10为本申请实施例提供的图像处理方法的另一种整体流程示意图。FIG. 10 is a schematic diagram of another overall flow of an image processing method provided by an embodiment of the application.
图11为本申请实施例提供的图像处理方法的另一种整体流程示意图。FIG. 11 is a schematic diagram of another overall flow of an image processing method provided by an embodiment of the application.
图12为本申请实施例提供的图像处理方法的另一种整体流程示意图。FIG. 12 is a schematic diagram of another overall flow of an image processing method provided by an embodiment of the application.
图13为本申请实施例提供的图像处理方法的另一种整体流程示意图。FIG. 13 is a schematic diagram of another overall flow of an image processing method provided by an embodiment of the application.
图14为图5提供的图像处理方法中步骤S104的流程示意图。FIG. 14 is a schematic flowchart of step S104 in the image processing method provided in FIG. 5.
图15为本申请实施例提供的另一种图像处理方法的流程示意图。FIG. 15 is a schematic flowchart of another image processing method provided by an embodiment of the application.
图16为图15提供的图像处理方法中步骤S202的流程示意图。FIG. 16 is a schematic flowchart of step S202 in the image processing method provided in FIG. 15.
图17为图15提供的图像处理方法中步骤S203的流程示意图。FIG. 17 is a schematic flowchart of step S203 in the image processing method provided in FIG. 15.
图18为图15提供的图像处理方法中步骤S204的流程示意图。FIG. 18 is a schematic flowchart of step S204 in the image processing method provided in FIG. 15.
图19为本申请实施例提供的图像处理方法的另一种流程示意图。FIG. 19 is a schematic flowchart of another image processing method provided by an embodiment of the application.
图20为本申请实施例提供的图像处理方法的另一种流程示意图。FIG. 20 is a schematic flowchart of another image processing method provided by an embodiment of the application.
图21为本申请实施例提供的图像处理方法的一种应用示意图。FIG. 21 is a schematic diagram of an application of the image processing method provided by an embodiment of the application.
图22为本申请实施例提供的图像处理方法的另一种应用示意图。FIG. 22 is a schematic diagram of another application of the image processing method provided by an embodiment of the application.
图23为本申请实施例提供的图像处理方法的另一种应用示意图。FIG. 23 is a schematic diagram of another application of the image processing method provided by an embodiment of the application.
图24为本申请实施例提供的图像处理装置的一种组成示意图。FIG. 24 is a schematic diagram of a composition of an image processing device provided by an embodiment of the application.
图25为本申请实施例提供的图像处理装置的另一种组成示意图。FIG. 25 is a schematic diagram of another composition of an image processing apparatus provided by an embodiment of the application.
图26为本申请实施例提供的图像处理装置的另一种组成示意图。FIG. 26 is a schematic diagram of another composition of an image processing apparatus provided by an embodiment of the application.
图27为本申请实施例提供的电子设备的组成示意图。FIG. 27 is a schematic diagram of the composition of an electronic device provided by an embodiment of the application.
具体实施方式Detailed ways
为使本申请的上述目的、特征和优点能够更为明显易懂,下面结合附图对本申请的具体实施例做详细的说明。In order to make the above objectives, features and advantages of the present application more obvious and understandable, specific embodiments of the present application will be described in detail below in conjunction with the accompanying drawings.
图像压缩主要分为有损压缩和无损压缩两大类,无损压缩,主要用在对图像细节要求很精确的场景,如认证签名图像处理、档案图像处理和部分医疗图像处理等。有损压缩利用人眼对于高频信号不敏感的特性,在变换编码中对高频分量粗量化,同时可以利用周围的像素值预测当前像素值,这样大大减少了需要编码的数据量,本申请描述的图像压缩均为有损压缩。Image compression is mainly divided into two categories: lossy compression and lossless compression. Lossless compression is mainly used in scenes that require very precise image details, such as authentication signature image processing, archive image processing, and part of medical image processing. Lossy compression utilizes the human eye’s insensitivity to high-frequency signals, and coarsely quantizes high-frequency components in transform coding. At the same time, the surrounding pixel values can be used to predict the current pixel value, which greatly reduces the amount of data that needs to be encoded. The image compression described is all lossy compression.
传统的图像压缩方法有JPEG、JPEG2000、BPG等,下面以JPEG压缩为例,对传统的图像压缩方法进行介绍。Traditional image compression methods include JPEG, JPEG2000, BPG, etc. The following takes JPEG compression as an example to introduce the traditional image compression methods.
请参照图1,图1示出的是JPEG图像压缩框架的示意图,该压缩框架包括编码过程和解码过程两部分。其中,编码过程包括:首先,原始图像(例如,RGB三通道图像)经离散余弦变换(Discrete Cosine Transform,DCT),将图像特征转换到频域空间,使图像中对于图像质量影响明显的低频信息与高频信息分开,降低数据冗余;然后,通过量化去除对于图像质量影响较小的高频信息,减少存储空间;再对量化后的整数进行Huffman编码,即可得到编码的JPEG码流。解码过程与编码过程相反,包括:编码的JPEG码流经熵解码、反量化得到浮点数,再通过反离散余弦变换将浮点数从频域空间变换到像素空间,得到重建图像。Please refer to FIG. 1. FIG. 1 shows a schematic diagram of a JPEG image compression framework. The compression framework includes two parts: an encoding process and a decoding process. Among them, the encoding process includes: First, the original image (for example, RGB three-channel image) undergoes Discrete Cosine Transform (DCT) to transform the image features into the frequency domain space, so that the low-frequency information in the image that has a significant impact on the image quality Separate it from high-frequency information to reduce data redundancy; then, through quantization to remove high-frequency information that has less impact on image quality, reducing storage space; and then Huffman encoding the quantized integer to obtain an encoded JPEG stream. The decoding process is opposite to the encoding process, including: the encoded JPEG code stream is entropy-decoded and dequantized to obtain a floating-point number, and then the floating-point number is transformed from the frequency domain space to the pixel space through inverse discrete cosine transform to obtain a reconstructed image.
目前,传统的图像压缩方法已被广泛应用,但是,由于编码时去除了图像的部分空域和频域信息,所以得到的重建图像视觉质量较差;同时,这些方法都是针对某种类型的图像特征手工设计的,无法适应不断出现的新媒体类型,例如,虚拟现实图像、全景图像、广场图像等。因此,如何在传统压缩方法的基础上进一步提升压缩性能,是研究人员关注的问题。At present, traditional image compression methods have been widely used. However, since part of the spatial and frequency domain information of the image is removed during encoding, the visual quality of the reconstructed image is poor; at the same time, these methods are all aimed at certain types of images. Features are manually designed and cannot adapt to the emerging new media types, such as virtual reality images, panoramic images, and square images. Therefore, how to further improve compression performance on the basis of traditional compression methods is a problem that researchers are concerned about.
近年来,随着深度学习技术的发展,尤其是卷积神经网络在图像处理和计算机视觉领域的成功应用,利用深度学习技术进行图像压缩成为可能。相比于传统的图像压缩方法,基于深度学习的图像压缩方法一方面可以把编解码器、量化以及熵估计进行联合优化,使得压缩总体性能达到最优;另一方面可以提供多样化的编解码方法,能够针对不同的任务,实现智能编解码,从而有效提升了图像的压缩性能。In recent years, with the development of deep learning technology, especially the successful application of convolutional neural networks in image processing and computer vision, it has become possible to use deep learning technology for image compression. Compared with traditional image compression methods, image compression methods based on deep learning can jointly optimize codec, quantization, and entropy estimation on the one hand, so that the overall performance of compression is optimal; on the other hand, it can provide diversified codecs. The method can realize intelligent coding and decoding for different tasks, thereby effectively improving the compression performance of the image.
基于深度学习的图像压缩方法主要包括:基于自编码器(Auto-encoder)的方法和基于循环神经网络(Recurrent Neural Network,RNN)的方法,下面对这两种方法进行简单介绍。Image compression methods based on deep learning mainly include: Auto-encoder-based methods and Recurrent Neural Network (RNN)-based methods. The two methods are briefly introduced below.
请参照图2,图2示出的是基于Auto-encoder的图像压缩框架的示意图。对于该压缩框架,编码时,将原始图像输入编码网络,进行空间变换,并通过量化得到编码数据,再经过熵编码得到压缩数据。解码时,将压缩数据经过熵解码、反量化后,输入解码网络,通过解码网络将数据转换回图像空间,得到重建图像。编码网络和解码网络均为卷积神经网络(Convolutional Neural Networks,CNN),二者构成Auto-encoder。Please refer to FIG. 2. FIG. 2 shows a schematic diagram of an image compression framework based on Auto-encoder. For this compression framework, when encoding, the original image is input to the encoding network, undergoes spatial transformation, and obtains encoded data through quantization, and then obtains compressed data through entropy encoding. When decoding, the compressed data is subjected to entropy decoding and dequantization, and then input to the decoding network, and the data is converted back to the image space through the decoding network to obtain a reconstructed image. The encoding network and the decoding network are both Convolutional Neural Networks (CNN), and the two constitute an Auto-encoder.
该压缩框架在训练时,可以将编码网络和解码网络联合优化,通过对比原始图像和重建图像,得到重建Loss;通过对编码数据的熵进行估计,得到码率Loss;通过调节码率Loss与重建Loss的权重,来训练不同码率的模型。因此,训练完成后,一个模型只适用于一个码率。也就是,针对一种输入图像只能输出一个码率的压缩数据,如果需要输出多个码率的压缩数据,就必须训练多个模型,严重限制了应用。因为,实际应用中存在各种带宽和存储需求,输出各种码率的压缩数据对实际应用至关重要。When the compression framework is trained, the coding network and the decoding network can be jointly optimized, and the reconstructed Loss can be obtained by comparing the original image and the reconstructed image; the code rate Loss can be obtained by estimating the entropy of the encoded data; the bit rate Loss can be adjusted and the reconstruction The weight of Loss is used to train models with different bit rates. Therefore, after the training is completed, a model is only applicable to one bit rate. That is, only one code rate of compressed data can be output for a kind of input image. If multiple code rates of compressed data need to be output, multiple models must be trained, which severely limits the application. Because there are various bandwidth and storage requirements in practical applications, outputting compressed data with various code rates is very important for practical applications.
上述的码率也称压缩率,是指单位像素编码所需要的编码长度。通常情况下,码率越高,重建图像越清晰,压缩数据所需的存储空间越大,同时传输压缩数据所需的带宽越高。The above-mentioned code rate is also called compression rate, which refers to the code length required for unit pixel coding. Generally, the higher the bit rate, the clearer the reconstructed image, the larger the storage space required for compressed data, and the higher the bandwidth required to transmit compressed data.
请参照图3,图3示出的是基于RNN的图像压缩框架的示意图。该压缩框架是一种基于残差输入的循环压缩框架,也就是,第一次循环,编码器(Encoder)输入原始图像,解码器(Decoder)输出第一次重建图像。第二次循环,编码器输入原始图像与第一次重建图像的残差,解码器输出压缩后的残差,并与前一次输出的重建图像进行叠加,得到第二次重建图像。以此类推,每次循环编码器都输入前一次重建图像与原始图像的残差。Please refer to FIG. 3, which shows a schematic diagram of an image compression framework based on RNN. The compression framework is a cyclic compression framework based on residual input, that is, in the first cycle, the encoder (Encoder) inputs the original image, and the decoder (Decoder) outputs the first reconstructed image. In the second cycle, the encoder inputs the residuals between the original image and the first reconstructed image, and the decoder outputs the compressed residuals, which are superimposed with the reconstructed image output from the previous time to obtain the second reconstructed image. By analogy, each time the cyclic encoder inputs the residual of the previous reconstructed image and the original image.
对于该压缩框架,码率与循环次数成正比,故可以通过控制循环次数来控制码率,能够实现一个模型适用于多个码率。但是,残差不利于压缩,故基于RNN的方法压缩效果不佳。For this compression framework, the code rate is proportional to the number of cycles, so the code rate can be controlled by controlling the number of cycles, and one model can be applied to multiple code rates. However, the residual is not conducive to compression, so the RNN-based method has poor compression effect.
由上可知,基于Auto-encoder的方法压缩效果好,但是一个模型只适用于一个码率。基于RNN的方法能够实现一个模型适用于多个码率,但是压缩效果不佳。而在实际应用中,不仅需要保证图片视觉质量基本不变,而且要求码率可调。因此,如何在保证压缩效果的同时实现一个压缩模型对应多个码率,是亟待需要解决的问题。It can be seen from the above that the Auto-encoder-based method has a good compression effect, but a model is only suitable for one bit rate. The RNN-based method can realize that one model is suitable for multiple code rates, but the compression effect is not good. In practical applications, it is not only necessary to ensure that the visual quality of the picture is basically unchanged, but also that the bit rate is adjustable. Therefore, how to realize a compression model corresponding to multiple code rates while ensuring the compression effect is a problem that needs to be solved urgently.
针对上述问题,发明人在研究中发现:图像压缩后解压时,一部分信息需要通过压缩后的码流来还原,另一部分信息可以通过先验知识推理而来。基于这一思想,请参照图4,本申请实施例在现有深度学习图像压缩方法的基础上,编码过程增加预处理环节,相应的,解码过程增加后处理环节。编码时先做预处理再做压缩,解码时先 做解压缩再做后处理。后处理是指将预处理作为先验知识进行推理的过程,也就是预处理的反向处理,从而使得重建图像的视觉质量基本不变。In view of the above-mentioned problems, the inventor found in research that when an image is compressed and decompressed, part of the information needs to be restored through the compressed code stream, and the other part of the information can be derived from prior knowledge. Based on this idea, please refer to FIG. 4. Based on the existing deep learning image compression method, the embodiment of the present application adds a pre-processing link in the encoding process, and correspondingly, a post-processing link in the decoding process. When encoding, do preprocessing and then compression, and when decoding, do decompression and then post-processing. Post-processing refers to the process of reasoning with pre-processing as prior knowledge, that is, the reverse processing of pre-processing, so that the visual quality of the reconstructed image is basically unchanged.
同时,本申请实施例在预处理环节提前设置多个预设策略,编码时从多个预设策略中选择目标策略做预处理。选择的目标策略不同,得到压缩数据的码率也会不同。解码时对于解压缩后的还原图像,采用目标策略的反向策略做预处理的反向处理。如此,在保证压缩效果的同时,实现一个压缩模型对应多个码率。At the same time, in the embodiment of the present application, multiple preset strategies are set in advance in the preprocessing step, and the target strategy is selected from the multiple preset strategies for preprocessing during encoding. The selected target strategy is different, the code rate of the compressed data will be different. When decoding the restored image after decompression, the reverse strategy of the target strategy is used to do the reverse processing of preprocessing. In this way, while ensuring the compression effect, one compression model corresponds to multiple code rates.
下面将结合附图对本申请实施例的实施方式进行详细描述。The implementation of the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings.
请参照图5,图5为本申请实施例提供的一种图像处理方法的流程示意图。该图像处理方法应用于编码端,例如可以是具有编码功能的电子设备,该图像处理方法可以包括以下步骤:Please refer to FIG. 5. FIG. 5 is a schematic flowchart of an image processing method provided by an embodiment of the application. The image processing method is applied to the encoding end, for example, it may be an electronic device with encoding function, and the image processing method may include the following steps:
S101,获取原始图像。S101. Obtain an original image.
原始图像可以是为了节省存储空间或满足带宽传输要求,需要进行压缩的图像数据。例如,相机内部摄像头输出的视频流裸数据(Raw Data)、终端相册中的图片、云相册中的图片等。The original image can be image data that needs to be compressed in order to save storage space or meet bandwidth transmission requirements. For example, the raw data of the video stream output by the camera inside the camera, the pictures in the terminal album, the pictures in the cloud album, etc.
同时,原始图像是指未经压缩的图像数据,原始图像的数据格式可以是RGB、YUV、CMYK。如果压缩任务对应的是压缩后的图像数据(例如,JPEG图像),则需要先利用对应的解码器(例如,JPEG解码器)对压缩后的图像数据(例如,JPEG图像)解码为原始图像,再进行压缩。At the same time, the original image refers to uncompressed image data, and the data format of the original image can be RGB, YUV, CMYK. If the compression task corresponds to compressed image data (e.g., JPEG image), the corresponding decoder (e.g., JPEG decoder) needs to be used to decode the compressed image data (e.g., JPEG image) into the original image. Compress again.
S102,响应对原始图像的操作,从多个预设策略中确定出目标策略,其中,至少两个预设策略对应的压缩数据的码率不同。S102: In response to an operation on the original image, determine a target strategy from a plurality of preset strategies, where at least two preset strategies correspond to different code rates of compressed data.
本申请实施例的编码过程增加预处理环节,预处理环节提前设置有多个预设策略,预设策略包括对原始图像做预处理的方法和参数。例如,对原始图像做全局缩放的方法和参数、对原始图像做模糊处理的方法和参数、对原始图像做图像增强的方法和参数等。The encoding process of the embodiment of the present application adds a pre-processing step, and the pre-processing step has a plurality of preset strategies set in advance, and the preset strategies include methods and parameters for pre-processing the original image. For example, methods and parameters for global scaling of the original image, methods and parameters for blurring the original image, and methods and parameters for image enhancement of the original image.
可以设置不同的预设策略对应不同的码率,也就是,如果采用不同的预设策略对原始图像做预处理,则得到的压缩数据的码率可能不同。但在实际应用中,可能会出现不同的预设策略对应同一码率的情形。例如,对原始图像做全局缩放的方法和参数、与对原始图像做模糊处理的方法和参数,按照这两种预设策略分别对图像做预处理,压缩后得到的压缩数据的码率可能一样,即,这两种预设策略对应同一码率。因此,实际应用中只要确保至少两个预设策略对应的压缩数据的码率不同即可。Different preset strategies can be set to correspond to different code rates, that is, if different preset strategies are used to preprocess the original image, the code rates of the compressed data obtained may be different. However, in actual applications, different preset strategies may correspond to the same bit rate. For example, the method and parameters for global scaling of the original image and the method and parameters for blurring the original image are preprocessed according to the two preset strategies. The bit rate of the compressed data obtained after compression may be the same. That is, these two preset strategies correspond to the same bit rate. Therefore, in actual applications, it is only necessary to ensure that the code rates of the compressed data corresponding to at least two preset strategies are different.
目标策略是指多个预设策略中的任一预设策略,且目标策略与用户对原始图像的操作有关。The target strategy refers to any one of a plurality of preset strategies, and the target strategy is related to the user's operation on the original image.
用户对原始图像的操作是指用户针对原始图像的选择操作。可以预先设置选择操作与预设策略之间的关联关系,即,预先设置一个选择操作与至少一个预设策略关联。例如,选择操作与预设策略之间的关联关系如下表1所示:The user's operation on the original image refers to the user's selection operation on the original image. The association relationship between the selection operation and the preset strategy can be preset, that is, one selection operation is preset to be associated with at least one preset strategy. For example, the relationship between the selection operation and the preset strategy is shown in Table 1 below:
表1Table 1
选择操作1 Select operation 1 预设策略1、预设策略2、预设策略3… Preset strategy 1, Preset strategy 2, Preset strategy 3...
选择操作2Select operation 2 预设策略1、预设策略2、预设策略3… Preset strategy 1, Preset strategy 2, Preset strategy 3...
选择操作3Select operation 3 预设策略1、预设策略2、预设策略3… Preset strategy 1, Preset strategy 2, Preset strategy 3...
其中,与同一选择操作(例如,选择操作1)关联的预设策略对应的压缩数据的码率相似,与不同选择策略(例如,选择操作1、选择操作2)关联的预设策略对应的压缩数据的码率不同。也就是说,每个选择操作都会对应一系列的预设策略,例如,对原始图像做全局缩放的预设策略、对原始图像做模糊处理的预设策略等,只是与不同选择操作(例如,选择操作1、选择操作2)关联的同一预设策略(例如,预设策略1)的参数不同。Among them, the code rate of the compressed data corresponding to the preset strategy associated with the same selection operation (for example, selection operation 1) is similar, and the compression corresponding to the preset strategy associated with different selection strategies (for example, selection operation 1, selection operation 2) The bit rate of the data is different. In other words, each selection operation corresponds to a series of preset strategies, for example, the preset strategy for global zooming of the original image, the preset strategy for blurring the original image, etc., which are only different from different selection operations (for example, Selection operation 1, selection operation 2) are associated with different parameters of the same preset strategy (for example, preset strategy 1).
同时,设置供用户选择的选项,一个选项表征一种用户的压缩需求,例如,设置“高”、“中”、“低”选项,分别表征用户想要的压缩质量为高、中、低。用户选择一个选项,也就是做了一次选择操作,例如,用户选择“高”选项,就是做了压缩质量高的选择操作。例如,对于相机内部摄像头输出的视频流裸数据,用户想要压缩质量高,则在拍照前,可以预先选择“高”选项。At the same time, an option is set for the user to select, and an option represents a user's compression requirement. For example, setting the "high", "medium", and "low" options respectively represents the compression quality desired by the user as high, medium, and low. When the user selects an option, it makes a selection operation. For example, when the user selects the "high" option, it makes a selection operation with high compression quality. For example, for the raw data of the video stream output by the camera's internal camera, if the user wants high compression quality, they can pre-select the "high" option before taking a picture.
针对原始图像,当用户选中一个选项时,也就是对原始图像做了一次选择操作,进而可以根据选择操作与预设策略之间的关联关系,将与选择操作关联的预设策略作为目标策略。如果选择操作关联多个预设策略,则从多个预设策略中找出一个效果最好的作为目标策略。例如,可以按照每个预设策略分别对原始图像做预处理及压缩,再选出一个效果最好的压缩数据,并将效果最好的压缩数据对应的预设策略作为目标策略。For the original image, when the user selects an option, that is, a selection operation is performed on the original image, and then the preset strategy associated with the selection operation can be used as the target strategy according to the association relationship between the selection operation and the preset strategy. If the selection operation is associated with multiple preset strategies, then one of the multiple preset strategies will be found as the target strategy with the best effect. For example, the original image can be preprocessed and compressed according to each preset strategy, and then a compressed data with the best effect can be selected, and the preset strategy corresponding to the compressed data with the best effect can be used as the target strategy.
需要指出的是,选择操作包括默认操作,默认操作表示用户没有选择任一选项。当用户对原始图像的操作为默认操作时,则从默认操作关联的预设策略中找出一个效果最好的作为目标策略。例如,默认操作为压缩质量高,则从压缩质量高关联的预设策略中找出一个效果最好的作为目标策略。It should be pointed out that the selection operation includes the default operation, which means that the user did not select any option. When the user's operation on the original image is the default operation, one of the preset strategies associated with the default operation is found as the target strategy with the best effect. For example, if the default operation is high compression quality, then one of the preset strategies associated with high compression quality will be found as the target strategy with the best effect.
S103,按照目标策略,对原始图像进行预处理,得到待压缩图像。S103: Preprocess the original image according to the target strategy to obtain the image to be compressed.
目标策略可以是,但不限于全局缩放的方法和参数、分块缩放的方法和参数、全局模糊的方法和参数、分块模糊的方法和参数、全局增强的方法和参数、分块增强的方法和参数中的一种或几种。相应的,预处理可以是,但不限于全局缩放、分块缩放、全局模糊、分块模糊、全局增强、分块增强等中的一种或几种。例如,目标策略为全局缩放的方法和参数及分块模糊的方法和参数,则预处理为全局缩放及分块模糊。The target strategy can be, but is not limited to, global scaling methods and parameters, block scaling methods and parameters, global blur methods and parameters, block blur methods and parameters, global enhancement methods and parameters, and block enhancement methods And one or more of the parameters. Correspondingly, the preprocessing may be, but is not limited to, one or more of global scaling, block scaling, global blur, block blur, global enhancement, block enhancement, and the like. For example, if the target strategy is the method and parameters of global scaling and the method and parameters of block blur, the preprocessing is global scaling and block blur.
待压缩图像是指按照目标策略,对原始图像做预处理后得到的图像。The image to be compressed refers to the image obtained after preprocessing the original image according to the target strategy.
S104,利用预设的深度学习图像压缩框架对待压缩图像进行压缩,得到压缩数据,其中,压缩数据用于通过预设的深度学习图像解压缩框架进行解压缩得到还原图像,还原图像用于基于目标策略的反向策略进行预处理的反向处理得到与原始图像对应的重建图像。S104. Compress the image to be compressed using a preset deep learning image compression framework to obtain compressed data, where the compressed data is used to decompress the preset deep learning image decompression framework to obtain a restored image, and the restored image is used to obtain a restored image based on the target. The reverse strategy of the strategy performs the reverse processing of the preprocessing to obtain the reconstructed image corresponding to the original image.
压缩数据是指原始图像经预处理、压缩后得到的码流,可以将目标策略和压缩数据作为一个文件存储或传输。当需要将压缩数据解码为图像时,首先采用深度学习图像解压缩框架对压缩数据解压缩为还原图像,再根据编码过程中预处理采用的目标策略,推理出目标策略的反向策略,并按照该目标策略的反向策略对还原图像做预处理的反向处理,最终生成与原始图像对应的重建图像。Compressed data refers to the code stream obtained after the original image is preprocessed and compressed. The target strategy and compressed data can be stored or transmitted as a file. When it is necessary to decode compressed data into an image, first use the deep learning image decompression framework to decompress the compressed data into a restored image, and then infer the reverse strategy of the target strategy according to the target strategy used in preprocessing in the encoding process, and follow The reverse strategy of the target strategy performs reverse processing of preprocessing on the restored image, and finally generates a reconstructed image corresponding to the original image.
上述的深度学习图像压缩框架和深度学习图像解压缩框架可以是图1所示的基于Auto-encoder的图像压缩框架,也可以是图2所示的基于RNN的图像压缩框架,也可以是本领域技术人员可能会采用的其它基于深度学习的图像压缩框架。The aforementioned deep learning image compression framework and deep learning image decompression framework can be the Auto-encoder-based image compression framework shown in Figure 1, or the RNN-based image compression framework shown in Figure 2, or the field Other image compression frameworks based on deep learning that technicians may use.
在图5的基础上,请参照图6,S103可以包括以下详细步骤:On the basis of Fig. 5, please refer to Fig. 6, S103 may include the following detailed steps:
S1031,按照第一指令和第一参数,对原始图像进行预处理,得到待压缩图像。S1031: Preprocess the original image according to the first instruction and the first parameter to obtain the image to be compressed.
目标策略包括第一指令和与第一指令对应的第一参数,第一指令是指对原始图像做预处理的方法,第一参数是指与对原始图像做预处理的方法对应的参数。The target strategy includes a first instruction and a first parameter corresponding to the first instruction. The first instruction refers to a method for preprocessing the original image, and the first parameter refers to a parameter corresponding to the method for preprocessing the original image.
例如,第一指令可以是,但不限于对原始图像做全局缩放、分块缩放、全局模糊、分块模糊、全局增强、分块增强等方法中的一种或几种。第一参数可以是,但不限于全局缩放参数、分块缩放参数、全局模糊参数、分块模糊参数、全局增强参数、分块增强参数等参数中的一种或几种。For example, the first instruction may be, but is not limited to, one or more of methods such as global scaling, block scaling, global blur, block blur, global enhancement, and block enhancement of the original image. The first parameter may be, but is not limited to, one or more of global scaling parameters, block scaling parameters, global blur parameters, block blur parameters, global enhancement parameters, block enhancement parameters and other parameters.
可以采用传统图像处理算法对原始图像进行预处理,例如,传统图像插值算法、高斯滤波等。也可以采用预先训练的深度学习网络对原始图像进行预处理,例如,深度卷积神经网络、卷积层、池化层等。The original image can be preprocessed by using traditional image processing algorithms, for example, traditional image interpolation algorithms, Gaussian filtering, and so on. It is also possible to pre-process the original image with a pre-trained deep learning network, for example, a deep convolutional neural network, a convolutional layer, a pooling layer, and so on.
下面对按照第一指令和第一参数对原始图像做预处理的过程进行举例介绍。The process of preprocessing the original image according to the first instruction and the first parameter will be introduced as an example below.
在一个实施例中,当第一指令为全局缩放指令,第一参数为全局缩放系数和缩放核时,预处理为全局缩放;In one embodiment, when the first instruction is a global zoom instruction and the first parameter is a global zoom factor and a zoom kernel, the preprocessing is global zoom;
按照第一指令和第一参数,对原始图像进行预处理,得到待压缩图像的过程,可以包括:According to the first instruction and the first parameter, the process of preprocessing the original image to obtain the image to be compressed may include:
按照全局缩放指令、全局缩放系数和缩放核,对原始图像进行全局缩放,得到待压缩图像。According to the global zoom instruction, the global zoom factor and the zoom kernel, the original image is globally zoomed to obtain the image to be compressed.
全局缩放指令是指对原始图像做全局缩放的方法,全局缩放也就是对图像整体进行缩小或放大,编码过程的预处理与解码过程的后处理刚好相反。例如,编码过程为:先把原始图像缩小再压缩,则解码过程为:先解压缩再把还原图像放大。The global zoom instruction refers to a method of global zooming of the original image. Global zooming is to reduce or enlarge the image as a whole. The preprocessing of the encoding process is just the opposite of the postprocessing of the decoding process. For example, the encoding process is: first reduce the original image and then compress, then the decoding process is: first decompress and then enlarge the restored image.
全局缩放系数也就是对图像整体进行缩小或放大的倍数,全局缩放系数可以用n表示。若n<1,则表示对图像整体进行缩小;若n>1,则表示对图像整体进行放大。The global zoom factor is the number of times that the image is reduced or enlarged as a whole, and the global zoom factor can be represented by n. If n<1, it means that the entire image is reduced; if n>1, it means that the entire image is enlarged.
缩放核包括线性插值、双线性插值等。The scaling kernel includes linear interpolation, bilinear interpolation, and so on.
例如,请参照图7,假设全局缩放系数为n(n<1),缩放核为降采样对应的核,则编码过程中采用降采样的方式对图像进行缩小,输入为原始图像,输出为长和宽为原始图像大小n(n<1)倍的待压缩图像。For example, referring to Figure 7, assuming that the global scaling factor is n (n<1), and the scaling core is the core corresponding to downsampling, the image is reduced by downsampling during the encoding process. The input is the original image, and the output is the long An image to be compressed whose sum width is n (n<1) times the original image size.
在图像压缩过程中之所以能采用全局缩放,是由于特定程度的缩放,对图像质量的影响很小,下面通过实验进行证明:The reason why global zoom can be used in the image compression process is that a certain degree of zoom has little effect on image quality. The following experiments are used to prove:
实验数据:CLIC公开数据集(330张);Experimental data: CLIC public data set (330 photos);
实验过程:利用resize函数,原始图像缩小一倍,还原图像放大一倍;Experimental process: Using the resize function, the original image is reduced by one time, and the restored image is doubled;
实验结果:平均MS-SSIM=0.9947,影响很少。Experimental results: average MS-SSIM = 0.9947, with little effect.
其中,MS-SSIM(Multi-Scale-Structural Similarity Index,多尺度结构相似性)为一种图像压缩质量评价指标,用来评价原始图像和重建图像的相似性,其取值范围为0~1,越接近1表示重建图像和原始图像越接近。Among them, MS-SSIM (Multi-Scale-Structural Similarity Index, multi-scale structural similarity) is an image compression quality evaluation index used to evaluate the similarity between the original image and the reconstructed image, and its value range is 0 to 1. The closer to 1 means that the reconstructed image is closer to the original image.
图像压缩质量评价指标用来评估压缩图像的图像质量,除了上文说到的MS-SSIM,还包括PSNR(Peak Signal to Noise Ratio,峰值信噪比)、SSIM(structural similarity index,结构相似性)等。PSNR、SSIM的值越高,表示图像压缩后失真越小、质量越好。The image compression quality evaluation index is used to evaluate the image quality of the compressed image. In addition to the MS-SSIM mentioned above, it also includes PSNR (Peak Signal to Noise Ratio) and SSIM (structural similarity index, structural similarity) Wait. The higher the value of PSNR and SSIM, the smaller the distortion and the better the quality of the image after compression.
采用不同的全局缩放系数对原始图像进行全局缩放,对应压缩数据的码率也会不同。也就是,采用同一压缩模型,只需通过调整全局缩放系数,即可实现多个码率压缩。n越小,待压缩图像的尺度越小,压缩数据的码率也越小;n越大,待压缩图像的尺度越大,压缩数据的码率也越大。Using different global zoom factors to global zoom the original image, the bit rate of the corresponding compressed data will also be different. That is, using the same compression model, multiple code rate compression can be achieved only by adjusting the global scaling factor. The smaller the n, the smaller the scale of the image to be compressed, and the smaller the code rate of the compressed data; the larger the n, the larger the scale of the image to be compressed, and the larger the code rate of the compressed data.
例如,请参照图8,左图是Kodak数据集的实验结果,右图是CLIC数据集的实验结果。图中纵轴为MS-SSIM,横轴为BPP(bits per pixel),表示存储每个像素消耗的比特数,BPP越小表示码率越小。GSM-org对应的曲线是初始压缩曲线,GSM-newMSSSIM、GSM-newMSSSIM-0.25、GSM-newMSSSIM-0.5分别表示全局压缩系数为1、0.25、0.5的压缩曲线。从图中可以明显的看出,使用同一压缩模型,通过调整全局缩放系数(1、0.25、0.5),即可在保证压缩性能的前提下,实现3个码率的压缩。For example, please refer to Figure 8. The left image is the experimental result of the Kodak data set, and the right image is the experimental result of the CLIC data set. In the figure, the vertical axis is MS-SSIM, and the horizontal axis is BPP (bits per pixel), which represents the number of bits consumed by each pixel. The smaller the BPP, the smaller the bit rate. The curve corresponding to GSM-org is the initial compression curve. GSM-newMSSSIM, GSM-newMSSSIM-0.25, and GSM-newMSSSIM-0.5 represent the compression curves with global compression coefficients of 1, 0.25, and 0.5, respectively. It can be clearly seen from the figure that using the same compression model, by adjusting the global scaling factor (1, 0.25, 0.5), the compression of 3 code rates can be achieved under the premise of ensuring the compression performance.
在另一个实施例中,当第一指令为自适应缩放指令,第一参数为分块参数时,预处理为先分块再自适应缩放;In another embodiment, when the first instruction is an adaptive scaling instruction and the first parameter is a block parameter, the preprocessing is to block first and then adaptive scaling;
按照第一指令和第一参数,对原始图像进行预处理,得到待压缩图像的过程,可以包括:According to the first instruction and the first parameter, the process of preprocessing the original image to obtain the image to be compressed may include:
首先,按照分块参数对原始图像进行划分,得到多个图像块;First, divide the original image according to the block parameters to obtain multiple image blocks;
然后,按照自适应缩放指令和每个图像块的图像特征,对每个图像块均进行自适应缩放,得到每个图像块对应的待压缩图像块,其中,待压缩图像包括多个待压缩图像块,图像特征用于确定图像块的缩放系数。Then, according to the adaptive scaling instruction and the image characteristics of each image block, each image block is adaptively scaled to obtain the image block to be compressed corresponding to each image block, where the image to be compressed includes multiple images to be compressed Block, the image feature is used to determine the scaling factor of the image block.
分块参数是用来表征如何划分原始图像的参数,分块参数可以用M×N表示,M为横向分块参数,N为纵向分块参数。例如,分块参数为3×3,则表示将原始图像划分为3×3共9个图像块。同时,分块后的每个图像块都有对应的位置向量(i,j),i表示横向第i个图像块,j表示横向第j个图像块。The block parameter is a parameter used to characterize how to divide the original image. The block parameter can be represented by M×N, where M is the horizontal block parameter, and N is the vertical block parameter. For example, if the block parameter is 3×3, it means that the original image is divided into 9 image blocks of 3×3. At the same time, each image block after block division has a corresponding position vector (i, j), i represents the i-th image block in the horizontal direction, and j represents the j-th image block in the horizontal direction.
图像块的图像特征可以是图像块的颜色特征、纹理特征、形状特征等中的一种或几种。颜色特征和纹理特征用于描述图像块所对应的物体的表面性质。形状特征包括轮廓特征和区域特征,轮廓特征包括物体的外边界特征,区域特征包括物体的形状区域特征。The image feature of the image block may be one or more of the color feature, texture feature, and shape feature of the image block. The color feature and texture feature are used to describe the surface properties of the object corresponding to the image block. The shape feature includes the contour feature and the area feature. The contour feature includes the outer boundary feature of the object, and the area feature includes the shape and area feature of the object.
自适应缩放指令是指对原始图像做自适应缩放的方法,基于原始图像的图像特征(例如,颜色特征、纹理特征、形状特征等),可以对图像特征不同的区域进行不同程度的缩放,例如,背景区域多缩放一些,前景区域少缩放一些。The adaptive zoom command refers to a method of adaptively zooming the original image. Based on the image characteristics of the original image (for example, color characteristics, texture characteristics, shape characteristics, etc.), areas with different image characteristics can be scaled to different degrees, such as , The background area is zoomed more, and the foreground area is zoomed less.
对每个图像块均进行自适应缩放,是指按照每个图像块对应的图像特征(例如,颜色特征、纹理特征、形状特征等),确定每个图像块的缩放系数,再按照各自的缩放系数进行分块缩小或分块放大。通常,为了保证压缩性能,图像特征(例如,颜色、纹理等)越多的图像块,缩放系数越大;图像特征(例如,颜色、纹理等)越少的图像块,缩放系数越小。也就是,平滑的图像块多缩放一些,不平滑的图像块少缩放一些。Adaptive scaling for each image block means to determine the scaling factor of each image block according to the corresponding image feature (for example, color feature, texture feature, shape feature, etc.) of each image block, and then according to the respective scaling The coefficient performs block reduction or block enlargement. Generally, in order to ensure compression performance, image blocks with more image features (for example, color, texture, etc.) have a larger scaling factor; image blocks with fewer image features (for example, color, texture, etc.) have a smaller scaling factor. That is, smooth image blocks are scaled more, and unsmooth image blocks are scaled less.
例如,请参照图9,假设分块参数为4×3,则编码过程中先将原始图像划分为12个图像块;再按照每个图像块的图像特征(例如,颜色、纹理等)确定每个图像块的缩放系数。例如,根据第(2,2)个图像块和第(1,1)个图像块的纹理,确定第(2,2)个图像块的缩放系数为1、第(2,2)个图像块的缩放系数为0.25。For example, referring to Figure 9, assuming the block parameter is 4×3, the original image is first divided into 12 image blocks in the encoding process; then each image block is determined according to the image characteristics (for example, color, texture, etc.) The zoom factor of each image block. For example, according to the texture of the (2,2)th image block and the (1,1)th image block, the scaling factor of the (2,2)th image block is determined to be 1, the (2,2)th image block The zoom factor is 0.25.
在另一个实施例中,当第一指令为模糊处理指令,第一参数为模糊核时,预处理为模糊处理;In another embodiment, when the first instruction is a fuzzy processing instruction and the first parameter is a fuzzy kernel, the preprocessing is fuzzy processing;
按照第一指令和第一参数,对原始图像进行预处理,得到待压缩图像的过程,可以包括:According to the first instruction and the first parameter, the process of preprocessing the original image to obtain the image to be compressed may include:
按照模糊处理指令和模糊核,对原始图像进行模糊处理,得到待压缩图像。According to the blur processing instruction and the blur kernel, the original image is subjected to blur processing to obtain the image to be compressed.
模糊处理指令是指对原始图像做模糊处理的方法,模糊处理指令可以是,但不限于中值函数、均值函数、高斯函数等。模糊处理可以是,但不限于中值模糊、均值模糊、高斯模糊等。相应的,模糊核可以是,但不限于中值模板、均值模板、高斯模板等。模糊核是卷积核的一种,实际上就是一个矩阵,将原始图像与模糊核卷积,可以使原始图像变得模糊。The blur processing instruction refers to a method of performing blur processing on the original image. The blur processing instruction can be, but is not limited to, a median function, an average function, a Gaussian function, and the like. The blur processing can be, but is not limited to, median blur, mean blur, Gaussian blur, and the like. Correspondingly, the fuzzy kernel can be, but is not limited to, a median template, an average template, a Gaussian template, and the like. The blur kernel is a kind of convolution kernel, which is actually a matrix. The original image and the blur kernel are convolved to blur the original image.
编码过程在压缩前先进行模糊处理,例如,请参照图10,先对原始图像进行高斯滤波再压缩,可以采用高斯函数进行平滑滤波,输入为原始图像,输出为滤波后的待压缩图像。In the encoding process, blurring is performed before compression. For example, please refer to Figure 10 to perform Gaussian filtering on the original image and then compress it. Gaussian function can be used for smoothing filtering. The input is the original image and the output is the filtered image to be compressed.
通过调整模糊核,可以实现不同码率的压缩。通常,模糊核(例如,高斯模板)尺度越大,滤波后图片越模糊,压缩数据的码率也越小;模糊核(例如,高斯模板)尺度越小,滤波后图片越清晰,压缩数据的码率也越大。下面通过实验进行证明:By adjusting the fuzzy kernel, compression of different code rates can be achieved. Generally, the larger the scale of the fuzzy kernel (for example, Gaussian template) is, the more blurred the picture after filtering, and the smaller the bit rate of the compressed data; the smaller the scale of the fuzzy kernel (for example, the Gaussian template), the clearer the picture after filtering, and the better the compressed data. The bit rate is also larger. The following is proved by experiment:
模型的初始码率和压缩性能如下:The initial code rate and compression performance of the model are as follows:
BPP:0.5048、PSNR:28.7966、MS-SSIM:0.9860;BPP: 0.5048, PSNR: 28.7966, MS-SSIM: 0.9860;
调整高斯模板的尺度后,新的码率和压缩性能如下:After adjusting the scale of the Gaussian template, the new code rate and compression performance are as follows:
高斯模板尺度为3:BPP:0.3100、PSNR:26.8661、MS-SSIM:0.9593;The Gaussian template scale is 3: BPP: 0.3100, PSNR: 26.8661, MS-SSIM: 0.9593;
高斯模板尺度为5:BPP:0.3657、PSNR:26.8711、MS-SSIM:0.9667。The Gaussian template scale is 5: BPP: 0.3657, PSNR: 26.8711, MS-SSIM: 0.9667.
显然,高斯模板尺度越大,BPP越大,压缩后图像质量越好;也就是,通过调整高斯模板尺度(3、5),实现了3个码率的压缩。Obviously, the larger the Gaussian template scale, the larger the BPP, and the better the image quality after compression; that is, by adjusting the Gaussian template scale (3, 5), compression of 3 code rates is achieved.
在另一个实施例中,当第一指令为图像退化指令,第一参数为图像退化参数时,预处理为图像退化;In another embodiment, when the first instruction is an image degradation instruction and the first parameter is an image degradation parameter, the preprocessing is image degradation;
按照第一指令和第一参数,对原始图像进行预处理,得到待压缩图像的过程,可以包括:According to the first instruction and the first parameter, the process of preprocessing the original image to obtain the image to be compressed may include:
按照图像退化指令和图像退化参数,对原始图像进行图像退化,得到待压缩图像。According to the image degradation instruction and the image degradation parameter, perform image degradation on the original image to obtain the image to be compressed.
图像退化指令是指对原始图像做图像退化的方法,编码过程在压缩前先进行图像退化,例如,请参照图11,先对原始图像进行图像退化再压缩,输入为原始图像,输出为退化后的待压缩图像。The image degradation instruction refers to the method of degrading the original image. The image degradation is performed before compression in the encoding process. For example, please refer to Figure 11. The original image is degraded and then compressed. The input is the original image, and the output is the degraded image. The image to be compressed.
通过调整图像退化参数,可以实现不同码率的压缩。通常,图像退化参数越大,压缩数据的码率越小。By adjusting the image degradation parameters, compression at different bit rates can be achieved. Generally, the larger the image degradation parameter, the smaller the bit rate of the compressed data.
在另一个实施例中,当第一指令为图像分离指令和第一后阶段处理指令,第一参数为与图像分离指令对应的图像分离参数和与第一后阶段处理指令对应的第一后阶段 处理参数时,预处理为先图像分离再第一后阶段处理;In another embodiment, when the first instruction is an image separation instruction and a first post-processing instruction, the first parameter is an image separation parameter corresponding to the image separation instruction and a first post-processing instruction corresponding to the first post-processing instruction When processing parameters, the pre-processing is image separation first and then the first post-processing;
按照第一指令和第一参数,对原始图像进行预处理,得到待压缩图像的过程,可以包括:According to the first instruction and the first parameter, the process of preprocessing the original image to obtain the image to be compressed may include:
首先,按照图像分离指令和图像分离参数,对原始图像进行图像分离,得到边缘图像和纹理图像;First, perform image separation on the original image according to the image separation instructions and image separation parameters to obtain edge images and texture images;
然后,按照第一后阶段处理指令和第一后阶段处理参数,对边缘图像和纹理图像均进行全局缩放、自适应缩放、模糊处理以及图像退化中的至少一种,得到待压缩边缘图像和待压缩纹理图像,其中,待压缩图像包括待压缩边缘图像和待压缩纹理图像。Then, according to the first post-stage processing instructions and the first post-stage processing parameters, at least one of global scaling, adaptive scaling, blur processing, and image degradation is performed on the edge image and the texture image to obtain the edge image to be compressed and the edge image to be compressed. Compressed texture image, where the image to be compressed includes edge image to be compressed and texture image to be compressed.
图像分离指令是指对原始图像做图像分离的方法,图像分离可以是按照原始图像的纹理特征,将原始图像分离为边缘图像和纹理图像,再分别对边缘图像和纹理图像进行第一后阶段处理。第一后阶段处理可以是全局缩放、自适应缩放、模糊处理、图像退化中的一种或几种。全局缩放、自适应缩放、模糊处理、图像退化的详细过程参见前文描述,在此不再赘述。The image separation instruction refers to the method of image separation of the original image. Image separation can be to separate the original image into edge image and texture image according to the texture characteristics of the original image, and then perform the first post-processing on the edge image and texture image respectively . The first post-stage processing can be one or more of global scaling, adaptive scaling, blur processing, and image degradation. The detailed process of global zooming, adaptive zooming, blur processing, and image degradation can be referred to the foregoing description, and will not be repeated here.
第一后阶段处理指令是指对原始图像做第一后阶段处理的方法,第一后阶段处理指令可以是全局缩放指令、自适应缩放指令、模糊处理指令、图像退化指令中的一种或几种。相应的,第一后阶段处理参数可以是全局缩放系数和缩放核、分块参数、模糊核、图像退化参数中的一种或几种。The first post-processing instruction refers to the method of performing the first post-processing on the original image. The first post-processing instruction can be one or more of the global zoom instruction, the adaptive zoom instruction, the blur processing instruction, and the image degradation instruction. kind. Correspondingly, the first post-stage processing parameter may be one or more of the global zoom factor and zoom kernel, block parameter, blur kernel, and image degradation parameter.
编码过程为先图像分离后第一阶段处理再压缩例如,请参照图12,先图像分离为边缘图像和纹理图像,再分别对边缘图像和纹理图像进行高斯滤波。纹理图像的高斯模板尺度可以小一点,边缘图像的高斯模板尺度可以大一点,得到待压缩边缘图像和待压缩纹理图像。The encoding process is the first stage of image separation, then the first stage of processing and then compression. For example, please refer to Figure 12, first the image is separated into edge images and texture images, and then Gaussian filtering is performed on the edge images and texture images respectively. The Gaussian template scale of the texture image can be smaller, and the Gaussian template scale of the edge image can be larger, to obtain the edge image to be compressed and the texture image to be compressed.
通过调整图像分离参数和第一后阶段处理参数,可以实现不同码率的压缩。By adjusting the image separation parameters and the first post-stage processing parameters, compression at different bit rates can be achieved.
在另一个实施例中,当第一指令为图像分割指令和第二后阶段处理指令,第一参数为与图像分割指令对应的分割类别和与第二后阶段处理指令对应的第二后阶段处理参数时,预处理为先图像分割再第二后阶段处理;In another embodiment, when the first instruction is an image segmentation instruction and a second post-processing instruction, the first parameter is the segmentation category corresponding to the image segmentation instruction and the second post-processing instruction corresponding to the second post-processing instruction For parameters, the preprocessing is first image segmentation and then the second post-processing stage;
按照第一指令和第一参数,对原始图像进行预处理,得到待压缩图像的过程,可以包括:According to the first instruction and the first parameter, the process of preprocessing the original image to obtain the image to be compressed may include:
首先,按照图像分割指令和分割类别,对原始图像进行图像分割,得到多个图像区域;First, perform image segmentation on the original image according to the image segmentation instruction and segmentation category to obtain multiple image regions;
然后,按照所述第二后阶段处理指令和第二后阶段处理参数,对多个图像区域均进行全局缩放、自适应缩放、模糊处理以及图像退化中的至少一种,得到每个图像区域对应的待压缩图像区域,其中,待压缩图像包括多个待压缩图像区域。Then, according to the second post-processing instruction and the second post-processing parameters, at least one of global scaling, adaptive scaling, blur processing, and image degradation is performed on multiple image regions to obtain the corresponding image region The image area to be compressed, where the image to be compressed includes a plurality of image areas to be compressed.
图像分割指令是指对原始图像做图像分割的方法,图像分割就是把图像分成若干个特定的、具有独特性质的区域并提出感兴趣目标的技术和过程。图像分割可以是按照分割类别,将原始图像分为若干个图像区域,每个图像区域都有对应的位置坐标(x,y)。该位置坐标可以是对应图像区域的每个边缘点坐标,也可以是对应图像区域的中心点坐标。The image segmentation instruction refers to the method of image segmentation of the original image. Image segmentation is the technology and process of dividing the image into a number of specific and unique areas and proposing objects of interest. Image segmentation can be based on the segmentation category, the original image is divided into several image areas, each image area has a corresponding location coordinates (x, y). The position coordinates can be the coordinates of each edge point of the corresponding image area, or the coordinates of the center point of the corresponding image area.
分割类别可以是前景和背景,也可以是前景中所有目标的类别,例如,人、动物、植物等。通常,图像分割方法可以是,但不限于基于阈值分割、基于区域分割、基于 边缘分割等。The segmentation categories can be foreground and background, or categories of all targets in the foreground, such as humans, animals, plants, and so on. Generally, the image segmentation method can be, but is not limited to, threshold-based segmentation, region-based segmentation, edge-based segmentation, and so on.
编码过程中,可以先将原始图像按照分割类别分割为多个图像区域(例如,前景和背景),再分别对每个图像区域进行第二后阶段处理。第二后阶段处理可以是全局缩放、自适应缩放、模糊处理、图像退化中的一种或几种。全局缩放、自适应缩放、模糊处理、图像退化的详细过程参见前文描述,在此不再赘述。In the encoding process, the original image can be divided into multiple image regions (for example, foreground and background) according to the segmentation category, and then the second post-processing is performed on each image region separately. The second post-stage processing can be one or more of global scaling, adaptive scaling, blur processing, and image degradation. The detailed process of global zooming, adaptive zooming, blur processing, and image degradation can be referred to the foregoing description, and will not be repeated here.
第二后阶段处理指令是指对原始图像做第二后阶段处理的方法,第二后阶段处理指令可以是全局缩放指令、自适应缩放指令、模糊处理指令、图像退化指令中的一种或几种。相应的,第二后阶段处理参数可以是全局缩放系数和缩放核、分块参数、模糊核、图像退化参数中的一种或几种。The second post-processing instruction refers to the method of performing the second post-processing on the original image. The second post-processing instruction can be one or more of global scaling instructions, adaptive scaling instructions, blur processing instructions, and image degradation instructions. kind. Correspondingly, the second post-stage processing parameter may be one or more of the global zoom factor and zoom kernel, block parameter, blur kernel, and image degradation parameter.
编码过程为先图像分割后第二阶段处理再压缩,例如,请参照图13,先图像分割为前景(即苍蝇)和背景,再采用高斯滤波分别对前景和背景进行高斯滤波。前景的高斯模板尺度可以小一点,背景的高斯模板尺度可以大一点,得到待压缩前景和待压缩背景。The encoding process is to segment the image first, then process the second stage and then compress it. For example, referring to Figure 13, the image is first segmented into the foreground (ie flies) and the background, and then Gaussian filtering is performed on the foreground and the background respectively. The Gaussian template scale of the foreground can be smaller, and the Gaussian template scale of the background can be larger, to obtain the foreground to be compressed and the background to be compressed.
通过调整分割类别和第二后阶段处理参数,可以实现不同码率的压缩。By adjusting the segmentation category and the second post-stage processing parameters, compression at different bit rates can be achieved.
深度学习图像压缩框架包括第一深度神经网络、量化模型和熵编码模型。在图5的基础上,请参照图14,S104可以包括以下详细步骤:The deep learning image compression framework includes the first deep neural network, quantization model and entropy coding model. On the basis of FIG. 5, please refer to FIG. 14. S104 may include the following detailed steps:
S1041,利用第一深度神经网络对待压缩图像进行特征提取,得到图像特征。S1041: Perform feature extraction on the compressed image using the first deep neural network to obtain image features.
第一深度神经网络可以是全连接神经网络、CNN、CNN变体、RNN、RNN变体等,也可以是本领域技术人员可能会采用的其它深度神经网络。CNN变体可以是DCNN(Dilated Convolutions Neural Network,空洞卷积神经网络)、IDCNN(Iteration Dilated Convolutions Neural Network,迭代空洞卷积神经网络)等。RNN变体可以是LSTM(Long Short-Term Memory,长短期记忆网络)、GRU(Gated Recurrent Unit,门控循环单元)等。The first deep neural network may be a fully connected neural network, CNN, CNN variants, RNN, RNN variants, etc., or may be other deep neural networks that may be used by those skilled in the art. The variants of CNN can be DCNN (Dilated Convolutions Neural Network), IDCNN (Iteration Dilated Convolutions Neural Network), etc. RNN variants can be LSTM (Long Short-Term Memory), GRU (Gated Recurrent Unit), etc.
第一深度神经网络用于对待压缩图像进行特征提取,得到图像特征。The first deep neural network is used for feature extraction of the image to be compressed to obtain image features.
S1042,利用量化模型对图像特征进行量化,得到压缩特征。S1042: Use the quantization model to quantize the image feature to obtain the compressed feature.
量化模型用于将压缩特征离散化,以节省存储空间,便于进一步熵编码。The quantization model is used to discretize the compressed features to save storage space and facilitate further entropy coding.
S1043,利用熵编码模型对压缩特征进行熵编码,得到压缩数据。S1043: Entropy coding the compressed feature using the entropy coding model to obtain compressed data.
得到压缩特征后,使用熵编码进一步降低数据量,熵编码模型可以采用算术编码等。After obtaining the compression features, use entropy coding to further reduce the amount of data, and the entropy coding model can use arithmetic coding and so on.
请参照图15,图15示出了本申请实施例提供的图像处理方法的另一种流程示意图。该图像处理方法应用于解码端,例如可以是具有解码功能的电子设备,该图像压缩方法可以包括以下步骤:Please refer to FIG. 15, which shows another schematic flowchart of an image processing method provided by an embodiment of the present application. The image processing method is applied to the decoding end, for example, it may be an electronic device with a decoding function, and the image compression method may include the following steps:
S201,获得压缩数据,其中,压缩数据为利用预设的深度学习图像压缩框架对待压缩图像进行压缩得到,待压缩图像为按照目标策略对原始图像进行预处理得到,目标策略是响应对原始图像的操作从多个预设策略中确定出的,至少两个预设策略对应的压缩数据的码率不同。S201: Obtain compressed data, where the compressed data is obtained by compressing a to-be-compressed image using a preset deep learning image compression framework, and the to-be-compressed image is obtained by preprocessing the original image according to a target strategy, and the target strategy is a response to the original image The operation is determined from a plurality of preset strategies, and the code rates of the compressed data corresponding to at least two preset strategies are different.
当用户想要查看或发送终端相册的图片、查看或下载云相册的图片时,终端或云端会将对应的压缩数据解压缩为还原图像。同时,为了使重建图像与原始图像尽可能一致,需要按照预处理的反向处理对还原图像进行处理。When a user wants to view or send a picture of a terminal album, or view or download a picture of a cloud album, the terminal or the cloud will decompress the corresponding compressed data into a restored image. At the same time, in order to make the reconstructed image and the original image as consistent as possible, it is necessary to process the restored image according to the reverse processing of preprocessing.
S202,利用预设的深度学习图像解压缩框架对压缩数据进行解压缩,得到还原图像。S202: Decompress the compressed data using a preset deep learning image decompression framework to obtain a restored image.
S203,获得目标策略对应的反向策略。S203: Obtain a reverse strategy corresponding to the target strategy.
S204,按照反向策略对还原图像进行预处理的反向处理,得到与原始图像对应的重建图像。S204: Perform reverse processing of pre-processing on the restored image according to the reverse strategy to obtain a reconstructed image corresponding to the original image.
上述的深度学习图像解压缩框架包括第二深度神经网络、反量化模型和熵解码模型。在图15的基础上,请参照图16,S202可以包括以下详细步骤:The aforementioned deep learning image decompression framework includes a second deep neural network, an inverse quantization model, and an entropy decoding model. On the basis of FIG. 15, please refer to FIG. 16, S202 may include the following detailed steps:
S2021,利用熵解码模型对压缩数据进行熵解码,得到压缩特征。S2021: Entropy decoding the compressed data using the entropy decoding model to obtain compression features.
S2022,利用反量化模型对压缩特征进行反量化,得到图像特征。S2022: Inversely quantize the compressed features using an inverse quantization model to obtain image features.
S2023,利用第二深度神经网络对图像特征进行还原,得到还原图像。S2023: Use the second deep neural network to restore the image features to obtain a restored image.
第二深度神经网络用于对图像特征进行变换学习,从而将频域信息无损地恢复到像素域,得到还原图像。The second deep neural network is used to transform and learn image features, so as to restore the frequency domain information to the pixel domain without loss, and obtain a restored image.
第二深度神经网络可以是全连接神经网络、CNN、CNN变体、RNN、RNN变体等,也可以是本领域技术人员可能会采用的其它深度神经网络。CNN变体可以是DCNN、IDCNN等,RNN变体可以是LSTM、GRU等。The second deep neural network may be a fully connected neural network, CNN, CNN variants, RNN, RNN variants, etc., or other deep neural networks that may be used by those skilled in the art. The CNN variants can be DCNN, IDCNN, etc., and the RNN variants can be LSTM, GRU, etc.
在图15的基础上,请参照图17,S203可以包括以下详细步骤:On the basis of FIG. 15, please refer to FIG. 17, S203 may include the following detailed steps:
S2031,获得目标策略,目标策略包括第一指令和与第一指令对应的第一参数。S2031: Obtain a target strategy, where the target strategy includes a first instruction and a first parameter corresponding to the first instruction.
S2032,依据第一指令及预设的指令对应关系确定第二指令。S2032: Determine the second command according to the corresponding relationship between the first command and the preset command.
S2033,依据第一参数及预设的参数计算规则确定第二参数,其中,反向策略包括第二指令和与第二指令对应的第二参数。S2033: Determine a second parameter according to the first parameter and a preset parameter calculation rule, where the reverse strategy includes a second instruction and a second parameter corresponding to the second instruction.
可以预先设置第一指令与第二指令的对应关系以便依据第一指令确定第二指令,例如,在指令对应关系中,全局缩放指令对应全局缩放指令、模糊处理指令对应去模糊处理指令等。同时,预先设置第一参数与第二参数的对应关系以便依据第一参数确定第二参数,例如,在参数对应关系中,第一参数为全局缩放系数和缩放核,第二参数为全局缩放系数的倒数和缩放核等。The correspondence between the first instruction and the second instruction can be preset to determine the second instruction according to the first instruction. For example, in the instruction correspondence, the global zoom instruction corresponds to the global zoom instruction, the blur processing instruction corresponds to the deblur processing instruction, and so on. At the same time, the corresponding relationship between the first parameter and the second parameter is preset to determine the second parameter according to the first parameter. For example, in the parameter corresponding relationship, the first parameter is the global scaling factor and the scaling kernel, and the second parameter is the global scaling factor. The reciprocal and zoom kernel etc.
在图15的基础上,请参照图18,S204可以包括以下详细步骤:On the basis of FIG. 15, please refer to FIG. 18. S204 may include the following detailed steps:
S2041,按照第二指令和第二参数,对还原图像进行预处理的反向处理,得到与原始图像对应的重建图像。S2041: Perform reverse processing of preprocessing on the restored image according to the second instruction and the second parameter to obtain a reconstructed image corresponding to the original image.
第二指令是指对还原图像做预处理的反向处理的方法,第二参数是指与对原始图像做预处理的反向处理的方法对应的参数。The second instruction refers to a reverse processing method of preprocessing the restored image, and the second parameter refers to a parameter corresponding to the reverse processing method of preprocessing the original image.
可以采用传统图像处理算法对还原图像做预处理的反向处理,例如,传统图像插值算法、高斯滤波、超分辨率算法等。也可以采用预先训练的深度学习网络对还原图像做预处理的反向处理等。Traditional image processing algorithms can be used to perform reverse processing of the restored image, for example, traditional image interpolation algorithms, Gaussian filtering, super-resolution algorithms, etc. It is also possible to use a pre-trained deep learning network to perform reverse processing of preprocessing the restored image.
下面对按照第二指令和第二参数对还原图像做预处理的反向处理的过程进行举例介绍。The process of reverse processing of preprocessing the restored image according to the second instruction and the second parameter will be described below with an example.
在一个实施例中,如果第一指令为全局缩放指令,第一参数为全局缩放系数和缩放核,预处理为全局缩放,则第二指令为全局缩放指令,第二参数为全局缩放系数的倒数和缩放核,预处理的反向处理为全局缩放;In one embodiment, if the first instruction is a global scaling instruction, the first parameter is a global scaling factor and a scaling kernel, and the preprocessing is global scaling, then the second instruction is a global scaling instruction, and the second parameter is the reciprocal of the global scaling factor. And zooming core, the reverse processing of pre-processing is global zooming;
按照第二指令和第二参数,对还原图像进行预处理的反向处理,得到与原始图像对应的重建图像的过程,可以包括:According to the second instruction and the second parameter, the reverse process of preprocessing the restored image to obtain the reconstructed image corresponding to the original image may include:
按照全局缩放指令、全局缩放系数的倒数和缩放核,对还原图像进行全局缩放,得到重建图像。According to the global zoom instruction, the reciprocal of the global zoom factor and the zoom kernel, the restored image is globally zoomed to obtain a reconstructed image.
例如,结合到图7,解码过程中采用升采样的方式对图像进行放大,输入为还原图像,输出为长和宽为原始图像一样大小的重建图像。For example, in conjunction with Figure 7, during the decoding process, an up-sampling method is used to enlarge the image, the input is a restored image, and the output is a reconstructed image whose length and width are the same size as the original image.
在这种情况下,也可以采用超分辨率算法对还原图像做预处理的反向处理,得到重建图像。In this case, the super-resolution algorithm can also be used to perform the reverse processing of the preprocessing of the restored image to obtain the reconstructed image.
在另一个实施例中,如果第一指令为自适应缩放指令,第一参数为分块参数,预处理为先分块再自适应缩放,则第二指令为自适应缩放指令,第二参数为分块参数关联的拼接参数,预处理的反向处理为先自适应缩放后拼接;In another embodiment, if the first instruction is an adaptive scaling instruction, the first parameter is a block parameter, and the preprocessing is to block first and then adaptive scaling, then the second instruction is an adaptive scaling instruction, and the second parameter is The splicing parameters related to the block parameters, the reverse processing of the pre-processing is first adaptive scaling and then splicing;
按照第二指令和第二参数,对还原图像进行预处理的反向处理,得到与原始图像对应的重建图像的过程,可以包括:According to the second instruction and the second parameter, the reverse process of preprocessing the restored image to obtain the reconstructed image corresponding to the original image may include:
首先,按照自适应缩放指令和每个还原图像块的图像特征,对每个还原图像块均进行自适应缩放,得到每个还原图像块对应的待重建图像块,其中,图像特征用于确定还原图像块的缩放系数;First, according to the adaptive scaling instructions and the image characteristics of each restored image block, each restored image block is adaptively scaled to obtain the image block to be reconstructed corresponding to each restored image block, where the image feature is used to determine the restoration The zoom factor of the image block;
然后,按照拼接参数对多个待重建图像块进行拼接,得到重建图像。Then, the multiple image blocks to be reconstructed are spliced according to the splicing parameters to obtain a reconstructed image.
拼接参数与分块参数关联,包括分块后的每个图像块对应的位置向量(i,j),也即每个还原图像块对应的位置向量(i,j)。The stitching parameter is associated with the block parameter, including the position vector (i, j) corresponding to each image block after the block, that is, the position vector (i, j) corresponding to each restored image block.
例如,结合到图9,解码过程中先按照每个还原图像块的图像特征(例如,颜色、纹理等)确定每个还原图像块的缩放系数,再按照每个还原图像块对应的位置向量(i,j)进行拼接,输出重建图像。For example, in conjunction with Figure 9, in the decoding process, the zoom factor of each restored image block is determined according to the image characteristics (for example, color, texture, etc.) of each restored image block, and then the position vector corresponding to each restored image block ( i, j) Perform splicing and output the reconstructed image.
在另一个实施例中,如果第一指令为模糊处理指令,第一参数为模糊核,预处理为模糊处理,则第二指令为去模糊处理指令,第二参数为模糊核对应的去模糊核,预处理的反向处理为去模糊处理;In another embodiment, if the first instruction is a fuzzy processing instruction, the first parameter is a fuzzy kernel, and the preprocessing is a fuzzy processing, then the second instruction is a de-blurring instruction, and the second parameter is a de-blurring kernel corresponding to the fuzzy kernel. , The reverse processing of pre-processing is de-blurring processing;
按照第二指令和第二参数,对还原图像进行预处理的反向处理,得到与原始图像对应的重建图像的过程,可以包括:According to the second instruction and the second parameter, the reverse process of preprocessing the restored image to obtain the reconstructed image corresponding to the original image may include:
按照去模糊处理指令和去模糊核,对还原图像进行去模糊处理,得到重建图像。According to the deblurring processing instruction and the deblurring kernel, the restored image is deblurred to obtain the reconstructed image.
去模糊处理可以是,但不限于边缘检测、图像锐化、深度学习图像复原等;相应地,去模糊核可以是锐化核等。The deblurring processing can be, but is not limited to, edge detection, image sharpening, deep learning image restoration, etc.; correspondingly, the deblurring kernel can be a sharpening kernel and the like.
若编码过程在压缩前先进行模糊处理,则解码过程在解压缩后进行去模糊处理。例如,结合到图10,先解压缩再图像锐化,可以采用拉普拉斯锐化函数或深度学习网络进行锐化,输入为还原图像,输出锐化后的重建图像。If the encoding process performs blurring before compression, the decoding process performs deblurring after decompression. For example, in conjunction with Figure 10, first decompress and then sharpen the image, you can use the Laplacian sharpening function or deep learning network for sharpening, the input is the restored image, and the sharpened reconstructed image is output.
在另一个实施例中,如果第一指令为图像退化指令,第一参数为图像退化参数,预处理为图像退化,则第二指令为所述图像增强指令,第二参数为图像增强参数;In another embodiment, if the first instruction is an image degradation instruction, the first parameter is an image degradation parameter, and the preprocessing is image degradation, then the second instruction is the image enhancement instruction, and the second parameter is an image enhancement parameter;
按照第二指令和第二参数,对还原图像进行预处理的反向处理,得到与原始图像对应的重建图像的过程,可以包括:According to the second instruction and the second parameter, the reverse process of preprocessing the restored image to obtain the reconstructed image corresponding to the original image may include:
按照图像增强指令和图像增强参数,对还原图像进行图像增强,得到重建图像。According to the image enhancement instructions and the image enhancement parameters, image enhancement is performed on the restored image to obtain a reconstructed image.
图像增强的目的是改善图像的视觉效果,或将图像转换成更适合于人眼观察和机器分析识别的形式,以便从图像中获取更有用的信息。The purpose of image enhancement is to improve the visual effect of the image, or to convert the image into a form more suitable for human observation and machine analysis and recognition, so as to obtain more useful information from the image.
图像增强方法可以是,但不限于直方图均衡化、对比度增强、伽马变换、平滑噪声、锐化等。图像增强指令可以是,但不限于变换函数、拉普拉斯算子等。The image enhancement method may be, but is not limited to, histogram equalization, contrast enhancement, gamma transformation, noise smoothing, sharpening, and the like. The image enhancement instructions can be, but are not limited to, transformation functions, Laplacian operators, and so on.
若编码过程在压缩前先进行图像退化,则解码过程在解压缩后进行图像增强。例如,结合到图11,解码过程为先解压缩再图像增强,可以利用深度学习网络后处理,输入为还原图像,输出为重建图像。If the encoding process performs image degradation before compression, the decoding process performs image enhancement after decompression. For example, in conjunction with Figure 11, the decoding process is first decompression and then image enhancement. Deep learning network post-processing can be used. The input is a restored image and the output is a reconstructed image.
在另一个实施例中,如果第一指令为第一指令为图像分离指令和第一后阶段处理指令,第一参数为与图像分离指令对应的图像分离参数和与第一后阶段处理指令对应的第一后阶段处理参数,预处理为先图像分离再第一后阶段处理;则第二指令为图像分离指令的反向指令和第一后阶段处理指令的反向指令,第二参数为与图像分离指令的反向指令对应的图像分离参数的反向参数和与第一后阶段处理指令的反向指令对应的第一后阶段处理参数的反向参数,预处理的反向处理为先第一后阶段处理的反向处理再图像融合;In another embodiment, if the first instruction is an image separation instruction and a first post-processing instruction, the first parameter is an image separation parameter corresponding to the image separation instruction and an image separation parameter corresponding to the first post-processing instruction. The first post-stage processing parameter, the preprocessing is the image separation first and then the first post-stage processing; the second instruction is the reverse instruction of the image separation instruction and the reverse instruction of the first post-processing instruction, and the second parameter is the image separation instruction. The reverse parameter of the image separation parameter corresponding to the reverse instruction of the separation instruction and the reverse parameter of the first post-processing parameter corresponding to the reverse instruction of the first post-processing instruction, the reverse processing of the preprocessing is first first Reverse processing and image fusion of post-processing;
按照第二指令和第二参数,对还原图像进行预处理的反向处理,得到与原始图像对应的重建图像的过程,可以包括:According to the second instruction and the second parameter, the reverse process of preprocessing the restored image to obtain the reconstructed image corresponding to the original image may include:
首先,按照第一后阶段处理指令的反向指令和第一后阶段处理参数的反向参数,对还原边缘图像和还原纹理图像均进行全局缩放的反向处理、自适应缩放的反向处理、去模糊处理以及图像增强中的至少一种,得到待重建边缘图像和待重建纹理图像;First, according to the reverse instruction of the first post-processing instruction and the reverse parameter of the first post-processing parameter, both the restored edge image and the restored texture image are subjected to the reverse processing of global scaling, the reverse processing of adaptive scaling, At least one of deblurring and image enhancement to obtain an edge image to be reconstructed and a texture image to be reconstructed;
然后,按照图像分离指令的反向指令和图像分离参数的反向参数,对待重建边缘图像和待重建纹理图像进行图像融合,得到重建图像。Then, according to the reverse instruction of the image separation instruction and the reverse parameter of the image separation parameter, image fusion is performed on the edge image to be reconstructed and the texture image to be reconstructed to obtain a reconstructed image.
第一后阶段处理指令的反向指令可以是全局缩放指令的反向指令、自适应缩放指令的反向指令、去模糊处理指令、图像增强指令中的一种或几种。相应的,第一后阶段处理参数可以是全局缩放系数的倒数和缩放核、拼接参数、去模糊核、图像增强参数中的一种或几种。The reverse command of the first post-stage processing command may be one or more of the reverse command of the global zoom command, the reverse command of the adaptive zoom command, the deblur processing command, and the image enhancement command. Correspondingly, the first post-stage processing parameter may be one or more of the reciprocal of the global zoom factor and zoom kernel, stitching parameter, deblurring kernel, and image enhancement parameter.
若编码过程为先图像分离后第一阶段处理再压缩,则解码过程为先解压缩后第一后阶段处理的反向处理再图像融合。例如,请参照图12,解码过程中先分别对解压缩后的还原边缘图像和还原纹理图像做图像锐化,再将锐化后的两个图像做图像融合,输出为重建图像。If the encoding process is first image separation and then the first stage of processing and then compression, then the decoding process is the reverse processing of first decompression and then the first post-stage processing and then image fusion. For example, referring to Figure 12, in the decoding process, image sharpening is performed on the decompressed restored edge image and the restored texture image respectively, and then the two sharpened images are image fused and output as a reconstructed image.
在另一个实施例中,如果第一指令为图像分割指令和第二后阶段处理指令,第一参数为与图像分割指令对应的分割类别和与第二后阶段处理指令对应的第二后阶段处理参数,预处理为先图像分割再第二后阶段处理;则第二指令为图像分割指令的反向指令和第二后阶段处理指令的反向指令,第二参数为与第二后阶段处理指令的反向指令对应的第二后阶段处理参数的反向参数,预处理的反向处理为先第二后阶段处理的反向处理再拼接;还原图像包括多个还原图像区域及每个还原图像区域的位置坐标;In another embodiment, if the first instruction is an image segmentation instruction and a second post-processing instruction, the first parameter is the segmentation category corresponding to the image segmentation instruction and the second post-processing instruction corresponding to the second post-processing instruction Parameter, the preprocessing is first image segmentation and then the second post-stage processing; then the second instruction is the reverse instruction of the image segmentation instruction and the reverse instruction of the second post-stage processing instruction, and the second parameter is the same as the second post-stage processing instruction The reverse instruction corresponding to the reverse parameter of the second post-stage processing parameter, the reverse processing of the pre-processing is the reverse processing of the second post-processing first and then splicing; the restored image includes multiple restored image regions and each restored image The location coordinates of the area;
按照第二指令和第二参数,对还原图像进行预处理的反向处理,得到与原始图像对应的重建图像的过程,可以包括:According to the second instruction and the second parameter, the reverse process of preprocessing the restored image to obtain the reconstructed image corresponding to the original image may include:
首先,按照第二后阶段处理指令的反向指令和第二后阶段处理参数的反向参数,对每个还原图像区域均进行全局缩放的反向处理、自适应缩放的反向处理、去模糊处 理以及图像增强中的至少一种,得到每个还原图像区域对应的待重建图像区域;First, in accordance with the reverse instruction of the second post-processing instruction and the reverse parameter of the second post-processing parameter, each restored image area is subjected to the reverse processing of the global zoom, the reverse processing of the adaptive zoom, and the deblurring At least one of processing and image enhancement to obtain the image area to be reconstructed corresponding to each restored image area;
然后,按照图像分割指令的反向指令和每个还原图像区域的位置坐标,对多个待重建图像区域进行拼接,得到所述重建图像。Then, according to the reverse instruction of the image segmentation instruction and the position coordinates of each restored image area, a plurality of image areas to be reconstructed are spliced to obtain the reconstructed image.
若编码过程为先图像分割后第二阶段处理再压缩,则解码过程为先解压缩后第二后阶段处理的反向处理再拼接。例如,结合到图13,解码过程中先分别对解压缩后的还原前景和还原背景做图像锐化,再将锐化后的两个图像区域做拼接,输出为重建图像。If the encoding process is first image segmentation and then second stage processing and then compression, then the decoding process is first decompression and then reverse processing of the second post-stage processing and then splicing. For example, in conjunction with Figure 13, in the decoding process, the decompressed restored foreground and restored background are respectively sharpened, and then the two sharpened image regions are spliced and output as a reconstructed image.
在一种可能的情形下,由于预处理的影响,生成重建图像的主观视觉效果可能不佳。因此,在图15的基础上,图19为本申请实施例提供的另一种图像处理方法的流程示意图。请参照图19,在S204之后,该图像处理方法还可以包括以下步骤:In a possible situation, due to the influence of preprocessing, the subjective visual effect of generating the reconstructed image may be poor. Therefore, on the basis of FIG. 15, FIG. 19 is a schematic flowchart of another image processing method provided by an embodiment of the application. Referring to FIG. 19, after S204, the image processing method may further include the following steps:
S205,利用超分辨率算法、去模糊算法、去雾算法以及去噪算法中的至少一种对重建图像进行处理,以改善重建图像的视觉效果。S205: Use at least one of a super-resolution algorithm, a deblurring algorithm, a dehazing algorithm, and a denoising algorithm to process the reconstructed image, so as to improve the visual effect of the reconstructed image.
请参照图20,图20示出了本申请实施例提供的图像处理方法的另一种流程示意图。该图像处理方法应用于编解码端,例如可以是具有编码和解码功能的电子设备,该图像处理方法可以包括以下步骤:Please refer to FIG. 20, which shows another schematic flowchart of an image processing method provided by an embodiment of the present application. The image processing method is applied to the encoding and decoding end, for example, it may be an electronic device with encoding and decoding functions, and the image processing method may include the following steps:
S301,获取原始图像。S301: Obtain an original image.
S302,响应对原始图像的操作,从多个预设策略中确定出目标策略,其中,至少两个预设策略对应的压缩数据的码率不同。S302: In response to an operation on the original image, determine a target strategy from a plurality of preset strategies, where at least two preset strategies have different code rates for the compressed data.
S303,按照目标策略,对原始图像进行预处理,得到待压缩图像。S303: Perform preprocessing on the original image according to the target strategy to obtain the image to be compressed.
S304,利用预设的深度学习图像压缩框架对待压缩图像进行压缩,得到压缩数据。S304: Compress the image to be compressed using a preset deep learning image compression framework to obtain compressed data.
S305,利用预设的深度学习图像解压缩框架对压缩数据进行解压缩,得到还原图像。S305: Decompress the compressed data using a preset deep learning image decompression framework to obtain a restored image.
S306,获得目标策略对应的反向策略。S306: Obtain a reverse strategy corresponding to the target strategy.
S307,按照反向策略对还原图像进行预处理的反向处理,得到与原始图像对应的重建图像。S307: Perform reverse processing of preprocessing the restored image according to the reverse strategy to obtain a reconstructed image corresponding to the original image.
S301~S307的详细实现可以参见前文实施例的描述,在此不再赘述。The detailed implementation of S301 to S307 can be referred to the description of the foregoing embodiment, which will not be repeated here.
下面对本申请实施例提供的图像处理方法的应用场景进行举例介绍。The application scenarios of the image processing method provided in the embodiments of the present application will be introduced below with examples.
在一种应用场景下,请参照图21,用户使用终端相机拍照,在拍照前可以对相机进行压缩质量设置,例如,选择“压缩质量(9/10)”,9/10表示压缩质量,假设压缩质量有10个档次,1表示最差,10表示最好,9/10表示压缩质量为9,如果不选择则为默认压缩质量,图中“压缩质量(10/10)”为默认压缩质量。之后相机拍照,摄像头输出视频流裸数据,由于用户选择的压缩程度为“压缩质量(9/10)”,故可以按照视频流裸数据自动的从“压缩质量(9/10)”对应的一系列预设策略中找出效果最好的目标策略,并将视频流裸数据按照目标策略预处理后压缩,生成包括压缩数据和目标策略的压缩文件并存储,以节省终端的存储空间。当用户想要查看终端存储的某一图片时,终端将压缩文件,解码后进行显示。In an application scenario, please refer to Figure 21. The user uses the terminal camera to take a picture. Before taking the picture, you can set the compression quality of the camera. For example, select "Compression Quality (9/10)". There are 10 levels of compression quality, 1 means the worst, 10 means the best, 9/10 means the compression quality is 9, if not selected, it is the default compression quality, and "compression quality (10/10)" in the figure is the default compression quality . Then the camera takes pictures, and the camera outputs the raw data of the video stream. Since the compression level selected by the user is "compression quality (9/10)", it can automatically change from the one corresponding to the "compression quality (9/10)" according to the raw data of the video stream. The target strategy with the best effect is found out of the series of preset strategies, and the raw video stream data is preprocessed and compressed according to the target strategy, and a compressed file including the compressed data and the target strategy is generated and stored to save the storage space of the terminal. When the user wants to view a certain picture stored in the terminal, the terminal will compress the file and display it after decoding.
在另一种应用场景下,请参照图22,用户将终端相册的图片上传到云相册,在上传前可以选择压缩质量,例如,选择“压缩质量(9/10)”,同上,如果不选择则为默认压缩质量,图中“压缩质量(10/10)”为默认压缩质量。之后将图片上传至云端, 如果终端相册的图片被压缩过(例如,.jpg文件),则云端要先将图片解析为原始图像(例如,YUV格式)。云端根据用户选择的压缩程度“压缩质量(9/10)”及图片自动找出压缩效果最好的目标策略,并将原始图像按照目标策略预处理后压缩,生成包括压缩数据和目标策略的压缩文件并存储,以节省云端的存储空间。In another application scenario, please refer to Figure 22. The user uploads the picture of the terminal album to the cloud album, and can select the compression quality before uploading, for example, select "Compression quality (9/10)", the same as above, if you do not select It is the default compression quality, and "compression quality (10/10)" in the figure is the default compression quality. After uploading the picture to the cloud, if the picture in the terminal album is compressed (for example, a .jpg file), the cloud must first parse the picture into an original image (for example, in YUV format). The cloud automatically finds the target strategy with the best compression effect according to the compression level selected by the user "compression quality (9/10)" and the picture, and compresses the original image after preprocessing according to the target strategy, and generates a compression including the compressed data and the target strategy File and store to save cloud storage space.
当用户想要下载或预览云相册的某一图片时,云端获得压缩文件,解码后供用户下载或预览。同时,如果用户上传的图片为特定格式的文件,例如,.jpg文件,则云端要将重建图像处理为特定格式,再供用户下载或预览。或者,云端也可以提供对应的解码器,用户直接将压缩文件进行下载,下载后再用云端提供的解码器解码。When a user wants to download or preview a certain picture of a cloud album, the cloud obtains the compressed file, which is decoded for the user to download or preview. At the same time, if the picture uploaded by the user is a file in a specific format, for example, a .jpg file, the cloud will process the reconstructed image into a specific format for the user to download or preview. Alternatively, the cloud can also provide a corresponding decoder, and the user directly downloads the compressed file, and then decodes it with the decoder provided by the cloud after downloading.
在另一种应用场景下,请参照图23,用户将终端相册的图片(例如,图片A)发送给其它终端,在发送前可以选择压缩质量,例如,选择“压缩质量(9/10)”,同上,如果不选择则为默认压缩质量,图中“压缩质量(10/10)”为默认压缩质量。发送方终端根据用户选择的压缩程度“压缩质量(9/10)”及选定图片自动选择找出压缩效果最好的目标策略,并将图片按照目标策略预处理后压缩,生成包括压缩数据和目标策略的压缩文件并传输至接收方终端,以节省传输带宽。同时,如果终端相册的图片被压缩过(例如,.jpg文件),则发送方终端要先将图片解析为原始图像(例如,YUV格式)再做预处理及压缩。当接收方想要下载“图片A”时,接收方终端获得压缩文件,解码后供用户下载。In another application scenario, please refer to Figure 23, the user sends a picture of the terminal album (for example, picture A) to other terminals, and can select the compression quality before sending, for example, select "compression quality (9/10)" , Same as above, if not selected, it is the default compression quality, and "compression quality (10/10)" in the figure is the default compression quality. The sender terminal automatically selects and finds the target strategy with the best compression effect according to the compression level "compression quality (9/10)" selected by the user and the selected picture, and preprocesses the picture according to the target strategy and compresses it to generate compressed data and The compressed file of the target strategy is transmitted to the receiving terminal to save transmission bandwidth. At the same time, if the picture of the terminal album has been compressed (for example, a .jpg file), the sender terminal must first parse the picture into an original image (for example, YUV format) before preprocessing and compression. When the receiver wants to download "Picture A", the receiver terminal obtains the compressed file, which is decoded for the user to download.
为了执行上述图像处理方法实施例及各个可能的实施方式中的相应步骤,下面给出图像处理装置的可能实现方式。In order to execute the corresponding steps in the foregoing image processing method embodiment and each possible implementation manner, possible implementation manners of the image processing apparatus are given below.
请参照图24,图24为本申请实施例提供的图像处理装置100的组成示意图。该图像处理装置100应用于编码端,例如可以是具有编码功能的电子设备。图像处理装置100包括图像获取模块101、响应模块102、预处理模块103及压缩模块104。Please refer to FIG. 24. FIG. 24 is a schematic diagram of the composition of an image processing apparatus 100 according to an embodiment of the application. The image processing apparatus 100 is applied to the encoding end, and may be, for example, an electronic device with encoding function. The image processing device 100 includes an image acquisition module 101, a response module 102, a preprocessing module 103, and a compression module 104.
图像获取模块101用于,获取原始图像。The image acquisition module 101 is used to acquire an original image.
响应模块102用于,响应对原始图像的操作,从多个预设策略中确定出目标策略,其中,至少两个预设策略对应的压缩数据的码率不同。The response module 102 is configured to determine a target strategy from a plurality of preset strategies in response to an operation on the original image, wherein the code rates of the compressed data corresponding to at least two preset strategies are different.
预处理模块103用于,按照目标策略,对原始图像进行预处理,得到待压缩图像。The preprocessing module 103 is used to preprocess the original image according to the target strategy to obtain the image to be compressed.
压缩模块104用于,利用预设的深度学习图像压缩框架对待压缩图像进行压缩,得到压缩数据,其中,压缩数据用于通过预设的深度学习图像解压缩框架进行解压缩得到还原图像,还原图像用于基于目标策略的反向策略进行预处理的反向处理得到与原始图像对应的重建图像。The compression module 104 is configured to compress the image to be compressed using a preset deep learning image compression framework to obtain compressed data, where the compressed data is used to decompress the preset deep learning image decompression framework to obtain a restored image, and restore the image Reverse processing for preprocessing based on the reverse strategy of the target strategy obtains the reconstructed image corresponding to the original image.
在一个实施例中,目标策略包括第一指令和与第一指令对应的第一参数;In one embodiment, the target strategy includes a first instruction and a first parameter corresponding to the first instruction;
预处理模块103具体用于,按照第一指令和第一参数,对原始图像进行预处理,得到待压缩图像。The preprocessing module 103 is specifically configured to preprocess the original image according to the first instruction and the first parameter to obtain the image to be compressed.
可选地,第一指令包括全局缩放指令,第一参数包括全局缩放系数和缩放核;Optionally, the first instruction includes a global zoom instruction, and the first parameter includes a global zoom factor and a zoom kernel;
预处理模块103执行按照第一指令和第一参数,对原始图像进行预处理,得到待压缩图像的方式,可以包括:按照全局缩放指令、全局缩放系数和缩放核,对原始图像进行全局缩放,得到待压缩图像。The preprocessing module 103 executes the preprocessing of the original image according to the first instruction and the first parameter to obtain the image to be compressed, which may include: global scaling of the original image according to the global scaling instruction, the global scaling factor and the scaling kernel, Get the image to be compressed.
可选地,第一指令包括自适应缩放指令,第一参数包括分块参数;Optionally, the first instruction includes an adaptive scaling instruction, and the first parameter includes a block parameter;
预处理模块103执行按照第一指令和第一参数,对原始图像进行预处理,得到待压缩图像的方式,可以包括:按照分块参数对原始图像进行划分,得到多个图像块;按照自适应缩放指令和每个图像块的图像特征,对每个图像块均进行自适应缩放,得到每个图像块对应的待压缩图像块,其中,待压缩图像包括多个待压缩图像块,图像特征用于确定图像块的缩放系数。The preprocessing module 103 executes the preprocessing of the original image according to the first instruction and the first parameter to obtain the image to be compressed, which may include: dividing the original image according to the block parameters to obtain multiple image blocks; The zoom instruction and the image feature of each image block are adaptively scaled for each image block to obtain the image block to be compressed corresponding to each image block. The image to be compressed includes multiple image blocks to be compressed, and the image feature is used for To determine the zoom factor of the image block.
可选地,第一指令包括模糊处理指令,第一参数包括模糊核;Optionally, the first instruction includes a fuzzy processing instruction, and the first parameter includes a fuzzy kernel;
预处理模块103执行按照第一指令和第一参数,对原始图像进行预处理,得到待压缩图像的方式,可以包括:按照模糊处理指令和模糊核,对原始图像进行模糊处理,得到待压缩图像。The preprocessing module 103 performs preprocessing on the original image according to the first instruction and the first parameter to obtain the image to be compressed, which may include: performing blur processing on the original image according to the blur processing instruction and blur kernel to obtain the image to be compressed .
可选地,第一指令包括图像退化指令,第一参数包括图像退化参数;Optionally, the first instruction includes an image degradation instruction, and the first parameter includes an image degradation parameter;
预处理模块103执行按照第一指令和第一参数,对原始图像进行预处理,得到待压缩图像的方式,可以包括:按照图像退化指令和图像退化参数,对原始图像进行图像退化,得到待压缩图像。The pre-processing module 103 performs pre-processing on the original image according to the first instruction and the first parameter to obtain the image to be compressed, which may include: performing image degradation on the original image according to the image degradation instruction and image degradation parameters to obtain the image to be compressed. image.
可选地,第一指令包括图像分离指令和第一后阶段处理指令,第一参数包括与图像分离指令对应的图像分离参数和与第一后阶段处理指令对应的第一后阶段处理参数;Optionally, the first instruction includes an image separation instruction and a first post-processing instruction, and the first parameter includes an image separation parameter corresponding to the image separation instruction and a first post-processing parameter corresponding to the first post-processing instruction;
预处理模块103执行按照第一指令和第一参数,对原始图像进行预处理,得到待压缩图像的方式,可以包括:按照图像分离指令和图像分离参数,对原始图像进行图像分离,得到边缘图像和纹理图像;按照第一后阶段处理指令和第一后阶段处理参数,对边缘图像和纹理图像均进行全局缩放、自适应缩放、模糊处理以及图像退化中的至少一种,得到待压缩边缘图像和待压缩纹理图像,其中,待压缩图像包括待压缩边缘图像和待压缩纹理图像。The preprocessing module 103 performs preprocessing on the original image according to the first instruction and the first parameter to obtain the image to be compressed, which may include: performing image separation on the original image according to the image separation instruction and image separation parameters to obtain the edge image And texture images; according to the first post-processing instructions and first post-processing parameters, perform at least one of global scaling, adaptive scaling, blur processing, and image degradation on both the edge image and the texture image to obtain the edge image to be compressed And the texture image to be compressed, where the image to be compressed includes the edge image to be compressed and the texture image to be compressed.
可选地,第一指令包括图像分割指令和第二后阶段处理指令,第一参数包括与图像分割指令对应的分割类别和与第二后阶段处理指令对应的第二后阶段处理参数;Optionally, the first instruction includes an image segmentation instruction and a second post-processing instruction, and the first parameter includes a segmentation category corresponding to the image segmentation instruction and a second post-processing parameter corresponding to the second post-processing instruction;
预处理模块103执行按照第一指令和第一参数,对原始图像进行预处理,得到待压缩图像的方式,可以包括:按照图像分割指令和分割类别,对原始图像进行图像分割,得到多个图像区域;按照第二后阶段处理指令和第二后阶段处理参数,对多个图像区域均进行全局缩放、自适应缩放、模糊处理以及图像退化中的至少一种,得到每个图像区域对应的待压缩图像区域,其中,待压缩图像包括多个待压缩图像区域。The preprocessing module 103 executes preprocessing of the original image according to the first instruction and the first parameter to obtain the image to be compressed, which may include: image segmentation of the original image according to the image segmentation instruction and segmentation category to obtain multiple images Area; according to the second post-processing instruction and the second post-processing parameters, at least one of global scaling, adaptive scaling, blur processing, and image degradation is performed on multiple image regions, to obtain the corresponding to each image region A compressed image area, where the image to be compressed includes a plurality of image areas to be compressed.
在一个实施例中,深度学习图像压缩框架包括第一深度神经网络、量化模型和熵编码模型;In one embodiment, the deep learning image compression framework includes a first deep neural network, a quantization model, and an entropy coding model;
压缩模块104具体用于,利用第一深度神经网络对待压缩图像进行特征提取,得到图像特征;利用量化模型对图像特征进行量化,得到压缩特征;利用熵编码模型对压缩特征进行熵编码,得到压缩数据。The compression module 104 is specifically configured to use the first deep neural network to perform feature extraction on the compressed image to obtain the image feature; use the quantization model to quantize the image feature to obtain the compressed feature; use the entropy coding model to entropy encode the compressed feature to obtain the compression data.
请参照图25,图25为本申请实施例提供的图像处理装置200的组成示意图。该图像处理装置200应用于解码端,例如可以是具有解码功能的电子设备。图像处理装置200包括序列获得模块201、解压缩模块202、反向策略获得模块203及后处理模块204。Please refer to FIG. 25. FIG. 25 is a schematic diagram of the composition of an image processing apparatus 200 according to an embodiment of the application. The image processing apparatus 200 is applied to a decoding end, and may be, for example, an electronic device with a decoding function. The image processing device 200 includes a sequence obtaining module 201, a decompression module 202, a reverse strategy obtaining module 203, and a post-processing module 204.
序列获得模块201,用于获得压缩数据,其中,压缩数据为利用预设的深度学习 图像压缩框架对待压缩图像进行压缩得到,待压缩图像为按照目标策略对原始图像进行预处理得到,目标策略是响应对原始图像的操作从多个预设策略中确定出的,至少两个预设策略对应的压缩数据的码率不同。The sequence obtaining module 201 is used to obtain compressed data, where the compressed data is obtained by compressing the image to be compressed using a preset deep learning image compression framework, and the image to be compressed is obtained by preprocessing the original image according to the target strategy. The target strategy is It is determined from a plurality of preset strategies in response to the operation on the original image, that the code rates of the compressed data corresponding to at least two preset strategies are different.
解压缩模块202,用于利用预设的深度学习图像解压缩框架对压缩数据进行解压缩,得到还原图像。The decompression module 202 is configured to decompress the compressed data using a preset deep learning image decompression framework to obtain a restored image.
反向策略获得模块203,用于获得目标策略对应的反向策略。The reverse strategy obtaining module 203 is used to obtain the reverse strategy corresponding to the target strategy.
后处理模块204,用于按照反向策略对还原图像进行预处理的反向处理,得到与原始图像对应的重建图像。The post-processing module 204 is configured to perform reverse processing of preprocessing the restored image according to the reverse strategy to obtain a reconstructed image corresponding to the original image.
在一个实施例中,深度学习图像解压缩框架包括第二深度神经网络、反量化模型和熵解码模型;In one embodiment, the deep learning image decompression framework includes a second deep neural network, an inverse quantization model, and an entropy decoding model;
解压缩模块202具体用于:利用熵解码模型对压缩数据进行熵解码,得到压缩特征;利用反量化模型对压缩特征进行反量化,得到图像特征;利用第二深度神经网络对图像特征进行还原,得到还原图像。The decompression module 202 is specifically configured to: use the entropy decoding model to entropy decode the compressed data to obtain compressed features; use the inverse quantization model to dequantize the compressed features to obtain image features; use the second deep neural network to restore the image features, Get the restored image.
在一个实施例中,反向策略获得模块203具体用于:获得目标策略,目标策略包括第一指令和与第一指令对应的第一参数;依据第一指令及预设的指令对应关系确定第二指令;依据第一参数及预设的参数计算规则确定第二参数,其中,反向策略包括第二指令和与第二指令对应的第二参数。In one embodiment, the reverse strategy obtaining module 203 is specifically configured to: obtain a target strategy, the target strategy including a first instruction and a first parameter corresponding to the first instruction; Two instructions; the second parameter is determined according to the first parameter and the preset parameter calculation rule, wherein the reverse strategy includes the second instruction and the second parameter corresponding to the second instruction.
在一个实施例中,后处理模块204具体用于:按照第二指令和第二参数,对还原图像进行预处理的反向处理,得到与原始图像对应的重建图像。In one embodiment, the post-processing module 204 is specifically configured to perform reverse processing of pre-processing on the restored image according to the second instruction and the second parameter to obtain a reconstructed image corresponding to the original image.
可选地,第一指令包括全局缩放指令,第一参数包括全局缩放系数和缩放核;第二指令包括全局缩放指令,第二参数包括全局缩放系数的倒数和缩放核;Optionally, the first instruction includes a global zoom instruction, the first parameter includes a global zoom factor and a zoom core; the second instruction includes a global zoom instruction, and the second parameter includes the reciprocal of the global zoom factor and the zoom core;
后处理模块204执行按照第二指令和第二参数,对还原图像进行预处理的反向处理,得到与原始图像对应的重建图像的方式,包括:按照全局缩放指令、全局缩放系数的倒数和缩放核,对还原图像进行全局缩放,得到重建图像。The post-processing module 204 executes the reverse processing of preprocessing the restored image according to the second instruction and the second parameter to obtain the reconstructed image corresponding to the original image, including: following the global scaling instruction, the inverse of the global scaling factor, and scaling Core, global zoom the restored image to obtain the reconstructed image.
可选地,第一指令包括自适应缩放指令,第一参数包括分块参数;第二指令包括自适应缩放指令,第二参数包括分块参数关联的拼接参数;还原图像包括多个还原图像块;Optionally, the first instruction includes an adaptive scaling instruction, the first parameter includes a block parameter; the second instruction includes an adaptive scaling instruction, and the second parameter includes a splicing parameter associated with the block parameter; the restored image includes a plurality of restored image blocks ;
后处理模块204执行按照第二指令和第二参数,对还原图像进行预处理的反向处理,得到与原始图像对应的重建图像的方式,包括:按照自适应缩放指令和每个还原图像块的图像特征,对每个还原图像块均进行自适应缩放,得到每个还原图像块对应的待重建图像块,其中,图像特征用于确定还原图像块的缩放系数;按照拼接参数对多个待重建图像块进行拼接,得到重建图像。The post-processing module 204 executes the reverse process of preprocessing the restored image according to the second instruction and the second parameter to obtain the reconstructed image corresponding to the original image, including: following the adaptive scaling instruction and each restored image block Image feature, each restored image block is adaptively scaled to obtain the image block to be reconstructed corresponding to each restored image block, where the image feature is used to determine the scaling factor of the restored image block; multiple to be reconstructed according to the stitching parameters The image blocks are stitched together to obtain a reconstructed image.
可选地,第一指令包括模糊处理指令,第一参数包括模糊核;第二指令包括去模糊处理指令,第二参数包括模糊核对应的去模糊核;Optionally, the first instruction includes a fuzzy processing instruction, and the first parameter includes a fuzzy kernel; the second instruction includes a deblurring processing instruction, and the second parameter includes a deblurring kernel corresponding to the fuzzy kernel;
后处理模块204执行按照第二指令和第二参数,对还原图像进行预处理的反向处理,得到与原始图像对应的重建图像的方式,包括:按照去模糊处理指令和去模糊核,对还原图像进行去模糊处理,得到重建图像。The post-processing module 204 executes the reverse process of preprocessing the restored image according to the second instruction and the second parameter to obtain the reconstructed image corresponding to the original image, including: according to the deblurring processing instruction and the deblurring kernel, the restoration The image is deblurred to obtain a reconstructed image.
可选地,第一指令包括图像退化指令,第一参数包括图像退化参数;第二指令包括图像增强指令,第二参数包括图像增强参数;Optionally, the first instruction includes an image degradation instruction, and the first parameter includes an image degradation parameter; the second instruction includes an image enhancement instruction, and the second parameter includes an image enhancement parameter;
后处理模块204执行按照第二指令和第二参数,对还原图像进行预处理的反向处理,得到与原始图像对应的重建图像的方式,包括:按照图像增强指令和图像增强参数,对还原图像进行图像增强,得到重建图像。The post-processing module 204 performs the reverse processing of preprocessing the restored image according to the second instruction and the second parameter to obtain the reconstructed image corresponding to the original image, including: according to the image enhancement instruction and the image enhancement parameter, the restored image Perform image enhancement to obtain a reconstructed image.
可选地,第一指令包括图像分离指令和第一后阶段处理指令,第一参数包括与图像分离指令对应的图像分离参数和与第一后阶段处理指令对应的第一后阶段处理参数;Optionally, the first instruction includes an image separation instruction and a first post-processing instruction, and the first parameter includes an image separation parameter corresponding to the image separation instruction and a first post-processing parameter corresponding to the first post-processing instruction;
第二指令包括图像分离指令的反向指令和第一后阶段处理指令的反向指令,第二参数包括与图像分离指令的反向指令对应的图像分离参数的反向参数和与第一后阶段处理指令的反向指令对应的第一后阶段处理参数的反向参数;还原图像包括还原边缘图像和还原纹理图像;The second instruction includes the reverse instruction of the image separation instruction and the reverse instruction of the first post-stage processing instruction, and the second parameter includes the reverse parameter of the image separation parameter corresponding to the reverse instruction of the image separation instruction and the reverse instruction of the first post-stage The inverse instruction of the processing instruction corresponds to the inverse parameter of the first post-stage processing parameter; restoring the image includes restoring the edge image and restoring the texture image;
后处理模块204执行按照第二指令和第二参数,对还原图像进行预处理的反向处理,得到与原始图像对应的重建图像的方式,包括:按照第一后阶段处理指令的反向指令和第一后阶段处理参数的反向参数,对还原边缘图像和还原纹理图像均进行全局缩放的反向处理、自适应缩放的反向处理、去模糊处理以及图像增强中的至少一种,得到待重建边缘图像和待重建纹理图像;按照图像分离指令的反向指令和图像分离参数的反向参数,对待重建边缘图像和待重建纹理图像进行图像融合,得到重建图像。The post-processing module 204 executes the reverse processing of preprocessing the restored image according to the second instruction and the second parameter to obtain the reconstructed image corresponding to the original image, including: the reverse instruction and the reverse instruction according to the first post-processing instruction The inverse parameter of the first post-processing parameter is to perform at least one of global scaling inverse processing, adaptive scaling inverse processing, deblurring processing, and image enhancement on both the restored edge image and the restored texture image to obtain the The edge image and the texture image to be reconstructed are reconstructed; according to the reverse instruction of the image separation instruction and the reverse parameter of the image separation parameter, the edge image to be reconstructed and the texture image to be reconstructed are image fused to obtain the reconstructed image.
可选地,第一指令包括图像分割指令和第二后阶段处理指令,第一参数包括与图像分割指令对应的分割类别和与第二后阶段处理指令对应的第二后阶段处理参数;Optionally, the first instruction includes an image segmentation instruction and a second post-processing instruction, and the first parameter includes a segmentation category corresponding to the image segmentation instruction and a second post-processing parameter corresponding to the second post-processing instruction;
第二指令包括图像分割指令的反向指令和第二后阶段处理指令的反向指令,第二参数包括与第二后阶段处理指令的反向指令对应的第二后阶段处理参数的反向参数;还原图像包括多个还原图像区域及每个还原图像区域的位置坐标;The second instruction includes the reverse instruction of the image segmentation instruction and the reverse instruction of the second post-processing instruction, and the second parameter includes the reverse parameter of the second post-processing parameter corresponding to the reverse instruction of the second post-processing instruction ; The restored image includes multiple restored image areas and the position coordinates of each restored image area;
后处理模块204执行按照第二指令和第二参数,对还原图像进行预处理的反向处理,得到与原始图像对应的重建图像的方式,包括:按照第二后阶段处理指令的反向指令和第二后阶段处理参数的反向参数,对每个还原图像区域均进行全局缩放的反向处理、自适应缩放的反向处理、去模糊处理以及图像增强中的至少一种,得到每个还原图像区域对应的待重建图像区域;按照图像分割指令的反向指令和每个还原图像区域的位置坐标,对多个待重建图像区域进行拼接,得到所述重建图像。The post-processing module 204 executes the reverse processing of preprocessing the restored image according to the second instruction and the second parameter to obtain the reconstructed image corresponding to the original image, including: the reverse instruction and the reverse instruction according to the second post-processing instruction The second post-processing parameter is the inverse parameter, and each restored image area is subjected to at least one of the inverse processing of global scaling, the inverse processing of adaptive scaling, the deblurring processing, and the image enhancement to obtain each restored image area. The image area to be reconstructed corresponding to the image area; according to the reverse instruction of the image segmentation instruction and the position coordinates of each restored image area, a plurality of image areas to be reconstructed are spliced to obtain the reconstructed image.
在一个实施例中,后处理模块204还用于,利用超分辨率算法、去模糊算法、去雾算法以及去噪算法中的至少一种对重建图像进行处理,以改善重建图像的视觉效果。In an embodiment, the post-processing module 204 is further configured to process the reconstructed image using at least one of a super-resolution algorithm, a deblurring algorithm, a dehazing algorithm, and a denoising algorithm to improve the visual effect of the reconstructed image.
请参照图26,图26为本申请实施例提供的图像处理装置300的组成示意图。该图像处理装置300应用于编解码端,例如可以是具有编码和解码功能的电子设备。图像处理装置300包括图像获取模块301、响应模块302、预处理模块303、压缩模块304、解压缩模块305、反向策略获得模块306及后处理模块307。Please refer to FIG. 26. FIG. 26 is a schematic diagram of the composition of an image processing apparatus 300 according to an embodiment of the application. The image processing device 300 is applied to the encoding and decoding end, and may be, for example, an electronic device with encoding and decoding functions. The image processing device 300 includes an image acquisition module 301, a response module 302, a preprocessing module 303, a compression module 304, a decompression module 305, a reverse strategy acquisition module 306, and a post-processing module 307.
图像获取模块301用于,获取原始图像。The image acquisition module 301 is used to acquire the original image.
响应模块302用于,响应对原始图像的操作,从多个预设策略中确定出目标策略,其中,至少两个预设策略对应的压缩数据的码率不同。The response module 302 is configured to determine a target strategy from a plurality of preset strategies in response to an operation on the original image, wherein the code rates of the compressed data corresponding to at least two preset strategies are different.
预处理模块303用于,按照目标策略,对原始图像进行预处理,得到待压缩图像。The preprocessing module 303 is used to preprocess the original image according to the target strategy to obtain the image to be compressed.
压缩模块304用于,利用预设的深度学习图像压缩框架对待压缩图像进行压缩,得到压缩数据。The compression module 304 is configured to compress the image to be compressed using a preset deep learning image compression framework to obtain compressed data.
解压缩模块305用于,利用预设的深度学习图像解压缩框架对压缩数据进行解压缩,得到还原图像。The decompression module 305 is configured to decompress the compressed data using a preset deep learning image decompression framework to obtain a restored image.
反向策略获得模块306用于,获得目标策略对应的反向策略。The reverse strategy obtaining module 306 is used to obtain the reverse strategy corresponding to the target strategy.
后处理模块307用于,按照反向策略对还原图像进行预处理的反向处理,得到与原始图像对应的重建图像。The post-processing module 307 is configured to perform reverse processing of preprocessing the restored image according to the reverse strategy to obtain a reconstructed image corresponding to the original image.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的图像处理装置100、200、300的工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of the description, the working process of the image processing apparatus 100, 200, 300 described above can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
请参照图27,图27为本申请实施例提供的电子设备10的组成示意图,电子设备10可以是终端、服务器等,电子设备10包括处理器11、存储器12及总线13,处理器11通过总线13与存储器12连接。Please refer to FIG. 27, which is a schematic diagram of the composition of an electronic device 10 provided by an embodiment of the application. The electronic device 10 may be a terminal, a server, etc. The electronic device 10 includes a processor 11, a memory 12, and a bus 13. The processor 11 passes through the bus. 13 is connected to the memory 12.
存储器12用于存储程序,例如图24所示的图像处理装置100,图像处理装置100包括至少一个可以软件或固件(firmware)的形式存储存储器12中或固化在电子设备10的操作系统(operating system,OS)中的软件功能模块,处理器11在接收到执行指令后,执行所述程序以实现上述实施例揭示的应用于编码端的图像处理方法。The memory 12 is used to store programs. For example, the image processing device 100 shown in FIG. 24 includes at least one operating system that can be stored in the memory 12 in the form of software or firmware or solidified in the electronic device 10 , The software function module in the OS). After receiving the execution instruction, the processor 11 executes the program to implement the image processing method applied to the encoding end disclosed in the foregoing embodiment.
存储器12可能包括高速随机存取存储器(Random Access Memory,RAM),也可能还包括非易失存储器(non-volatile memory,NVM)。The memory 12 may include a high-speed random access memory (Random Access Memory, RAM), and may also include a non-volatile memory (NVM).
处理器11可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器11中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器11可以是通用处理器,包括中央处理器(Central Processing Unit,简称CPU)、微控制单元(Microcontroller Unit,MCU)、复杂可编程逻辑器件(Complex Programmable Logic Device,CPLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、嵌入式ARM等芯片。The processor 11 may be an integrated circuit chip with signal processing capabilities. In the implementation process, the steps of the above method can be completed by an integrated logic circuit of hardware in the processor 11 or instructions in the form of software. The aforementioned processor 11 may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a microcontroller unit (Microcontroller Unit, MCU), a complex programmable logic device (Complex Programmable Logic Device, CPLD), and an on-site programmable logic device (CPLD). Programmable gate array (Field-Programmable Gate Array, FPGA), embedded ARM and other chips.
本申请实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现上述实施例揭示的图像处理方法。The embodiments of the present application also provide a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the image processing method disclosed in the above-mentioned embodiments is implemented.
本申请实施例中还提供一种计算机程序产品,包括指令,当其在计算机上运行时,使得计算机执行上述实施例揭示的图像处理方法。The embodiments of the present application also provide a computer program product, including instructions, which when run on a computer, cause the computer to execute the image processing method disclosed in the above embodiments.
本申请实施例提供了一种芯片系统,该芯片系统包括处理器,还可以包括存储器,用于实现上述实施例揭示的图像处理方法。该芯片系统可以由芯片构成,也可以包含芯片和其他分立器件。The embodiments of the present application provide a chip system. The chip system includes a processor and may also include a memory for implementing the image processing method disclosed in the foregoing embodiments. The chip system can be composed of chips, or it can include chips and other discrete devices.
虽然本申请披露如上,但本申请并非限定于此。任何本领域技术人员,在不脱离本申请的精神和范围内,均可作各种更动与修改,因此本申请的保护范围应当以权利要求所限定的范围为准。Although this application is disclosed as above, this application is not limited to this. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of this application. Therefore, the protection scope of this application shall be subject to the scope defined by the claims.

Claims (26)

  1. 一种图像处理方法,其特征在于,所述图像处理方法包括:An image processing method, characterized in that the image processing method includes:
    获取原始图像;Get the original image;
    响应对原始图像的操作,从多个预设策略中确定出目标策略,其中,至少两个所述预设策略对应的压缩数据的码率不同;In response to the operation on the original image, a target strategy is determined from a plurality of preset strategies, wherein at least two of the preset strategies have different code rates for the compressed data;
    按照所述目标策略,对所述原始图像进行预处理,得到待压缩图像;Preprocessing the original image according to the target strategy to obtain the image to be compressed;
    利用预设的深度学习图像压缩框架对所述待压缩图像进行压缩,得到所述压缩数据,其中,所述压缩数据用于通过预设的深度学习图像解压缩框架进行解压缩得到还原图像,所述还原图像用于基于所述目标策略的反向策略进行所述预处理的反向处理得到与所述原始图像对应的重建图像。Use a preset deep learning image compression framework to compress the image to be compressed to obtain the compressed data, wherein the compressed data is used to decompress the preset deep learning image decompression framework to obtain a restored image, so The restored image is used to perform reverse processing of the pre-processing based on the reverse strategy of the target strategy to obtain a reconstructed image corresponding to the original image.
  2. 根据权利要求1所述的图像处理方法,其特征在于,所述目标策略包括第一指令和与所述第一指令对应的第一参数;The image processing method according to claim 1, wherein the target strategy comprises a first instruction and a first parameter corresponding to the first instruction;
    所述按照所述目标策略,对所述原始图像进行预处理,得到待压缩图像的步骤,包括:The step of preprocessing the original image according to the target strategy to obtain the image to be compressed includes:
    按照所述第一指令和所述第一参数,对所述原始图像进行预处理,得到所述待压缩图像。According to the first instruction and the first parameter, the original image is preprocessed to obtain the image to be compressed.
  3. 根据权利要求2所述的图像处理方法,其特征在于,所述第一指令包括全局缩放指令,所述第一参数包括全局缩放系数和缩放核;The image processing method according to claim 2, wherein the first instruction includes a global zoom instruction, and the first parameter includes a global zoom factor and a zoom kernel;
    所述按照所述第一指令和所述第一参数,对所述原始图像进行预处理,得到所述待压缩图像的步骤,包括:The step of preprocessing the original image according to the first instruction and the first parameter to obtain the image to be compressed includes:
    按照所述全局缩放指令、全局缩放系数和缩放核,对所述原始图像进行全局缩放,得到所述待压缩图像。According to the global zoom instruction, the global zoom factor and the zoom kernel, the original image is globally zoomed to obtain the image to be compressed.
  4. 根据权利要求2所述的图像处理方法,其特征在于,所述第一指令包括自适应缩放指令,所述第一参数包括分块参数;The image processing method according to claim 2, wherein the first instruction includes an adaptive scaling instruction, and the first parameter includes a block parameter;
    所述按照所述第一指令和所述第一参数,对所述原始图像进行预处理,得到所述待压缩图像的步骤,包括:The step of preprocessing the original image according to the first instruction and the first parameter to obtain the image to be compressed includes:
    按照所述分块参数对所述原始图像进行划分,得到多个图像块;Divide the original image according to the block parameters to obtain multiple image blocks;
    按照所述自适应缩放指令和每个所述图像块的图像特征,对每个所述图像块均进行自适应缩放,得到每个所述图像块对应的待压缩图像块,其中,所述待压缩图像包括多个待压缩图像块,所述图像特征用于确定所述图像块的缩放系数。According to the adaptive scaling instruction and the image characteristics of each image block, each image block is adaptively scaled to obtain the image block to be compressed corresponding to each image block, wherein the to-be-compressed image block is obtained. The compressed image includes a plurality of image blocks to be compressed, and the image feature is used to determine the scaling factor of the image block.
  5. 根据权利要求2所述的图像处理方法,其特征在于,所述第一指令包括模糊处理指令,所述第一参数包括模糊核;The image processing method according to claim 2, wherein the first instruction includes a blur processing instruction, and the first parameter includes a blur kernel;
    所述按照所述第一指令和所述第一参数,对所述原始图像进行预处理,得到所述待压缩图像的步骤,包括:The step of preprocessing the original image according to the first instruction and the first parameter to obtain the image to be compressed includes:
    按照所述模糊处理指令和所述模糊核,对所述原始图像进行模糊处理,得到所述待压缩图像。According to the blur processing instruction and the blur kernel, the original image is subjected to blur processing to obtain the image to be compressed.
  6. 根据权利要求2所述的图像处理方法,其特征在于,所述第一指令包括图像退化指令,所述第一参数包括图像退化参数;The image processing method according to claim 2, wherein the first instruction includes an image degradation instruction, and the first parameter includes an image degradation parameter;
    所述按照所述第一指令和所述第一参数,对所述原始图像进行预处理,得到所述 待压缩图像的步骤,包括:The step of preprocessing the original image according to the first instruction and the first parameter to obtain the image to be compressed includes:
    按照所述图像退化指令和所述图像退化参数,对所述原始图像进行图像退化,得到所述待压缩图像。Perform image degradation on the original image according to the image degradation instruction and the image degradation parameter to obtain the image to be compressed.
  7. 根据权利要求2所述的图像处理方法,其特征在于,所述第一指令包括图像分离指令和第一后阶段处理指令,所述第一参数包括与所述图像分离指令对应的图像分离参数和与所述第一后阶段处理指令对应的第一后阶段处理参数;The image processing method according to claim 2, wherein the first instruction includes an image separation instruction and a first post-processing instruction, and the first parameter includes an image separation parameter and an image separation parameter corresponding to the image separation instruction. A first post-stage processing parameter corresponding to the first post-stage processing instruction;
    所述按照所述第一指令和所述第一参数,对所述原始图像进行预处理,得到所述待压缩图像的步骤,包括:The step of preprocessing the original image according to the first instruction and the first parameter to obtain the image to be compressed includes:
    按照所述图像分离指令和所述图像分离参数,对所述原始图像进行图像分离,得到边缘图像和纹理图像;Performing image separation on the original image according to the image separation instruction and the image separation parameter to obtain an edge image and a texture image;
    按照所述第一后阶段处理指令和所述第一后阶段处理参数,对所述边缘图像和所述纹理图像均进行全局缩放、自适应缩放、模糊处理以及图像退化中的至少一种,得到待压缩边缘图像和待压缩纹理图像,其中,所述待压缩图像包括所述待压缩边缘图像和所述待压缩纹理图像。According to the first post-processing instruction and the first post-processing parameter, at least one of global scaling, adaptive scaling, blur processing, and image degradation is performed on the edge image and the texture image to obtain The edge image to be compressed and the texture image to be compressed, wherein the image to be compressed includes the edge image to be compressed and the texture image to be compressed.
  8. 根据权利要求2所述的图像处理方法,其特征在于,所述第一指令包括图像分割指令和第二后阶段处理指令,所述第一参数包括与所述图像分割指令对应的分割类别和与所述第二后阶段处理指令对应的第二后阶段处理参数;The image processing method according to claim 2, wherein the first instruction includes an image segmentation instruction and a second post-processing instruction, and the first parameter includes a segmentation category corresponding to the image segmentation instruction and The second post-stage processing parameter corresponding to the second post-stage processing instruction;
    所述按照所述第一指令和所述第一参数,对所述原始图像进行预处理,得到所述待压缩图像的步骤,包括:The step of preprocessing the original image according to the first instruction and the first parameter to obtain the image to be compressed includes:
    按照所述图像分割指令和所述分割类别,对所述原始图像进行图像分割,得到多个图像区域;Performing image segmentation on the original image according to the image segmentation instruction and the segmentation category to obtain multiple image regions;
    按照所述第二后阶段处理指令和所述第二后阶段处理参数,对所述多个图像区域均进行全局缩放、自适应缩放、模糊处理以及图像退化中的至少一种,得到每个所述图像区域对应的待压缩图像区域,其中,所述待压缩图像包括多个待压缩图像区域。According to the second post-processing instruction and the second post-processing parameter, at least one of global scaling, adaptive scaling, blur processing, and image degradation is performed on the multiple image regions to obtain each The image area to be compressed corresponds to the image area, wherein the image to be compressed includes a plurality of image areas to be compressed.
  9. 根据权利要求1-8任一项所述的图像处理方法,其特征在于,所述深度学习图像压缩框架包括第一深度神经网络、量化模型和熵编码模型;The image processing method according to any one of claims 1-8, wherein the deep learning image compression framework includes a first deep neural network, a quantization model, and an entropy coding model;
    所述利用预设的深度学习图像压缩框架对所述待压缩图像进行压缩,得到压缩数据的步骤,包括:The step of compressing the image to be compressed using a preset deep learning image compression framework to obtain compressed data includes:
    利用所述第一深度神经网络对所述待压缩图像进行特征提取,得到图像特征;Performing feature extraction on the image to be compressed by using the first deep neural network to obtain image features;
    利用所述量化模型对所述图像特征进行量化,得到压缩特征;Quantify the image features by using the quantization model to obtain compressed features;
    利用所述熵编码模型对所述压缩特征进行熵编码,得到所述压缩数据。Entropy coding the compression feature by using the entropy coding model to obtain the compressed data.
  10. 一种图像处理方法,其特征在于,所述图像处理方法包括:An image processing method, characterized in that the image processing method includes:
    获得压缩数据,其中,所述压缩数据为利用预设的深度学习图像压缩框架对待压缩图像进行压缩得到,所述待压缩图像为按照目标策略对原始图像进行预处理得到,所述目标策略是响应对所述原始图像的操作从多个预设策略中确定出的,至少两个所述预设策略对应的所述压缩数据的码率不同;Obtain compressed data, wherein the compressed data is obtained by compressing an image to be compressed using a preset deep learning image compression framework, and the image to be compressed is obtained by preprocessing the original image according to a target strategy, and the target strategy is response The operation on the original image is determined from a plurality of preset strategies, and the code rates of the compressed data corresponding to at least two of the preset strategies are different;
    利用预设的深度学习图像解压缩框架对所述压缩数据进行解压缩,得到还原图像;Decompress the compressed data using a preset deep learning image decompression framework to obtain a restored image;
    获得所述目标策略对应的反向策略;Obtain the reverse strategy corresponding to the target strategy;
    按照所述反向策略对所述还原图像进行所述预处理的反向处理,得到与所述原始 图像对应的重建图像。Perform the reverse processing of the pre-processing on the restored image according to the reverse strategy to obtain a reconstructed image corresponding to the original image.
  11. 根据权利要求10所述的图像处理方法,其特征在于,所述获得所述目标策略对应的反向策略的步骤,包括:The image processing method according to claim 10, wherein the step of obtaining the reverse strategy corresponding to the target strategy comprises:
    获得所述目标策略,所述目标策略包括第一指令和与所述第一指令对应的第一参数;Obtaining the target strategy, where the target strategy includes a first instruction and a first parameter corresponding to the first instruction;
    依据所述第一指令及预设的指令对应关系确定第二指令;Determining the second instruction according to the corresponding relationship between the first instruction and the preset instruction;
    依据所述第一参数及预设的参数计算规则确定第二参数,其中,所述反向策略包括所述第二指令和与所述第二指令对应的所述第二参数。The second parameter is determined according to the first parameter and a preset parameter calculation rule, wherein the reverse strategy includes the second instruction and the second parameter corresponding to the second instruction.
  12. 根据权利要求11所述的图像处理方法,其特征在于,所述按照所述反向策略对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像的步骤,包括:11. The image processing method according to claim 11, wherein the step of performing reverse processing of the pre-processing on the restored image according to the reverse strategy to obtain a reconstructed image corresponding to the original image ,include:
    按照所述第二指令和所述第二参数,对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像。According to the second instruction and the second parameter, the reverse processing of the pre-processing is performed on the restored image to obtain a reconstructed image corresponding to the original image.
  13. 根据权利要求12所述的图像处理方法,其特征在于,所述第一指令包括全局缩放指令,所述第一参数包括全局缩放系数和缩放核;所述第二指令包括全局缩放指令,所述第二参数包括全局缩放系数的倒数和缩放核;The image processing method according to claim 12, wherein the first instruction includes a global zoom instruction, the first parameter includes a global zoom factor and a zoom kernel; the second instruction includes a global zoom instruction, the The second parameter includes the reciprocal of the global zoom factor and the zoom kernel;
    所述按照所述第二指令和所述第二参数,对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像的步骤,包括:The step of performing the reverse processing of the pre-processing on the restored image according to the second instruction and the second parameter to obtain a reconstructed image corresponding to the original image includes:
    按照所述全局缩放指令、全局缩放系数的倒数和缩放核,对所述还原图像进行全局缩放,得到所述重建图像。According to the global zoom instruction, the reciprocal of the global zoom coefficient, and the zoom kernel, the restored image is globally zoomed to obtain the reconstructed image.
  14. 根据权利要求12所述的图像处理方法,其特征在于,所述第一指令包括自适应缩放指令,所述第一参数包括分块参数;所述第二指令包括自适应缩放指令,所述第二参数包括所述分块参数关联的拼接参数;所述还原图像包括多个还原图像块;The image processing method according to claim 12, wherein the first instruction includes an adaptive scaling instruction, the first parameter includes a block parameter; the second instruction includes an adaptive scaling instruction, and the second instruction includes an adaptive scaling instruction. The second parameter includes the splicing parameter associated with the block parameter; the restored image includes a plurality of restored image blocks;
    所述按照所述第二指令和所述第二参数,对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像的步骤,包括:The step of performing the reverse processing of the pre-processing on the restored image according to the second instruction and the second parameter to obtain a reconstructed image corresponding to the original image includes:
    按照所述自适应缩放指令和每个所述还原图像块的图像特征,对每个所述还原图像块均进行自适应缩放,得到每个所述还原图像块对应的待重建图像块,其中,所述图像特征用于确定所述还原图像块的缩放系数;According to the adaptive scaling instruction and the image characteristics of each restored image block, each restored image block is adaptively scaled to obtain a to-be-reconstructed image block corresponding to each restored image block, wherein, The image feature is used to determine the scaling factor of the restored image block;
    按照所述拼接参数对多个待重建图像块进行拼接,得到所述重建图像。The multiple image blocks to be reconstructed are spliced according to the splicing parameters to obtain the reconstructed image.
  15. 根据权利要求12所述的图像处理方法,其特征在于,所述第一指令包括模糊处理指令,所述第一参数包括模糊核;所述第二指令包括去模糊处理指令,所述第二参数包括所述模糊核对应的去模糊核;The image processing method according to claim 12, wherein the first instruction includes a blur processing instruction, the first parameter includes a blur kernel; the second instruction includes a deblur processing instruction, and the second parameter Including a deblurring kernel corresponding to the blurring kernel;
    所述按照所述第二指令和所述第二参数,对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像的步骤,包括:The step of performing the reverse processing of the pre-processing on the restored image according to the second instruction and the second parameter to obtain a reconstructed image corresponding to the original image includes:
    按照所述去模糊处理指令和所述去模糊核,对所述还原图像进行去模糊处理,得到所述重建图像。According to the deblurring processing instruction and the deblurring kernel, deblurring the restored image is performed to obtain the reconstructed image.
  16. 根据权利要求12所述的图像处理方法,其特征在于,所述第一指令包括图像退化指令,所述第一参数包括图像退化参数;所述第二指令包括图像增强指令,所述第二参数包括图像增强参数;The image processing method according to claim 12, wherein the first instruction includes an image degradation instruction, the first parameter includes an image degradation parameter; the second instruction includes an image enhancement instruction, and the second parameter Including image enhancement parameters;
    所述按照所述第二指令和所述第二参数,对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像的步骤,包括:The step of performing the reverse processing of the pre-processing on the restored image according to the second instruction and the second parameter to obtain a reconstructed image corresponding to the original image includes:
    按照所述图像增强指令和所述图像增强参数,对所述还原图像进行所述图像增强,得到所述重建图像。According to the image enhancement instruction and the image enhancement parameter, the image enhancement is performed on the restored image to obtain the reconstructed image.
  17. 根据权利要求12所述的图像处理方法,其特征在于,所述第一指令包括图像分离指令和第一后阶段处理指令,所述第一参数包括与所述图像分离指令对应的图像分离参数和与所述第一后阶段处理指令对应的第一后阶段处理参数;The image processing method according to claim 12, wherein the first instruction includes an image separation instruction and a first post-processing instruction, and the first parameter includes an image separation parameter and an image separation parameter corresponding to the image separation instruction. A first post-stage processing parameter corresponding to the first post-stage processing instruction;
    所述第二指令包括所述图像分离指令的反向指令和所述第一后阶段处理指令的反向指令,所述第二参数包括与所述图像分离指令的反向指令对应的所述图像分离参数的反向参数和与所述第一后阶段处理指令的反向指令对应的所述第一后阶段处理参数的反向参数;The second instruction includes a reverse instruction of the image separation instruction and a reverse instruction of the first post-processing instruction, and the second parameter includes the image corresponding to the reverse instruction of the image separation instruction The reverse parameter of the separation parameter and the reverse parameter of the first post-processing parameter corresponding to the reverse instruction of the first post-processing instruction;
    所述还原图像包括还原边缘图像和还原纹理图像;The restored image includes a restored edge image and a restored texture image;
    所述按照所述第二指令和所述第二参数,对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像的步骤,包括:The step of performing the reverse processing of the pre-processing on the restored image according to the second instruction and the second parameter to obtain a reconstructed image corresponding to the original image includes:
    按照所述第一后阶段处理指令的反向指令和所述第一后阶段处理参数的反向参数,对所述还原边缘图像和所述还原纹理图像均进行全局缩放的反向处理、自适应缩放的反向处理、去模糊处理以及图像增强中的至少一种,得到待重建边缘图像和待重建纹理图像;According to the reverse instruction of the first post-stage processing instruction and the reverse parameter of the first post-stage processing parameter, both the restored edge image and the restored texture image are subjected to the reverse processing of global scaling and adaptive At least one of reverse processing of scaling, deblurring processing, and image enhancement to obtain an edge image to be reconstructed and a texture image to be reconstructed;
    按照所述图像分离指令的反向指令和所述图像分离参数的反向参数,对所述待重建边缘图像和所述待重建纹理图像进行图像融合,得到所述重建图像。According to the reverse instruction of the image separation instruction and the reverse parameter of the image separation parameter, image fusion is performed on the edge image to be reconstructed and the texture image to be reconstructed to obtain the reconstructed image.
  18. 根据权利要求12所述的图像处理方法,其特征在于,所述第一指令包括图像分割指令和第二后阶段处理指令,所述第一参数包括与所述图像分割指令对应的分割类别和与所述第二后阶段处理指令对应的第二后阶段处理参数;The image processing method according to claim 12, wherein the first instruction includes an image segmentation instruction and a second post-processing instruction, and the first parameter includes a segmentation category corresponding to the image segmentation instruction and The second post-stage processing parameter corresponding to the second post-stage processing instruction;
    所述第二指令包括所述图像分割指令的反向指令和所述第二后阶段处理指令的反向指令,所述第二参数包括与所述第二后阶段处理指令的反向指令对应的所述第二后阶段处理参数的反向参数;The second instruction includes a reverse instruction of the image segmentation instruction and a reverse instruction of the second post-processing instruction, and the second parameter includes a reverse instruction corresponding to the second post-processing instruction The reverse parameter of the second post-stage processing parameter;
    所述还原图像包括多个还原图像区域及每个所述还原图像区域的位置坐标;The restored image includes a plurality of restored image areas and the position coordinates of each restored image area;
    所述按照所述第二指令和所述第二参数,对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像的步骤,包括:The step of performing the reverse processing of the pre-processing on the restored image according to the second instruction and the second parameter to obtain a reconstructed image corresponding to the original image includes:
    按照所述第二后阶段处理指令的反向指令和所述第二后阶段处理参数的反向参数,对每个所述还原图像区域均进行全局缩放的反向处理、自适应缩放的反向处理、去模糊处理以及图像增强中的至少一种,得到每个所述还原图像区域对应的待重建图像区域;According to the reverse instruction of the second post-processing instruction and the reverse parameter of the second post-processing parameter, the reverse processing of global scaling and the reverse of adaptive scaling are performed on each of the restored image regions. At least one of processing, deblurring, and image enhancement, to obtain an image area to be reconstructed corresponding to each restored image area;
    按照所述图像分割指令的反向指令和每个所述还原图像区域的位置坐标,对多个待重建图像区域进行拼接,得到所述重建图像。According to the reverse instruction of the image segmentation instruction and the position coordinates of each restored image area, a plurality of image areas to be reconstructed are spliced to obtain the reconstructed image.
  19. 根据权利要求10-18任一项所述的图像处理方法,其特征在于,所述深度学习图像解压缩框架包括第二深度神经网络、反量化模型和熵解码模型;The image processing method according to any one of claims 10-18, wherein the deep learning image decompression framework includes a second deep neural network, an inverse quantization model, and an entropy decoding model;
    所述利用预设的深度学习图像解压缩框架对所述压缩数据进行解压缩,得到还原图像的步骤,包括:The step of decompressing the compressed data using a preset deep learning image decompression framework to obtain a restored image includes:
    利用所述熵解码模型对所述压缩数据进行熵解码,得到压缩特征;Entropy decoding the compressed data using the entropy decoding model to obtain compression features;
    利用所述反量化模型对所述压缩特征进行反量化,得到图像特征;Using the inverse quantization model to perform inverse quantization on the compressed features to obtain image features;
    利用所述第二深度神经网络对所述图像特征进行还原,得到所述还原图像。The second deep neural network is used to restore the image features to obtain the restored image.
  20. 根据权利要求10-18任一项所述的图像处理方法,其特征在于,所述图像处理方法还包括:The image processing method according to any one of claims 10-18, wherein the image processing method further comprises:
    利用超分辨率算法、去模糊算法、去雾算法以及去噪算法中的至少一种对所述重建图像进行处理,以改善所述重建图像的视觉效果。At least one of a super-resolution algorithm, a de-blurring algorithm, a de-hazing algorithm, and a de-noising algorithm is used to process the reconstructed image to improve the visual effect of the reconstructed image.
  21. 一种图像处理方法,其特征在于,所述图像处理方法包括:An image processing method, characterized in that the image processing method includes:
    获取原始图像;Get the original image;
    响应对原始图像的操作,从多个预设策略中确定出目标策略,其中,至少两个所述预设策略对应的压缩数据的码率不同;In response to the operation on the original image, a target strategy is determined from a plurality of preset strategies, wherein at least two of the preset strategies have different code rates for the compressed data;
    按照所述目标策略,对所述原始图像进行预处理,得到待压缩图像;Preprocessing the original image according to the target strategy to obtain the image to be compressed;
    利用预设的深度学习图像压缩框架对所述待压缩图像进行压缩,得到所述压缩数据;Compress the image to be compressed by using a preset deep learning image compression framework to obtain the compressed data;
    利用预设的深度学习图像解压缩框架对所述压缩数据进行解压缩,得到还原图像;Decompress the compressed data using a preset deep learning image decompression framework to obtain a restored image;
    获得所述目标策略对应的反向策略;Obtain the reverse strategy corresponding to the target strategy;
    按照反向策略对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像。Perform the reverse processing of the pre-processing on the restored image according to the reverse strategy to obtain a reconstructed image corresponding to the original image.
  22. 一种图像处理装置,其特征在于,所述图像处理装置包括:An image processing device, characterized in that the image processing device includes:
    图像获取模块,用于获取原始图像;The image acquisition module is used to acquire the original image;
    响应模块,用于响应对原始图像的操作,从多个预设策略中确定出目标策略,其中,至少两个所述预设策略对应的压缩数据的码率不同;The response module is configured to determine a target strategy from a plurality of preset strategies in response to an operation on the original image, wherein at least two of the preset strategies have different code rates for the compressed data;
    预处理模块,用于按照预设策略,对所述原始图像进行预处理,得到待压缩图像;The preprocessing module is used to preprocess the original image according to a preset strategy to obtain the image to be compressed;
    压缩模块,用于利用预设的深度学习图像压缩框架对所述待压缩图像进行压缩,得到所述压缩数据,其中,所述压缩数据用于通过预设的深度学习图像解压缩框架进行解压缩得到还原图像,所述还原图像用于基于所述预设策略的反向策略进行所述预处理的反向处理得到与所述原始图像对应的重建图像。The compression module is used to compress the image to be compressed using a preset deep learning image compression framework to obtain the compressed data, wherein the compressed data is used to decompress the preset deep learning image decompression framework A restored image is obtained, and the restored image is used to perform reverse processing of the pre-processing based on the reverse strategy of the preset strategy to obtain a reconstructed image corresponding to the original image.
  23. 一种图像处理装置,其特征在于,所述图像处理装置包括:An image processing device, characterized in that the image processing device includes:
    序列获得模块,用于获得压缩数据,其中,所述压缩数据为利用预设的深度学习图像压缩框架对待压缩图像进行压缩得到,所述待压缩图像为按照目标策略对原始图像进行预处理得到,所述目标策略是响应对所述原始图像的操作从多个预设策略中确定出的,至少两个所述预设策略对应的所述压缩数据的码率不同;A sequence obtaining module for obtaining compressed data, wherein the compressed data is obtained by compressing an image to be compressed using a preset deep learning image compression framework, and the image to be compressed is obtained by preprocessing the original image according to the target strategy, The target strategy is determined from a plurality of preset strategies in response to an operation on the original image, and the code rates of the compressed data corresponding to at least two of the preset strategies are different;
    解压缩模块,用于利用预设的深度学习图像解压缩框架对所述压缩数据进行解压缩,得到还原图像;The decompression module is used to decompress the compressed data using a preset deep learning image decompression framework to obtain a restored image;
    反向策略获得模块,用于获得所述目标策略对应的反向策略;The reverse strategy obtaining module is used to obtain the reverse strategy corresponding to the target strategy;
    后处理模块,用于按照所述反向策略对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像。The post-processing module is configured to perform the pre-processing reverse processing on the restored image according to the reverse strategy to obtain a reconstructed image corresponding to the original image.
  24. 一种图像处理装置,其特征在于,所述图像处理装置包括:An image processing device, characterized in that the image processing device includes:
    图像获取模块,用于获取原始图像;The image acquisition module is used to acquire the original image;
    响应模块,用于响应对原始图像的操作,从多个预设策略中确定出目标策略,其中,至少两个所述预设策略对应的压缩数据的码率不同;The response module is configured to determine a target strategy from a plurality of preset strategies in response to an operation on the original image, wherein at least two of the preset strategies have different code rates for the compressed data;
    预处理模块,用于按照预设策略,对所述原始图像进行预处理,得到待压缩图像;The preprocessing module is used to preprocess the original image according to a preset strategy to obtain the image to be compressed;
    压缩模块,用于利用预设的深度学习图像压缩框架对所述待压缩图像进行压缩,得到所述压缩数据;A compression module, configured to compress the image to be compressed using a preset deep learning image compression framework to obtain the compressed data;
    解压缩模块,利用预设的深度学习图像解压缩框架对所述压缩数据进行解压缩,得到还原图像;The decompression module uses a preset deep learning image decompression framework to decompress the compressed data to obtain a restored image;
    反向策略获得模块,用于获得所述目标策略对应的反向策略;The reverse strategy obtaining module is used to obtain the reverse strategy corresponding to the target strategy;
    后处理模块,用于按照所述反向策略对所述还原图像进行所述预处理的反向处理,得到与所述原始图像对应的重建图像。The post-processing module is configured to perform the pre-processing reverse processing on the restored image according to the reverse strategy to obtain a reconstructed image corresponding to the original image.
  25. 一种电子设备,其特征在于,所述电子设备包括:An electronic device, characterized in that, the electronic device includes:
    一个或多个处理器;One or more processors;
    存储器,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行时,使得所述一个或多个处理器实现如权利要求1-9任一项所述的图像处理方法,或者,如权利要求10-20任一项所述的图像处理方法,或者,如权利要求21所述的图像处理方法。The memory is used to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors realize any one of claims 1-9 The image processing method, or the image processing method according to any one of claims 10-20, or the image processing method according to claim 21.
  26. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该计算机程序被处理器执行时实现如权利要求1-9任一项所述的图像处理方法,或者,如权利要求10-20任一项所述的图像处理方法,或者,如权利要求21所述的图像处理方法。A computer-readable storage medium with a computer program stored thereon, wherein the computer program implements the image processing method according to any one of claims 1-9 when executed by a processor, or, as claimed in claim 10. The image processing method according to any one of -20, or the image processing method according to claim 21.
PCT/CN2020/128207 2020-02-26 2020-11-11 Image processing method and apparatus, and electronic device and storage medium WO2021169408A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010120792.1A CN113313774A (en) 2020-02-26 2020-02-26 Image processing method, image processing device, electronic equipment and storage medium
CN202010120792.1 2020-02-26

Publications (1)

Publication Number Publication Date
WO2021169408A1 true WO2021169408A1 (en) 2021-09-02

Family

ID=77370010

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/128207 WO2021169408A1 (en) 2020-02-26 2020-11-11 Image processing method and apparatus, and electronic device and storage medium

Country Status (2)

Country Link
CN (1) CN113313774A (en)
WO (1) WO2021169408A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116916034A (en) * 2022-07-21 2023-10-20 澳门大学 SAFD-based image processing method, SAFD-based image processing device, SAFD-based image processing equipment and storage medium
CN116916034B (en) * 2022-07-21 2024-05-10 澳门大学 SAFD-based image processing method, SAFD-based image processing device, SAFD-based image processing equipment and storage medium

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114627143A (en) * 2021-10-12 2022-06-14 深圳宏芯宇电子股份有限公司 Image processing method and device, terminal equipment and readable storage medium
CN114245141B (en) * 2021-11-30 2022-07-15 慧之安信息技术股份有限公司 Video code stream compression method and device based on deep learning
CN113962867B (en) * 2021-12-22 2022-03-15 深圳思谋信息科技有限公司 Image processing method, image processing device, computer equipment and storage medium
TWI812003B (en) * 2022-02-10 2023-08-11 宏正自動科技股份有限公司 Method and system for previewing the image
CN114866782A (en) * 2022-03-21 2022-08-05 上海工程技术大学 Video image processing method based on depth dimension-variable code rate control
WO2024008147A1 (en) * 2022-07-07 2024-01-11 Douyin Vision (Beijing) Co., Ltd. System and method for learned image compression with pre-processing

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6798914B1 (en) * 1999-05-07 2004-09-28 Galaxy Ip Source, Llc Neural-network-based method of image compression
CN109495741A (en) * 2018-11-29 2019-03-19 四川大学 Method for compressing image based on adaptive down-sampling and deep learning
CN110321769A (en) * 2019-03-25 2019-10-11 浙江工业大学 A kind of more size commodity on shelf detection methods
CN110730347A (en) * 2019-04-24 2020-01-24 合肥图鸭信息科技有限公司 Image compression method and device and electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6798914B1 (en) * 1999-05-07 2004-09-28 Galaxy Ip Source, Llc Neural-network-based method of image compression
CN109495741A (en) * 2018-11-29 2019-03-19 四川大学 Method for compressing image based on adaptive down-sampling and deep learning
CN110321769A (en) * 2019-03-25 2019-10-11 浙江工业大学 A kind of more size commodity on shelf detection methods
CN110730347A (en) * 2019-04-24 2020-01-24 合肥图鸭信息科技有限公司 Image compression method and device and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116916034A (en) * 2022-07-21 2023-10-20 澳门大学 SAFD-based image processing method, SAFD-based image processing device, SAFD-based image processing equipment and storage medium
CN116916034B (en) * 2022-07-21 2024-05-10 澳门大学 SAFD-based image processing method, SAFD-based image processing device, SAFD-based image processing equipment and storage medium

Also Published As

Publication number Publication date
CN113313774A (en) 2021-08-27

Similar Documents

Publication Publication Date Title
WO2021169408A1 (en) Image processing method and apparatus, and electronic device and storage medium
Li et al. Learning convolutional networks for content-weighted image compression
Cheng et al. Deep convolutional autoencoder-based lossy image compression
Zhou et al. Variational autoencoder for low bit-rate image compression
Galteri et al. Deep generative adversarial compression artifact removal
Li et al. Learning content-weighted deep image compression
Zhang et al. Compression artifact reduction by overlapped-block transform coefficient estimation with block similarity
Liu et al. Data-driven soft decoding of compressed images in dual transform-pixel domain
CN108737823B (en) Image coding method and device and decoding method and device based on super-resolution technology
WO2020237646A1 (en) Image processing method and device, and computer-readable storage medium
Zhao et al. Learning a virtual codec based on deep convolutional neural network to compress image
EP2145476B1 (en) Image compression and decompression using the pixon method
Zhang et al. Ultra high fidelity deep image decompression with l∞-constrained compression
Strümpler et al. Learning to improve image compression without changing the standard decoder
Guleryuz et al. Sandwiched Image Compression: Increasing the resolution and dynamic range of standard codecs
Jiang et al. Multi-modality deep network for extreme learned image compression
Fu et al. Learned image compression with generalized octave convolution and cross-resolution parameter estimation
Kirmemis et al. Learned compression artifact removal by deep residual networks
Najgebauer et al. Fully convolutional network for removing dct artefacts from images
Duan et al. Efficient feature compression for edge-cloud systems
Shu et al. A study on quantization effects of dct based compression
Miklós et al. Analysis and improvement of JPEG compression performance using custom quantization and block boundary
Li et al. A dual-residual network for JPEG compression artifacts reduction
Aqqa et al. CAR-DCGAN: A Deep Convolutional Generative Adversarial Network for Compression Artifact Removal in Video Surveillance Systems.
Marsh et al. Removal of Blocking Artifacts from JPEG-Compressed Images Using a Neural Network

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20921216

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20921216

Country of ref document: EP

Kind code of ref document: A1