Image compression method, device, electronic equipment and computer readable medium

By using an adaptive coding parameter prediction model to compress images, the problem of over-compression caused by the failure to consider differences in image features in existing technologies is solved, and better image compression results are achieved.

CN119420932BActive Publication Date: 2025-11-04ZHONGXING ELECTRONICS CO LTD +2
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411550262.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-01
Publication Date
2025-11-04
Estimated Expiration
2044-11-01

AI Technical Summary

Technical Problem

In the existing technology, when compressing images based on preset encoding parameters, the feature differences between different images are not taken into account, resulting in over-compression of images with more complex features, loss of important details, and a large degree of blurring or distortion in the compressed image.

Method used

By acquiring an initial coding parameter prediction training set, updating the coding parameter prediction samples, training the coding parameter prediction model, generating adaptive coding parameter information, and adaptively compressing the image based on image feature information and quality score information.

Benefits of technology

It reduces the possibility of over-compression of images, effectively preserves the complex details of image features, and reduces the degree of blurring or distortion of compressed images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119420932B_ABST
    Figure CN119420932B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure disclose an image compression method, device, electronic equipment and computer readable medium. A specific implementation of the method comprises: obtaining an initial encoding parameter prediction training set; updating each initial encoding parameter prediction sample in each initial encoding parameter prediction sample to obtain an encoding parameter prediction sample; determining each obtained encoding parameter prediction sample as an updated encoding parameter prediction training set; training an encoding parameter prediction network to obtain a trained encoding parameter prediction model; obtaining a to-be-encoded image; generating image feature information and image quality score information corresponding to the to-be-encoded image; inputting the image feature information and the image quality score information into the encoding parameter prediction model to obtain adaptive encoding parameter information corresponding to the to-be-encoded image; and compressing the to-be-encoded image based on the adaptive encoding parameter information. The implementation reduces the blur or distortion degree of the compressed image.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present disclosure relate to the field of computer technology, and particularly to an image compression method and device, electronic equipment and computer readable medium. BACKGROUND

[0002] Image compression is a technology for compressing and encoding an image. At present, when compressing and encoding an image, a commonly used manner is to compress and encode a to-be-encoded image according to preset encoding parameter information (quantization parameter QP value).

[0003] However, when the image is compressed and encoded in the above manner, the following technical problems often exist:

[0004] The to-be-encoded image is compressed and encoded according to preset encoding parameter information (preset QP value). Different images have large feature differences, and the preset QP value fails to consider different image features (such as texture complexity and edge details) of different images. Therefore, when an image with more complex image features is compressed using the fixed preset encoding parameter information (preset QP value), the image may be excessively compressed, important details may be lost, and the compressed image may have a large degree of blurring or distortion.

[0005] The above information disclosed in the background section is only intended to enhance the understanding of the background of the present inventive concept, and therefore, it can include information that does not form the prior art known to those of ordinary skill in the art. SUMMARY

[0006] The summary section is provided to introduce concepts briefly in a simplified form, which will be described in detail in the specific embodiments section. The summary section is not intended to identify key or essential features of the claimed technology nor is it intended to be used to limit the scope of the claimed technology.

[0007] Some embodiments of the present disclosure provide an image compression method, device, electronic equipment and computer readable medium to solve one or more of the technical problems mentioned in the background section.

[0008] In a first aspect, some embodiments of the present disclosure provide an image compression method, which comprises: obtaining an initial encoding parameter prediction training set, wherein the initial encoding parameter prediction training set comprises a plurality of initial encoding parameter prediction samples, each of the initial encoding parameter prediction samples comprises a sample to-be-encoded image and a plurality of preset encoding parameter information; performing update processing on each of the initial encoding parameter prediction samples to obtain an encoding parameter prediction sample; determining the obtained encoding parameter prediction samples as an updated encoding parameter prediction training set; training an encoding parameter prediction network according to the updated encoding parameter prediction training set to obtain a trained encoding parameter prediction model; obtaining a to-be-encoded image; generating image feature information and image quality score information corresponding to the to-be-encoded image based on the to-be-encoded image; inputting the image feature information and the image quality score information into the encoding parameter prediction model to obtain adaptive encoding parameter information corresponding to the to-be-encoded image; and performing compression processing on the to-be-encoded image based on the adaptive encoding parameter information to obtain a compressed image.

[0009] In a second aspect, some embodiments of the present disclosure provide an image compression device, which comprises: a first obtaining unit configured to obtain an initial encoding parameter prediction training set, wherein the initial encoding parameter prediction training set comprises a plurality of initial encoding parameter prediction samples, each of the initial encoding parameter prediction samples comprises a sample to-be-encoded image and a plurality of preset encoding parameter information; an updating unit configured to perform update processing on each of the initial encoding parameter prediction samples to obtain an encoding parameter prediction sample; a determining unit configured to determine the obtained encoding parameter prediction samples as an updated encoding parameter prediction training set; a training unit configured to train an encoding parameter prediction network according to the updated encoding parameter prediction training set to obtain a trained encoding parameter prediction model; a second obtaining unit configured to obtain a to-be-encoded image; a generating unit configured to generate image feature information and image quality score information corresponding to the to-be-encoded image based on the to-be-encoded image; an input unit configured to input the image feature information and the image quality score information into the encoding parameter prediction model to obtain adaptive encoding parameter information corresponding to the to-be-encoded image; and a compression processing unit configured to perform compression processing on the to-be-encoded image based on the adaptive encoding parameter information to obtain a compressed image.

