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

Through adaptive encoding parameter prediction technology, the encoding parameters are dynamically adjusted for the feature differences of different images, solving the problems of excessive compression and detail loss during image compression, and improving the compressed image quality.

CN119420932AActive Publication Date: 2025-02-11ZHONGXING ELECTRONICS CO LTD +2
View PDF 3 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In the prior art, when image compression, fixed preset encoding parameter information fails to take into account the feature differences of different images, resulting in overcompression of images with more complex image features, loss of important details, and blurring or distortion of compressed images.

Method used

By obtaining the initial coding parameter prediction training set, updating the coding parameter prediction sample, forming an updated coding parameter prediction training set, and training the coding parameter prediction network based on this, obtaining adaptive coding parameter information for compressing the image to be encoded.

Benefits of technology

The blur or distortion degree of compressed images is reduced, effectively retaining more complex image details of image features and avoiding excessive compression.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119420932A_ABST
    Figure CN119420932A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses an image compression method and device, electronic equipment and a computer readable medium. A specific embodiment of the method comprises the following steps: acquiring an initial coding parameter prediction training set; performing updating processing on each initial coding parameter prediction sample in each initial coding parameter prediction sample to obtain a coding parameter prediction sample; determining each obtained coding parameter prediction sample as an updated coding parameter prediction training set; training the coding parameter prediction network to obtain a trained coding parameter prediction model; obtaining a to-be-coded image; generating image feature information and image quality score information corresponding to the to-be-coded image; inputting the image feature information and the image quality scoring information into a coding parameter prediction model to obtain adaptive coding parameter information corresponding to the to-be-coded image; and performing compression processing on the to-be-coded image based on the adaptive coding parameter information. According to the embodiment, the blurring or distortion degree of the compressed image is reduced.
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 in particular to an image compression method, device, electronic device, and computer-readable medium. Background Art

[0002] Image compression is a technology for compressing and encoding images. At present, when compressing and encoding images, a common method is to compress and encode the image to be encoded according to preset encoding parameter information (quantization parameter QP value).

[0003] However, when the above method is used to compress and encode images, the following technical problems often occur:

[0004] The image to be encoded is compressed and encoded according to the preset encoding parameter information (preset QP value). The features of different images are quite different. The preset QP value fails to take into account the different image features of different images (such as texture complexity and edge details, etc.). Therefore, when using the fixed preset encoding parameter information (preset QP value) to compress images with more complex image features, the image may be over-compressed and important details may be lost, resulting in a greater degree of blur or distortion in the compressed image.

[0005] The above information disclosed in this Background section is only for enhancement of understanding of the background of the inventive concept and therefore it may contain information that does not form the prior art that is already known to a person of ordinary skill in the art. Summary of the invention

[0006] The content of this disclosure is used to introduce concepts in a brief form, which will be described in detail in the detailed implementation section below. The content of this disclosure is not intended to identify the key features or essential features of the technical solution claimed for protection, nor is it intended to limit the scope of the technical solution claimed for protection.

[0007] Some embodiments of the present disclosure propose image compression methods, devices, electronic devices, and computer-readable media to solve one or more of the technical problems mentioned in the above background technology section.

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

[0009] In a second aspect, some embodiments of the present disclosure provide an image compression device, the device comprising: a first acquisition unit, configured to acquire an initial coding parameter prediction training set, wherein the initial coding parameter prediction training set comprises initial coding parameter prediction samples, each of the initial coding parameter prediction samples comprises a sample to be encoded image and each preset coding parameter information; an update unit, configured to perform update processing on each of the initial coding parameter prediction samples to obtain a coding parameter prediction sample; a determination unit, configured to determine each obtained coding parameter prediction sample as an updated coding parameter prediction training set; The training unit is configured to train the coding parameter prediction network according to the above-mentioned updated coding parameter prediction training set to obtain a trained coding parameter prediction model; the second acquisition unit is configured to obtain the image to be encoded; the generation unit is configured to generate image feature information and image quality score information corresponding to the above-mentioned image to be encoded based on the above-mentioned image to be encoded; the input unit is configured to input the above-mentioned image feature information and image quality score information into the above-mentioned coding parameter prediction model to obtain adaptive coding parameter information corresponding to the above-mentioned image to be encoded; the compression processing unit is configured to compress the above-mentioned image to be encoded based on the above-mentioned adaptive coding parameter information to obtain a compressed image.

