Image compression model training method and device, image compression method and device
By inputting sample images, target code rate parameters and fully connected parameters into the image compression model, calculating the loss value and training, it solves the multi-stage training and image quality problems in the existing technology, and achieves image compression that simplifies training and improves robustness. Effect.
Patent Information
- Application Number
- CN202010784856.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-06
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2040-08-06
AI Technical Summary
Existing deep learning-based variable code rate image compression models require multiple training stages, resulting in complex operations, long training time, overfitting and reduced image quality, and are not suitable for terminal devices with small storage capacity.
By obtaining the sample image, target code rate parameters and target full connection parameters, input them into the image compression model, calculate the loss value and train the model until the stopping condition is reached, simplifying the training process and achieving multi-code rate control.
It saves training time, improves the robustness of model training, is suitable for terminal devices with small storage capacity, and improves image compression quality.
Smart Images

Figure CN114071164B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a training method for an image compression model. The present invention also relates to two training methods for image compression models, three training devices for image compression models, three image compression methods and devices, a computing device, and a computer-readable storage medium. Background Art
[0002] In the image compression scheme based on deep learning, image compression is achieved by controlling the bit rate. A corresponding model is required for each bit rate control. If 100 bit rate controls are to be implemented, 100 models are required. For terminal devices with small storage capacity, too many models have no practical application value. Therefore, a variable bit rate deep learning model has emerged to compress images.
[0003] The currently implemented variable bit rate deep learning model performs image compression by inputting the model and target bit rate into the image compression model. However, this variable bit rate based deep learning model requires two training stages: coarse multi-bit rate training and fine multi-bit rate training. The operation is complex and the training time is long. Long training time will cause overfitting, reduce the robustness of the training, and the quality of the compressed image will decrease.
[0004] Therefore, a simpler and more convenient way to compress images is needed. Summary of the invention
[0005] In view of this, the embodiments of this specification provide a method for training an image compression model. This specification also relates to a training device for an image compression model, three image compression methods and devices, a computing device, and a computer-readable storage medium to solve the technical defects existing in the prior art.
[0006] According to a first aspect of an embodiment of this specification, a method for training an image compression model is provided, comprising:
[0007] Obtain sample images, target bitrate parameters, and target full connection parameters;
[0008] Inputting the sample image, the target bit rate parameter and the target full connection parameter into the image compression model to be trained to obtain a target image corresponding to the sample image;
[0009] Calculate a loss value according to the sample image and the target image;
[0010] The image compression model is trained according to the loss value until a training stop condition is reached.
[0011] According to a second aspect of an embodiment of this specification, a method for training an image compression model is provided, comprising:
[0012] Based on the user's model training request, display an image input interface for the user;
[0013] Receiving a sample image, a target bit rate parameter, and a target full connection parameter input by the user based on the image input interface;
[0014] Inputting the sample image, the target bit rate parameter and the target full connection parameter into the image compression model to be trained to obtain a target image corresponding to the sample image;
[0015] Calculate a loss value according to the sample image and the target image;
[0016] The image compression model is trained according to the loss value until a training stop condition is reached.
[0017] According to a third aspect of an embodiment of this specification, a method for training an image compression model is provided, comprising:
[0018] Receive a model training request sent by a user, wherein the model training request carries a sample image, a target bitrate parameter, and a target full connection parameter;
[0019] Inputting the sample image, the target bit rate parameter and the target full connection parameter into the image compression model to be trained to obtain a target image corresponding to the sample image;
[0020] Calculate a loss value according to the sample image and the target image;
[0021] The image compression model is trained according to the loss value until a training stop condition is reached.
[0022] According to a fourth aspect of the embodiments of this specification, there is provided an image compression method, including:
[0023] Acquire an image to be compressed and an image compression requirement of the image to be compressed;
[0024] Determine a target bit rate parameter and a target full connection parameter according to the image compression requirement;
[0025] The image to be compressed, the target bit rate parameter and the target full connection parameter are input into an image compression model to obtain a compressed image corresponding to the image to be compressed.
[0026] According to a fifth aspect of the embodiments of this specification, there is provided an image compression method, including:
[0027] Displaying an image input interface to the user based on a call request from the user;
[0028] Receiving the image to be compressed input by the user based on the image input interface and the image compression requirement of the image to be compressed;
[0029] Determine a target bit rate parameter and a target full connection parameter according to the image compression requirement;
[0030] The image to be compressed, the target bit rate parameter and the target full connection parameter are input into an image compression model to obtain a compressed image corresponding to the image to be compressed.
[0031] According to a sixth aspect of the embodiments of this specification, there is provided an image compression method, comprising:
[0032] Receiving a call request sent by a user, wherein the call request carries a picture to be compressed and a picture compression requirement of the picture to be compressed;
[0033] Determine a target bit rate parameter and a target full connection parameter according to the image compression requirement;
[0034] The image to be compressed, the target bit rate parameter and the target full connection parameter are input into an image compression model to obtain a compressed image corresponding to the image to be compressed.
[0035] According to a seventh aspect of the embodiments of this specification, there is provided a training device for an image compression model, comprising:
[0036] An acquisition module, configured to acquire a sample image, a target bitrate parameter, and a target full connection parameter;
[0037] An input module, configured to input the sample image, the target bit rate parameter and the target full connection parameter into the image compression model to be trained, to obtain a target image corresponding to the sample image;
[0038] A calculation module, configured to calculate a loss value according to the sample image and the target image;
[0039] A training module is configured to train the image compression model according to the loss value until a training stop condition is reached.
[0040] According to an eighth aspect of the embodiments of this specification, a training device for an image compression model is provided, comprising:
[0041] An interface display module, configured to display an image input interface to the user based on the user's model training request;
[0042] A receiving module, configured to receive a sample image, a target bit rate parameter, and a target full connection parameter input by the user based on the image input interface;
[0043] An input module, configured to input the sample image, the target bit rate parameter and the target full connection parameter into the image compression model to be trained, to obtain a target image corresponding to the sample image;
[0044] A calculation module, configured to calculate a loss value according to the sample image and the target image;
[0045] A training module is configured to train the image compression model according to the loss value until a training stop condition is reached.
[0046] According to a ninth aspect of the embodiments of this specification, a training device for an image compression model is provided, comprising:
[0047] A request receiving module is configured to receive a model training request sent by a user, wherein the model training request carries a sample image, a target bitrate parameter, and a target full connection parameter;
[0048] An input module, configured to input the sample image, the target bit rate parameter and the target full connection parameter into the image compression model to be trained, to obtain a target image corresponding to the sample image;
[0049] A calculation module, configured to calculate a loss value according to the sample image and the target image;
[0050] A training module is configured to train the image compression model according to the loss value until a training stop condition is reached.
[0051] According to a tenth aspect of the embodiments of this specification, there is provided an image compression device, including:
[0052] An acquisition module is configured to acquire an image to be compressed and an image compression requirement of the image to be compressed;
[0053] A determination module, configured to determine a target bit rate parameter and a target full connection parameter according to the image compression requirement;
[0054] The compression module is configured to input the image to be compressed, the target bit rate parameter and the target full connection parameter into an image compression model to obtain a compressed image corresponding to the image to be compressed.
[0055] According to an eleventh aspect of the embodiments of this specification, there is provided an image compression device, including:
[0056] An interface display module, configured to display an image input interface to the user based on a user's call request;
[0057] A receiving module, configured to receive the image to be compressed input by the user based on the image input interface and the image compression requirement of the image to be compressed;
[0058] A determination module, configured to determine a target bit rate parameter and a target full connection parameter according to the image compression requirement;
[0059] The compression module is configured to input the image to be compressed, the target bit rate parameter and the target full connection parameter into an image compression model to obtain a compressed image corresponding to the image to be compressed.
[0060] According to a twelfth aspect of the embodiments of this specification, there is provided an image compression device, including:
[0061] A request receiving module is configured to receive a call request sent by a user, wherein the call request carries a picture to be compressed and a picture compression requirement of the picture to be compressed;
[0062] A determination module, configured to determine a target bit rate parameter and a target full connection parameter according to the image compression requirement;
[0063] The compression module is configured to input the image to be compressed, the target bit rate parameter and the target full connection parameter into an image compression model to obtain a compressed image corresponding to the image to be compressed.
[0064] According to a thirteenth aspect of the embodiments of this specification, a computing device is provided, including:
[0065] Memory and processor;
[0066] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, wherein the processor implements the training method of the image compression model or the steps of the image compression method when executing the computer-executable instructions.
[0067] According to the fourteenth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the training method of any of the image compression models or the steps of the image compression method are implemented.
[0068] The training method of the image compression model provided in this specification includes obtaining a sample image, a target bit rate parameter and a target full connection parameter; inputting the sample image, the target bit rate parameter and the target full connection parameter into the image compression model to be trained to obtain a target image corresponding to the sample image; calculating a loss value according to the sample image and the target image; training the image compression model according to the loss value until a training stop condition is reached. The training method of the image compression model trains the image compression model through the target bit rate parameter and the target full connection parameter, thereby saving training time and improving the robustness of the algorithm training. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1 It is a specific example diagram of an image compression method applied to sending pictures by a communication tool provided in an embodiment of this specification;
[0070] Figure 2 is a flowchart of a first image compression model training method provided in an embodiment of this specification;
[0071] Figure 3 is a structural diagram of an image compression model provided in an embodiment of this specification;
[0072] Figure 4 It is a flowchart of encoding a sample image in a training method of an image compression model provided in an embodiment of this specification;
[0073] Figure 5 is a structural diagram of an interpolation variable bit rate control subunit in an image compression model provided in an embodiment of this specification;
[0074] Figure 6 It is a flowchart of decoding an image feature vector in a training method of an image compression model provided in an embodiment of this specification;
[0075] Figure 7 is a flow chart of a first image compression method provided in an embodiment of this specification;
[0076] Figure 8 is a flow chart of a second image compression method provided in an embodiment of this specification;
[0077] Fig. 9 is a flow chart of a third image compression method provided in an embodiment of this specification;
[0078] Fig.10 It is a structural schematic diagram of a training device for a first image compression model provided in an embodiment of this specification;
[0079] Fig.11 is a structural schematic diagram of a first image compression device provided by an embodiment of this specification;
[0080] Fig.12 is a structural schematic diagram of a second image compression device provided in an embodiment of this specification;
[0081] Fig.13 is a structural schematic diagram of a third image compression device provided in an embodiment of this specification;
[0082] Fig.14 is a flow chart of a second image compression model training method provided in an embodiment of this specification;
[0083] Fig.15 is a flowchart of a third image compression model training method provided in an embodiment of this specification;
[0084] Fig.16 It is a structural schematic diagram of a training device for a second image compression model provided in an embodiment of this specification;
[0085] Fig.17 It is a structural schematic diagram of a training device for a third image compression model provided in an embodiment of this specification;
[0086] Fig.18 It is a structural block diagram of a computing device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0087] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0088] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0089] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0090] First, the terms involved in one or more embodiments of this specification are explained.
[0091] Bit rate: corresponds to the compression rate in the image compression algorithm, but is the opposite of the compression rate. The higher the bit rate, the lower the compression rate, the larger the compressed image file, the higher the image quality, and the more similar it is to the original image. The lower the bit rate, the higher the compression rate, the smaller the compressed image file, the lower the image quality, and the less similar it is to the original image.
[0092] Image quality: measures the similarity to the original image. Common image quality metrics include peak signal-to-noise ratio (PSNR) and multi-level structural similarity (MS-SSIM).
[0093] In this specification, a training method for an image compression model is provided. This specification also relates to a training device for an image compression model, three image compression methods and devices, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.
[0094] In real life, images are often compressed, such as sending pictures through communication tools, uploading pictures with a size not exceeding 50k according to the requirements of the website, inserting pictures into documents, etc. The multi-rate picture model in the prior art receives the picture to be compressed and the target bit rate, and compresses the picture to be compressed according to the target bit rate. Correspondingly, during the training process of the multi-rate picture model, if a multi-rate image compression model with N bit rates is trained, it is necessary to perform corresponding model training for each bit rate separately, which is complicated to operate and takes a long time to train. Based on this, one or more embodiments of the present specification provide a training method and an image compression method for an image compression model to solve the above-mentioned technical problems. The training method and image compression method of the image compression model provided in the present specification are applicable to any scenario where there is a need to compress images, and the present specification does not limit the application scenario in any way.
[0095] For ease of understanding, an image compression method is described in detail below using an example of an image compression method used in a communication tool to send pictures.
[0096] See also Figure 1 , Figure 1A specific example diagram of an image compression method applied to sending pictures by a communication tool provided by an embodiment of the present specification is shown.
[0097] Figure 1 The application scenario includes terminal 102 and terminal 104. Terminal 102 sends a photo to terminal 104. The size of the photo is 2M. In order to improve the transmission rate and save traffic, the photo needs to be compressed. The photo is the picture to be compressed. After clicking send in terminal 102, the corresponding picture compression requirement is determined according to the current picture sending scenario, and the corresponding target bit rate parameter and target full connection parameter are determined according to the picture compression requirement. The picture to be compressed, the target bit rate parameter and the target full connection parameter are input into a pre-trained image compression model for image compression processing to obtain the corresponding compressed picture. The size of the compressed picture is 950K, and then the compressed picture is sent to terminal 104. At this time, terminal 104 receives the compressed picture with a capacity of 950K.
[0098] The image compression method provided in the embodiments of the present specification determines the target bit rate parameter and the target full connection parameter according to the image compression requirements, and then inputs the image to be compressed, the target bit rate parameter and the target full connection parameter into the image compression model for image compression processing. The bit rate can be finely controlled according to the target bit rate parameter and the target full connection parameter, so that the image compression model can achieve fine bit rate change control, obtain a more refined compressed image, and improve the quality of the compressed image.
[0099] See also Figure 2 , Figure 2 A flowchart of a first image compression model training method provided according to an embodiment of this specification is shown, which specifically includes the following steps:
[0100] Step 202: Obtain a sample image, a target bitrate parameter, and a target full connection parameter.
[0101] Specifically, in practical applications, a sample image is obtained from a preset sample image set; a target bit rate parameter is obtained from a preset bit rate parameter set; and a target full connection parameter is obtained from a preset initial full connection parameter set.
[0102] The sample image is an image compressed during the image compression model training process, and the sample image is obtained from a preset sample image set.
[0103] The target rate parameter is a position parameter of the rate in the rate control interval. For example, if there are N rates in the image compression model, and the rate is represented by λ, then the rate list λ_list corresponding to the image compression model is (λ1, λ2, ... λN), and the value range of the target rate parameter i is an integer in [0, N-2]. That is, when the target rate parameter i is 0, it corresponds to λ1 in the rate list; when the target rate parameter i is 1, it corresponds to λ2 in the rate list, and so on. [0, N-2] is the preset rate parameter set.
[0104] The target fully connected parameter is identified by a. In this specification, the target fully connected parameter is a parameter for determining the interpolation bit rate. By adjusting the value of a, an association is generated between two adjacent bit rates, so that during the model training process, the model training between the two adjacent bit rates is no longer completely independent. The target fully connected parameter is selected from the initial fully connected parameter set. The value range of the initial fully connected parameter set is [0, 1]. In order to save training time in the training stage of the model, the values in the fully connected set parameter set can be set to fixed values according to actual conditions. For example, the initial fully connected parameter set is set to a set of three numbers (0, 0.5, 1), or it can be set to a set of four numbers (0, 0.3, 0.6, 1). There is no restriction on this in this specification.
[0105] In one embodiment provided in this specification, the model training method provided in this specification is further explained by taking obtaining a sample image x, a target bit rate parameter i, and a target full connection parameter a as an example.
[0106] Step 204: Input the sample image, the target bit rate parameter and the target full connection parameter into the image compression model to be trained to obtain a target image corresponding to the sample image.
[0107] See also Figure 3 , Figure 3 The schematic diagram of the structure of the image compression model of the embodiment of the present specification is shown. The image compression model is a multi-rate image compression model, including an encoder and a decoder, the encoder includes a plurality of sequentially connected encoding convolutional layers, each encoding convolutional layer includes a convolution subunit and an interpolation variable rate control subunit, the decoder includes a plurality of sequentially connected decoding convolutional layers, each decoding convolutional layer includes a convolution subunit and an interpolation variable rate control subunit, Figure 3 The figure shows a schematic diagram of the encoding convolution layer and the decoding convolution layer. In practical applications, each encoding convolution layer core and each decoding convolution layer have the same structure.
[0108] Inputting the sample image, the target bit rate parameter and the target full connection parameter into the image compression model for image compression processing to obtain a target image corresponding to the sample image, including:
[0109] Determine a target bit rate according to the target bit rate parameter and the target full connection parameter;
[0110] Inputting the sample image and the target bit rate into the encoder to obtain an image feature vector corresponding to the sample image;
[0111] The image feature vector and the target bit rate are input into the decoder to obtain a target image corresponding to the sample image.
[0112] In practical applications, when there are N bit rates in the bit rate list, an N*N unit matrix index is constructed. After determining the target bit rate parameter i and the target full connection parameter a, the corresponding target bit rate λ can be determined. The target bit rate λ is the interpolated variable bit rate corresponding to the target bit rate parameter i and the target full connection parameter a. The target bit rate is multiplied by the convolution result in each interpolation variable bit rate control subunit to obtain the corresponding interpolation result. The specific calculation formula of the target bit rate λ is shown in the following formula (1):
[0113] λ=a*(λ_list[i])+(1-a)*(λ_list[i+1]) (1)
[0114] Among them, λ is the target bitrate, a is the target full connection parameter, i is the target bitrate parameter, and λ_list[i] and λ_list[i+1] are two adjacent bitrates in the model's bitrate set.
[0115] In a specific implementation provided in this specification, taking i=3 and a=0.5 as an example, λ=0.5*λ4+0.5*λ5.
[0116] In another specific implementation manner provided in this specification, taking i=5 and a=0 as an example, λ=λ7.
[0117] In another specific implementation manner provided in this specification, taking i=0, a=1 as an example, λ=λ1.
[0118] After determining the target bit rate λ according to the target bit rate parameter i and the target full connection parameter a, the sample image and the target bit rate are input into the encoder to obtain an image feature vector corresponding to the sample image.
[0119] In one embodiment provided in the present specification, following the above example, a sample image x, a target bit rate parameter i and a target full connection parameter a are obtained and input into the image compression model to be trained, and a target bit rate λ is determined according to the target bit rate parameter i and the target full connection parameter a.
[0120] Specifically, the encoder includes n sequentially connected encoding convolutional layers, where n>1;
[0121] See also Figure 4 , Figure 4 A flowchart for encoding a sample image provided by an embodiment of this specification is shown, including steps 402 to 410.
[0122] Step 402: Input the sample image and the target bit rate into a first coding convolution layer to obtain a first image feature output by the first coding convolution layer.
[0123] Specifically, the sample image and the target bit rate are input into the first coding convolution layer for coding processing. It is assumed that the size of the sample image is H*W, where H is the height of the sample image and W is the width of the sample image. In practical applications, image features are usually represented in four dimensions (batch, h, w, channel), where batch is the number of images, h is the height of the image, w is the width of the image, and channel is the number of channels.
[0124] The sample image is convolutionally downsampled to extract the image features of the sample image. In the process of extracting the image features of the sample image through convolutional downsampling, the feature size will gradually decrease. For example, the original size is 1024*128, which will become 512*64 after one downsampling, 256*32 after the second downsampling, and 128*16 after the third downsampling.
[0125] According to the image feature of the sample image and the target bit rate, the first image feature of the first encoding convolutional layer output is obtained, see Figure 5 , Figure 5 The structure diagram of the interpolation variable bit rate control subunit provided in the embodiment of this specification is shown as follows: Figure 5 As shown in the figure, the target bit rate λ can be determined according to the target bit rate parameter i and the target full connection parameter a. The parameters entering the full connection (FCN) are associated with different bit rates. N is the number of bit rates in the bit rate list, CH is the number of channels, and N*CH refers to the number of parameters to be learned in the FCN fully connected layer. The output of the fully connected layer is processed by the Softplus activation function and multiplied with the image feature output by the convolution subunit to obtain the first image feature output by the first encoding convolution layer.
[0126] In one embodiment provided in this specification, following the above example, the sample image x and the target bit rate λ are input into the first coding convolution layer to obtain the first image feature M1 output by the first coding convolution layer.
[0127] Step 404: input the t-1th image feature output by the t-1th coding convolution layer and the target bit rate into the tth coding convolution layer to obtain the tth image feature output by the tth coding convolution layer, where 2≤t≤n.
[0128] In practical applications, t starts to take values from 2, that is, starting from the second coding convolution layer, the image features output by the previous coding convolution layer and the target bit rate are input into the current coding convolution layer to obtain the image features output by the current coding convolution layer.
[0129] Specifically, the t-th image feature output by the t-th encoding convolutional layer is obtained, including:
[0130] Perform convolution down sampling on the t-1th image feature to extract the image feature of the t-1th image feature;
[0131] The t-th image feature output by the t-th encoding convolutional layer is obtained according to the image feature of the t-1-th image feature and the target bit rate.
[0132] The operations in the t-th coded convolutional layer are similar to those in the first coded convolutional layer. For the processing in the t-th coded convolutional layer, refer to the processing of the first coded convolutional layer, which will not be repeated here.
[0133] In one embodiment provided in this specification, following the above example, the image feature M output by the previous encoding convolution layer is received. t-1 And the target bit rate λ, get the image feature M output by the current encoding convolution layer t .
[0134] Step 406: Increment t by 1 to determine whether t is greater than n. If not, execute step 404; if so, execute step 408.
[0135] Increment t by 1 and determine whether t is greater than n. If t is less than or equal to n, it means that the last coding convolution layer has not yet been reached, and then continue to execute step 404. If t is greater than n, it means that it is the last coding convolution layer, and then execute step 408.
[0136] In one embodiment provided in the present specification, the above example is used, taking n=4 as an example, that is, the current encoder includes 4 encoding convolutional layers, when t=2, t increases by 1 to become 3, 3 is less than 4, and step 404 is continued to be executed. When t=4, t increases by 1 to become 5, 5 is greater than 4, and step 408 is executed.
[0137] Step 408: Determine that the image feature output by the last encoding convolutional layer is the image feature corresponding to the sample image.
[0138] The image features output by the last encoding convolutional layer are used as the image features corresponding to the sample image.
[0139] In one embodiment provided in this specification, following the above example, when the image feature M output by the fourth encoding convolutional layer tAs the image feature M corresponding to the sample image x.
[0140] Step 410: Determine an image feature vector corresponding to the image feature according to the image feature.
[0141] The image features corresponding to the sample image are usually represented in multiple dimensions, and the image features need to be stretched to obtain image feature vectors corresponding to the image features. There are many ways to determine the image feature vectors corresponding to the image features based on the image features, such as converting the image features into image feature vectors based on the product of the height, width and number of channels of the image features. This specification does not limit the specific method of converting image features into corresponding image feature vectors.
[0142] In one embodiment provided in this specification, the above example is used to convert the image feature M into an image feature vector E based on the product of its height, width and number of channels.
[0143] Specifically, the decoder includes m decoding convolutional layers connected in sequence, where m>1; the decoder is used to decode according to the image feature vector obtained by the encoder to obtain a decoded compressed image.
[0144] See also Figure 6 , Figure 6 A flowchart of decoding an image feature vector provided by an embodiment of this specification is shown, including steps 602 to 610.
[0145] Step 602: Input the image feature vector and the target bit rate into a first decoding convolution layer to obtain a first decoding vector output by the first decoding convolution layer.
[0146] Specifically, obtaining a first decoding vector output by a first decoding convolutional layer includes:
[0147] Performing convolution upsampling on the image feature vector to obtain an initial decoding vector of the image feature vector;
[0148] A first decoding vector output by a first decoding convolutional layer is obtained according to the initial decoding vector of the image feature vector and the target bit rate.
[0149] Convolution upsampling is to restore the image by performing a convolution operation on the image feature vector. The upsampling method adopts the interpolation method, that is, inserting new elements between pixels based on the original image pixels using a suitable interpolation algorithm.
[0150] In one embodiment provided in the present specification, following the above example, the image feature vector E and the target bit rate λ are input into the first decoding convolution layer for decoding processing, and the image feature vector E is convolutionally upsampled by the convolution subunit to obtain an initial decoding vector of the image feature vector. The initial decoding vector is multiplied by the corresponding target bit rate λ to obtain the first decoding vector output by the first decoding convolution layer.
[0151] Step 604: Input the j-1th decoding vector output by the j-1th encoding convolutional layer and the target bit rate into the j-th decoding convolutional layer to obtain the j-th decoding vector output by the j-th decoding convolutional layer, where 2≤j≤m.
[0152] Specifically, obtaining the j-th decoding vector output by the j-th decoding convolutional layer includes:
[0153] Performing convolution upsampling on the j-1th decoding vector to obtain an initial decoding vector of the j-1th decoding vector;
[0154] The j-th decoding vector output by the j-th decoding convolutional layer is obtained according to the initial decoding vector of the j-1-th decoding vector and the target bit rate.
[0155] For the other decoding convolution layers except the first decoding convolution layer, they all receive the decoding vector output by the previous decoding convolution layer, perform convolution upsampling on the decoding vector output by the previous decoding convolution layer in the current decoding convolution layer, obtain the corresponding initial decoding vector, and then multiply the initial decoding vector corresponding to the decoding vector output by the previous decoding convolution layer by the corresponding target bit rate λ to obtain the decoding vector output by the current decoding convolution layer.
[0156] Step 606: Increment j by 1 and determine whether j is greater than m. If not, execute step 604; if so, execute step 608.
[0157] Increment j by 1 and determine whether j is greater than m. If j is less than or equal to m, it means that the last decoding convolution layer has not yet been reached, and then continue to execute step 604. If j is greater than m, it means that it is the last decoding convolution layer, and then execute step 608.
[0158] In one embodiment provided in the present specification, the above example is used, taking m=4 as an example, that is, the current decoder includes 4 decoding convolutional layers, when j=2, j increases by 1 to become 3, 3 is less than 4, and step 604 is continued to be executed. When j=4, j increases by 1 to become 5, 5 is greater than 4, and step 608 is executed.
[0159] Step 608: Determine that the decoding vector output by the last decoding convolutional layer is the decoding vector corresponding to the sample image.
[0160] The decoding vector output by the last decoding convolutional layer is used as the decoding vector output by the decoder, that is, the decoding vector corresponding to the sample image.
[0161] In one embodiment provided in this specification, following the above example, the decoding vector output by the fourth decoding convolutional layer is used as the decoding vector corresponding to the sample image.
[0162] Step 610: normalize the decoded vector to obtain a target image corresponding to the sample image.
[0163] The decoded vector is fully connected and normalized to finally obtain a target image corresponding to the sample image output by the image compression model, where the target image is the image obtained after the sample image is compressed.
[0164] Step 206: Calculate a loss value according to the sample image and the target image.
[0165] Optionally, step 206 includes calculating a loss value according to the target bit rate, the sample image and the target image.
[0166] The image compression model provided in this manual is unsupervised training. The loss value is calculated by the target bit rate, sample image and target image output by the image compression model. The specific loss value calculation method is shown in the following formula 2-4.
[0167] Loss=λD+R (2)
[0168] D = (Sum ((x-x_hat) 2 )) / (H*W) (3)
[0169] R = Sum(-log2Prob(y_hat)) (4)
[0170] Wherein, λ is the target bit rate, which is determined by the target bit rate parameter i and the target full connection parameter a, see the above formula (1). D represents the difference between the target image and the sample image. R represents the size of the storage space required to store each pixel in the end, x is the sample image, x_hat is the target image, H is the height of the sample image x, and W is the width of the sample image x. y_hat is the image feature vector obtained after the sample image is processed by the encoder, Prob(y_hat) represents the probability distribution of y_hat, and each value of y_hat obeys the laplace distribution (u, sigma).
[0171] In the embodiments provided in this specification, the loss value is calculated according to the target bit rate λ, the sample image x, and the target image x_hat output by the image compression model.
[0172] Step 208: Train the image compression model according to the loss value until a training stop condition is reached.
[0173] The parameters of the image compression model are adjusted according to the back propagation of the loss value until the number of model training reaches a preset number of training rounds, or the loss value is less than a preset threshold, then the training is stopped.
[0174] The training stop condition is a preset training round, or the loss value is less than a preset threshold.
[0175] The training method of the image compression model provided in the embodiment of this specification obtains a sample image, a target bit rate parameter and a target full connection parameter, and processes the sample image, the target bit rate parameter and the target full connection parameter by inputting the sample image, the target bit rate parameter and the target full connection parameter into the image compression model to be trained to obtain a target image, and calculates a loss value based on the sample image and the target image, and then trains the image compression model through the loss value. The model training process is simplified, and there is no need for a multi-stage training process. The multi-bit rate image compression model can be trained by adjusting the target bit rate parameter and the target full connection parameter. During the training process, an interpolation variable bit rate control subunit is directly added to the encoder and decoder, which simplifies the training method. The model is fine-tuned by controlling the input parameters to complete the training, and the quality of the compressed target image is also improved.
[0176] See also Figure 7 , Figure 7 A flowchart of a first image compression method provided according to an embodiment of this specification is shown, which specifically includes the following steps:
[0177] Step 702: Obtain an image to be compressed and an image compression requirement of the image to be compressed.
[0178] The image to be compressed is an image that needs to be compressed, such as a photo transmitted between two terminal devices, a thumbnail of a picture in the news, a photo that needs to be uploaded to a website, etc. The image compression requirement is the degree to which the image to be compressed needs to be compressed. For example, when transmitting a photo between two terminal devices, the original photo size is 9M. In order to facilitate transmission, it is compressed to 1M. Then compressing the 9M image to be compressed to 1M is the image compression requirement. For example, some websites require uploading a personal portrait within 50K, and the selected picture size is 2M. The picture size needs to be compressed to within 50K. Then compressing the 2M picture to within 50K is the image compression requirement.
[0179] In a specific implementation provided in this specification, taking uploading a personal portrait on a website as an example for explanation, an image x to be compressed is obtained, and the image compression requirement is to compress the image x to be compressed to 50K.
[0180] Step 704: Determine a target bit rate parameter and a target full connection parameter according to the image compression requirement.
[0181] Optionally, determining a target bit rate parameter and a target full connection parameter according to the image compression requirement includes: determining a target bit rate parameter in a preset bit rate parameter set according to the image compression requirement, and determining a target full connection parameter in a preset full connection parameter set.
[0182] In practical applications, the target bitrate parameter is still determined from a preset bitrate parameter set, which is the same as the bitrate parameter set in the training process. The target fully connected parameter is determined from the fully connected parameter set. In the process of image model training, the initial fully connected parameter set is a relatively rough value, such as selecting from three values of 0, 0.5, and 1. In the application process of the image model, the fully connected parameter set is interpolated from a fixed interval between 0 and 1. For example, the target fully connected parameter a is selected from a fully connected parameter set of 100 values (value interval 1 / 100) of [1, 0.99, 0.98, ... 0.02, 0.01], or from a more refined (such as a value interval of 1 / 200) fully connected parameter set. In short, the value of a must be in the interval [0, 1]. In this way, the value of the interpolated variable bitrate can be more refined, which can enable the image compression model to achieve more than 1,000 bitrate change control. Compress compressed images with more refined bitrates.
[0183] In the embodiment provided in this specification, according to the image compression requirement, the image x to be compressed is compressed to 50K, and the corresponding target bit rate parameter i and the target full connection parameter a are determined.
[0184] Step 706: Input the image to be compressed, the target bit rate parameter and the target full connection parameter into an image compression model to obtain a compressed image corresponding to the image to be compressed.
[0185] Optionally, the image compression model includes an encoder and a decoder.
[0186] Inputting the image to be compressed, the target bit rate parameter and the target full connection parameter into the image compression model to obtain a compressed image corresponding to the image to be compressed, including S7062 to S7066:
[0187] S7062. Determine a target bit rate according to the target bit rate parameter and the target full connection parameter.
[0188] S7064: Input the image to be compressed and the target bit rate into the encoder to obtain an image feature vector corresponding to the image to be compressed.
[0189] Specifically, the encoder includes n sequentially connected encoding convolutional layers, where n>1; step S7064 includes:
[0190] Inputting the image to be compressed and the target bit rate into a first encoding convolution layer to obtain a first image feature output by the first encoding convolution layer;
[0191] Inputting the t-1th image feature output by the t-1th coding convolution layer and the target bit rate into the tth coding convolution layer to obtain the tth image feature output by the tth coding convolution layer, where 2≤t≤n;
[0192] Increment t by 1 to determine whether t is greater than n;
[0193] If not, continue to execute the step of inputting the t-1th image feature output by the t-1th encoding convolution layer and the target bit rate into the tth encoding convolution layer to obtain the tth image feature output by the tth encoding convolution layer;
[0194] If so, it is determined that the image feature output by the last encoding convolutional layer is the image feature corresponding to the image to be compressed, and an image feature vector corresponding to the image feature is determined based on the image feature.
[0195] Specifically, obtaining the first image feature output by the first encoding convolutional layer includes: performing convolution downsampling on the image to be compressed to extract the image feature of the image to be compressed; and obtaining the first image feature output by the first encoding convolutional layer according to the image feature of the image to be compressed and the target bit rate.
[0196] Obtaining the t-th image feature output by the t-th coding convolutional layer, comprising: performing convolution downsampling on the t-1-th image feature to extract the image feature of the t-1-th image feature; and obtaining the t-th image feature output by the t-th coding convolutional layer according to the image feature of the t-1-th image feature and the target bit rate.
[0197] S7066: Input the image feature vector and the target bit rate into the decoder to obtain a target image corresponding to the image to be compressed.
[0198] Specifically, the decoder includes m sequentially connected decoding convolutional layers, where m≥1; step S7066 includes:
[0199] Inputting the image feature vector and the target bit rate into a first decoding convolution layer to obtain a first decoding vector output by the first decoding convolution layer;
[0200] Inputting the j-1th decoding vector output by the j-1th encoding convolutional layer and the target bit rate into the j-th decoding convolutional layer to obtain the j-th decoding vector output by the j-th decoding convolutional layer, where 2≤j≤m;
[0201] Increment j by 1 to determine whether j is greater than m;
[0202] If not, continue to execute the step of inputting the j-1th decoding vector output by the j-1th encoding convolutional layer and the target bit rate into the jth decoding convolutional layer to obtain the jth decoding vector output by the jth decoding convolutional layer;
[0203] If so, it is determined that the decoding vector output by the last decoding convolutional layer is the decoding vector corresponding to the image to be compressed, and the decoding vector is normalized to obtain the target image corresponding to the image to be compressed.
[0204] Specifically, obtaining a first decoding vector output by a first decoding convolutional layer includes: performing convolution upsampling on the image feature vector to obtain an initial decoding vector of the image feature vector; and obtaining a first decoding vector output by the first decoding convolutional layer according to the initial decoding vector of the image feature vector and the target bit rate.
[0205] Obtaining a j-th decoding vector output by the j-th decoding convolutional layer, comprising: performing convolution upsampling on the j-1-th decoding vector to obtain an initial decoding vector of the j-1-th decoding vector; and obtaining a j-th decoding vector output by the j-th decoding convolutional layer according to the initial decoding vector of the j-1-th decoding vector and the target bit rate.
[0206] Step 706 is consistent with the method of step 204 above. For a specific explanation of step 706, please refer to the detailed content of step 204 in the above embodiment, which will not be repeated here.
[0207] In the embodiment provided in this specification, the image to be compressed x, the target bit rate parameter i and the target full connection parameter a are input into a pre-trained image compression model, and the target bit rate λ is determined according to the target bit rate parameter i and the target full connection parameter a.
[0208] The image to be compressed x and the target bit rate λ are input into the encoder, which includes a plurality of sequentially connected coding convolutional layers, each of which includes a convolution subunit and an interpolation variable bit rate control subunit. In each coding convolutional layer, the image to be compressed is convolved, and the target bit rate (i.e., the interpolation variable bit rate) is multiplied with the convolution result to obtain the coding vector E output by the final encoder.
[0209] When the encoding vector E and the target bit rate λ are input into the decoder for decoding, the decoder includes a plurality of decoding convolutional layers connected in sequence, each decoding convolutional layer also includes a convolution subunit and an interpolation variable bit rate control subunit, and the encoding vector is convolutionally upsampled in each decoding convolutional layer, and multiplied with the convolution result according to the target bit rate (i.e., the interpolation variable bit rate) to obtain a compressed image x_hat corresponding to the image to be compressed output by the final decoder.
[0210] The image compression method provided in the embodiment of this specification obtains the image to be compressed and the image compression requirements of the image to be compressed; determines the target bit rate parameter and the target full connection parameter according to the image compression requirements; inputs the image to be compressed, the target bit rate parameter and the target full connection parameter into the image compression model to obtain the compressed image corresponding to the image to be compressed. The image compression model can achieve more refined bit rate control, and compressed images with different bit rates can be obtained by controlling parameters in a multi-bit rate image compression model. The quality of the compressed image obtained by the image compression model can be effectively improved by interpolation variable bit rate control.
[0211] See also Figure 8 , Figure 8 The flowchart of the second image compression method provided in an embodiment of the present specification is shown, comprising the following steps:
[0212] Step 802: Displaying an image input interface to the user based on the user's call request.
[0213] Specifically, when receiving a call request from a user, an image input interface is determined according to the call request, and the image input interface is displayed to the user. The user can input the image to be compressed and the image compression requirement of the image to be compressed through the image input interface.
[0214] Step 804: receiving the image to be compressed input by the user based on the image input interface and the image compression requirement of the image to be compressed.
[0215] Step 806: Determine a target bit rate parameter and a target full connection parameter according to the image compression requirement.
[0216] Step 808: Input the image to be compressed, the target bit rate parameter and the target full connection parameter into an image compression model to obtain a compressed image corresponding to the image to be compressed.
[0217] It should be noted that the part of the image compression method provided in the embodiment of this specification that corresponds to the embodiment of the first image compression method provided in the above embodiment can be found in the detailed description of the first image compression method in the above embodiment, and will not be repeated here.
[0218] The image compression method provided in the embodiment of this specification provides an interactive interface for the user, through which the image to be compressed and the image compression requirements of the image to be compressed are obtained; the target bit rate parameter and the target full connection parameter are determined according to the image compression requirements; the image to be compressed, the target bit rate parameter and the target full connection parameter are input into the image compression model to obtain the compressed image corresponding to the image to be compressed. The image compression model can achieve more refined bit rate control, and compressed images with different bit rates can be obtained by controlling parameters in a multi-bit rate image compression model. The quality of the compressed image obtained by the image compression model can be effectively improved by interpolation variable bit rate control.
[0219] See also Fig. 9 , Fig. 9 The flowchart of the third image compression method provided in an embodiment of the present specification is shown, comprising the following steps:
[0220] Step 902: receiving a call request sent by a user, wherein the call request carries a picture to be compressed and a picture compression requirement of the picture to be compressed.
[0221] Step 904: Determine a target bit rate parameter and a target full connection parameter according to the image compression requirement.
[0222] Step 906: Input the image to be compressed, the target bit rate parameter and the target full connection parameter into an image compression model to obtain a compressed image corresponding to the image to be compressed.
[0223] It should be noted that the part of the image compression method provided in the embodiment of this specification that corresponds to the embodiment of the first image compression method provided in the above embodiment can be found in the detailed description of the first image compression method in the above embodiment, and will not be repeated here.
[0224] In actual applications, for users who have requirements for compressing large quantities of images, such as website editors, who need to compress images in batches, the corresponding API interface can be used to receive call requests sent by users. The call requests carry the images to be compressed and the image compression requirements. The images are compressed in batches using the image compression method provided in the embodiments of this specification, and the compressed target images are returned to the user to improve the user experience.
[0225] The image compression method provided in the embodiment of this specification receives a user's call request, the call request carries a picture to be compressed and a picture compression requirement, determines a target bit rate parameter and a target full connection parameter according to the image compression requirement, inputs the picture to be compressed, the target bit rate parameter and the target full connection parameter into an image compression model, and obtains a compressed image corresponding to the picture to be compressed. The image compression model can achieve more sophisticated bit rate control, and compressed pictures with different bit rates can be obtained by controlling parameters in a multi-bit rate image compression model. The quality of the compressed picture obtained by the image compression model can be effectively improved by interpolation variable bit rate control.
[0226] Corresponding to the above-mentioned training method embodiment of the image compression model, this specification also provides an embodiment of the training device embodiment of the image compression model. Fig.10 FIG. 1 is a schematic diagram showing the structure of a training device for a first image compression model provided in an embodiment of the present specification. Fig.10 As shown, the device comprises:
[0227] The acquisition module 1002 is configured to acquire a sample image, a target bit rate parameter, and a target full connection parameter.
[0228] The input module 1004 is configured to input the sample image, the target bit rate parameter and the target full connection parameter into the image compression model to be trained to obtain a target image corresponding to the sample image.
[0229] The calculation module 1006 is configured to calculate a loss value according to the sample image and the target image.
[0230] The training module 1008 is configured to train the image compression model according to the loss value until a training stop condition is reached.
[0231] Optionally, the image compression model includes an encoder and a decoder;
[0232] The input module 1004 includes:
[0233] A determination submodule, configured to determine a target bit rate according to the target bit rate parameter and the target full connection parameter;
[0234] An encoding submodule, configured to input the sample image and the target bit rate into the encoder to obtain an image feature vector corresponding to the sample image;
[0235] The decoding submodule is configured to input the image feature vector and the target bit rate into the decoder to obtain a target image corresponding to the sample image.
[0236] Optionally, the encoder comprises n sequentially connected encoding convolutional layers, where n>1;
[0237] The encoding submodule is further configured as follows:
[0238] Inputting the sample image and the target bit rate into a first encoding convolution layer to obtain a first image feature output by the first encoding convolution layer;
[0239] Inputting the t-1th image feature output by the t-1th coding convolution layer and the target bit rate into the tth coding convolution layer to obtain the tth image feature output by the tth coding convolution layer, where 2≤t≤n;
[0240] Increment t by 1 to determine whether t is greater than n;
[0241] If not, continue to perform the operation of inputting the t-1th image feature output by the t-1th encoding convolution layer and the target bit rate into the tth encoding convolution layer to obtain the tth image feature output by the tth encoding convolution layer;
[0242] If so, it is determined that the image feature output by the last encoding convolutional layer is the image feature corresponding to the sample image, and an image feature vector corresponding to the image feature is determined based on the image feature.
[0243] Optionally, the encoding submodule is further configured as follows:
[0244] Performing convolution down-sampling on the sample image to extract image features of the sample image;
[0245] A first image feature output by a first encoding convolutional layer is obtained according to the image feature of the sample image and the target bit rate.
[0246] Optionally, the encoding submodule is further configured as follows:
[0247] Perform convolution down sampling on the t-1th image feature to extract the image feature of the t-1th image feature;
[0248] The t-th image feature output by the t-th encoding convolutional layer is obtained according to the image feature of the t-1-th image feature and the target bit rate.
[0249] Optionally, the decoder comprises m decoding convolutional layers connected in sequence, where m>1;
[0250] The decoding submodule is further configured as follows:
[0251] Inputting the image feature vector and the target bit rate into a first decoding convolution layer to obtain a first decoding vector output by the first decoding convolution layer;
[0252] Inputting the j-1th decoding vector output by the j-1th encoding convolutional layer and the target bit rate into the j-th decoding convolutional layer to obtain the j-th decoding vector output by the j-th decoding convolutional layer, where 2≤j≤m;
[0253] Increment j by 1 to determine whether j is greater than m;
[0254] If not, continue to perform the operation of inputting the j-1th decoding vector output by the j-1th encoding convolution layer and the target bit rate into the jth decoding convolution layer to obtain the jth decoding vector output by the jth decoding convolution layer;
[0255] If so, it is determined that the decoding vector output by the last decoding convolutional layer is the decoding vector corresponding to the sample image, and the decoding vector is normalized to obtain the target image corresponding to the sample image.
[0256] Optionally, the decoding submodule is further configured as follows:
[0257] Performing convolution upsampling on the image feature vector to obtain an initial decoding vector of the image feature vector;
[0258] A first decoding vector output by a first decoding convolutional layer is obtained according to the initial decoding vector of the image feature vector and the target bit rate.
[0259] Optionally, the decoding submodule is further configured as follows:
[0260] Performing convolution upsampling on the j-1th decoding vector to obtain an initial decoding vector of the j-1th decoding vector;
[0261] The j-th decoding vector output by the j-th decoding convolutional layer is obtained according to the initial decoding vector of the j-1-th decoding vector and the target bit rate.
[0262] Optionally, the calculation module 1006 is further configured to calculate a loss value according to the target bit rate, the sample image and the target image.
[0263] Optionally, the acquisition module 1002 is further configured to:
[0264] Obtain a sample image from a preset sample image set;
[0265] Obtaining a target bit rate parameter from a preset bit rate parameter set;
[0266] Get the target full connection parameters from the preset initial full connection parameter set.
[0267] The training device of the image compression model provided in the embodiment of this specification obtains a sample image, a target bit rate parameter and a target full connection parameter, and processes the sample image, the target bit rate parameter and the target full connection parameter by inputting the sample image, the target bit rate parameter and the target full connection parameter into the image compression model to be trained to obtain a target image, and calculates a loss value according to the sample image and the target image, and then trains the image compression model by the loss value. The model training process is simplified, and there is no need for a multi-stage training process. The multi-bit rate image compression model can be trained by adjusting the target bit rate parameter and the target full connection parameter. During the training process, an interpolation variable bit rate control subunit is directly added to the encoder and decoder, which simplifies the training method. The model is fine-tuned by controlling the input parameters to complete the training, and the quality of the compressed target image is also improved.
[0268] The above is a schematic scheme of a training device for an image compression model of this embodiment. It should be noted that the technical scheme of the training device for the image compression model and the technical scheme of the training method for the image compression model described above belong to the same concept, and the details of the technical scheme of the training device for the image compression model that are not described in detail can be found in the description of the technical scheme of the training method for the image compression model described above.
[0269] Corresponding to the first embodiment of the image compression method described above, this specification also provides an embodiment of an image compression device. Fig.11 FIG. 1 shows a schematic diagram of the structure of a first image compression device provided by an embodiment of the present specification. Fig.11 As shown, the device comprises:
[0270] The acquisition module 1102 is configured to acquire the image to be compressed and the image compression requirement of the image to be compressed.
[0271] The determination module 1104 is configured to determine a target bit rate parameter and a target full connection parameter according to the image compression requirement.
[0272] The compression module 1106 is configured to input the image to be compressed, the target bit rate parameter and the target full connection parameter into an image compression model to obtain a compressed image corresponding to the image to be compressed.
[0273] Optionally, the image compression model includes an encoder and a decoder;
[0274] The compression module 1106 includes:
[0275] A determination submodule, configured to determine a target bit rate according to the target bit rate parameter and the target full connection parameter;
[0276] The encoding submodule is configured to input the image to be compressed and the target bit rate into the encoder to obtain an image feature vector corresponding to the image to be compressed;
[0277] The decoding submodule is configured to input the image feature vector and the target bit rate into the decoder to obtain a target image corresponding to the image to be compressed.
[0278] Optionally, the encoder comprises n sequentially connected encoding convolutional layers, where n>1;
[0279] The encoding submodule is further configured as follows:
[0280] Inputting the image to be compressed and the target bit rate into a first encoding convolution layer to obtain a first image feature output by the first encoding convolution layer;
[0281] Inputting the t-1th image feature output by the t-1th coding convolution layer and the target bit rate into the tth coding convolution layer to obtain the tth image feature output by the tth coding convolution layer, where 2≤t≤n;
[0282] Increment t by 1 to determine whether t is greater than n;
[0283] If not, continue to execute the step of inputting the t-1th image feature output by the t-1th encoding convolution layer and the target bit rate into the tth encoding convolution layer to obtain the tth image feature output by the tth encoding convolution layer;
[0284] If so, it is determined that the image feature output by the last encoding convolutional layer is the image feature corresponding to the image to be compressed, and an image feature vector corresponding to the image feature is determined based on the image feature.
[0285] Optionally, the encoding submodule is further configured as follows:
[0286] Performing convolution down sampling on the image to be compressed to extract image features of the image to be compressed;
[0287] A first image feature output by a first encoding convolutional layer is obtained according to the image feature of the image to be compressed and the target bit rate.
[0288] Optionally, the encoding submodule is further configured as follows:
[0289] Perform convolution down sampling on the t-1th image feature to extract the image feature of the t-1th image feature;
[0290] The t-th image feature output by the t-th encoding convolutional layer is obtained according to the image feature of the t-1-th image feature and the target bit rate.
[0291] Optionally, the decoder comprises m decoding convolutional layers connected in sequence, where m>1;
[0292] The decoding submodule is further configured as follows:
[0293] Inputting the image feature vector and the target bit rate into a first decoding convolution layer to obtain a first decoding vector output by the first decoding convolution layer;
[0294] Inputting the j-1th decoding vector output by the j-1th encoding convolutional layer and the target bit rate into the j-th decoding convolutional layer to obtain the j-th decoding vector output by the j-th decoding convolutional layer, where 2≤j≤m;
[0295] Increment j by 1 to determine whether j is greater than m;
[0296] If not, continue to execute the step of inputting the j-1th decoding vector output by the j-1th encoding convolutional layer and the target bit rate into the jth decoding convolutional layer to obtain the jth decoding vector output by the jth decoding convolutional layer;
[0297] If so, it is determined that the decoding vector output by the last decoding convolutional layer is the decoding vector corresponding to the image to be compressed, and the decoding vector is normalized to obtain the target image corresponding to the image to be compressed.
[0298] Optionally, the decoding submodule is further configured as follows:
[0299] Performing convolution upsampling on the image feature vector to obtain an initial decoding vector of the image feature vector;
[0300] A first decoding vector output by a first decoding convolutional layer is obtained according to the initial decoding vector of the image feature vector and the target bit rate.
[0301] Optionally, the decoding submodule is further configured as follows:
[0302] Performing convolution upsampling on the j-1th decoding vector to obtain an initial decoding vector of the j-1th decoding vector;
[0303] The j-th decoding vector output by the j-th decoding convolutional layer is obtained according to the initial decoding vector of the j-1-th decoding vector and the target bit rate.
[0304] Optionally, the determination module 1104 is further configured to determine a target bit rate parameter in a preset bit rate parameter set and a target full connection parameter in a preset full connection parameter set according to the image compression requirement.
[0305] The image compression device provided in the embodiment of this specification obtains the image to be compressed and the image compression requirements of the image to be compressed; determines the target bit rate parameter and the target full connection parameter according to the image compression requirements; inputs the image to be compressed, the target bit rate parameter and the target full connection parameter into the image compression model to obtain the compressed image corresponding to the image to be compressed. The image compression model can achieve more refined bit rate control, and compressed images with different bit rates can be obtained by controlling parameters in a multi-bit rate image compression model. The quality of the compressed image obtained by the image compression model can be effectively improved by interpolation variable bit rate control.
[0306] The above is a schematic scheme of an image compression device of this embodiment. It should be noted that the technical scheme of the image compression device and the technical scheme of the first image compression method of the above embodiment belong to the same concept, and the details not described in detail in the technical scheme of the image compression device can be referred to the description of the technical scheme of the first image compression method of the above embodiment.
[0307] Corresponding to the above-mentioned second embodiment of the image compression method, this specification also provides a second embodiment of the image compression device, Fig.12 FIG. 2 shows a schematic diagram of the structure of a second image compression device provided by an embodiment of the present specification. Fig.12 As shown, the device comprises:
[0308] The interface display module 1202 is configured to display an image input interface to the user based on a user's call request.
[0309] The receiving module 1204 is configured to receive the image to be compressed input by the user based on the image input interface and the image compression requirement of the image to be compressed.
[0310] The determination module 1206 is configured to determine a target bit rate parameter and a target full connection parameter according to the image compression requirement.
[0311] The compression module 1208 is configured to input the image to be compressed, the target bit rate parameter and the target full connection parameter into an image compression model to obtain a compressed image corresponding to the image to be compressed.
[0312] The image compression device provided in the embodiment of this specification provides an interactive interface for the user, through which the image to be compressed and the image compression requirements of the image to be compressed are obtained; the target bit rate parameter and the target full connection parameter are determined according to the image compression requirements; the image to be compressed, the target bit rate parameter and the target full connection parameter are input into the image compression model to obtain the compressed image corresponding to the image to be compressed. The image compression model can achieve more refined bit rate control, and compressed images with different bit rates can be obtained by controlling parameters in a multi-bit rate image compression model. The quality of the compressed image obtained by the image compression model can be effectively improved by interpolation variable bit rate control.
[0313] The above is a schematic scheme of an image compression device of this embodiment. It should be noted that the technical scheme of the image compression device and the technical scheme of the second image compression method of the above embodiment belong to the same concept, and the details not described in detail in the technical scheme of the image compression device can be referred to the description of the technical scheme of the second image compression method of the above embodiment.
[0314] Corresponding to the third embodiment of the above-mentioned image compression method, this specification also provides a third embodiment of an image compression device, Fig.13 FIG. 2 shows a schematic diagram of the structure of a third image compression device provided in an embodiment of this specification. Fig.13 As shown, the device comprises:
[0315] The request receiving module 1302 is configured to receive a call request sent by a user, wherein the call request carries a picture to be compressed and a picture compression requirement of the picture to be compressed.
[0316] The determination module 1304 is configured to determine a target bit rate parameter and a target full connection parameter according to the image compression requirement.
[0317] The compression module 1306 is configured to input the image to be compressed, the target bit rate parameter and the target full connection parameter into an image compression model to obtain a compressed image corresponding to the image to be compressed.
[0318] The image compression device provided in the embodiment of this specification receives a user's call request, the call request carries a picture to be compressed and a picture compression requirement, determines a target bit rate parameter and a target full connection parameter according to the image compression requirement, inputs the picture to be compressed, the target bit rate parameter and the target full connection parameter into an image compression model, and obtains a compressed image corresponding to the picture to be compressed. The image compression model can achieve more sophisticated bit rate control, and compressed pictures with different bit rates can be obtained by controlling parameters in a multi-bit rate image compression model. The quality of the compressed picture obtained by the image compression model can be effectively improved by interpolation variable bit rate control.
[0319] The above is a schematic scheme of an image compression device of this embodiment. It should be noted that the technical scheme of the image compression device and the technical scheme of the third image compression method of the above embodiment belong to the same concept, and the details not described in detail in the technical scheme of the image compression device can be referred to the description of the technical scheme of the third image compression method of the above embodiment.
[0320] See also Fig.14 , Fig.14 A flowchart of a second image compression model training method provided in an embodiment of this specification is shown, comprising the following steps:
[0321] Step 1402: Displaying an image input interface to the user based on the user's model training request.
[0322] Step 1404: receiving a sample image, a target bit rate parameter, and a target full connection parameter input by the user based on the image input interface.
[0323] Step 1406: Input the sample image, the target bit rate parameter and the target full connection parameter into the image compression model to be trained to obtain a target image corresponding to the sample image.
[0324] Step 1408: Calculate a loss value based on the sample image and the target image.
[0325] Step 1410: Train the image compression model according to the loss value until a training stop condition is reached.
[0326] It should be noted that the part of the training method of the image compression model provided in the embodiment of this specification that corresponds to the embodiment of the training method of the first image compression model provided in the above embodiment can be referred to the detailed description of the training method of the first image compression model in the above embodiment, and will not be repeated here.
[0327] See also Fig.15 , Fig.15 A flowchart of a third image compression model training method provided in an embodiment of this specification is shown, comprising the following steps:
[0328] Step 1502: Receive a model training request sent by a user, wherein the model training request carries a sample image, a target bitrate parameter, and a target full connection parameter.
[0329] Step 1504: Input the sample image, the target bit rate parameter and the target full connection parameter into the image compression model to be trained to obtain a target image corresponding to the sample image.
[0330] Step 1506: Calculate a loss value based on the sample image and the target image.
[0331] Step 1508: Train the image compression model according to the loss value until a training stop condition is reached.
[0332] It should be noted that the part of the training method of the image compression model provided in the embodiment of this specification that corresponds to the embodiment of the training method of the first image compression model provided in the above embodiment can be referred to the detailed description of the training method of the first image compression model in the above embodiment, and will not be repeated here.
[0333] Corresponding to the above-mentioned embodiment of the training method of the second image compression model, this specification also provides an embodiment of the training device of the second image compression model. Fig.16 FIG. 2 shows a schematic diagram of the structure of a training device for a second image compression model provided in an embodiment of the present specification. Fig.16 As shown, the device comprises:
[0334] The interface display module 1602 is configured to display an image input interface to the user based on the user's model training request.
[0335] The receiving module 1604 is configured to receive the sample image, target bit rate parameter and target full connection parameter input by the user based on the image input interface.
[0336] The input module 1606 is configured to input the sample image, the target bit rate parameter and the target full connection parameter into the image compression model to be trained to obtain a target image corresponding to the sample image.
[0337] The calculation module 1608 is configured to calculate a loss value according to the sample image and the target image.
[0338] The training module 1610 is configured to train the image compression model according to the loss value until a training stop condition is reached.
[0339] The above is a schematic scheme of a training device for an image compression model of this embodiment. It should be noted that the technical scheme of the training device for the image compression model and the technical scheme of the second training method for the image compression model in the above embodiment belong to the same concept, and the details not described in detail in the technical scheme of the training device for the image compression model can be found in the description of the technical scheme of the second training method for the image compression model in the above embodiment.
[0340] Corresponding to the above-mentioned embodiment of the training method of the third image compression model, this specification also provides an embodiment of a training device of the third image compression model. Fig.17FIG. 2 shows a schematic diagram of the structure of a training device for a third image compression model provided in an embodiment of this specification. Fig.17 As shown, the device comprises:
[0341] The request receiving module 1702 is configured to receive a model training request sent by a user, wherein the model training request carries a sample image, a target bitrate parameter, and a target full connection parameter.
[0342] The input module 1704 is configured to input the sample image, the target bit rate parameter and the target full connection parameter into the image compression model to be trained to obtain the target image corresponding to the sample image.
[0343] The calculation module 1706 is configured to calculate a loss value according to the sample image and the target image.
[0344] The training module 1708 is configured to train the image compression model according to the loss value until a training stop condition is reached.
[0345] The above is a schematic scheme of a training device for an image compression model of this embodiment. It should be noted that the technical scheme of the training device for the image compression model and the technical scheme of the third training method for the image compression model in the above embodiment belong to the same concept, and the details not described in detail in the technical scheme of the training device for the image compression model can be found in the description of the technical scheme of the third training method for the image compression model in the above embodiment.
[0346] Fig.18 The structure block diagram of a computing device 1800 provided according to an embodiment of the present specification is shown. The components of the computing device 1800 include but are not limited to a memory 1810 and a processor 1820. The processor 1820 is connected to the memory 1810 via a bus 1830, and the database 1850 is used to store data.
[0347] The computing device 1800 also includes an access device 1840 that enables the computing device 1800 to communicate via one or more networks 1860. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 1840 may include one or more of any type of network interface (e.g., a network interface card (NIC)) wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Wide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0348] In one embodiment of the present specification, the above components of the computing device 1800 and Fig.18 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Fig.18 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0349] Computing device 1800 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. Computing device 1800 may also be a mobile or stationary server.
[0350] The processor 1820 is used to execute the following computer executable instructions, wherein the processor implements the training method of the image compression model or the steps of the image compression method when executing the computer executable instructions.
[0351] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the above-mentioned training method of the image compression model or the technical scheme of the image compression method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the above-mentioned training method of the image compression model or the technical scheme of the image compression method.
[0352] An embodiment of the present specification also provides a computer-readable storage medium storing computer instructions, which, when executed by a processor, implement the training method of the image compression model or the steps of the image compression method.
[0353] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the training method of the image compression model or the image compression method mentioned above belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the training method of the image compression model or the technical scheme of the image compression method.
[0354] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0355] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0356] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that this specification is not limited by the order of the actions described, because according to this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this specification.
[0357] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0358] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is limited only by the claims and their full scope and equivalents.
Claims
1. A training method for an image compression model, comprising: Obtaining a sample image, a target bit rate parameter and a target full connection parameter, wherein the target bit rate parameter is a position parameter of the bit rate in the bit rate control interval, and the target full connection parameter is a parameter for determining the interpolation bit rate; Inputting the sample image, the target bit rate parameter, and the target full connection parameter into the image compression model to be trained to obtain a target image corresponding to the sample image, wherein inputting the sample image, the target bit rate parameter, and the target full connection parameter into the image compression model to be trained to obtain a target image corresponding to the sample image includes: Determine a target bit rate according to the target bit rate parameter and the target full connection parameter, wherein the target bit rate is an interpolated variable bit rate corresponding to the target bit rate parameter and the target full connection parameter; Inputting the sample image and the target bit rate into an encoder to obtain an image feature vector corresponding to the sample image; Inputting the image feature vector and the target bit rate into a decoder to obtain a target image corresponding to the sample image; Calculate a loss value according to the sample image and the target image; The image compression model is trained according to the loss value until a training stop condition is reached.
2. The training method of the image compression model according to claim 1, wherein the encoder comprises n sequentially connected encoding convolutional layers, wherein: n>1; Inputting the sample image and the target bit rate into the encoder to obtain an image feature vector corresponding to the sample image includes: Inputting the sample image and the target bit rate into a first encoding convolution layer to obtain a first image feature output by the first encoding convolution layer; Inputting the t-1th image feature output by the t-1th coding convolution layer and the target bit rate into the tth coding convolution layer to obtain the tth image feature output by the tth coding convolution layer, where 2≤t≤n; Increment t by 1 to determine whether t is greater than n; If not, continue to perform the operation of inputting the t-1th image feature output by the t-1th encoding convolution layer and the target bit rate into the tth encoding convolution layer to obtain the tth image feature output by the tth encoding convolution layer; If so, it is determined that the image feature output by the last encoding convolutional layer is the image feature corresponding to the sample image, and an image feature vector corresponding to the image feature is determined based on the image feature.
3. The training method of the image compression model according to claim 2, wherein obtaining the first image feature output by the first encoding convolutional layer comprises: Performing convolution down-sampling on the sample image to extract image features of the sample image; A first image feature output by a first encoding convolutional layer is obtained according to the image feature of the sample image and the target bit rate.
4. The training method of the image compression model according to claim 2, wherein obtaining the t-th image feature output by the t-th encoding convolutional layer comprises: Perform convolution down sampling on the t-1th image feature to extract the image feature of the t-1th image feature; The t-th image feature output by the t-th encoding convolutional layer is obtained according to the image feature of the t-1-th image feature and the target bit rate.
5. The training method of the image compression model according to claim 1, wherein the decoder comprises m sequentially connected decoding convolutional layers, wherein: m>1; Inputting the image feature vector and the target bit rate into the decoder to obtain a target image corresponding to the sample image includes: Inputting the image feature vector and the target bit rate into a first decoding convolution layer to obtain a first decoding vector output by the first decoding convolution layer; Inputting the j-1th decoding vector output by the j-1th encoding convolutional layer and the target bit rate into the j-th decoding convolutional layer to obtain the j-th decoding vector output by the j-th decoding convolutional layer, where 2≤j≤m; Increment j by 1 to determine whether j is greater than m; If not, continue to perform the operation of inputting the j-1th decoding vector output by the j-1th encoding convolution layer and the target bit rate into the jth decoding convolution layer to obtain the jth decoding vector output by the jth decoding convolution layer; If so, it is determined that the decoding vector output by the last decoding convolutional layer is the decoding vector corresponding to the sample image, and the decoding vector is normalized to obtain the target image corresponding to the sample image.
6. The training method of the image compression model according to claim 5, obtaining the first decoding vector output by the first decoding convolutional layer, comprising: Performing convolution upsampling on the image feature vector to obtain an initial decoding vector of the image feature vector; A first decoding vector output by a first decoding convolutional layer is obtained according to the initial decoding vector of the image feature vector and the target bit rate.
7. The training method of the image compression model according to claim 5, obtaining the j-th decoding vector output by the j-th decoding convolutional layer, comprising: Performing convolution upsampling on the j-1th decoding vector to obtain an initial decoding vector of the j-1th decoding vector; The j-th decoding vector output by the j-th decoding convolutional layer is obtained according to the initial decoding vector of the j-1-th decoding vector and the target bit rate.
8. The training method of the image compression model according to claim 1, wherein the loss value is calculated according to the sample image and the target image, comprising: A loss value is calculated according to the target bit rate, the sample image and the target image.
9. The method for training an image compression model according to claim 1, obtaining a sample image, a target bit rate parameter and a target full connection parameter, comprising: Obtain a sample image from a preset sample image set; Obtaining a target bit rate parameter from a preset bit rate parameter set; Get the target full connection parameters from the preset initial full connection parameter set.
10. A method for training an image compression model, comprising: Based on the user's model training request, display an image input interface for the user; Receiving a sample image, a target bit rate parameter, and a target full connection parameter input by the user based on the image input interface, wherein the target bit rate parameter is a position parameter of the bit rate in the bit rate control interval, and the target full connection parameter is a parameter for determining the interpolation bit rate; Inputting the sample image, the target bit rate parameter, and the target full connection parameter into the image compression model to be trained to obtain a target image corresponding to the sample image, wherein inputting the sample image, the target bit rate parameter, and the target full connection parameter into the image compression model to be trained to obtain a target image corresponding to the sample image includes: Determine a target bit rate according to the target bit rate parameter and the target full connection parameter, wherein the target bit rate is an interpolated variable bit rate corresponding to the target bit rate parameter and the target full connection parameter; Inputting the sample image and the target bit rate into an encoder to obtain an image feature vector corresponding to the sample image; Inputting the image feature vector and the target bit rate into a decoder to obtain a target image corresponding to the sample image; Calculate a loss value according to the sample image and the target image; The image compression model is trained according to the loss value until a training stop condition is reached.
11. A method for training an image compression model, comprising: Receive a model training request sent by a user, wherein the model training request carries a sample image, a target bit rate parameter, and a target full connection parameter, wherein the target bit rate parameter is a position parameter of the bit rate in the bit rate control interval, and the target full connection parameter is a parameter for determining the interpolation bit rate; Inputting the sample image, the target bit rate parameter, and the target full connection parameter into the image compression model to be trained to obtain a target image corresponding to the sample image, wherein inputting the sample image, the target bit rate parameter, and the target full connection parameter into the image compression model to be trained to obtain a target image corresponding to the sample image includes: Determine a target bit rate according to the target bit rate parameter and the target full connection parameter, wherein the target bit rate is an interpolated variable bit rate corresponding to the target bit rate parameter and the target full connection parameter; Inputting the sample image and the target bit rate into an encoder to obtain an image feature vector corresponding to the sample image; Inputting the image feature vector and the target bit rate into a decoder to obtain a target image corresponding to the sample image; Calculate a loss value according to the sample image and the target image; The image compression model is trained according to the loss value until a training stop condition is reached.
12. An image compression method, comprising: Acquire an image to be compressed and an image compression requirement of the image to be compressed; Determining a target bit rate parameter and a target full connection parameter according to the image compression requirement, wherein the target bit rate parameter is a position parameter of the bit rate in the bit rate control interval, and the target full connection parameter is a parameter for determining the interpolation bit rate; Inputting the image to be compressed, the target bit rate parameter, and the target full connection parameter into an image compression model to obtain a compressed image corresponding to the image to be compressed, wherein inputting the image to be compressed, the target bit rate parameter, and the target full connection parameter into the image compression model to obtain a compressed image corresponding to the image to be compressed includes: Determine a target bit rate according to the target bit rate parameter and the target full connection parameter, wherein the target bit rate is an interpolated variable bit rate corresponding to the target bit rate parameter and the target full connection parameter; Inputting the image to be compressed and the target bit rate into an encoder to obtain an image feature vector corresponding to the image to be compressed; The image feature vector and the target bit rate are input into a decoder to obtain a compressed image corresponding to the image to be compressed.
13. The image compression method according to claim 12, wherein the encoder comprises n sequentially connected encoding convolutional layers, wherein: n>1; Inputting the image to be compressed and the target bit rate into the encoder to obtain an image feature vector corresponding to the image to be compressed, including: Inputting the image to be compressed and the target bit rate into a first encoding convolution layer to obtain a first image feature output by the first encoding convolution layer; Inputting the t-1th image feature output by the t-1th coding convolution layer and the target bit rate into the tth coding convolution layer to obtain the tth image feature output by the tth coding convolution layer, where 2≤t≤n; Increment t by 1 to determine whether t is greater than n; If not, continue to perform the operation of inputting the t-1th image feature output by the t-1th encoding convolution layer and the target bit rate into the tth encoding convolution layer to obtain the tth image feature output by the tth encoding convolution layer; If so, it is determined that the image feature output by the last encoding convolutional layer is the image feature corresponding to the image to be compressed, and an image feature vector corresponding to the image feature is determined based on the image feature.
14. The image compression method according to claim 13, wherein obtaining the first image feature output by the first encoding convolutional layer comprises: Performing convolution down sampling on the image to be compressed to extract image features of the image to be compressed; A first image feature output by a first encoding convolutional layer is obtained according to the image feature of the image to be compressed and the target bit rate.
15. The image compression method according to claim 13, wherein obtaining the t-th image feature output by the t-th encoding convolutional layer comprises: Perform convolution down sampling on the t-1th image feature to extract the image feature of the t-1th image feature; The t-th image feature output by the t-th encoding convolutional layer is obtained according to the image feature of the t-1-th image feature and the target bit rate.
16. The image compression method according to claim 12, wherein the decoder comprises m sequentially connected decoding convolutional layers, wherein: m≥1; Inputting the image feature vector and the target bit rate into the decoder to obtain a target image corresponding to the image to be compressed, including: Inputting the image feature vector and the target bit rate into a first decoding convolution layer to obtain a first decoding vector output by the first decoding convolution layer; Inputting the j-1th decoding vector output by the j-1th encoding convolutional layer and the target bit rate into the j-th decoding convolutional layer to obtain the j-th decoding vector output by the j-th decoding convolutional layer, where 2≤j≤m; Increment j by 1 to determine whether j is greater than m; If not, continue to perform the operation of inputting the j-1th decoding vector output by the j-1th encoding convolution layer and the target bit rate into the jth decoding convolution layer to obtain the jth decoding vector output by the jth decoding convolution layer; If so, it is determined that the decoding vector output by the last decoding convolutional layer is the decoding vector corresponding to the image to be compressed, and the decoding vector is normalized to obtain the target image corresponding to the image to be compressed.
17. The image compression method according to claim 16, obtaining a first decoding vector output by a first decoding convolutional layer, comprising: Performing convolution upsampling on the image feature vector to obtain an initial decoding vector of the image feature vector; A first decoding vector output by a first decoding convolutional layer is obtained according to the initial decoding vector of the image feature vector and the target bit rate.
18. The image compression method according to claim 16, obtaining the j-th decoding vector output by the j-th decoding convolutional layer comprises: Performing convolution upsampling on the j-1th decoding vector to obtain an initial decoding vector of the j-1th decoding vector; The j-th decoding vector output by the j-th decoding convolutional layer is obtained according to the initial decoding vector of the j-1-th decoding vector and the target bit rate.
19. The image compression method according to claim 12, wherein determining a target bit rate parameter and a target full connection parameter according to the image compression requirement comprises: According to the image compression requirement, a target bit rate parameter is determined in a preset bit rate parameter set, and a target full connection parameter is determined in a preset full connection parameter set.
20. An image compression method, comprising: Displaying an image input interface to the user based on a call request from the user; receiving an image to be compressed and an image compression requirement of the image to be compressed input by the user based on the image input interface; Determining a target bit rate parameter and a target full connection parameter according to the image compression requirement, wherein the target bit rate parameter is a position parameter of the bit rate in the bit rate control interval, and the target full connection parameter is a parameter for determining the interpolation bit rate; Inputting the image to be compressed, the target bit rate parameter, and the target full connection parameter into an image compression model to obtain a compressed image corresponding to the image to be compressed, wherein inputting the image to be compressed, the target bit rate parameter, and the target full connection parameter into the image compression model to obtain a compressed image corresponding to the image to be compressed includes: Determine a target bit rate according to the target bit rate parameter and the target full connection parameter, wherein the target bit rate is an interpolated variable bit rate corresponding to the target bit rate parameter and the target full connection parameter; Inputting the image to be compressed and the target bit rate into an encoder to obtain an image feature vector corresponding to the image to be compressed; The image feature vector and the target bit rate are input into a decoder to obtain a compressed image corresponding to the image to be compressed.
21. An image compression method, comprising: Receiving a call request sent by a user, wherein the call request carries an image to be compressed and an image compression requirement of the image to be compressed; Determining a target bit rate parameter and a target full connection parameter according to the image compression requirement, wherein the target bit rate parameter is a position parameter of the bit rate in the bit rate control interval, and the target full connection parameter is a parameter for determining the interpolation bit rate; Inputting the image to be compressed, the target bit rate parameter, and the target full connection parameter into an image compression model to obtain a compressed image corresponding to the image to be compressed, wherein inputting the image to be compressed, the target bit rate parameter, and the target full connection parameter into the image compression model to obtain a compressed image corresponding to the image to be compressed includes: Determine a target bit rate according to the target bit rate parameter and the target full connection parameter, wherein the target bit rate is an interpolated variable bit rate corresponding to the target bit rate parameter and the target full connection parameter; Inputting the image to be compressed and the target bit rate into an encoder to obtain an image feature vector corresponding to the image to be compressed; The image feature vector and the target bit rate are input into a decoder to obtain a compressed image corresponding to the image to be compressed.
22. A training device for an image compression model, comprising: An acquisition module is configured to acquire a sample image, a target bit rate parameter and a target full connection parameter, wherein the target bit rate parameter is a position parameter of the bit rate in the bit rate control interval, and the target full connection parameter is a parameter for determining the interpolation bit rate; An input module, configured to input the sample image, the target bit rate parameter and the target full connection parameter into the image compression model to be trained, to obtain a target image corresponding to the sample image; The input module comprises: A determination submodule is configured to determine a target bit rate according to the target bit rate parameter and the target full connection parameter, wherein the target bit rate is an interpolated variable bit rate corresponding to the target bit rate parameter and the target full connection parameter; An encoding submodule, configured to input the sample image and the target bit rate into an encoder to obtain an image feature vector corresponding to the sample image; A decoding submodule, configured to input the image feature vector and the target bit rate into a decoder to obtain a target image corresponding to the sample image; A calculation module, configured to calculate a loss value according to the sample image and the target image; A training module is configured to train the image compression model according to the loss value until a training stop condition is reached.
23. A training device for an image compression model, comprising: An interface display module, configured to display an image input interface to the user based on the user's model training request; A receiving module, configured to receive a sample image, a target bit rate parameter and a target full connection parameter input by the user based on the image input interface, wherein the target bit rate parameter is a position parameter of the bit rate in the bit rate control interval, and the target full connection parameter is a parameter for determining the interpolation bit rate; An input module, configured to input the sample image, the target bit rate parameter and the target full connection parameter into the image compression model to be trained, to obtain a target image corresponding to the sample image; The input module comprises: A determination submodule is configured to determine a target bit rate according to the target bit rate parameter and the target full connection parameter, wherein the target bit rate is an interpolated variable bit rate corresponding to the target bit rate parameter and the target full connection parameter; An encoding submodule, configured to input the sample image and the target bit rate into an encoder to obtain an image feature vector corresponding to the sample image; A decoding submodule, configured to input the image feature vector and the target bit rate into a decoder to obtain a target image corresponding to the sample image; A calculation module, configured to calculate a loss value according to the sample image and the target image; A training module is configured to train the image compression model according to the loss value until a training stop condition is reached.
24. A training device for an image compression model, comprising: A request receiving module is configured to receive a model training request sent by a user, wherein the model training request carries a sample image, a target bit rate parameter and a target full connection parameter, wherein the target bit rate parameter is a position parameter of the bit rate in the bit rate control interval, and the target full connection parameter is a parameter for determining the interpolation bit rate; An input module, configured to input the sample image, the target bit rate parameter and the target full connection parameter into the image compression model to be trained, to obtain a target image corresponding to the sample image; The input module comprises: A determination submodule is configured to determine a target bit rate according to the target bit rate parameter and the target full connection parameter, wherein the target bit rate is an interpolated variable bit rate corresponding to the target bit rate parameter and the target full connection parameter; An encoding submodule, configured to input the sample image and the target bit rate into an encoder to obtain an image feature vector corresponding to the sample image; A decoding submodule, configured to input the image feature vector and the target bit rate into a decoder to obtain a target image corresponding to the sample image; A calculation module, configured to calculate a loss value according to the sample image and the target image; A training module is configured to train the image compression model according to the loss value until a training stop condition is reached.
25. An image compression device, comprising: An acquisition module is configured to acquire an image to be compressed and an image compression requirement of the image to be compressed; A determination module is configured to determine a target bit rate parameter and a target full connection parameter according to the image compression requirement, wherein the target bit rate parameter is a position parameter of the bit rate in the bit rate control interval, and the target full connection parameter is a parameter for determining the interpolation bit rate; A compression module, configured to input the image to be compressed, the target bit rate parameter and the target full connection parameter into an image compression model to obtain a compressed image corresponding to the image to be compressed; The compression module comprises: A determination submodule is configured to determine a target bit rate according to the target bit rate parameter and the target full connection parameter, wherein the target bit rate is an interpolated variable bit rate corresponding to the target bit rate parameter and the target full connection parameter; The encoding submodule is configured to input the image to be compressed and the target bit rate into an encoder to obtain an image feature vector corresponding to the image to be compressed; The decoding submodule is configured to input the image feature vector and the target bit rate into a decoder to obtain a compressed image corresponding to the image to be compressed.
26. An image compression device, comprising: An interface display module, configured to display an image input interface to the user based on a user's call request; A receiving module, configured to receive the image to be compressed and the image compression requirement of the image to be compressed input by the user based on the image input interface; A determination module is configured to determine a target bit rate parameter and a target full connection parameter according to the image compression requirement, wherein the target bit rate parameter is a position parameter of the bit rate in the bit rate control interval, and the target full connection parameter is a parameter for determining the interpolation bit rate; A compression module, configured to input the image to be compressed, the target bit rate parameter and the target full connection parameter into an image compression model to obtain a compressed image corresponding to the image to be compressed; The compression module comprises: A determination submodule is configured to determine a target bit rate according to the target bit rate parameter and the target full connection parameter, wherein the target bit rate is an interpolated variable bit rate corresponding to the target bit rate parameter and the target full connection parameter; The encoding submodule is configured to input the image to be compressed and the target bit rate into an encoder to obtain an image feature vector corresponding to the image to be compressed; The decoding submodule is configured to input the image feature vector and the target bit rate into a decoder to obtain a compressed image corresponding to the image to be compressed.
27. An image compression device, comprising: A request receiving module is configured to receive a call request sent by a user, wherein the call request carries an image to be compressed and an image compression requirement of the image to be compressed; A determination module is configured to determine a target bit rate parameter and a target full connection parameter according to the image compression requirement, wherein the target bit rate parameter is a position parameter of the bit rate in the bit rate control interval, and the target full connection parameter is a parameter for determining the interpolation bit rate; A compression module, configured to input the image to be compressed, the target bit rate parameter and the target full connection parameter into an image compression model to obtain a compressed image corresponding to the image to be compressed; The compression module comprises: A determination submodule is configured to determine a target bit rate according to the target bit rate parameter and the target full connection parameter, wherein the target bit rate is an interpolated variable bit rate corresponding to the target bit rate parameter and the target full connection parameter; The encoding submodule is configured to input the image to be compressed and the target bit rate into an encoder to obtain an image feature vector corresponding to the image to be compressed; The decoding submodule is configured to input the image feature vector and the target bit rate into a decoder to obtain a compressed image corresponding to the image to be compressed.
28. A computing device comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, wherein when the processor executes the computer-executable instructions, it implements the training method of the image compression model described in any one of claims 1-9 or 10 or 11 or the steps of the image compression method described in any one of 12-19 or 20 or 21.
29. A computer-readable storage medium storing computer instructions, which, when executed by a processor, implement the training method of the image compression model described in any one of claims 1-9 or 10 or 11 or the steps of the image compression method described in any one of claims 12-19 or 20 or 21.