[0010] In a third aspect, some embodiments of the present disclosure provide an electronic device, which comprises: one or more processors; and a storage device having one or more programs stored thereon, when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any of the implementation manners of the first aspect.

[0011] In a fourth aspect, some embodiments of the present disclosure provide a computer readable medium having stored thereon a computer program, wherein the program, when executed by a processor, implements the method described in any implementation manner of the first aspect.

[0012] The above various embodiments of the present disclosure have the following beneficial effects: through the image compression method of some embodiments of the present disclosure, the blurring or distortion degree of the compressed image is reduced. Specifically, the reason why the blurring or distortion degree of the compressed image is large is that the preset encoding parameter information (preset QP value) is used to compress and encode the to-be-encoded image, the characteristics of different images are quite different, and the preset QP value fails to consider the different image characteristics (such as texture complexity and edge details) of different images. Therefore, when the image with more complex image characteristics is compressed using the fixed preset encoding parameter information (preset QP value), the image may be excessively compressed, important details may be lost, and the blurring or distortion degree of the compressed image is large. Based on this, the image compression method of some embodiments of the present disclosure first acquires an initial encoding parameter prediction training set, wherein the initial encoding parameter prediction training set includes various initial encoding parameter prediction samples, and each initial encoding parameter prediction sample includes a sample to-be-encoded image and various preset encoding parameter information. In this way, the initial encoding parameter prediction training set used to generate an updated encoding parameter prediction training set can be obtained. Then, each initial encoding parameter prediction sample in the various initial encoding parameter prediction samples is updated to obtain an encoding parameter prediction sample. Next, the various encoding parameter prediction samples obtained are determined as the updated encoding parameter prediction training set. In this way, the updated encoding parameter prediction training set used to train the encoding parameter prediction network can be obtained. Then, the encoding parameter prediction network is trained according to the updated encoding parameter prediction training set to obtain a trained encoding parameter prediction model. In this way, the encoding parameter prediction model used to predict the encoding parameter information (preset QP value) suitable for the to-be-encoded image according to the characteristic information and the image quality score of the to-be-encoded image can be obtained. Then, the to-be-encoded image is acquired. In this way, the to-be-encoded image can be obtained. Then, the image characteristic information corresponding to the to-be-encoded image and the image quality score information are generated based on the to-be-encoded image. In this way, the image characteristic information representing the characteristics of the to-be-encoded image and the image quality score information representing the image quality of the to-be-encoded image can be obtained. Then, the image characteristic information and the image quality score information are input into the encoding parameter prediction model to obtain adaptive encoding parameter information corresponding to the to-be-encoded image. In this way, the adaptive encoding parameter information suitable for the compression of the to-be-encoded image can be predicted according to the image characteristic information and the image quality score information before encoding. Finally, the to-be-encoded image is compressed based on the adaptive encoding parameter information to obtain a compressed image. In this way, the adaptive encoding parameter information suitable for the compression of the to-be-encoded image can be predicted to compress the to-be-encoded image.The image to be compressed is compressed by adaptive coding parameter information suitable for image compression to be coded, which reduces the possibility of over-compression of images with more complex image features, effectively retains the details of images with more complex image features in the compression process, and reduces the blurring or distortion degree of the compressed image. BRIEF DESCRIPTION OF DRAWINGS

[0013] The above and other features, advantages and aspects of embodiments of the present disclosure will become more apparent by describing in detail some embodiments thereof with reference to the attached drawings in which:

[0014] Figure 1 is a flow chart of some embodiments of the image compression method according to the present disclosure;

[0015] Figure 2 is a structural schematic diagram of some embodiments of the image compression apparatus according to the present disclosure;

[0016] Figure 3 is a structural schematic diagram of an electronic device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION

[0017] Embodiments of the present disclosure will be described below in more detail with reference to the accompanying drawings. Although some embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms, and should not be interpreted as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes, and are not intended to limit the scope of protection of the present disclosure.

[0018] It should also be noted that, for ease of description, only the parts related to the present application are shown in the drawings. The embodiments in the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0019] It should be noted that the terms "first", "second", etc. mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not intended to limit the order or interdependence of the functions performed by these devices, modules or units.

[0020] It should be noted that the adjectives "one", "multiple" mentioned in the present disclosure are illustrative and not limiting, and those skilled in the art should understand that, unless otherwise explicitly stated in the context, it should be understood as "one or more".

[0021] Names of messages or information exchanged between a plurality of devices in the embodiments of the present disclosure are merely for illustrative purposes, and are not intended to limit the scope of the messages or information.

[0022] The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.

[0023] Figure 1 A flow 100 of some embodiments of the image compression method according to the present disclosure is shown. The image compression method comprises the following steps:

[0024] In step 101, an initial encoding parameter prediction training set is obtained.