[0010] In a third aspect, some embodiments of the present disclosure provide an electronic device comprising: one or more processors; a storage device on which one or more programs are stored, and 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 implementation manner of the above-mentioned first aspect.

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

[0012] The above-mentioned embodiments of the present disclosure have the following beneficial effects: through the image compression method of some embodiments of the present disclosure, the blur or distortion degree of the compressed image is reduced. Specifically, the reason for the large blur or distortion degree of the compressed image is that: the image to be encoded is compressed and encoded according to the preset encoding parameter information (preset QP value), the characteristics of different images are quite different, and the preset QP value fails to take into account the different image characteristics of different images (such as texture complexity and edge details, etc.). Therefore, when the image with more complex image features is compressed using the fixed preset encoding parameter information (preset QP value), the image may be over-compressed and important details may be lost, resulting in a large blur or distortion degree of the compressed image. Based on this, the image compression method of some embodiments of the present disclosure, first, obtains an initial encoding parameter prediction training set, wherein the above-mentioned initial encoding parameter prediction training set includes each initial encoding parameter prediction sample, and each of the above-mentioned initial encoding parameter prediction samples includes a sample image to be encoded and each preset encoding parameter information. Thus, the initial encoding parameter prediction training set used to generate an updated encoding parameter prediction training set can be obtained. Afterwards, each of the initial coding parameter prediction samples is updated to obtain a coding parameter prediction sample. Then, each obtained coding parameter prediction sample is determined as an updated coding parameter prediction training set. Thus, an updated coding parameter prediction training set for training a coding parameter prediction network can be obtained. Then, the coding parameter prediction network is trained according to the updated coding parameter prediction training set to obtain a trained coding parameter prediction model. Thus, a coding parameter prediction model for predicting coding parameter information (preset QP value) applicable to the image to be encoded according to feature information and image quality score of the image to be encoded can be obtained. Then, the image to be encoded is obtained. Thus, the image to be encoded can be obtained. Then, based on the image to be encoded, image feature information and image quality score information corresponding to the image to be encoded are generated. Thus, image feature information characterizing the features of the image to be encoded and image quality score information representing the image quality of the image to be encoded can be obtained. Then, the image feature information and image quality score information are input into the coding parameter prediction model to obtain adaptive coding parameter information corresponding to the image to be encoded. Thus, adaptive coding parameter information applicable to compression of the image to be encoded can be predicted based on the image feature information and image quality score information before encoding. Finally, based on the adaptive coding parameter information, the image to be encoded is compressed to obtain a compressed image. Thus, adaptive coding parameter information applicable to compression of the image to be encoded can be obtained by prediction, and the image to be encoded can be compressed.By using adaptive coding parameter information suitable for compressing the image to be encoded, the image to be encoded is compressed, 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 during the compression process, and reduces the blur or distortion of the compressed image. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that components and elements are not necessarily drawn to scale.

[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 schematic structural diagram of some embodiments of the image compression device according to the present disclosure;

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

[0017] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. 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 invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other.

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

[0020] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0021] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these 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 The process 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] Step 101, obtaining an initial coding parameter prediction training set.

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

[0026] Step 102: Update each initial coding parameter prediction sample in each initial coding parameter prediction sample to obtain a coding parameter prediction sample.

[0027] In some embodiments, the execution entity may update each of the initial coding parameter prediction samples to obtain a coding parameter prediction sample.

