Conditional entropy coding method, device and equipment
By using continuous index values and cumulative distribution functions in the conditional entropy model to find tables, the problem of high coding complexity of conditional entropy models in the prior art is solved, and more efficient image encoding and more reliable coding results are achieved.
Patent Information
- Application Number
- CN202510428878.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-06-17
AI Technical Summary
The existing conditional entropy model uses complex probability prediction models in image encoding, resulting in high encoding complexity and low encoding efficiency.
The continuous index value of the element to be encoded is determined through the conditional entropy model, and the discrete index value is determined through simple mapping operations. The corresponding cumulative distribution function is obtained from the pre-stored cumulative distribution function lookup table, and entropy encoding is performed.
It reduces the computational complexity of encoding, improves coding efficiency, and reduces floating-point calculation errors, and improves the reliability of encoding.
Smart Images

Figure CN120166231A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technologies, and in particular, to a conditional entropy encoding method, apparatus, and device. Background Art
[0002] In applications such as image storage and transmission, it is usually necessary to perform an encoding operation on an image. By converting the image into a binary bitstream, the encoding operation can reduce the storage capacity and transmission bandwidth.
[0003] In recent years, with the rapid development of deep learning technologies, end-to-end image encoding methods based on deep learning have gradually become mainstream. In end-to-end image encoding methods, the conditional entropy model (CEM) is widely used to more precisely model the probability distribution of the image to be encoded, so as to improve the efficiency of entropy encoding. The conditional entropy model usually includes a hyperprior model and a context model, which achieve efficient entropy encoding by predicting the probability distribution parameters of the elements to be encoded.
[0004] However, the conditional entropy model usually uses complex probability prediction models (including Gaussian models, mixture Gaussian models, generalized Gaussian models, etc.) to represent the probability distribution parameters of the elements to be encoded, resulting in a relatively high encoding complexity and a low encoding efficiency.
[0005] Therefore, how to perform image encoding with lower complexity and higher encoding efficiency has become a technical problem to be urgently solved. Summary of the Invention
[0006] Based on the above problems, this application provides a conditional entropy encoding method, apparatus, and device, which can reduce the computational complexity of encoding and improve the encoding efficiency.
[0007] The embodiments of this application disclose the following technical solutions:
[0008] In a first aspect, this application discloses a conditional entropy encoding method, and the method includes:
[0009] Determine a continuous index value corresponding to an element to be encoded through a conditional entropy model;
[0010] Determine a discrete index value corresponding to the continuous index value, and determine a probability distribution corresponding to the discrete index value from a preset probability distribution set;
[0011] Determine a cumulative distribution function corresponding to the probability distribution from a pre-stored cumulative distribution function lookup table;
[0012] Perform entropy encoding on the element to be encoded through the cumulative distribution function.
[0013] Optionally, determining the discrete index value corresponding to the continuous index value includes:
[0014] Determining the weight values corresponding to all preset discrete index values according to the continuous index value;
[0015] Determining the discrete index value with the largest weight value as the discrete index value corresponding to the continuous index value.
[0016] Optionally, when the probability distribution set is one-dimensional, the determination formula of the weight value is as follows:
[0017]
[0018] where, π m is the weight value, i is the continuous index value, m is the discrete index value, and τ is the temperature coefficient.
[0019] Optionally, when the probability distribution set is two-dimensional, the determination formula of the weight value is as follows:
[0020]
[0021] where, π mn is the weight value, (i, j) is the continuous index value, (m, n) is the discrete index value, and τ is the temperature coefficient.
[0022] Optionally, the conditional entropy model is obtained as follows:
[0023] Using a hyperprior model or a context model to obtain the continuous index value corresponding to the sample coding element;
[0024] Determining the weight values corresponding to all preset discrete index values according to the continuous index value;
[0025] Determining the code rate value according to the weight value; the determination formula of the code rate value is as follows:
[0026]
[0027] where, R is the code rate value, M is the number of probability distributions, m is the discrete index value, π m is the weight value, and P is the probability of calculating the sample coding element m under the given probability distribution θ ;
[0028] Training the original conditional entropy model by minimizing the difference between the loss function value and the code rate value to obtain the conditional entropy model; the determination formula of the loss function value is as follows:
[0029] L = R + λD
[0030] Among them, L is the loss function value, R is the code rate value, λ is the weight coefficient, and D is the distortion metric.
[0031] Optionally, the element to be encoded is the image to be encoded or the feature image corresponding to the image to be encoded.
[0032] Optionally, when the element to be encoded is the feature image corresponding to the image to be encoded, determining the continuous index value corresponding to the element to be encoded through the conditional entropy model includes:
[0033] Determining the continuous index value corresponding to the hyperprior information in the feature image corresponding to the image to be encoded through the conditional entropy model.
[0034] Optionally, when the probability distribution set is one-dimensional, the distribution forms in the probability distribution set include Gaussian distribution or generalized Gaussian distribution; when the probability distribution set is two-dimensional, the distribution forms in the probability distribution set include any one of Gaussian distribution, generalized Gaussian distribution, and mixture Gaussian distribution.
[0035] In a second aspect, the present application provides a conditional entropy encoding device, and the device includes: an index determination module, a distribution determination module, a function determination module, and an element encoding module;
[0036] The index determination module is configured to determine the continuous index value corresponding to the element to be encoded through the conditional entropy model;
[0037] The distribution determination module is configured to determine the probability distribution corresponding to the discrete index value from a preset probability distribution set by determining the discrete index value corresponding to the continuous index value;
[0038] The function determination module is configured to determine the cumulative distribution function corresponding to the probability distribution from a pre-stored cumulative distribution function lookup table;
[0039] The element encoding module is configured to perform entropy encoding on the element to be encoded through the cumulative distribution function.
[0040] Optionally, the distribution determination module is specifically configured to: determine the weight value corresponding to each preset discrete index value according to the continuous index value; determine the discrete index value with the largest weight value as the discrete index value corresponding to the continuous index value.
[0041] Optionally, when the probability distribution set is one-dimensional, the formula for determining the weight value is as follows:
[0042]
[0043] Among them, π mis the weight value, i is the continuous index value, m is the discrete index value, and τ is the temperature coefficient.
[0044] Optionally, when the set of probability distributions is two-dimensional, the formula for determining the weight value is as follows:
[0045]
[0046] where, π mn is the weight value, (i, j) is the continuous index value, (m, n) is the discrete index value, and τ is the temperature coefficient.
[0047] Optionally, the obtaining unit of the conditional entropy model is as follows:
[0048] The first obtaining unit is used to obtain the continuous index value corresponding to the sample coding element by using the hyperprior model or the context model;
[0049] The second obtaining unit is used to determine the weight value corresponding to each preset discrete index value according to the continuous index value;
[0050] The third obtaining unit is used to determine the code rate value according to the weight value; the formula for determining the code rate value is as follows:
[0051]
[0052] where, R is the code rate value, M is the number of probability distributions, m is the discrete index value, π m is the weight value, P is the probability of calculating the sample coding element m under the given probability distribution θ ;
[0053] The fourth obtaining unit is used to train the original conditional entropy model by minimizing the difference between the loss function value and the code rate value to obtain the conditional entropy model; the formula for determining the loss function value is as follows:
[0054] L = R + λD
[0055] where, L is the loss function value, R is the code rate value, λ is the weight coefficient, and D is the distortion measure.
[0056] Optionally, the element to be encoded is the image to be encoded or the feature image corresponding to the image to be encoded.
[0057] Optionally, when the element to be encoded is the feature image corresponding to the image to be encoded, the index determination module is specifically used to: determine the continuous index value corresponding to the hyperprior information in the feature image corresponding to the image to be encoded through the conditional entropy model.
[0058] Optionally, when the set of probability distributions is one-dimensional, the distribution forms in the set of probability distributions include Gaussian distribution or generalized Gaussian distribution; when the set of probability distributions is two-dimensional, the distribution forms in the set of probability distributions include any one of Gaussian distribution, generalized Gaussian distribution, and mixture of Gaussian distributions.
[0059] In a third aspect, the present application discloses a conditional entropy encoding device, which includes: a memory and a processor;
[0060] The memory is used to store programs;
[0061] The processor is used to execute the program to implement each step of the conditional entropy encoding method as described in the first aspect.
[0062] Compared with the prior art, the present application has the following beneficial effects:
[0063] The embodiments of the present application provide a conditional entropy encoding method, apparatus, and device. The method includes: determining a continuous index value corresponding to an element to be encoded through a conditional entropy model; determining a discrete index value corresponding to the continuous index value, and determining a probability distribution corresponding to the discrete index value from a preset set of probability distributions; determining a cumulative distribution function corresponding to the probability distribution from a pre-stored cumulative distribution function lookup table; and performing entropy encoding on the element to be encoded through the cumulative distribution function. Thus, the present application only needs to predict a continuous index value, determine the discrete index value through a simple mapping operation, and then directly obtain the cumulative distribution function corresponding to the discrete index value through the pre-stored cumulative distribution function lookup table, avoiding the complex process of dynamically calculating the cumulative distribution function. This method reduces the computational complexity of encoding and improves the encoding efficiency. Description of the Drawings
[0064] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0065] Figure 1 It is a flowchart of a conditional entropy encoding method provided by an embodiment of the present application;
[0066] Figure 2 It is a schematic diagram of the training process of a conditional entropy model provided by an embodiment of the present application;
[0067] Figure 3 It is a schematic diagram of a conditional entropy encoding and decoding process provided by an embodiment of the present application;
[0068] Figure 4 Schematic diagram of a conditional entropy encoding device provided by an embodiment of the present application. Detailed implementation manners
[0069] First, the technical terms involved in the present application are explained:
[0070] Conditional entropy represents the uncertainty or amount of information of a random variable given a certain condition. In the field of information coding and compression, conditional entropy models are used to predict and code information based on certain known conditions, so as to reduce the amount of data or improve the transmission efficiency.
[0071] As described above, current conditional entropy models usually use complex probability prediction models to represent the probability distribution parameters of elements to be encoded (such as the mean μ and scale σ of a Gaussian model), resulting in high coding complexity and low coding efficiency.
[0072] After research, the inventors proposed a conditional entropy encoding method, device and equipment. The method includes: determining a continuous index value corresponding to an element to be encoded through a conditional entropy model; determining a discrete index value corresponding to the continuous index value, and determining a probability distribution corresponding to the discrete index value from a preset probability distribution set; determining a cumulative distribution function corresponding to the probability distribution from a pre-stored cumulative distribution function lookup table; and performing entropy encoding on the element to be encoded through the cumulative distribution function. Thus, the present application only needs to predict a continuous index value, determine the discrete index value through a simple mapping operation, and then directly obtain the cumulative distribution function corresponding to the discrete index value through the pre-stored cumulative distribution function lookup table, avoiding the complex process of dynamically calculating the cumulative distribution function. This method reduces the computational complexity of encoding and improves the encoding efficiency. Further, if the dynamic calculation of the cumulative distribution function is performed according to the conditional entropy encoding method in the prior art, floating-point calculation errors may be introduced, resulting in inconsistent encoding and decoding results on different platforms and affecting the reliability of encoding. Therefore, the present application directly determines the cumulative distribution function corresponding to the probability distribution from the pre-stored cumulative distribution function lookup table, avoiding the complex process of dynamically calculating the cumulative distribution function, reducing floating-point calculation errors, and improving the reliability of encoding.
[0073] To enable those skilled in the art to better understand the solution of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0074] First Embodiment
[0075] First, taking the set of probability distributions as one dimension, the conditional entropy coding method provided by the embodiments of the present application is explained as follows:
[0076] Refer to Figure 1 , which is a flowchart of a conditional entropy coding method provided by the embodiments of the present application. The method includes:
[0077] S101: Determine the continuous index value corresponding to the element to be encoded through a conditional entropy model.
[0078] Traditional conditional entropy models usually directly predict complex probability model parameters (such as the mean μ and scale σ of a Gaussian model). The determination of these probability model parameters often requires a large amount of data and computing resources. However, the conditional entropy model provided by the embodiments of the present application simplifies this process by predicting the continuous index value i corresponding to the element to be encoded.
[0079] Refer to Figure 2 , which is a schematic diagram of the training process of a conditional entropy model provided by the embodiments of the present application. The training process of the conditional entropy model can be as follows:
[0080] First, use a hyperprior model or a context model to obtain the continuous index value corresponding to the sample coding element.
[0081] Secondly, according to the continuous index value, determine the weight value π corresponding to each preset discrete index value through the following formula (1) m , where the weight value π m represents the probability that this distribution is selected:
[0082]
[0083] where π m is the weight value, i is the continuous index value, m is the discrete index value, and τ is the temperature coefficient (used to control the smoothness of the weight). It should be noted that during the training process of determining the weight value π m according to the continuous index value (i.e., during the training process corresponding to formula (1)), the temperature coefficient τ gradually decreases (i.e., annealing), so that the weight value π m gradually tends to a discrete distribution. The annealing strategy can be linear or exponential. For the specific annealing strategy, the present application does not make a limitation.
[0084] Subsequently, according to the weight value π m , determine the code rate value through the following formula (2):
[0085]
[0086] where R is the code rate value, M is the number of probability distributions, m is the discrete index value, and πm is the weight value, and P is to calculate the given probability distribution θ m of the sample coding element below probability.
[0087] Finally, by minimizing the difference between the loss function value and the code rate value, the original conditional entropy model is trained to obtain the conditional entropy model, where the loss function is shown in the following formula (3):
[0088] L = R + λD (3)
[0089] where L is the loss function value, R is the code rate value, λ is the weight coefficient, and D is the distortion measure.
[0090] After training the conditional entropy model in the above manner, in actual applications, the trained conditional entropy model can be directly used to determine the continuous index value i corresponding to the element to be encoded. See Figure 3 , this figure is a schematic diagram of a conditional entropy encoding and decoding process provided by an embodiment of the present application. The continuous index value i can represent the position of the element to be encoded in the preset probability distribution set {θ1, θ2, …, θ M}
[0091] It should be noted that when the probability distribution set is one-dimensional, the distribution forms in the probability distribution set include Gaussian distribution or generalized Gaussian distribution. Among them, the distribution form in the probability distribution set being Gaussian distribution means restricting μ = 0, that is, θ = σ. The distribution form in the probability distribution set being generalized Gaussian distribution means restricting μ = 0, that is, θ = (β, α).
[0092] In a specific implementation manner, the element to be encoded input to the conditional entropy model can be the image to be encoded or the feature image corresponding to the image to be encoded. Through the information in the feature image corresponding to the image to be encoded, the position of the continuous index value i corresponding to the element to be encoded in the preset probability distribution set can be predicted more accurately, thereby further improving the accuracy and efficiency of encoding (i.e., achieving lossless encoding).
[0093] When the element to be encoded is a feature image, the conditional entropy model can further analyze the hyperprior information (such as the statistical characteristics of the feature map) in the feature image, and predict the corresponding continuous index value i according to the hyperprior information . Among them, the hyperprior information is the high-level statistical information in the feature image, which is usually used to assist in the modeling of the probability distribution.
[0094] S102: By determining the discrete index value corresponding to the continuous index value, determine the probability distribution corresponding to the discrete index value from the preset probability distribution set.
[0095] Since the consecutive index values i are consecutive, it is necessary to map the consecutive index values i to the set of discrete probability distributions {θ1, θ2, …, θ M} in some way. In the conditional entropy coding method provided in the embodiments of the present application, the discrete index value m corresponding to the consecutive index value i can be determined, and the position of the probability distribution corresponding to the element to be encoded in the set of probability distributions {θ1, θ2, …, θ M} can be determined (i.e., θ m ).
[0096] In practical applications, the integer closest to the consecutive index value i can be determined from all the preset discrete index values m as the discrete index value m corresponding to the consecutive index value i, as shown in the following formula (4):
[0097]
[0098] where is the rounding symbol. It can be understood that in practical applications, formula (1) can also be directly used for the calculation of the index value. For this, the present application does not make any limitations.
[0099] S103: Determine the cumulative distribution function corresponding to the probability distribution from the pre-stored cumulative distribution function lookup table.
[0100] The cumulative distribution function is the integral form of the probability distribution. Before actual operation, the conditional entropy coding method provided in the embodiments of the present application has calculated the cumulative distribution function {CDF1, CDF2, …, CDF M} for each probability distribution {θ1, θ2, …, θ M}. And all the cumulative distribution functions
[0101] {CDF1, CDF2, …, CDF M} have been stored in the encoder in the form of a cumulative distribution function lookup table.
[0102] The cumulative distribution function lookup table will be directly used in the actual coding process, that is, the cumulative distribution function corresponding to the probability distribution can be directly determined from the pre-stored cumulative distribution function lookup table, thereby avoiding the complex process of dynamically calculating the cumulative distribution function, reducing the floating-point calculation error, and improving the reliability of coding.
[0103] S104: Perform entropy coding on the element to be encoded through the cumulative distribution function.
[0104] It can be understood that the above conditional entropy coding method is the coding step executed by the coding end, and the same discrete index value m and cumulative distribution function CDF m, the element to be encoded is decoded from the binary bitstream. This will not be elaborated here.
[0105] In summary, the embodiment of the present application provides a conditional entropy encoding method, which includes: determining a continuous index value corresponding to the element to be encoded through a conditional entropy model; determining a discrete index value corresponding to the continuous index value, and determining a probability distribution corresponding to the discrete index value from a preset probability distribution set; determining a cumulative distribution function corresponding to the probability distribution from a pre-stored cumulative distribution function lookup table; and performing entropy encoding on the element to be encoded through the cumulative distribution function. Thus, the present application only needs to predict a continuous index value, determine the discrete index value through a simple mapping operation, and then directly obtain the cumulative distribution function corresponding to the discrete index value through the pre-stored cumulative distribution function lookup table, avoiding the complex process of dynamically calculating the cumulative distribution function. This method reduces the computational complexity of encoding and improves the encoding efficiency. Further, if the dynamic calculation of the cumulative distribution function is performed according to the conditional entropy encoding method in the prior art, floating-point calculation errors may be introduced, resulting in inconsistent encoding and decoding results on different platforms and affecting the reliability of encoding. Therefore, the present application directly determines the cumulative distribution function corresponding to the probability distribution from the pre-stored cumulative distribution function lookup table, avoiding the complex process of dynamically calculating the cumulative distribution function, reducing floating-point calculation errors, and improving the reliability of encoding.
[0106] Second Embodiment
[0107] Subsequently, with the probability distribution set being two-dimensional, the conditional entropy encoding method provided by the embodiment of the present application will be explained:
[0108] S101: Determine a continuous index value corresponding to the element to be encoded through a conditional entropy model.
[0109] The conditional entropy model provided by the embodiment of the present application is used to predict the continuous index value (i, j) corresponding to the element to be encoded.
[0110] In a specific implementation manner, the training process of the conditional entropy model can be as follows:
[0111] First, use a hyperprior model or a context model to obtain a continuous index value corresponding to the sample encoded element.
[0112] Second, according to the continuous index value, determine the weight value π corresponding to each preset discrete index value through the following formula (5) mn , the weight value π mn represents the probability that this distribution is selected.
[0113]
[0114] Among them, πmn is the weight value, (i, j) is the continuous index value, (m, n) is the discrete index value, and τ is the temperature coefficient (used to control the smoothness of the weight). It should be noted that when determining the weight value π corresponding to all preset discrete index values (m, n) according to the continuous index value (i, j). mn During the training process of (i.e., during the training process corresponding to formula (5)), the temperature coefficient τ will gradually decrease (i.e., annealing), so that the weight value π mn gradually tends to a discrete distribution (i.e., finally only one probability distribution θ mn ) is selected. The annealing strategy can be linear or exponential. For the specific annealing strategy, this application does not make any limitations.
[0115] Subsequently, the code rate value is determined according to the weight value π mn
[0116] Finally, by minimizing the difference between the loss function value and the code rate value, the original conditional entropy model is trained to obtain the conditional entropy model.
[0117] After training the conditional entropy model in the above manner, in actual applications, the trained conditional entropy model can be directly used to determine the continuous index value (i, j) corresponding to the element to be encoded. The continuous index value (i, j) can represent the position of the element to be encoded in the preset probability distribution set {θ 11 , θ 12 , …, θ MN}.
[0118] It should be noted that when the probability distribution set is two-dimensional, the distribution forms in the probability distribution set include any one of Gaussian distribution, generalized Gaussian distribution, and mixture Gaussian distribution. Among them, the distribution form in the probability distribution set being Gaussian distribution means that there is no restriction on Gaussian distribution μ = 0, that is, θ = (μ, σ). The distribution form in the probability distribution set being generalized Gaussian distribution means that there is no restriction on Gaussian distribution μ = 0, that is, θ = (μ, β, α). The distribution form in the probability distribution set being mixture Gaussian distribution means that there is no restriction on Gaussian distribution μ = 0. When the mixture Gaussian distribution contains three Gaussian distributions, θ = (p1, μ1, σ1, p2, μ2, σ2, p3, μ3, σ3).
[0119] In a specific implementation manner, the element to be encoded input to the conditional entropy model can be the image to be encoded or the feature image corresponding to the image to be encoded. Through the information in the feature image corresponding to the image to be encoded, the position of the continuous index value (i, j) corresponding to the element to be encoded in the preset probability distribution set can be predicted more accurately, thereby further improving the accuracy and efficiency of encoding (i.e., achieving lossless encoding).
[0120] When the element to be encoded is a feature image, the conditional entropy model can further analyze the hyperprior information in the feature image (such as the statistical characteristics of the feature map), and predict the corresponding continuous index values (i, j) according to the hyperprior information . Among them, the hyperprior information is the high-level statistical information in the feature image, which is usually used to assist in the modeling of the probability distribution.
[0121] S102: Determine the probability distribution corresponding to the discrete index value from the preset set of probability distributions by determining the discrete index value corresponding to the continuous index value.
[0122] Since the continuous index values (i, j) are continuous, it is necessary to map the continuous index values (i, j) to the set of discrete probability distributions {θ 11 , θ 12 , …, θ MN} in some way. In the conditional entropy coding method provided in the embodiments of the present application, the position of the probability distribution corresponding to the element to be encoded in the set of probability distributions {θ 11 , θ 12 , …, θ MN} can be determined by determining the discrete index value (m, n) corresponding to the continuous index value (i, j) (i.e., θ mn ).
[0123] In practical applications, the integer closest to the continuous index value (i, j) can be determined from all the preset discrete index values (m, n) as the discrete index value (m, n) corresponding to the continuous index value (i, j), that is where is the rounding symbol. It can be understood that in practical applications, the formula (5) can also be directly used for the calculation of the index value. For this, the present application does not make a limitation.
[0124] S103: Determine the cumulative distribution function corresponding to the probability distribution from the pre-stored cumulative distribution function lookup table.
[0125] Before actual operation, the conditional entropy coding method provided in the embodiments of the present application has already calculated the cumulative distribution functions {CDF 11 , CDF 12 , …, CDF MN} for each probability distribution {θ 11 , CDF 12 , …, CDF MN}. And all the cumulative distribution functions {CDF 11 , CDF 12 , …, CDF MN} have been stored in the encoder in the form of a cumulative distribution function lookup table.
[0126] The cumulative distribution function lookup table is directly used in the actual coding process, that is, the cumulative distribution function corresponding to the probability distribution can be directly determined from the pre-stored cumulative distribution function lookup table, thus avoiding the complex process of dynamically calculating the cumulative distribution function, reducing the floating-point calculation error, and improving the reliability of coding.
[0127] S104: Perform entropy coding on the element to be coded through the cumulative distribution function.
[0128] It can be understood that the above conditional entropy coding method is the coding step executed by the coding end, and the same discrete index values (m, n) and cumulative distribution function CDF can also be used at the decoding end mn , to decode the element to be coded from the binary code stream. This will not be elaborated here.
[0129] In summary, the embodiment of the present application provides a conditional entropy coding method, which includes: determining the continuous index value corresponding to the element to be coded through a conditional entropy model; determining the discrete index value corresponding to the continuous index value, and determining the probability distribution corresponding to the discrete index value from a preset probability distribution set; determining the cumulative distribution function corresponding to the probability distribution from a pre-stored cumulative distribution function lookup table; performing entropy coding on the element to be coded through the cumulative distribution function. Thus, the present application only needs to predict a continuous index value, and determines the discrete index value through a simple mapping operation, and then directly obtains the cumulative distribution function corresponding to the discrete index value through the pre-stored cumulative distribution function lookup table, avoiding the complex process of dynamically calculating the cumulative distribution function. This method reduces the computational complexity of coding and improves the coding efficiency. Further, if the dynamic calculation of the cumulative distribution function is performed according to the conditional entropy coding method in the prior art, floating-point calculation errors may be introduced, resulting in inconsistent coding and decoding results on different platforms and affecting the reliability of coding. Therefore, the present application directly determines the cumulative distribution function corresponding to the probability distribution from the pre-stored cumulative distribution function lookup table, avoiding the complex process of dynamically calculating the cumulative distribution function, reducing the floating-point calculation error, and improving the reliability of coding.
[0130] The third embodiment
[0131] See Figure 4 , which is a schematic diagram of a conditional entropy coding device provided by the embodiment of the present application. The conditional entropy coding device 400 includes: an index determination module 401, a distribution determination module 402, a function determination module 403, and an element coding module 404.
[0132] The index determination module 401 is used to determine the continuous index value corresponding to the element to be coded through a conditional entropy model;
[0133] A distribution determination module 402, configured to determine a probability distribution corresponding to a discrete index value from a preset set of probability distributions by determining the discrete index value corresponding to a continuous index value;
[0134] A function determination module 403, configured to determine a cumulative distribution function corresponding to the probability distribution from a pre-stored cumulative distribution function look-up table;
[0135] An element encoding module 404, configured to perform entropy encoding on an element to be encoded through the cumulative distribution function.
[0136] In some specific implementation manners, the distribution determination module 402 is specifically configured to: determine weight values corresponding to all preset discrete index values according to the continuous index value; determine the discrete index value with the largest weight value as the discrete index value corresponding to the continuous index value.
[0137] In some specific implementation manners, when the set of probability distributions is one-dimensional, the formula for determining the weight value is as shown in formula (6) below:
[0138]
[0139] where, π m is the weight value, i is the continuous index value, m is the discrete index value, and τ is the temperature coefficient.
[0140] In some specific implementation manners, when the set of probability distributions is two-dimensional, the formula for determining the weight value is as shown in formula (7) below:
[0141]
[0142] where, π mn is the weight value, (i, j) is the continuous index value, (m, n) is the discrete index value, and τ is the temperature coefficient.
[0143] In some specific implementation manners, the obtaining unit of the conditional entropy model is as follows:
[0144] A first obtaining unit, configured to obtain a continuous index value corresponding to a sample encoding element by using a hyperprior model or a context model;
[0145] A second obtaining unit, configured to determine weight values corresponding to all preset discrete index values according to the continuous index value;
[0146] A third obtaining unit, configured to determine a code rate value according to the weight value; the formula for determining the code rate value is as shown in formula (8) below;
[0147]
[0148] where R is the code rate value, M is the number of probability distributions, m is the discrete index value, and π m is the weight value, and P is the probability of calculating the sample coding element m under the given probability distribution θ ;
[0149] A fourth obtaining unit, configured to train the original conditional entropy model by minimizing the difference between the loss function value and the code rate value, and obtain a conditional entropy model; the determination formula of the loss function value is shown in the following formula (9):
[0150] L = R + λD (9)
[0151] where L is the loss function value, R is the code rate value, λ is the weight coefficient, and D is the distortion metric.
[0152] In some specific implementation manners, the element to be encoded is an image to be encoded or a feature image corresponding to the image to be encoded.
[0153] In some specific implementation manners, when the element to be encoded is a feature image corresponding to the image to be encoded, the index determination module 401 is specifically configured to: determine the continuous index value corresponding to the hyperprior information in the feature image corresponding to the image to be encoded through the conditional entropy model.
[0154] In some specific implementation manners, when the probability distribution set is one-dimensional, the distribution form in the probability distribution set includes a Gaussian distribution or a generalized Gaussian distribution; when the probability distribution set is two-dimensional, the distribution form in the probability distribution set includes any one of a Gaussian distribution, a generalized Gaussian distribution, and a mixture Gaussian distribution.
[0155] In summary, the embodiments of the present application provide a conditional entropy encoding device, which includes: determining a continuous index value corresponding to an element to be encoded through a conditional entropy model; determining a discrete index value corresponding to the continuous index value, and determining a probability distribution corresponding to the discrete index value from a preset set of probability distributions; determining a cumulative distribution function corresponding to the probability distribution from a pre-stored cumulative distribution function lookup table; and performing entropy encoding on the element to be encoded through the cumulative distribution function. Thus, the present application only needs to predict a continuous index value, determine the discrete index value through a simple mapping operation, and then directly obtain the cumulative distribution function corresponding to the discrete index value through the pre-stored cumulative distribution function lookup table, avoiding the complex process of dynamically calculating the cumulative distribution function. This device reduces the computational complexity of encoding and improves the encoding efficiency. Further, if the dynamic calculation of the cumulative distribution function is performed according to the conditional entropy encoding device in the prior art, floating-point calculation errors may be introduced, resulting in inconsistent encoding and decoding results on different platforms and affecting the reliability of encoding. Therefore, the present application directly determines the cumulative distribution function corresponding to the probability distribution from the pre-stored cumulative distribution function lookup table, avoiding the complex process of dynamically calculating the cumulative distribution function, reducing floating-point calculation errors, and improving the reliability of encoding.
[0156] The present application also discloses a conditional entropy encoding device, which includes: a memory and a processor; the memory is used for storing a program; the processor is used for executing the program to implement each step of the conditional entropy encoding method as described in the first aspect.
[0157] It should be noted that the embodiments in this specification are all described in a progressive manner. The same or similar parts among the embodiments can be referred to each other, and the differences between each embodiment and other embodiments are emphasized. In particular, for the device embodiments, since they are basically similar to the method embodiments, they are described relatively simply, and the relevant parts can refer to the partial descriptions of the method embodiments. The device embodiments described above are only illustrative. The units described as separated components may or may not be physically separated, and the components described as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without creative efforts.
[0158] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. On the contrary, the specific features and acts described above are merely example forms for implementing the claims.
[0159] Although several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present application. Certain features described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, the various features described in the context of a single embodiment can also be implemented separately or in any suitable sub-combination in multiple embodiments.
[0160] The above description is only a preferred embodiment of the present application and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of disclosure involved in the present application is not limited to the technical solutions formed by the specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosure concept. For example, the technical solutions formed by mutually replacing the above features with the technical features (but not limited to) having similar functions disclosed in the present application.
Claims
1. A conditional entropy coding method, characterized in that: The method comprises: Determine the continuous index value corresponding to the element to be encoded through the conditional entropy model; By determining a discrete index value corresponding to the continuous index value, determining a probability distribution corresponding to the discrete index value from a preset probability distribution set; Determining a cumulative distribution function corresponding to the probability distribution from a pre-stored cumulative distribution function lookup table; The element to be encoded is entropy encoded by using the cumulative distribution function.
2. The method according to claim 1, characterized in that The determining of the discrete index value corresponding to the continuous index value comprises: Determine, according to the continuous index value, weight values corresponding to all preset discrete index values respectively; A discrete index value with the largest weight value is determined as the discrete index value corresponding to the continuous index value.
3. The method according to claim 2, characterized in that When the probability distribution set is one-dimensional, the formula for determining the weight value is as follows: Among them, π m is the weight value, i is the continuous index value, m is the discrete index value, and τ is the temperature coefficient.
4. The method according to claim 2, characterized in that: When the probability distribution set is two-dimensional, the formula for determining the weight value is as follows: Among them, π mn is the weight value, (i, j) is the continuous index value, (m, n) is the discrete index value, and τ is the temperature coefficient.
5. The method according to claim 1, characterized in that The conditional entropy model is obtained as follows: Using a hyper-prior model or a context model, obtaining continuous index values corresponding to sample coding elements; Determine, according to the continuous index value, weight values corresponding to all preset discrete index values respectively; According to the weight value, the code rate value is determined; the formula for determining the code rate value is as follows: Among them, R is the bit rate value, M is the number of probability distributions, m is the discrete index value, π m is the weight value, P is the value for calculating the given probability distribution θ m Sample coded elements The probability of The original conditional entropy model is trained by minimizing the difference between the loss function value and the bit rate value to obtain a conditional entropy model; the formula for determining the loss function value is as follows: L = R + λD; Among them, L is the loss function value, R is the bit rate value, λ is the weight coefficient, and D is the distortion measure.
6. The method according to any one of claims 1 to 5, characterized in that: The element to be encoded is an image to be encoded, or a feature image corresponding to the image to be encoded.
7. The method according to claim 6, characterized in that When the element to be encoded is a feature image corresponding to the image to be encoded, determining the continuous index value corresponding to the element to be encoded by the conditional entropy model includes: The continuous index values corresponding to the super-prior information in the feature image corresponding to the image to be encoded are determined through the conditional entropy model.
8. The method according to claim 1, characterized in that: When the probability distribution set is one-dimensional, the distribution form in the probability distribution set includes Gaussian distribution or generalized Gaussian distribution; when the probability distribution set is two-dimensional, the distribution form in the probability distribution set includes any one of Gaussian distribution, generalized Gaussian distribution and mixed Gaussian distribution.
9. A conditional entropy coding device, characterized in that: The device comprises: an index determination module, a distribution determination module, a function determination module and an element encoding module; The index determination module is used to determine the continuous index values corresponding to the elements to be encoded through a conditional entropy model; The distribution determination module is used to determine the probability distribution corresponding to the discrete index value from a preset probability distribution set by determining the discrete index value corresponding to the continuous index value; The function determination module is used to determine the cumulative distribution function corresponding to the probability distribution from a pre-stored cumulative distribution function lookup table; The element encoding module is used to perform entropy encoding on the element to be encoded by using the cumulative distribution function.
10. A conditional entropy coding device, characterized in that: The device comprises: a memory and a processor; The memory is used to store programs; The processor is used to execute the program to implement each step of the conditional entropy coding method according to any one of claims 1 to 8.