[0025] In some embodiments, an execution subject (for example, a computing device) of the image compression method can obtain an initial encoding parameter prediction training set. The initial encoding parameter prediction training set comprises a plurality of initial encoding parameter prediction samples, and each initial encoding parameter prediction sample comprises a sample to-be-encoded image and a plurality of preset encoding parameter information. In practice, the execution subject can obtain the initial encoding parameter prediction training set from a preset database. The sample to-be-encoded image can be an image used for training an encoding parameter prediction model. Each preset encoding parameter information in the plurality of preset encoding parameter information can be a preset encoding parameter value used for compressing the sample to-be-encoded image. The encoding parameter value can be a QP (Quantizer Parameter) quantization parameter. The encoding parameter prediction model can be a deep Q-network (DQN) model that takes image feature information and image quality score information as input and takes encoding parameter information as output. The image feature information can be a vector representing the image features of the to-be-encoded image. The image quality score information can represent the image quality score of the to-be-encoded image before encoding. The image quality score is used to measure the clarity, details, and other features of the image.

[0026] In step 102, each initial encoding parameter prediction sample in the plurality of initial encoding parameter prediction samples is updated to obtain an encoding parameter prediction sample.

[0027] In some embodiments, the execution subject can update each initial encoding parameter prediction sample in the plurality of initial encoding parameter prediction samples to obtain an encoding parameter prediction sample.

[0028] In some optional implementations of some embodiments, the execution subject can update each initial encoding parameter prediction sample in the plurality of initial encoding parameter prediction samples to obtain an encoding parameter prediction sample by the following steps:

[0029] In a first step, a quality score and image feature information corresponding to the sample to-be-encoded image are generated based on the initial encoding parameter prediction sample and the sample to-be-encoded image.

[0030] In a second step, target encoding parameter information corresponding to the sample to-be-encoded image is generated based on the initial encoding parameter prediction sample, each preset encoding parameter information, and the sample to-be-encoded image. The target encoding parameter information can be a QP quantization parameter corresponding to an inflection point of a balance between a quality score and a QP quantization parameter on a curve in which a compressed image quality score decreases with an increase in the QP quantization parameter within a range of a minimum QP quantization parameter and a maximum QP quantization parameter corresponding to each preset encoding parameter information. The inflection point can be a point at which a curve always remains concave and a slope significantly slows down.

[0031] In a third step, the initial encoding parameter prediction sample is updated based on the quality score of the sample to-be-encoded image, the image feature information, and the target encoding parameter information to obtain an encoding parameter prediction sample.

[0032] In some optional implementations of some embodiments, the execution subject can generate target encoding parameter information corresponding to the sample to-be-encoded image based on the initial encoding parameter prediction sample and the sample to-be-encoded image by the following steps:

[0033] In a first step, each encoding parameter value included in each preset encoding parameter information is sorted to obtain an encoding parameter sequence. In practice, the execution subject can sort each encoding parameter value included in each preset encoding parameter information in ascending order or descending order to obtain an encoding parameter sequence.

[0034] In a second step, for each encoding parameter in the encoding parameter sequence, the following steps are performed:

[0035] In a first sub-step, a sample compressed image is obtained by compressing the sample to-be-encoded image based on the encoding parameter. In practice, the execution subject can call a preset encoder to compress the sample to-be-encoded image according to the encoding parameter to obtain a compressed image as a sample compressed image. For example, the preset encoder can be an x264 encoder.

[0036] In a second sub-step, the sample compressed image is subjected to image quality detection processing to obtain a sample image quality score. In practice, the execution subject can subject the sample compressed image to image quality detection processing through an image quality assessment (IQA) technique to obtain a sample image quality score. Alternatively, the execution subject can also input the sample compressed image into a pre-trained image quality assessment model to obtain a sample image quality score. The image quality assessment model can be a BRISQUE model that takes an image as input and outputs an image quality score.

[0037] In a third sub-step, the encoding parameter and the sample image quality score are determined as a first value of a coordinate point and a second value of the coordinate point, respectively, to obtain encoding quality point coordinate information corresponding to the encoding parameter. As an example, the encoding quality point coordinate information can be "(20, 75)". The first value (encoding parameter) can be "20" in the "(20, 75)", and the second value (sample image quality score) can be "75" in the "(20, 75)".

[0038] In a third step, based on the obtained respective encoding quality point coordinate information, an encoding quality point coordinate information sequence is generated.

[0039] In a fourth step, respective encoding quality points corresponding to the encoding quality point coordinate information sequence are fitted into an encoding parameter quality curve. In practice, the execution subject can call a polyfit function to fit the respective encoding quality points in the encoding quality point coordinate information sequence into an encoding parameter quality curve.

[0040] In a fifth step, coordinate information corresponding to an inflection point in the encoding parameter quality curve is determined as target encoding quality point coordinate information. The inflection point can be a point at which the curve always remains concave and the slope significantly slows down.

[0041] In a sixth step, a first value in the target encoding quality point coordinate information is determined as target encoding parameter information.

[0042] In some optional implementations of some embodiments, the execution subject can update the initial encoding parameter prediction sample based on the quality score of the sample to-be-encoded image, the image feature information, and the target encoding parameter information to obtain an encoding parameter prediction sample through the following steps:

[0043] In a first step, the respective preset encoding parameter information in the initial encoding parameter prediction sample is deleted, and the quality score, the image feature information, and the target encoding parameter information are added to the initial encoding parameter prediction sample to update the initial encoding parameter prediction sample.