[0028] In some optional implementations of some embodiments, the execution subject may update each of the initial coding parameter prediction samples in the initial coding parameter prediction samples through the following steps to obtain a coding parameter prediction sample:

[0029] The first step is to generate a quality score and image feature information corresponding to the sample to be encoded image included in the sample prediction based on the initial encoding parameters.

[0030] In the second step, based on the preset coding parameter information included in the initial coding parameter prediction sample and the sample to be encoded image, the target coding parameter information corresponding to the sample to be encoded image is generated. The target coding parameter information may be the QP quantization parameter (optimal QP quantization parameter) corresponding to the inflection point of the balance between the quality score on the curve where the compressed image quality score decreases as the QP quantization parameter increases within the range of the minimum QP quantization parameter and the maximum QP quantization parameter corresponding to each preset coding parameter information and the QP quantization parameter. The inflection point may be a point where the curve always remains concave and the slope slows down significantly.

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

[0032] In some optional implementations of some embodiments, the execution subject may generate target coding parameter information corresponding to the sample to-be-encoded image based on each preset coding parameter information included in the initial coding parameter prediction sample and the sample to-be-encoded image through the following steps:

[0033] The first step is to sort the encoding parameter values ​​included in the above-mentioned preset encoding parameter information to obtain a encoding parameter sequence. In practice, the above-mentioned execution subject can sort the encoding parameter values ​​included in the preset encoding parameter information in an ascending order or a descending order to obtain a encoding parameter sequence.

[0034] In the second step, for each encoding parameter in the above encoding parameter sequence, perform the following steps:

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

[0036] The second sub-step is to perform image quality detection on the sample compressed image to obtain a sample image quality score. In practice, the execution subject may perform image quality detection on the sample compressed image through image quality assessment (IQA) technology to obtain a sample image quality score. Optionally, the execution subject may 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 may be a BRISQUE model that takes an image as input and an image quality score as output.

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

[0038] The third step is to generate a coding quality point coordinate information sequence based on the obtained coding quality point coordinate information.

[0039] The fourth step is to fit the coordinates of each encoding quality point corresponding to the above encoding quality point coordinate information sequence into an encoding parameter quality curve. In practice, the above execution subject can call the polyfit function to fit the coordinates of each encoding quality point in the encoding quality point coordinate information sequence into an encoding parameter quality curve.

[0040] Step 5: Determine the coordinate information corresponding to the inflection point in the coding parameter quality curve as the target coding quality point coordinate information. The inflection point may be a point where the curve always remains concave and the slope slows down significantly.

[0041] The sixth step is to determine the first value in the above target encoding quality point coordinate information as the target encoding parameter information.

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

[0043] In the first step, each preset coding parameter information in the above-mentioned initial coding parameter prediction sample is deleted, and the above-mentioned quality score, the above-mentioned image feature information and the above-mentioned target coding parameter information are added to the initial coding parameter prediction sample to update the initial coding parameter prediction sample.

[0044] In the second step, the updated initial coding parameter prediction samples are determined as coding parameter prediction samples.

[0045] In some optional implementations of some embodiments, the above-mentioned execution subject may generate a coding quality point coordinate information sequence based on the obtained respective coding quality point coordinate information through the following steps:

[0046] The first step is to arrange the above-mentioned various coding quality point coordinate information according to the order of various coding parameters corresponding to the various coding quality point coordinate information in the coding parameter sequence to obtain a coding quality point coordinate information sequence.

[0047] Step 103: determine the obtained coding parameter prediction samples as an updated coding parameter prediction training set.

[0048] In some embodiments, the execution entity may determine the obtained coding parameter prediction samples as an updated coding parameter prediction training set.

[0049] Step 104: training the coding parameter prediction network according to the updated coding parameter prediction training set to obtain a trained coding parameter prediction model.

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

[0051] Step 105: Obtain the image to be encoded.

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