[0044] Secondly, the updated initial encoding parameter prediction sample is determined as the encoding parameter prediction sample.

[0045] In some optional implementations of some embodiments, the execution subject can generate the encoding quality point coordinate information sequence based on the obtained various encoding quality point coordinate information by the following steps:

[0046] Firstly, the various encoding quality point coordinate information is arranged according to the order of the various encoding parameters corresponding to the various encoding quality point coordinate information in the encoding parameter sequence, to obtain the encoding quality point coordinate information sequence.

[0047] Step 103, the obtained various encoding parameter prediction samples are determined as the updated encoding parameter prediction training set.

[0048] In some embodiments, the execution subject can determine the obtained various encoding parameter prediction samples as the updated encoding parameter prediction training set.

[0049] Step 104, the encoding parameter prediction network is trained according to the updated encoding parameter prediction training set, to obtain the trained encoding parameter prediction model.

[0050] In some embodiments, the execution subject can train the encoding parameter prediction network according to the updated encoding parameter prediction training set, to obtain the trained encoding parameter prediction model. In practice, the execution subject can train the encoding parameter prediction network by taking the updated encoding parameter prediction training set as the training data by using the Q-learning algorithm, to obtain the trained encoding parameter prediction model. The encoding parameter prediction network can be a deep Q network (DQN) taking the quality score and the image feature information included in the encoding parameter prediction sample as the input and taking the predicted encoding parameter information as the output.

[0051] Step 105, a to-be-encoded image is obtained.

[0052] In some embodiments, the execution subject can obtain the to-be-encoded image. In practice, the execution subject can obtain the to-be-encoded image from a preset file. The preset file can be an image file used to store the to-be-encoded image. For example, the image file can be but is not limited to one of the following: a JPEG file, a PNG file.

[0053] Step 106, based on the to-be-encoded image, the image feature information and the image quality score information corresponding to the to-be-encoded image are generated.

[0054] In some embodiments, the execution subject can generate image feature information and image quality score information corresponding to the to-be-encoded image based on the to-be-encoded image.

[0055] In the process of solving the problems mentioned in the background by adopting the technical solutions, the following problems are often accompanied:

[0056] Before compressing the to-be-encoded image, feature extraction and quality detection need to be performed on the to-be-encoded image to obtain image feature information and image quality score information of the to-be-encoded image. However, directly performing quality detection on the entire to-be-encoded image may ignore local details and quality differences in the image, resulting in low accuracy of the image quality score information, and further resulting in poor image compression effect (if the quality score accuracy is poor, the predicted encoding parameter information (preset QP value) may be large, and thus the image may be excessively compressed, resulting in poor image compression effect).

[0057] In the face of the above technical problems, the inventors considered the shortcomings of directly performing quality detection on the entire to-be-encoded image to obtain image quality score information, and combined the image quality detection advantages possessed by the company where the inventors work, and decided to adopt the following solutions:

[0058] In some optional implementations of some embodiments, the execution subject can generate image feature information and image quality score information corresponding to the to-be-encoded image based on the to-be-encoded image by the following steps:

[0059] Firstly, the to-be-encoded image is input into a feature extraction layer of a pre-trained image feature extraction model to obtain feature extraction information corresponding to the to-be-encoded image. The image feature extraction model includes the feature extraction layer, an activation layer, a pooling layer, a flattening layer, and a full connection layer. The feature extraction layer can be a convolutional layer (Convolutional layer) that takes the to-be-encoded image as input and outputs feature extraction information. The feature extraction information can be a feature map obtained after performing a convolution operation on the to-be-encoded image. The feature map can represent image features (such as edge, texture, shape, etc.) of the to-be-encoded image.

[0060] Secondly, the feature extraction information is input into the activation layer to obtain activated feature extraction information. The activation layer can be an activation layer that takes the feature map of the to-be-encoded image as input and outputs activated feature extraction information. The activated feature extraction information can be a feature map processed by an activation function (such as ReLU).

[0061] Thirdly, the activated feature extraction information is input into the pooling layer to obtain pooled feature extraction information. The pooled feature extraction information can be a feature map processed by a pooling operation.

[0062] In the fourth step, the pooling feature extraction information is input into the flattening layer to obtain fusion feature information. The flattening layer can be a flatten layer taking the pooling feature extraction information as input and outputting the fusion feature information. The flattening layer can convert the feature map into a one-dimensional vector. The fusion feature information can be a one-dimensional vector representing image features.

[0063] In the fifth step, the fusion feature information is input into the fully connected layer to obtain image feature information corresponding to the image to be encoded.

[0064] In the sixth step, the area of the image to be encoded is determined as the total area to be divided.

[0065] In the seventh step, in response to determining that the total area to be divided can be evenly divided by the preset division area, the image to be encoded is divided into each division image block with an area of the preset division area and without overlapping images.

[0066] In the eighth step, in response to determining that the total area to be divided cannot be evenly divided by the preset division area, the image to be encoded is subjected to sliding window division processing based on the preset sliding window length, the preset sliding window width, the preset horizontal sliding step length, and the preset vertical sliding step length to obtain each division image block. In practice, the execution subject can execute a pre-packaged division method to divide the image to be encoded based on the sliding window length, the sliding window width, the horizontal sliding step length, and the vertical sliding step length to obtain each division image block. Among the division image blocks obtained by sliding window division, there are overlapping areas.

[0067] In the ninth step, for each division image block obtained, the following steps are performed:

[0068] In the first sub-step, the division image block is subjected to frequency domain conversion processing to obtain frequency domain matrix information corresponding to the division image block. In practice, the execution subject can perform frequency domain conversion processing on the division image block by DCT transformation technology to obtain frequency domain matrix information corresponding to the division image block. The frequency domain matrix information can be a discrete cosine transformation coefficient matrix.

[0069] In the second sub-step, the frequency domain matrix information is input into a pre-trained image quality evaluation model to obtain an image block quality score corresponding to the division image block.

[0070] In the tenth step, based on the obtained image block quality scores, image quality score information corresponding to the image to be encoded is generated. In practice, the execution subject can determine the mean of the obtained image block quality scores as the image quality score information corresponding to the image to be encoded.

[0071] The technical solution combines steps 107 and 108 and related content as an invention point of an embodiment of the present disclosure, solves the technical problem of "poor image compression effect", and the factors leading to poor image compression effect are often as follows: before compressing the to-be-encoded image, feature extraction and quality detection need to be performed on the to-be-encoded image to obtain image feature information and image quality score information of the to-be-encoded image. However, directly performing quality detection on the entire to-be-encoded image may ignore local details and quality differences in the image, resulting in low accuracy of the image quality score information, and further resulting in poor image compression effect (if the quality score accuracy is poor, the predicted encoding parameter information (preset QP value) may be large, and further the image may be compressed too much, resulting in poor image compression effect). If the above factors are solved, the image compression effect can be improved. In order to achieve this effect, first, the to-be-encoded image is input to a feature extraction layer of a pre-trained image feature extraction model to obtain feature extraction information corresponding to the to-be-encoded image. The image feature extraction model includes the feature extraction layer, an activation layer, a pooling layer, a flattening layer, and a full connection layer. Then, the feature extraction information is input to the activation layer to obtain activated feature extraction information. Then, the activated feature extraction information is input to the pooling layer to obtain pooled feature extraction information. Then, the pooled feature extraction information is input to the flattening layer to obtain fused feature information. Then, the fused feature information is input to the full connection layer to obtain image feature information corresponding to the to-be-encoded image. In this way, the feature extraction of the to-be-encoded image can be performed through the above steps to obtain image feature information for subsequent image compression. Then, the area of the to-be-encoded image is determined as a total area to be divided. In this way, the total area to be divided for dividing the to-be-encoded image can be obtained. Then, in response to determining that the total area to be divided can be divided by a preset division area, the to-be-encoded image is divided into each division image block with an area of the preset division area and without overlapping images. In this way, the to-be-encoded image can be divided without overlapping to obtain each image block. Then, in response to determining that the total area to be divided cannot be divided by the preset division area, a sliding window division processing is performed on the to-be-encoded image based on the preset sliding window length, the preset sliding window width, the preset horizontal sliding step length, and the preset vertical sliding step length to obtain each division image block. In this way, the to-be-encoded image can be divided with overlapping. Then, for each division image block in the obtained each division image block, the following steps are performed: a first sub-step of performing frequency domain conversion processing on the division image block to obtain frequency domain matrix information corresponding to the division image block. In this way, the frequency domain matrix information for predicting the image quality of the division image block can be obtained. A second sub-step of inputting the frequency domain matrix information to a pre-trained image quality evaluation model to obtain an image block quality score corresponding to the division image block.Thus, the image block quality score prediction of the divided image blocks can be performed. Then, based on the obtained image block quality scores, the image quality score information corresponding to the to-be-encoded image is generated. Thus, the image quality score information of the to-be-encoded image can be generated based on the image block quality scores. The block prediction of the to-be-encoded image can more accurately capture local details and local quality differences, thereby improving the accuracy of the generated image quality score information. In combination with step 107, the image feature information and the image quality score information are input into the encoding parameter prediction model to obtain the adaptive encoding parameter information corresponding to the to-be-encoded image. Thus, the encoding parameter information (preset QP value) can be predicted based on the more accurate image quality score information, and the adaptive encoding parameter information with higher accuracy and more suitable for the to-be-encoded image is obtained. In combination with step 108, the to-be-encoded image is compressed based on the adaptive encoding parameter information to obtain a compressed image. Thus, the to-be-encoded image can be compressed according to the adaptive encoding parameter information with higher accuracy and more suitable for the to-be-encoded image, the possibility of over-compression of the to-be-encoded image is reduced, and the image compression effect of the to-be-encoded image is improved.

[0072] Step 107: inputting the image feature information and the image quality score information into the encoding parameter prediction model to obtain adaptive encoding parameter information corresponding to the to-be-encoded image.

[0073] In some embodiments, the execution subject can input the image feature information and the image quality score information into the encoding parameter prediction model to obtain adaptive encoding parameter information corresponding to the to-be-encoded image.

[0074] Step 108: compressing the to-be-encoded image based on the adaptive encoding parameter information to obtain a compressed image.

[0075] In some embodiments, the execution subject can compress the to-be-encoded image based on the adaptive encoding parameter information to obtain a compressed image.

[0076] In some optional implementations of some embodiments, the execution subject can compress the to-be-encoded image based on the adaptive encoding parameter information to obtain a compressed image by the following steps:

[0077] First, a preset encoder is called to compress the to-be-encoded image according to the adaptive encoding parameter information to obtain a compressed image. The preset encoder can be an x264 encoder.

[0078] The above various embodiments of the present disclosure have the following beneficial effects: through the image compression method of some embodiments of the present disclosure, the blurring or distortion degree of the compressed image is reduced. Specifically, the reason why the blurring or distortion degree of the compressed image is large is that the preset encoding parameter information (preset QP value) is used to compress and encode the to-be-encoded image, the characteristics of different images are quite different, and the preset QP value fails to consider the different image characteristics (such as texture complexity and edge details) of different images. Therefore, when the image with more complex image characteristics is compressed using the fixed preset encoding parameter information (preset QP value), the image may be excessively compressed, important details may be lost, and the blurring or distortion degree of the compressed image is large. Based on this, the image compression method of some embodiments of the present disclosure first acquires an initial encoding parameter prediction training set, wherein the initial encoding parameter prediction training set includes various initial encoding parameter prediction samples, and each initial encoding parameter prediction sample includes a sample to-be-encoded image and various preset encoding parameter information. In this way, the initial encoding parameter prediction training set used to generate an updated encoding parameter prediction training set can be obtained. Then, each initial encoding parameter prediction sample in the various initial encoding parameter prediction samples is updated to obtain an encoding parameter prediction sample. Next, the various encoding parameter prediction samples obtained are determined as the updated encoding parameter prediction training set. In this way, the updated encoding parameter prediction training set used to train the encoding parameter prediction network can be obtained. Then, the encoding parameter prediction network is trained according to the updated encoding parameter prediction training set to obtain a trained encoding parameter prediction model. In this way, the encoding parameter prediction model used to predict the encoding parameter information (preset QP value) suitable for the to-be-encoded image according to the characteristic information and the image quality score of the to-be-encoded image can be obtained. Then, the to-be-encoded image is acquired. In this way, the to-be-encoded image can be obtained. Then, the image characteristic information corresponding to the to-be-encoded image and the image quality score information are generated based on the to-be-encoded image. In this way, the image characteristic information representing the characteristics of the to-be-encoded image and the image quality score information representing the image quality of the to-be-encoded image can be obtained. Then, the image characteristic information and the image quality score information are input into the encoding parameter prediction model to obtain adaptive encoding parameter information corresponding to the to-be-encoded image. In this way, the adaptive encoding parameter information suitable for the compression of the to-be-encoded image can be predicted according to the image characteristic information and the image quality score information before encoding. Finally, the to-be-encoded image is compressed based on the adaptive encoding parameter information to obtain a compressed image. In this way, the adaptive encoding parameter information suitable for the compression of the to-be-encoded image can be predicted to compress the to-be-encoded image.By using the adaptive encoding parameter information suitable for the image compression to be encoded, the image to be encoded is compressed, the possibility of over-compression of the image with more complex image features is reduced, the details of the image with more complex image features in the compression process are effectively preserved, and the blurring or distortion degree of the compressed image is reduced.

[0079] Further referring to Figure 2 , as an implementation of the method shown in each figure, the disclosure provides some embodiments of an image compression device, which device embodiments correspond to those method embodiments, and the device can be specifically applied to various electronic devices. Figure 1

[0080] As shown in Figure 2 , the image compression device 200 of some embodiments includes a first acquisition unit 201, an update unit 202, a determination unit 203, a training unit 204, a second acquisition unit 205, a generation unit 206, an input unit 207, and a compression processing unit 208. The first acquisition unit 201 is configured to acquire an initial encoding parameter prediction training set, wherein the initial encoding parameter prediction training set includes each initial encoding parameter prediction sample, and each initial encoding parameter prediction sample includes a sample image to be encoded and each preset encoding parameter information. The update unit 202 is configured to update each initial encoding parameter prediction sample in the initial encoding parameter prediction training set to obtain an encoding parameter prediction sample. The determination unit 203 is configured to determine each encoding parameter prediction sample obtained as an updated encoding parameter prediction training set. The training unit 204 is configured to train an encoding parameter prediction network according to the updated encoding parameter prediction training set to obtain a trained encoding parameter prediction model. The second acquisition unit 205 is configured to acquire an image to be encoded. The generation unit 206 is configured to generate image feature information and image quality score information corresponding to the image to be encoded based on the image to be encoded. The input unit 207 is configured to input the image feature information and the image quality score information into the encoding parameter prediction model to obtain adaptive encoding parameter information corresponding to the image to be encoded. The compression processing unit 208 is configured to compress the image to be encoded based on the adaptive encoding parameter information to obtain a compressed image.

[0081] It can be understood that the units recorded in the device 200 correspond to each step in the method described with reference to Figure 1 . Therefore, the operations, features and beneficial effects described above for the method also apply to the device 200 and the units contained therein, which will not be described here.

[0082] The following refers to Figure 3 ​It shows a schematic diagram of the structure of an electronic device 300 suitable for implementing some embodiments of the present disclosure. Figure 3 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments of this disclosure.

[0083] like Figure 3 As shown, the electronic device 300 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 302 or a program loaded from a storage device 308 into a random access memory (RAM) 303. The RAM 303 also stores various programs and data required for the operation of the electronic device 300. The processing unit 301, ROM 302, and RAM 303 are interconnected via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.