[0053] Step 106: Based on the image to be encoded, generate image feature information and image quality score information corresponding to the image to be encoded.

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

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

[0056] Before compressing the image to be encoded, it is necessary to extract features and perform quality detection on the image to be encoded to obtain image feature information and image quality score information of the image to be encoded. However, directly performing quality detection on the entire image to be encoded may ignore local details and quality differences in the image, resulting in low accuracy of image quality score information, and then poor subsequent image compression effect (if the quality score accuracy is poor, it may cause the predicted encoding parameter information (preset QP value) to be large, resulting in over-compression of the image and 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 image to be encoded to obtain image quality score information, and combined with the image quality detection advantages of the inventor's company, decided to adopt the following solution:

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

[0059] The first step is to input the above-mentioned image to be encoded into the feature extraction layer of a pre-trained image feature extraction model to obtain feature extraction information corresponding to the above-mentioned image to be encoded. Among them, the above-mentioned image feature extraction model includes the above-mentioned feature extraction layer, activation layer, pooling layer, flattening layer, and fully connected layer. The above-mentioned feature extraction layer can be a convolutional layer (Convolutional layer) that takes the image to be encoded as input and takes feature extraction information as output. The above-mentioned feature extraction information can be a feature map obtained after performing a convolution operation on the image to be encoded. The above-mentioned feature map can characterize the image features of the image to be encoded (for example, features such as edges, textures, and shapes).

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

[0061] In the third step, the activation feature extraction information is input into the pooling layer to obtain pooling feature extraction information, wherein the pooling feature extraction information may be a feature map after the pooling operation.

[0062] In the fourth step, the pooled feature extraction information is input into the flatten layer to obtain fused feature information. The flatten layer may be a flatten layer that takes the pooled feature extraction information as input and takes the fused feature information as output. The flatten layer may convert the feature map into a one-dimensional vector. The fused feature information may be a one-dimensional vector that represents the image features.

[0063] The fifth step is to input the fused feature information 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 is divisible by the preset division area, the image to be encoded is divided into individual divided image blocks with an area equal to the preset division area and without overlapping images.

[0066] In step 8, in response to determining that the total area to be divided cannot be divided by the preset divided 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 divided 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 preset horizontal sliding step length, and the preset vertical sliding step length to obtain each divided image block. There are overlapping areas in each divided image block after the sliding window segmentation.

[0067] In step 9, for each of the obtained divided image blocks, perform the following steps:

[0068] The first sub-step is to perform frequency domain conversion processing on the above-mentioned divided image blocks to obtain frequency domain matrix information corresponding to the above-mentioned divided image blocks. In practice, the above-mentioned execution subject can perform frequency domain conversion processing on the above-mentioned divided image blocks through DCT transformation technology to obtain frequency domain matrix information corresponding to the above-mentioned divided image blocks. The above-mentioned frequency domain matrix information can be a discrete cosine transform coefficient matrix.

[0069] In the second sub-step, the frequency domain matrix information is input into a pre-trained image quality assessment model to obtain image block quality scores corresponding to the divided image blocks.

[0070] Step 10: Generate image quality score information corresponding to the image to be encoded based on the obtained quality scores of each image block. In practice, the execution subject may determine the average of the obtained quality scores of each image block as the image quality score information corresponding to the image to be encoded.

[0071] The above technical solution combines step 107 and step 108 and their related contents as an inventive point of an embodiment of the present disclosure, and solves the technical problem "the final problem such as poor image compression effect". The factors that lead to poor image compression effect are often as follows: before compressing the image to be encoded, it is necessary to perform feature extraction and quality detection on the image to be encoded to obtain image feature information and image quality score information of the image to be encoded. However, directly performing quality detection on the entire image to be encoded may ignore local details and quality differences in the image, resulting in low accuracy of image quality score information, and then resulting in poor subsequent image compression effect (if the quality score accuracy is poor, it may cause the predicted encoding parameter information (preset QP value) to be large, and then cause the image to be over-compressed and the image compression effect is poor). If the above factors are solved, the image compression effect can be improved. In order to achieve this effect, first, the above image to be encoded is input into the feature extraction layer of a pre-trained image feature extraction model to obtain feature extraction information corresponding to the above image to be encoded. Among them, the above image feature extraction model includes the above feature extraction layer, activation layer, pooling layer, flattening layer, and fully connected layer. Then, the feature extraction information is input into the activation layer to obtain the activation feature extraction information. After that, the activation feature extraction information is input into the pooling layer to obtain the pooling feature extraction information. Next, the pooling feature extraction information is input into the flattening layer to obtain the fusion feature information. Then, the fusion feature information is input into the fully connected layer to obtain the image feature information corresponding to the image to be encoded. Thus, the image to be encoded can be feature extracted through the above steps to obtain the image feature information for subsequent image compression. After that, the area of ​​the image to be encoded is determined as the total area to be divided. Thus, the total area to be divided for dividing the image to be encoded can be obtained. Then, in response to determining that the total area to be divided can be divided by the preset division area, the image to be encoded is divided into individual divided image blocks whose area is the preset division area and there is no overlapping image. Thus, the image to be encoded can be divided without overlap to obtain individual image blocks. Next, in response to determining that the total area to be divided cannot be divided by the above-mentioned preset divided area, based on the above-mentioned preset sliding window length, preset sliding window width, preset horizontal sliding step length, and preset vertical sliding step length, the above-mentioned image to be encoded is subjected to sliding window division processing to obtain each divided image block. In this way, the image to be encoded can be divided with overlap. Next, for each of the obtained divided image blocks, the following steps are performed: a first sub-step, performing frequency domain conversion processing on the above-mentioned divided image block to obtain frequency domain matrix information corresponding to the above-mentioned divided image block. In this way, frequency domain matrix information for predicting the image quality of the divided image block can be obtained. A second sub-step, inputting the above-mentioned frequency domain matrix information into a pre-trained image quality evaluation model to obtain an image block quality score corresponding to the above-mentioned divided image block.Thus, the image block quality score prediction can be performed on the divided image blocks. Afterwards, based on the obtained quality scores of each image block, the image quality score information corresponding to the above-mentioned image to be encoded is generated. Thus, the image quality score information of the image to be encoded can be generated based on the quality scores of each image block. Block prediction of the image to be encoded can more accurately capture local details and local quality differences, thereby improving the accuracy of the generated image quality score information. Combined with step 107, the above-mentioned image feature information and image quality score information are input into the above-mentioned coding parameter prediction model to obtain the adaptive coding parameter information corresponding to the above-mentioned image to be encoded. Thus, the coding parameter information (preset QP value) can be predicted on the basis of the higher accuracy of the image quality score information, and the adaptive coding parameter information with higher accuracy and more suitable for the image to be encoded can be obtained. Combined with step 108, based on the above-mentioned adaptive coding parameter information, the above-mentioned image to be encoded is compressed to obtain a compressed image. Thus, the image to be encoded can be compressed according to the adaptive coding parameter information with higher accuracy and more suitable for the image to be encoded, which reduces the possibility of over-compression of the image to be encoded and improves the image compression effect of the image to be encoded.

[0072] Step 107: input the image feature information and the image quality score information into a coding parameter prediction model to obtain adaptive coding parameter information corresponding to the image to be coded.

[0073] In some embodiments, the execution entity may input the image feature information and the image quality score information into the coding parameter prediction model to obtain adaptive coding parameter information corresponding to the image to be encoded.

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

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

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

[0077] The first step is to call a preset encoder and compress the image to be encoded according to the adaptive encoding parameter information to obtain a compressed image. The preset encoder may be an x264 encoder.

[0078] The above-mentioned embodiments of the present disclosure have the following beneficial effects: through the image compression method of some embodiments of the present disclosure, the blur or distortion degree of the compressed image is reduced. Specifically, the reason for the large blur or distortion degree of the compressed image is that: the image to be encoded is compressed and encoded according to the preset encoding parameter information (preset QP value), the characteristics of different images are quite different, and the preset QP value fails to take into account the different image characteristics of different images (such as texture complexity and edge details, etc.). Therefore, when the image with more complex image features is compressed using the fixed preset encoding parameter information (preset QP value), the image may be over-compressed and important details may be lost, resulting in a large blur or distortion degree of the compressed image. Based on this, the image compression method of some embodiments of the present disclosure, first, obtains an initial encoding parameter prediction training set, wherein the above-mentioned initial encoding parameter prediction training set includes each initial encoding parameter prediction sample, and each of the above-mentioned initial encoding parameter prediction samples includes a sample image to be encoded and each preset encoding parameter information. Thus, the initial encoding parameter prediction training set used to generate an updated encoding parameter prediction training set can be obtained. Afterwards, each of the initial coding parameter prediction samples is updated to obtain a coding parameter prediction sample. Then, each obtained coding parameter prediction sample is determined as an updated coding parameter prediction training set. Thus, an updated coding parameter prediction training set for training a coding parameter prediction network can be obtained. Then, the coding parameter prediction network is trained according to the updated coding parameter prediction training set to obtain a trained coding parameter prediction model. Thus, a coding parameter prediction model for predicting coding parameter information (preset QP value) applicable to the image to be encoded according to feature information and image quality score of the image to be encoded can be obtained. Then, the image to be encoded is obtained. Thus, the image to be encoded can be obtained. Then, based on the image to be encoded, image feature information and image quality score information corresponding to the image to be encoded are generated. Thus, image feature information characterizing the features of the image to be encoded and image quality score information representing the image quality of the image to be encoded can be obtained. Then, the image feature information and image quality score information are input into the coding parameter prediction model to obtain adaptive coding parameter information corresponding to the image to be encoded. Thus, adaptive coding parameter information applicable to compression of the image to be encoded can be predicted based on the image feature information and image quality score information before encoding. Finally, based on the adaptive coding parameter information, the image to be encoded is compressed to obtain a compressed image. Thus, adaptive coding parameter information applicable to compression of the image to be encoded can be obtained by prediction, and the image to be encoded can be compressed.By using adaptive coding parameter information suitable for compressing the image to be encoded, the image to be encoded is compressed, 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 during the compression process, and reduces the blur or distortion of the compressed image.

[0079] Further references Figure 2 As an implementation of the methods shown in the figures, the present disclosure provides some embodiments of an image compression device, and these device embodiments are Figure 1 Corresponding to the method embodiments shown, the device can be specifically applied to various electronic devices.

[0080] like Figure 2 As shown, the image compression device 200 of some embodiments includes: a first acquisition unit 201, an updating unit 202, a determining unit 203, a training unit 204, a second acquisition unit 205, a generating unit 206, an input unit 207 and a compression processing unit 208. The first acquisition unit 201 is configured to acquire an initial coding parameter prediction training set, wherein the initial coding parameter prediction training set includes various initial coding parameter prediction samples, and each of the initial coding parameter prediction samples includes a sample to be encoded image and various preset coding parameter information; the updating unit 202 is configured to update each of the initial coding parameter prediction samples to obtain a coding parameter prediction sample; the determining unit 203 is configured to determine each obtained coding parameter prediction sample as an updated coding parameter prediction training set; the training unit 204 is configured to update the coding parameter prediction samples according to the above-mentioned updated coding parameter prediction training set; The new coding parameter prediction training set is used to train the coding parameter prediction network to obtain a trained coding parameter prediction model; the second acquisition unit 205 is configured to acquire the 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 image quality score information into the coding parameter prediction model to obtain adaptive coding parameter information corresponding to the image to be encoded; the compression processing unit 208 is configured to perform compression processing on the image to be encoded based on the adaptive coding parameter information to obtain a compressed image.

[0081] It is understood that the units described in the device 200 are similar to those described in the reference Figure 1 Therefore, the operations, features and beneficial effects described above for the method are also applicable to the device 200 and the units contained therein, and will not be described in detail here.

[0082] Reference below Figure 3, which shows a structural schematic diagram of an electronic device 300 suitable for implementing some embodiments of the present disclosure. Figure 3 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0083] like Figure 3 As shown, the electronic device 300 may include a processing device (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. In the RAM 303, various programs and data required for the operation of the electronic device 300 are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.

[0084] Typically, the following devices may be connected to the I / O interface 305: input devices 306 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 307 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 308 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 309. The communication devices 309 may allow the electronic device 300 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 3 The electronic device 300 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 3 Each block shown in the figure may represent one device, or may represent multiple devices as required.

[0085] In particular, according to some embodiments of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, some embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from the network through the communication device 309, or installed from the storage device 308, or installed from the ROM 302. When the computer program is executed by the processing device 301, the functions defined in the method of some embodiments of the present disclosure are executed.

[0086] It should be noted that the computer-readable medium recorded in some embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In some embodiments of the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, device or device. In some embodiments of the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.

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

[0088] The computer-readable medium may be included in the electronic device; or it may exist independently without being assembled into the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains an initial coding parameter prediction training set, wherein the initial coding parameter prediction training set includes each initial coding parameter prediction sample, and each initial coding parameter prediction sample in the initial coding parameter prediction samples includes a sample image to be encoded and each preset coding parameter information; updates each initial coding parameter prediction sample in the initial coding parameter prediction samples to obtain a coding parameter prediction sample; determines each obtained coding parameter prediction sample as an updated coding parameter prediction training set; trains a coding parameter prediction network according to the updated coding parameter prediction training set to obtain a trained coding parameter prediction model; obtains an image to be encoded; based on the image to be encoded, generates image feature information and image quality score information corresponding to the image to be encoded; inputs the image feature information and image quality score information into the coding parameter prediction model to obtain adaptive coding parameter information corresponding to the image to be encoded; based on the adaptive coding parameter information, compresses the image to be encoded to obtain a compressed image.

[0089] Computer program code for performing the operations of some embodiments of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0090] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0091] The units described in some embodiments of the present disclosure may be implemented by software or by hardware. The described units may also be arranged in a processor, for example, may be described as: a processor including a first acquisition unit, an update unit, a determination unit, a training unit, a second acquisition unit, a generation unit, an input unit, and a compression processing unit. The names of these units do not, in some cases, constitute limitations on the units themselves, for example, the determination unit may also be described as "a unit that determines the obtained individual coding parameter prediction samples as an updated coding parameter prediction training set".