[0084] Typically, the following devices can be connected to I / O interface 305: input devices 306 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 307 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 308 including, for example, magnetic tapes, hard disks, etc.; and communication devices 309. Communication device 309 allows electronic device 300 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 3 An electronic device 300 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively. Figure 3 Each box shown can represent a device or multiple devices as needed.

[0085] In particular, according to some embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, some embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 309, or installed from storage device 308, or installed from ROM 302. When the computer program is executed by processing device 301, it performs the functions defined in the methods of some embodiments of this disclosure.

[0086] Note that the computer-readable medium in some embodiments of the present disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination thereof. The computer-readable storage medium may, for example and without limitation, be an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In some embodiments of the present disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program used by or in connection with an instruction execution system, apparatus, or device. In some embodiments of the present disclosure, the computer-readable signal medium can include a data signal propagated in baseband or propagated as a carrier wave in a propagated data signal, in which the computer-readable program code is contained. Such a propagated data signal can take a variety of forms, including but not limited to electro-magnetic, optical, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium that is not a storage medium and that can communicate, propagate, or transport program for use by or in connection with an instruction execution system, apparatus, or device. Program code contained in the computer-readable medium can be transmitted using any suitable medium, including but not limited to wire, cable, RF, etc., or any suitable combination of the foregoing.

[0087] In some embodiments, the client, server, or both can communicate using any current known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), the Internet, and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any current known or future developed networks.

[0088] The computer readable medium can be contained in the electronic device or exist separately from the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: obtain an initial encoding parameter prediction training set, wherein the initial encoding parameter prediction training set includes respective initial encoding parameter prediction samples, and each initial encoding parameter prediction sample includes a sample image to be encoded and respective preset encoding parameter information; perform update processing on each initial encoding parameter prediction sample to obtain an encoding parameter prediction sample; determine the obtained respective encoding parameter prediction samples as an updated encoding parameter prediction training set; train an encoding parameter prediction network based on the updated encoding parameter prediction training set to obtain a trained encoding parameter prediction model; obtain an image to be encoded; generate image feature information and image quality score information corresponding to the image to be encoded based on the image to be encoded; input the image feature information and the image quality score information into the encoding parameter prediction model to obtain adaptive encoding parameter information corresponding to the image to be encoded; and perform compression processing on the image to be encoded based on the adaptive encoding parameter information to obtain a compressed image.

[0089] Computer program code for carrying out operations of some embodiments of the disclosure can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).

[0090] The computer program product of the first aspect can include a computer readable storage medium. The computer readable storage medium can include instructions. The instructions can include one or both of: instructions for causing a computer to perform the operations of the method of the first aspect; and instructions for causing a computer to perform the operations of the method of the second aspect. The computer readable storage medium can include a computer readable storage medium as defined above. The computer readable storage medium can include one or both of: a computer readable storage medium that stores the instructions; and a computer readable storage medium that transmits the instructions. The computer readable storage medium can include one or both of: a computer readable storage medium that is further configured to, working with the computer program, cause the computer to perform the operations of the method of the first aspect; and a computer readable storage medium that is further configured to, working with the computer program, cause the computer to perform the operations of the method of the second aspect.

[0091] The units described in some embodiments of the present disclosure can be implemented by means of software, or can be implemented by hardware. The described units can also be provided in a processor, for example, can be described as: a processor comprising a first obtaining unit, an updating unit, a determining unit, a training unit, a second obtaining unit, a generating unit, an inputting unit and a compression processing unit. Among them, the names of these units do not constitute a limitation to the units themselves in some cases, for example, the determining unit can also be described as "a unit for determining the obtained each encoding parameter prediction sample as an updated encoding parameter prediction training set".

[0092] The functions described above in the present document can be performed, at least in part, by one or more hardware logic components. For example, and without limitation, example types of hardware logic components that can be used include Field-programmable Gate Arrays (FPGAs), Application-specific Integrated Circuits (ASICs), Application-specific Standard Products (ASSPs), System-on-a-chip systems (SOCs), Complex Programmable Logic Devices (CPLDs), etc.

[0093] The above description is merely some of the preferred embodiments of the present disclosure and a description of the principles of the technology used. Those skilled in the art should understand that the scope of the application involved in the embodiments of the present disclosure is not limited to the technical solutions formed by the specific combinations of technical features, and should also cover other technical solutions formed by any combination of technical features or their equivalent features without departing from the inventive concept. For example, the technical solutions formed by replacing the features with the technical features disclosed in the embodiments of the present disclosure (but not limited to) having similar functions.

Claims

1. An image compression method, comprising: obtaining an initial encoding parameter prediction training set, wherein the initial encoding parameter prediction training set comprises respective initial encoding parameter prediction samples, each of the respective initial encoding parameter prediction samples comprising a sample to-be-encoded image and respective preset encoding parameter information; updating each of the respective initial encoding parameter prediction samples to obtain an encoding parameter prediction sample, wherein the updating each of the respective initial encoding parameter prediction samples to obtain an encoding parameter prediction sample comprises: generating image feature information and a quality score corresponding to the sample to-be-encoded image based on the sample to-be-encoded image comprised in the initial encoding parameter prediction sample; generating target encoding parameter information corresponding to the sample to-be-encoded image based on the respective preset encoding parameter information comprised in the initial encoding parameter prediction sample and the sample to-be-encoded image; updating the initial encoding parameter prediction sample based on the quality score of the sample to-be-encoded image, the image feature information, and the target encoding parameter information to obtain an encoding parameter prediction sample; determining the obtained respective encoding parameter prediction samples as an updated encoding parameter prediction training set; training an encoding parameter prediction network based on the updated encoding parameter prediction training set to obtain a trained encoding parameter prediction model; obtaining a to-be-encoded image; generating image feature information and image quality score information corresponding to the to-be-encoded image based on the to-be-encoded image; inputting the image feature information and the image quality score information into the encoding parameter prediction model to obtain adaptive encoding parameter information corresponding to the to-be-encoded image; performing compression processing on the to-be-encoded image based on the adaptive encoding parameter information to obtain a compressed image.

2. The method of claim 1, wherein, Each of the respective preset encoding parameter information comprises an encoding parameter value, and the generating target encoding parameter information corresponding to the sample to-be-encoded image based on the respective preset encoding parameter information comprised in the initial encoding parameter prediction sample and the sample to-be-encoded image comprises: sorting the respective encoding parameter values comprised in the respective preset encoding parameter information to obtain an encoding parameter sequence; for each encoding parameter in the encoding parameter sequence, performing the following steps: performing compression processing on the sample to-be-encoded image based on the encoding parameter to obtain a sample compressed image; performing image quality detection processing on the sample compressed image to obtain a sample image quality score; determining the encoding parameter and the sample image quality score as a first value of a coordinate point and a second value of the coordinate point, respectively, to obtain encoding quality point coordinate information corresponding to the encoding parameter; generating an encoding quality point coordinate information sequence based on the obtained respective encoding quality point coordinate information; fitting the respective encoding quality point coordinates corresponding to the encoding quality point coordinate information sequence into an encoding parameter quality curve. determine the coordinate information corresponding to the inflection point in the encoding parameter quality curve as target encoding quality point coordinate information; determine a first value in the target encoding quality point coordinate information as target encoding parameter information.

3. The method of claim 1, wherein, The initial encoding parameter prediction sample is updated based on the quality score of the sample to-be-encoded image, the image feature information, and the target encoding parameter information, to obtain an encoding parameter prediction sample, including: Each preset encoding parameter information in the initial encoding parameter prediction sample is deleted, and the quality score, the image feature information, and the target encoding parameter information are added to the initial encoding parameter prediction sample, to update the initial encoding parameter prediction sample; The updated initial encoding parameter prediction sample is determined as the encoding parameter prediction sample.

4. The method of claim 2, wherein, Based on the obtained each encoding quality point coordinate information, an encoding quality point coordinate information sequence is generated, including: The each encoding quality point coordinate information is arranged according to the order of each encoding parameter corresponding to each encoding quality point coordinate information in the encoding parameter sequence, to obtain the encoding quality point coordinate information sequence.

5. The method of claim 1, wherein, The to-be-encoded image is compressed based on the adaptive encoding parameter information, to obtain a compressed image, including: A preset encoder is called to compress the to-be-encoded image based on the adaptive encoding parameter information, to obtain the compressed image.

6. An image compression device, including: A first obtaining unit configured to obtain an initial encoding parameter prediction training set, wherein the initial encoding parameter prediction training set includes each initial encoding parameter prediction sample, and each initial encoding parameter prediction sample includes a sample to-be-encoded image and each preset encoding parameter information; An updating unit configured to update each initial encoding parameter prediction sample in the each initial encoding parameter prediction sample to obtain an encoding parameter prediction sample, wherein the updating each initial encoding parameter prediction sample in the each initial encoding parameter prediction sample to obtain an encoding parameter prediction sample includes: generating a quality score and image feature information corresponding to the sample to-be-encoded image based on the sample to-be-encoded image included in the initial encoding parameter prediction sample; generating target encoding parameter information corresponding to the sample to-be-encoded image based on each preset encoding parameter information included in the initial encoding parameter prediction sample and the sample to-be-encoded image; and updating the initial encoding parameter prediction sample based on the quality score of the sample to-be-encoded image, the image feature information, and the target encoding parameter information to obtain the encoding parameter prediction sample; A determining unit configured to determine each obtained encoding parameter prediction sample as an updated encoding parameter prediction training set; A training unit configured to train an encoding parameter prediction network according to the updated encoding parameter prediction training set to obtain a trained encoding parameter prediction model; A second obtaining unit configured to obtain a to-be-encoded image; The generating unit is configured to generate image feature information and image quality score information corresponding to the image to be encoded based on the image to be encoded; The input unit is configured to input the image feature information and the image quality score information into the encoding parameter prediction model to obtain adaptive encoding parameter information corresponding to the image to be encoded; The compression processing unit is configured to perform compression processing on the image to be encoded based on the adaptive encoding parameter information to obtain a compressed image. 7.An electronic device, comprising: one or more processors; a memory device having stored thereon one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1-5.

8. A computer readable medium having stored thereon a computer program, wherein, The program is executed by the processor to implement the method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Content adaptive video coding method and device, equipment and storage medium

    CN114554211A