[0092] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0093] The above descriptions are only some preferred embodiments of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of technical features, but 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, a technical solution formed by replacing the features with (but not limited to) the technical features with similar functions disclosed in the embodiments of the present disclosure.

Claims

1. An image compression method, comprising: Acquire an initial coding parameter prediction training set, wherein the initial coding parameter prediction training set includes initial coding parameter prediction samples, and each of the initial coding parameter prediction samples includes a sample to-be-encoded image and various preset coding parameter information; Performing an updating process on each of the initial coding parameter prediction samples to obtain a coding parameter prediction sample; Determine each obtained coding parameter prediction sample as an updated coding parameter prediction training set; Training the coding parameter prediction network according to the updated coding parameter prediction training set to obtain a trained coding parameter prediction model; Obtaining an image to be encoded; Based on the image to be encoded, generating image feature information and image quality score information corresponding to the image to be encoded; Inputting the image feature information and the image quality score information into the coding parameter prediction model to obtain adaptive coding parameter information corresponding to the image to be coded; Based on the adaptive encoding parameter information, the image to be encoded is compressed to obtain a compressed image.

2. The method according to claim 1, wherein: The updating process of each of the initial coding parameter prediction samples to obtain the coding parameter prediction sample comprises: Based on the sample to-be-encoded image included in the initial encoding parameter prediction sample, generating a quality score and image feature information corresponding to the sample to-be-encoded image; Based on each preset coding parameter information included in the initial coding parameter prediction sample and the sample to-be-encoded image, generating target coding parameter information corresponding to the sample to-be-encoded image; Based on the quality score of the sample to be encoded image, the image feature information and the target encoding parameter information, the initial encoding parameter prediction sample is updated to obtain a encoding parameter prediction sample.

3. The method according to claim 2, wherein: Each of the preset coding parameter information includes a coding parameter value, and the generating of target coding parameter information corresponding to the sample to be encoded image based on the preset coding parameter information included in the initial coding parameter prediction sample and the sample to be encoded image includes: Sorting the encoding parameter values ​​included in the respective preset encoding parameter information to obtain a encoding parameter sequence; For each encoding parameter in the encoding parameter sequence, perform the following steps: Based on the encoding parameters, compressing the sample image to be encoded to obtain a sample compressed image; Performing image quality detection processing on the sample compressed image to obtain a sample image quality score; Determine the encoding parameter and the sample image quality score as a first value of a coordinate point and a second value of a coordinate point respectively, and obtain encoding quality point coordinate information corresponding to the encoding parameter; Based on the obtained coordinate information of each encoding quality point, a coding quality point coordinate information sequence is generated; Fitting each encoding quality point coordinate 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 the target encoding quality point coordinate information; The first value in the target encoding quality point coordinate information is determined as the target encoding parameter information.

4. The method according to claim 2, wherein: The updating of the initial coding parameter prediction sample based on the quality score of the sample to be encoded image, the image feature information and the target coding parameter information to obtain the coding parameter prediction sample includes: Deleting each preset coding parameter information in the initial coding parameter prediction sample, and adding the quality score, the image feature information and the target coding parameter information to the initial coding parameter prediction sample, so as to update the initial coding parameter prediction sample; The updated initial coding parameter prediction sample is determined as the coding parameter prediction sample.

5. The method according to claim 3, wherein: The step of generating a coding quality point coordinate information sequence based on the obtained coding quality point coordinate information comprises: The encoding quality point coordinate information is arranged according to the order of the encoding parameters corresponding to the encoding quality point coordinate information in the encoding parameter sequence to obtain the encoding quality point coordinate information sequence.

6. The method according to claim 1, wherein: The step of compressing the image to be encoded based on the adaptive encoding parameter information to obtain a compressed image includes: The preset encoder is called to compress the image to be encoded according to the adaptive encoding parameter information to obtain a compressed image.

7. An image compression device, comprising: A first acquisition unit is configured to acquire an initial coding parameter prediction training set, wherein the initial coding parameter prediction training set includes initial coding parameter prediction samples, and each of the initial coding parameter prediction samples includes a sample to-be-encoded image and various preset coding parameter information; an updating unit, configured to update each of the initial coding parameter prediction samples to obtain a coding parameter prediction sample; A determination unit, configured to determine each obtained coding parameter prediction sample as an updated coding parameter prediction training set; A training unit is configured to train a coding parameter prediction network according to the updated coding parameter prediction training set to obtain a trained coding parameter prediction model; A second acquisition unit is configured to acquire an image to be encoded; A generating unit, 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; An input unit, configured to input the image feature information and the image quality score information into the coding parameter prediction model to obtain adaptive coding 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.

8. An electronic device comprising: one or more processors; 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 according to any one of claims 1 to 6.

9. A computer readable medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Self-adaptive coding method and device, electronic equipment and computer storage medium

    CN111246209A

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

    CN114554211A

  • Method and apparatus for adaptive image compression with flexible hyperprior model by meta learning

    US20220292726A1