---
title: "Conditional Probability Models for Deep Image Compression (2018)"
description: "How conditional probability estimates guide learned image compression, balance image quality against bitrate, and improve entropy coding."
canonical: "https://research.elamur.ai/free/en/papers/mentzer-2018-conditional-probability-models-deep-image/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/mentzer-2018-conditional-probability-models-deep-image/)

[home](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2018](https://md.research.elamur.ai/free/en/papers/2018/) / Conditional Probability Models for Deep Image Compression

# Conditional Probability Models for Deep Image Compression

Paper · 2018 · Fabian Mentzer, Eirikur Agustsson, Michael Tschannen et al.

**Authors:** [Fabian Mentzer](https://md.research.elamur.ai/free/en/authors/fabian-mentzer/), [Eirikur Agustsson](https://md.research.elamur.ai/free/en/authors/eirikur-agustsson/), [Michael Tschannen](https://md.research.elamur.ai/free/en/authors/michael-tschannen/), [Radu Timofte](https://md.research.elamur.ai/free/en/authors/radu-timofte/) and [Luc Van Gool](https://md.research.elamur.ai/free/en/authors/luc-van-gool/) · **Year:** 2018 · **Venue:** IEEE Computer Society Conference on Computer Vision and Pattern Recognition/Proceedings - IEEE Computer Society Conference on Computer Vision and Pattern Recognition/Proceedings · **Licence:** [arXiv — non-exclusive license to distribute](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

[**490** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W2782637256) · IEEE Computer Society Conference on Computer Vision and Pattern Recognition/Proceedings - IEEE Computer Society Conference on Computer Vision and Pattern Recognition/Proceedings · [licence](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

- [DOI 10.1109/cvpr.2018.00462](https://doi.org/10.1109/cvpr.2018.00462)
- [arXiv 1801.04260](https://arxiv.org/abs/1801.04260)
- [OpenAlex](https://openalex.org/W2782637256)

## Deep dive: Conditional Probability Models for Deep Image Compression

How conditional probability estimates guide learned image compression, balance image quality against bitrate, and improve entropy coding. · about 34 minutes to read

**In this deep dive**

1. [Summary](#dd-summary)
2. [Ideas worth borrowing](#dd-ideas-worth-borrowing)
3. [How Mova uses it](#dd-how-mova-uses-it)
4. [The problem and its context](#dd-the-problem-and-its-context)
5. [The method, step by step](#dd-the-method-step-by-step)
6. [Experiments and results](#dd-experiments-and-results)
7. [What the ablations show](#dd-what-the-ablations-show)
8. [Limitations](#dd-limitations)
9. [What came after](#dd-what-came-after)

### Summary

Compressing an image means deciding what information to preserve and how economically to describe it. A learned encoder can turn an image into a compact internal representation, and a decoder can reconstruct an approximation from that representation. But a small representation does not automatically produce a small file. Its storage cost also depends on how predictable its contents are. Conditional Probability Models for Deep Image Compression studies how to make that predictability part of the learning process, so that the encoder learns to preserve useful visual information in a form that is economical to encode.

The paper combines a convolutional image auto-encoder with a separate probability-estimation network. An auto-encoder is a pair of networks: one transforms the image into an intermediate representation, and the other reconstructs the image from it. The intermediate values are quantized, meaning that each is replaced by a member of a finite set of permitted symbols. The probability network predicts each symbol from symbols that come earlier in a fixed ordering. These predictions estimate the representation’s coding cost. Crucially, the encoder and probability network learn together. The encoder therefore receives feedback about both reconstruction quality and the cost of describing what it produces.

The probability network uses masked three-dimensional convolutions. Its input is the quantized representation, which has spatial dimensions and a channel dimension. Masking prevents a prediction from depending on the symbol being predicted or on symbols that would be unavailable during decoding. This gives the training procedure an efficient way to calculate many conditional probabilities together while preserving the ordering required for compression. The paper also introduces an importance map within the encoder. This map lets different image regions use different amounts of the available representation, providing a direct way to allocate more capacity to complex areas and less to predictable ones.

The experiments optimize and evaluate multi-scale structural similarity, or MS-SSIM, a measure of similarity between an original image and its reconstruction. On Kodak, the authors report better MS-SSIM performance than BPG, JPEG, JPEG2000, and several earlier learned approaches, with performance comparable to Rippel and Bourdev over the tested range from 0.3 bpp to 0.9 bpp. Here, bpp means bits per pixel. Tests on ImageNetTest, B100, and Urban100 also favor the proposed system over the engineered codecs under that metric. A separate analysis shows that learning symbol dependencies improves coding even when the image representation is held fixed, while supplementary experiments support an additional benefit from training the representation and probability estimator together.

The result is a specific contribution to [efficient computation and compression](https://md.research.elamur.ai/free/en/topics/efficient-models/): the mechanism used to estimate storage cost can help shape the representation itself. The evidence concerns lossy image compression evaluated primarily through MS-SSIM. It does not establish universal perceptual superiority, and the visual examples reveal tradeoffs, including occasional blurring and weaker preservation of some fine structures.

### Ideas worth borrowing

Train against the cost that deployment actually incurs. The paper makes the probability estimator part of the encoder’s learning objective because the estimator determines how economically the output can be coded. A representation that appears compact under a crude assumption may remain expensive when passed through the real coding procedure. The reusable idea is to bring a sufficiently faithful estimate of the eventual resource cost into training. It applies whenever a learned representation will later be stored, transmitted, or processed through a mechanism whose behavior depends on that representation.

Learn the representation and its evaluator together. The probability network adapts to the symbols produced by the encoder, while the encoder adapts to the costs assigned by the probability network. These updates address different parts of the same problem. A better predictor can exploit regularities that already exist, and a better encoder can create regularities without sacrificing too much reconstruction quality. This suggests a broader design pattern for [machine learning](https://md.research.elamur.ai/free/en/concepts/machine-learning/): when an auxiliary estimator supplies a training signal, keeping that estimator responsive to the changing representation can matter as much as making it powerful in isolation.

Express availability constraints in the architecture. The context network must predict a symbol using only information that a decoder could already possess. Instead of separately constructing and evaluating a permissible input patch for every prediction, the authors enforce this restriction by masking convolutional weights. The resulting network can process the complete known representation during training without gaining access to forbidden information. The transferable idea is to encode information-access rules directly into computation. This is useful when parallel training must remain faithful to a process that reveals information progressively.

Use exact discrete values forward and smooth derivatives backward. Quantization is necessary to obtain a finite symbol alphabet, but nearest-center assignment does not provide useful ordinary gradients everywhere. The paper keeps the actual discrete assignment in the forward computation and borrows derivatives from a smooth approximation during back-propagation. This makes the decoder and probability network train on the values they will actually receive. The broader lesson is to distinguish fidelity of the simulated operation from usefulness of the derivative. That distinction can help with learned systems containing discrete bottlenecks, although the resulting derivative remains an approximation.

Give resource allocation an explicit control surface. The conditional coding objective already allows different regions to have different costs, but discovering a useful allocation entirely through that objective may be difficult. The importance map adds an architectural route for changing how many channels remain active at each location. The authors find this convenient for controlling bitrate with a fixed channel capacity. The reusable principle is to expose a direct allocation variable when a network otherwise has to discover a complicated indirect route to the same behavior.

Separate fixed-representation gains from joint-training gains. The context ablation first freezes an encoder and decoder, then compares ways of predicting their symbols. That isolates what better probability estimation can recover from an unchanged representation. A supplementary comparison then examines the further benefit of concurrent training. This separation is valuable in any system where a learned representation and a downstream component improve together. Without it, a favorable final result can leave unclear whether the gain came from better prediction, a different representation, or their interaction.

### How Mova uses it

For Mova, the small transparent language system written in Rust, the useful connection is conceptual instead of an established implementation claim. There is no documented integration here of the paper’s image encoder, importance map, or masked convolutional probability network. The paper instead offers a way to think about the relationship between representation, predictability, and storage. A system can produce a short sequence of internal symbols and still use space inefficiently if the storage mechanism ignores regularities among those symbols.

One possible application would be to evaluate the storage of Mova’s internal symbolic data through conditional coding cost. Rather than treating every symbol as having an identical cost, an experimental component could estimate how predictable a symbol is given an explicitly defined preceding context. Repeated or strongly constrained sequences could then receive lower estimated costs than surprising ones. This would be a proposed experiment, not a feature demonstrated by the image-compression results. The relevant evidence from the paper is that dependencies in a learned representation can be useful both for coding it and for guiding how it is produced.

Transparency would make the definition of context especially important. In the image system, the authors state an ordering and restrict each prediction to earlier symbols. A Mova experiment could follow the same discipline by making its permitted context inspectable. A developer should be able to determine which previous entries influence a prediction and whether that information would be available when reconstructing the stored data. The transferable requirement is agreement between the assumptions used to estimate a cost and the information available when that cost is actually incurred.

Another possible use concerns representation design. If Mova ever learns a compact intermediate representation, the paper suggests evaluating reconstruction or task utility together with the cost of describing that representation. It would be premature to assume that image distortion has a direct language equivalent. In language, losing a small written detail can alter meaning substantially, so an acceptable utility measure would have to be specified independently. The image experiments establish a method for balancing objectives; they do not establish the right objective for a transparent language system.

The importance map also offers an architectural analogy. A language system might benefit from an explicit mechanism for allocating representational capacity where it is needed. That possibility should remain separate from any claim that image channels correspond to linguistic units. What can be borrowed is the engineering question: can a clear allocation mechanism make resource control easier to understand and tune? The paper’s evidence supports asking that question. It does not demonstrate a language implementation or a measured benefit for Mova.

### The problem and its context

#### Why a compact representation is not enough

An image compressor has to solve related but distinct problems. It must choose a representation from which a useful reconstruction can be obtained, and it must describe that representation economically. In lossless compression, reconstruction must recover the original image exactly. In lossy compression, the system may discard information, provided the resulting distortion is acceptable. This creates a tradeoff: a shorter description generally requires accepting more reconstruction error.

A learned auto-encoder provides a natural framework for making that tradeoff. The encoder transforms the input image into a latent representation, and the decoder transforms that representation back into an image. “Latent” here means an intermediate representation learned for the compression task instead of a directly supplied image format. The encoder can learn what information is useful for the decoder, while the decoder learns how to reconstruct from the encoder’s outputs.

However, real-valued intermediate outputs cannot simply be treated as a finite compressed message. They must first be mapped to discrete symbols. Once that is done, the number of symbols still does not fully determine the required storage. A sequence containing highly predictable symbols can be encoded more economically than a sequence whose symbols are difficult to predict, even if the sequences have the same length.

This is why entropy enters the objective. Entropy characterizes the uncertainty of a discrete distribution and therefore its ideal coding cost. The encoder should preserve information that matters for reconstruction while avoiding unnecessary uncertainty in the representation. The paper’s main problem is how to estimate that uncertainty in a way that is useful during learning.

A simple estimate might assume that symbols are independent. Under that assumption, a symbol’s probability does not depend on its neighbors or on preceding channels. Such an estimate can recognize that some symbols are more frequent than others, but it cannot recognize all the savings available from relationships among symbols. If the representation contains dependable patterns, an independence assumption gives the encoder an incomplete account of what can be compressed.

#### What earlier learned compressors did

The paper describes an emerging body of learned image compression using auto-encoders and recurrent neural networks. Many of the earlier systems optimized mean squared error, or MSE, between the original and reconstructed images. Other work used perceptual similarity objectives, including MS-SSIM. The distinction matters because a reconstruction that performs well under one distortion measure need not be preferred under another.

The earlier approaches also explored several architectural and training choices. The paper discusses progressive reconstruction, adversarial training, multiscale decompositions, and generalized divisive normalization. These techniques offered different ways to improve visual reconstruction or organize the compression process. The present contribution is more narrowly focused on the cost assigned to the intermediate representation during optimization.

Context-dependent coding was already established in engineered compression. The paper places its work within that longer history instead of presenting conditional probability estimation as a new invention. It also describes previous learned compressors that used context-dependent arithmetic coding to improve the coding of their outputs. The question is therefore not whether context helps compression at all. It is how context-dependent cost can influence the representation while that representation is still being learned.

In the approaches attributed to Toderici and to Li, the context component was trained after the main compression system. That arrangement can extract coding savings from a finished representation, but the encoder does not receive the resulting conditional costs while learning. It cannot deliberately change its outputs in response to those costs.

The paper contrasts this with approaches by Theis and Agustsson that estimated the rate term using independence among symbols. Those systems did include an entropy-related learning objective, but the estimate did not capture the conditional dependencies targeted here. The proposed method joins the advantages of these directions: a context-sensitive cost estimate becomes part of the encoder’s training signal.

#### Why PixelCNN and PixelRNN matter here

The authors draw on PixelCNN and PixelRNN for factorizing a joint distribution into conditional predictions. In the work described by the paper, these architectures operate on image pixels and can support lossless compression or image generation. Their relevance is the ability to assign probabilities while respecting an ordering: each prediction uses information that precedes its target.

The present paper moves that idea inside a lossy compressor. Its probability network does not directly predict the original image’s pixels. It predicts the discrete symbols emitted by the learned encoder. That distinction gives the encoder an opportunity to make the prediction problem easier. The representation is no longer a fixed object supplied by the dataset; it changes as the compression system learns.

There is also a dimensional difference. The latent representation has spatial axes and a potentially substantial channel axis. The authors therefore extend masked convolution to a three-dimensional symbol volume. The resulting probability estimator can learn relationships across both space and channel position while obeying the decoding order.

The central scientific claim follows from this combination. Conditional prediction is not merely an extra coding stage attached to an already trained compressor. It becomes a source of pressure on what the compressor learns to represent. The experiments then ask whether this relatively direct arrangement can achieve strong rate–distortion performance without the more specialized machinery used by some contemporary systems.

### The method, step by step

#### Follow an image through the system

The full system contains an encoder, an importance-map mechanism, a quantizer, a probability estimator, and a decoder. During compression, the encoder creates a latent representation. The importance map changes which parts of that representation remain active. Quantization turns the resulting values into a finite alphabet of symbols. A context network assigns probabilities to those symbols, enabling entropy coding. Reconstruction reverses the storage part of the process to recover the symbols and then passes them through the decoder.

Learning a compressible image representation The steps in order.

The training process uses the same discrete values that the decoder will later receive. Its special treatment of quantization concerns derivatives, not the values seen in the forward computation. This is important because both reconstruction quality and symbol predictability depend on the actual discrete representation.

#### Define the encoder and reconstruction

The encoder maps an image into a real-valued latent representation:

```
z = E(x)
```

Here, x is the input image, E is the encoder, and z is its output. The paper writes the image as belonging to a real-valued space of dimension d and the latent representation as belonging to a real-valued space of dimension m. These dimensions describe the number of scalar entries when the image and representation are viewed as vectors.

Quantization produces the representation supplied to the decoder:

```
x̂ = D(ẑ)
```

The symbol ẑ denotes the quantized latent representation, D denotes the decoder, and x̂ denotes the reconstructed image. The hat distinguishes a discrete or reconstructed quantity from its original continuous counterpart.

Though vector notation is convenient for the mathematics, the actual latent representation is a feature volume. It has spatial locations and channels. Its entries can be placed in a fixed scan order, allowing ẑᵢ to refer to an individual symbol. This ordering becomes essential when defining which symbols are available as context for a prediction.

The basic learning objective balances reconstruction distortion against entropy:

```
d(x, x̂) + βH(ẑ)
```

The function d measures the discrepancy between input x and reconstruction x̂. H denotes the entropy-related cost of the discrete representation ẑ. The positive weight β controls the emphasis placed on that cost. A larger weight favors a representation that is cheaper to describe, while a smaller weight permits more coding cost in pursuit of reconstruction quality.

The notation d is used for distortion even though it also appears in the paper’s description of input dimensionality. These are separate uses. In the objective, d is a function of the original and reconstructed images.

#### Replace continuous values with learned symbols

The quantizer uses a finite collection of centers:

```
𝒞 = {c₁, …, c_L}
```

The set 𝒞 is the symbol alphabet expressed as real-valued centers. Each cⱼ is an allowed representative value, and L is the number of centers. The centers are learned along with the rest of the compression system.

For each scalar latent value, quantization selects the nearest center:

```
I(zᵢ) = argminⱼ ‖zᵢ − cⱼ‖,    ẑᵢ = c_I(zᵢ)
```

The index i identifies a latent entry, j ranges over the centers, and the distance measures how far zᵢ lies from cⱼ. The function I returns the selected center’s index, while ẑᵢ is the selected center itself. Making this distinction explicit helps separate a symbol’s stored identity from the numerical value passed to the decoder.

The paper’s hard-assignment expression uses an argmin in its definition of quantization. Read operationally, the intended operation is nearest-center selection. The decoder receives the corresponding center value, while coding and classification refer to its index within the alphabet.

Nearest-center assignment is suitable for making discrete symbols, but it creates a training difficulty. Small changes in a latent value often leave its assigned center unchanged. Ordinary gradients through that decision therefore do not provide a useful description of how the encoder should change.

The paper introduces a smooth alternative for calculating derivatives:

```
z̃ᵢ = Σⱼ₌₁ᴸ [exp(−σ‖zᵢ − cⱼ‖) / Σₗ₌₁ᴸ exp(−σ‖zᵢ − cₗ‖)]cⱼ
```

The quantity z̃ᵢ is a weighted average of the centers. The exponential terms give greater weight to centers closer to zᵢ. The parameter σ controls the sharpness of those weights, and l is the index used in the normalizing denominator. Unlike a hard nearest-center choice, this weighted expression varies smoothly with the latent value and centers.

The forward and backward computations are then combined:

```
z̄ᵢ = stopgradient(ẑᵢ − z̃ᵢ) + z̃ᵢ
```

The operation stopgradient keeps its argument’s value while blocking its derivative. Numerically, z̄ᵢ equals the hard-quantized value ẑᵢ. During back-propagation, however, the derivative comes from z̃ᵢ. The decoder and context network therefore encounter discrete inputs, while the encoder receives gradients through the smooth approximation.

This combines learned quantization centers with a relatively simple training procedure. The authors do not need to gradually force a soft forward representation to become hard through an annealing schedule. In their experiments, σ is set to 1.

#### Factor the distribution into conditional predictions

To estimate coding cost, the paper describes the probability of the complete symbol sequence through a product:

```
p(ẑ) = ∏ᵢ₌₁ᵐ p(ẑᵢ | ẑᵢ₋₁, …, ẑ₁)
```

The distribution p is the true distribution of quantized representations produced by the encoder over images. The integer m counts the latent entries in the chosen ordering. Each factor gives the probability of the current symbol conditioned on all preceding symbols.

This factorization does not assume independence. It expresses a joint probability through a sequence of conditional probabilities. Its practical difficulty is that those conditionals are unknown. The paper learns an approximation with a neural context network, denoted P.

For each latent position and possible center, the network supplies a probability:

```
Pᵢ,ₗ(ẑ) ≈ p(ẑᵢ = cₗ | ẑᵢ₋₁, …, ẑ₁)
```

The subscript i selects the latent position. The subscript l selects a center cₗ from the alphabet. Pᵢ,ₗ is therefore the predicted probability that the current symbol equals that center, given the permitted earlier context.

The approximate probability assigned to the entire representation is:

```
q(ẑ) = ∏ᵢ₌₁ᵐ Pᵢ,I(ẑᵢ)(ẑ)
```

Here, q is the distribution induced by the learned predictions. I(ẑᵢ) identifies the alphabet entry actually observed at location i. The product multiplies the probabilities assigned to the observed symbols throughout the representation.

This notation also clarifies the relationship between the network and the distribution. P produces local probability vectors; q is the sequence distribution assembled from the relevant entries of those vectors. A good context network makes q a useful approximation to the unknown p.

#### Enforce the information available during decoding

A probability predictor would be useless for compression if it could inspect the answer before predicting it. During decoding, the current symbol is not yet known. A valid prediction can depend only on symbols already recovered.

The authors impose this restriction through masked convolutional weights. The first layer excludes the current input symbol and later symbols. Subsequent layers can use appropriately restricted intermediate features. When these local restrictions are composed, the final prediction remains dependent only on the allowed input context.

The three-dimensional formulation treats the latent channel axis as a dimension across which filters move. This is different from an ordinary two-dimensional convolution that combines all input channels at once. Unrestricted mixing across channels could expose a prediction to values that occur later in the coding order. Sliding a masked filter across the channel dimension lets the network preserve the required ordering.

The context network has 4 layers, and the supplementary description specifies filter size 3 along each of its spatial and depth axes. The architecture caption describes intermediate masked convolutions with 24 output channels. The final layer emits L values for each latent location, corresponding to the possible quantization centers.

These local convolutions mean that the implemented predictor uses a bounded neighborhood, rather than literally every preceding symbol in the full factorization. The conditional notation states the permissible direction of dependence. The architecture determines how much of that permissible context the network can actually exploit.

When the complete quantized representation is available during training, the masked network can calculate probabilities across positions together. This is a major efficiency advantage over separately extracting and processing a context patch for every symbol. It should not be confused with unrestricted parallel decoding: an encoded representation still has to be recovered according to the context dependencies.

#### Turn prediction quality into a coding objective

The context network is trained to assign high probability to the symbols that the encoder actually produces. The corresponding cross-entropy objective is:

```
CE = 𝔼_ẑ∼p [Σᵢ₌₁ᵐ −log Pᵢ,I(ẑᵢ)(ẑ)]
```

The symbol 𝔼 denotes an expectation over representations sampled from p. The summation adds the negative logarithm of the predicted probability of each observed symbol. CE names the resulting cross-entropy.

A predictable symbol receives a high probability and contributes a smaller coding cost. An unexpected symbol receives a lower probability and contributes a larger cost. Training P to reduce cross-entropy is equivalent to maximizing the likelihood it assigns to the observed representations.

The paper relates this quantity to entropy:

```
H(ẑ) = 𝔼_ẑ∼p [−log p(ẑ)] ≈ 𝔼_ẑ∼p [−log q(ẑ)] = CE
```

H(ẑ) is the entropy under the unknown true distribution p. The approximation replaces p with the learned distribution q. The last equality follows because q is built from the conditional probabilities emitted by P.

The distinction between entropy and cross-entropy matters. The learned distribution need not match the true distribution perfectly. Its negative log-probabilities nevertheless describe the coding cost associated with using that distribution. For an actual compression system, that operational cost is directly relevant.

For an individual representation, the paper defines:

```
C(ẑ) = Σᵢ₌₁ᵐ −log Pᵢ,I(ẑᵢ)(ẑ)
```

C is the coding-cost estimate for that particular latent representation. CE is its expectation across representations. The same per-symbol predictions can support adaptive arithmetic coding, connecting the learning objective to the representation’s eventual compressed description.

The encoder can now be trained to reduce C as well as reconstruction distortion. Changes to the representation affect the symbols themselves and the contexts presented to P. The smooth backward treatment of quantization allows training signals to pass through those dependencies.

#### Add an importance map for spatial allocation

The encoder’s feature volume assigns the same maximum number of channels to every spatial location. Yet an image does not require equal descriptive capacity everywhere. A relatively uniform region and an area containing intricate texture pose different reconstruction demands.

The conditional coding objective already permits different spatial costs. Predictable symbols can be cheap wherever they occur. The authors nonetheless find it useful to provide a more direct architectural mechanism: an importance map predicted by the encoder.

If the encoder contains three stride-2 convolutional stages, the paper describes a latent volume with dimensions:

```
(W/8) × (H/8) × K
```

W and H are the input image’s width and height, and K is the number of latent channels. The importance map has the same spatial dimensions but a single output channel. Its value yᵢ,ⱼ controls how many latent channels remain active at spatial location (i, j).

The intended mask has a linear transition between inactive and active channel positions:

```
mᵢ,ⱼ,ₖ = 0 if yᵢ,ⱼ ≤ k;  yᵢ,ⱼ − k if k ≤ yᵢ,ⱼ ≤ k + 1;  1 if yᵢ,ⱼ ≥ k + 1
```

The mask entry mᵢ,ⱼ,ₖ corresponds to spatial coordinates i and j and channel coordinate k. Its intermediate values allow the mask to vary smoothly during derivative calculation. The endpoints express the intended transition described by the authors.

Before quantization, the encoder output is multiplied by a binarized version of that mask:

```
z ← z ⊙ ⌈m⌉
```

The symbol ⊙ denotes elementwise multiplication, and the ceiling operation ⌈m⌉ turns the mask into an active-or-inactive pattern. Inactive entries become zero before quantization. Since the ceiling operation is not differentiable, the authors use an identity derivative in the backward computation.

The resulting structure is ordered along each channel column. Earlier channels can remain active while later ones are suppressed. This makes the allocation mechanism more specific than arbitrary sparsity: it creates a spatially varying prefix of retained channels.

#### Explain the masked coding cost

A suppressed latent entry is quantized to Q(0), which the paper calls the zero symbol. It need not be a center whose numerical value is literally zero. What matters is that every suppressed entry produces the same known quantized symbol.

The authors observe that an effective mask can be recovered by examining consecutive zero symbols at the ends of channel columns. If an otherwise active entry already equals the zero symbol, the recovered mask can suppress it without changing the quantized representation.

This recoverability supports an entropy decomposition:

```
H(ẑ) = H(ẑ | ⌈m⌉) + H(⌈m⌉)
```

The first term on the right is the uncertainty of the representation when the mask is known. The second is the uncertainty of the mask itself. The equality depends on treating the effective mask as recoverable from ẑ, so that the mask contributes no additional uncertainty once the representation is known.

If mask entropy is treated as constant during optimization, reducing the conditional term provides a way to influence total representation cost. For inactive entries, the known mask makes the zero symbol deterministic. Their conditional coding contribution therefore vanishes.

The resulting estimate is:

```
H(ẑ | ⌈m⌉) ≈ 𝔼_ẑ∼p [Σᵢ₌₁ᵐ −⌈mᵢ⌉ log Pᵢ,I(ẑᵢ)(ẑ)]
```

The index i now refers to entries of both the flattened representation and the corresponding mask. The factor ⌈mᵢ⌉ removes the contribution from inactive positions. The remaining probabilities come from the same context network.

For an individual representation, the authors call this masked coding cost:

```
MC(ẑ) = Σᵢ₌₁ᵐ −⌈mᵢ⌉ log Pᵢ,I(ẑᵢ)(ẑ)
```

MC differs from C by weighting symbol costs with the binary mask. This gives the encoder a direct route to changing its estimated rate: it can alter the importance-map values and thereby change which channel positions contribute.

The context network itself continues to learn from the full masked symbol volume. It does not receive the importance mask as separate side information. At coding time, the complete latent representation can therefore be processed with ordinary context-dependent arithmetic coding, rather than requiring a separate mask stream followed by selected symbols.

#### Train the components concurrently

For a minibatch of cropped images, the encoder, decoder, and quantizer are updated using:

```
ℒ_E,D,Q = (1/B) Σⱼ₌₁ᴮ [d(x⁽ʲ⁾, x̂⁽ʲ⁾) + βMC(ẑ⁽ʲ⁾)]
```

B is the minibatch size, and j identifies an example within it. The superscript in parentheses labels the example instead of an exponent. ℒ_E,D,Q is the objective used to update the encoder E, decoder D, and quantizer Q.

The paper also writes the context-network objective as:

```
ℒ_P = (1/B) Σⱼ₌₁ᴮ [d(x⁽ʲ⁾, x̂⁽ʲ⁾) + βC(ẑ⁽ʲ⁾)]
```

ℒ_P denotes the objective for updating P. Though the expression includes distortion, that term does not depend on P when the other components are held fixed for this update. The effective learning signal for P is therefore the full coding cost C.

The asymmetry is deliberate. The encoder receives the masked cost, which exposes a convenient allocation mechanism. The context network learns to predict every symbol, including the patterned zero symbols created by masking. Both are updated throughout training, so each remains responsive to the other.

The authors identify an official implementation under the name imgcomp-cvpr. Their training pipeline uses fully convolutional components, allowing the computations for a minibatch to be carried out together on a GPU. The central implementation idea is straightforward despite the lengthy derivation: reconstruct from discrete symbols, estimate their conditional costs, and update the representation and its predictor together.

### Experiments and results

#### What was trained

The main experiments use a convolutional auto-encoder related to the architecture attributed to Theis, with additional layers. The encoder and decoder include residual units. The architecture description specifies batch normalization and SAME padding, together with normalization of image inputs using statistics obtained from part of the training data.

The authors train seven operating points. They vary the target rate and latent channel capacity to cover different compression levels. The probability estimator remains a relatively small masked 3D-CNN, instead of the deeper context architectures discussed in the related work.

The distortion objective is:

```
d(x, x̂) = 100 · (1 − MS-SSIM(x, x̂))
```

MS-SSIM measures similarity between the input x and reconstruction x̂ across scales. Subtracting it from 1 converts higher similarity into lower distortion, and the factor 100 scales the training term. This is the objective used for both training and the reported quality comparisons.

The choice matters when interpreting the results. The paper states that MS-SSIM has been reported to correspond more closely to perceived distortion than MSE. That motivates the metric, but does not make every visual judgment equivalent to MS-SSIM. The authors’ own examples show that different codecs preserve different kinds of detail.

Training uses Adam with a minibatch size of 30. A starting learning rate of 4 · 10⁻³ serves as a baseline for the compression components, with some variation between operating points. For the context network, the learning rate is 10⁻⁴. The rate–distortion weight is β = 10.

The learning rate is reduced by a factor of 10 after every two epochs. Each operating point is trained for 6 epochs, taking roughly 24h on a single GPU. The paper reports stable optimization with a small amount of weight regularization.

To improve control over the achieved rate, the authors clip the rate contribution:

```
βH → max(t, βH)
```

The quantity t is the target used in this clipped objective. When the estimated rate contribution falls below it, that contribution stops providing further pressure toward smaller rate. The authors report that this modification made the operating point easier to control without harming performance.

#### Training images and evaluation sets

Training uses ImageNet from ILSVRC2012. Images are sampled through random crops of size 160 × 160, with random flipping as augmentation. The authors reserve 100 ImageNet images as ImageNetTest.

The evaluation also includes Kodak, B100, and Urban100. The paper describes the latter evaluation sets as useful for examining high-quality images at full resolution. This matters because training on crops does not on its own establish performance on complete images with varied content and dimensions.

The tests therefore examine both held-out material associated with the training source and other established image collections. Favorable behavior across them supports some transfer beyond the particular crops seen during learning. It does not establish performance on every image domain.

The supplementary material includes a separate example from Manga109. That example is useful as a visual stress case involving non-photographic content, but it is not presented as an aggregate benchmark comparable to the main dataset curves.

#### Baselines and comparison procedure

The directly evaluated engineered codecs are JPEG, JPEG2000, and BPG. JPEG is run through libjpeg, while JPEG2000 uses Kakadu. BPG uses its non-default 4:4:4 chroma configuration, following the comparison setup attributed to Rippel and Bourdev.

For learned comparisons, the paper includes results attributed to Rippel and Bourdev, Johnston, Ballé, and Theis. These comparisons have a different provenance from the authors’ direct codec runs. Because implementations were generally unavailable, the authors digitized Kodak curves collected in the Rippel and Bourdev study.

That distinction affects how precisely the evidence should be read. The learned-baseline curves provide a common published reference, but they are not all newly generated under a single execution environment. The authors separately regenerate the BPG Kodak curve and check that it agrees with the corresponding published curve, providing a useful consistency check on their MS-SSIM implementation.

The averaging procedure is also important. For each image, the authors compress it at several operating points, producing pairs of bitrate and MS-SSIM. They interpolate a curve for that image. They then choose a grid of bitrate values and average the per-image curves at each grid point.

If an image’s measured operating points do not cover a grid value, that image is omitted at that value. The authors do not extrapolate beyond the available range. This avoids inventing behavior outside the observed operating points, although it means the contributing image set can vary across the rate grid.

This procedure differs from simply averaging the bitrate and quality of one trained operating point. Both approaches produce useful summaries, but they answer different questions. The supplementary discussion explicitly warns against treating those summaries as interchangeable.

#### Main rate–distortion findings

On Kodak, the reported curves favor the proposed system over JPEG, JPEG2000, and BPG in MS-SSIM. The authors also report stronger performance than the learned approaches attributed to Johnston, Ballé, and Theis. Their result is described as comparable to Rippel and Bourdev across the tested interval from 0.3 bpp to 0.9 bpp.

The paper does not supply a numerical listing of all curve coordinates in its prose. It would therefore be misleading to attach invented MS-SSIM values to particular bitrates. The supported quantitative range is the reported bitrate interval; the ranking within that interval comes from the authors’ curve comparison.

On ImageNetTest, B100, and Urban100, the proposed approach also exceeds BPG, JPEG, and JPEG2000 in the reported MS-SSIM comparisons. These additional sets strengthen the claim that the method’s behavior is not restricted to Kodak.

The comparison remains tied to the quality objective. Rippel and Bourdev and Johnston also optimize similarity-based criteria, whereas several other compared methods optimize MSE. The results establish strong performance under MS-SSIM, while the different training objectives help explain why rankings and visual preferences may vary with the chosen measure.

#### A numerical example of spatial allocation

The importance-map experiment provides exact bitrate values for an ImageNetTest image. The configuration with an importance map uses at most K = 32 channels and produces a representation at 0.463 bpp. The comparison configuration uses K = 16 without the map and produces 0.504 bpp for that image.

ImageNetTest example, bitrate with and without an importance map The configuration with spatial allocation uses fewer bits for this example, but the comparison does not establish matched reconstruction quality.

**The numbers**

| System or setting | bpp |
| --- | --- |
| Without importance map, K=16 | 0.504 |
| With importance map, K=32 (this paper) | 0.463 |

This chart reports storage for a particular example, not a controlled quality ranking. The architectures have different maximum channel capacities, and the paper does not attach a numerical quality score to the example in its discussion. Its main purpose is to make the allocation mechanism visible.

The visualizations show that later channels become progressively sparser when the importance map is used. Without it, the available channels are used more similarly. The result supports the claim that the map changes how representational capacity is distributed, rather than merely adding an uninterpreted extra output.

#### What the visual comparisons reveal

For the Kodak image kodim21, the authors discuss a strong-compression comparison. Their reconstruction preserves soft visual structure, including clouds. BPG retains some high-frequency detail more effectively, with the fence serving as an example, while losing structure in other regions such as the clouds and sea.

The supplementary examples broaden this pattern. Some outputs from the learned compressor appear overly smooth where BPG keeps sharper structures, including fences and text. In other cases, the learned method retains low-contrast detail that BPG discards, with examples involving a door and hair.

The Manga109 example makes the same point in a different domain. Text remains readable in the learned reconstruction, but appears less crisp than with BPG. A fine facial texture is preserved more effectively by the learned system in the authors’ comparison.

These observations help interpret the aggregate metric. The compressor has learned a particular balance of visual errors under MS-SSIM. Strong average similarity does not mean every local feature is preserved better, and a reader concerned with small text or sharp edges should pay attention to those examples.

All bitrate calculations in the paper exclude header information for every compared method. The authors state that their own format needs image dimensions and an identifier specifying the selected operating point. The reported rates therefore characterize the coded representation under that accounting convention.

### What the ablations show

#### Better prediction helps an unchanged representation

The most direct context ablation begins by training the auto-encoder without an entropy penalty. The setting uses β = 0, L = 6 centers, and K = 16 latent channels. On Kodak, the resulting reconstruction has mean MS-SSIM of 0.982.

Under the assumption that every symbol requires log₂(L) = 2.59 bits, its average bitrate is 0.646 bpp. This establishes the starting point for examining how much coding improvement is possible without changing the reconstruction. Since the encoder and decoder are subsequently frozen, the image output remains the same.

The authors then fit alternative probability estimators to those fixed symbols. A histogram baseline estimates symbol frequencies without conditioning on context. A one-step baseline estimates a symbol’s probability from the immediately preceding symbol. The proposed masked network can exploit a richer neighborhood.

The paper reports that the proposed context network lowers the rate by 10 % even though the encoder was trained under a uniform coding assumption. This is evidence for useful dependencies within the representation. Those dependencies can be exploited after the fact, independently of any improvement to the image transform.

The prose names a table of resulting rates, but does not supply its numerical entries. The exact per-baseline rates therefore cannot be reconstructed from the stated aggregate finding. The supported conclusion is that richer context improves coding of the frozen representation, with the reported reduction under that setup.

The terminology for baseline order also varies between the experiment description and the discussion. Describing the baselines by what they condition on avoids making that naming inconsistency consequential: one ignores context, and the other uses the previous symbol.

#### Joint learning adds another source of improvement

The supplementary material compares the separately trained context network with the concurrently trained system. A comparison of mean operating-point results shows a reported decrease of 22% in bpp. The authors explicitly identify the relevant comparison point as estimated.

That analysis supports the paper’s central claim: it helps to let the encoder respond to conditional coding cost. The gain is not exhausted by taking a finished representation and fitting a better compressor to it. Concurrent learning can change the representation into something that is easier for the probability network to describe.

The numerical result needs its stated qualification. It is based on mean points, with an estimated reference point, rather than a direct tabulation of matched per-image rates. The authors themselves distinguish it from the main interpolated Kodak curve. It should be treated as supporting evidence for joint optimization, with the comparison procedure kept visible.

This distinction is especially useful for understanding causation. The frozen-transform experiment isolates better probability prediction. The supplementary comparison adds representation adaptation. Together they explain why the final system can benefit from both a strong context estimator and a training signal that reaches the encoder.

#### The importance map exposes learned allocation

The importance-map visualization is a structural analysis rather than a comprehensive removal study. It compares configurations chosen to have broadly similar rates, while allowing different maximum channel capacities. The authors inspect the resulting channel activity and spatial importance output.

With the map, later channel positions become sparse. This is consistent with the intended architecture: a region can keep a shorter or longer prefix of channels. Without the map, the representation distributes activity more evenly among the available channels.

The paper does not conclude that the map is essential for the best achievable rate–distortion behavior. The authors state that careful selection of K can make it unnecessary for that purpose. Their stronger practical claim is that it simplifies rate control when K is held fixed.

A related training observation compares the ordinary and masked entropy losses. The masked estimate converges to a value around ≈ 3.5% smaller, which the authors attribute to excluding mask entropy. This shows that the objectives are close in their experiments while remaining distinct quantities.

#### Sharing a network across operating points

The supplementary experiment uses 5 importance maps within a shared auto-encoder. At each training iteration, a map is selected randomly and assigned a corresponding target:

```
target entropy = (i/5) · t
```

Here, i identifies the selected importance map, and t is the reference target. Different maps therefore encourage different operating points while sharing the main network.

The authors describe this untuned experiment as competitive with BPG. It demonstrates that the importance mechanism can support several compression levels within a shared system. It does not establish an optimized variable-rate design or remove the need to study quality and rate control more thoroughly.

### Limitations

#### Limits the authors identify

The authors’ visual discussion acknowledges over-blurring in some reconstructions. Fine structures such as fences and small text can be retained more sharply by BPG. This is a material limitation for applications where local legibility or exact edge structure matters, even if the overall image scores well under MS-SSIM.

They also identify context-network capacity as an open direction. The chosen masked network is deliberately lightweight. More powerful predictors might discover additional regularities and improve compression, but the paper does not demonstrate those improvements.

The importance map is presented as a useful aid rather than an indispensable ingredient. The authors state that careful adjustment of latent channel depth can produce strong rate–distortion performance without it. Its practical benefit is easier allocation and control under a fixed capacity, which is narrower than saying that spatial masking always improves the optimum.

The shared-network, multiple-rate experiment is explicitly preliminary. It is not tuned for maximum performance. Its role is to show feasibility within the framework, rather than establish the strongest attainable system for every rate.

The supplementary joint-training comparison also contains an acknowledged estimation step. The reported improvement should therefore retain the condition that its reference point is estimated. Removing that qualification would make the evidence appear more exact than the authors present it.

#### Limits visible in the evaluation

The main quality conclusions concern MS-SSIM. The system is trained for that measure and evaluated with it. The paper motivates MS-SSIM through its reported relationship to perception, but it does not present a human preference study establishing that viewers consistently favor these reconstructions.

Nor does it establish that the same ordering holds under MSE or every other quality criterion. Some competing methods optimize a different distortion objective. The experiments show that the proposed training and representation work particularly well for the selected similarity measure.

The dataset coverage is useful but finite. Evaluation across ImageNetTest, Kodak, B100, and Urban100 supports transfer among those collections. It does not justify a universal claim about documents, scientific imagery, synthetic graphics, or every other possible domain.

The Manga109 example illustrates behavior outside ordinary photographic content, but remains an example. It cannot establish average performance for that collection or for non-photographic imagery generally. Its mixed visual outcome is informative precisely because it shows different strengths within the same image.

The learned-baseline comparison relies on digitized published curves rather than newly executed implementations for all systems. This is a reasonable response to unavailable code, and the BPG consistency check is helpful. Still, the comparison does not have the same provenance as a fully reproduced experiment with every implementation run under shared conditions.

#### Limits of the rate accounting

Header information is excluded from the rates for all methods. This makes the accounting convention consistent within the reported comparisons, but the numbers do not include every byte that a complete stored file might require. Image dimensions and operating-point identification still have to be communicated.

The interpolated curve procedure omits images whose observed rate range does not cover a chosen grid value. Consequently, the dataset contribution can change along a curve. The method avoids extrapolation, but readers should not assume that every grid point necessarily averages an identical collection of images.

The cross-entropy estimate is also not identical to an independently known true entropy. The real distribution of encoder outputs is unknown, and the context network supplies an approximation. The paper’s practical justification is that the induced coding cost is the quantity the system needs to reduce.

The masked objective makes an additional approximation by treating mask entropy as constant for the encoder update. The reported closeness of the masked and full losses is reassuring within the experiments. It does not turn the masked expression into a universally exact measure of total rate.

#### Limits of the architectural evidence

The importance-map comparison changes channel capacity as well as the presence of masking. It therefore provides a useful visualization of allocation, but does not cleanly isolate every effect of adding the map under an otherwise identical architecture. The per-image bitrate values should not be read as a matched-quality causal estimate.

The bounded receptive field of the context network limits which dependencies it can exploit. The mathematical factorization permits dependence on all preceding symbols, while the implemented convolutions use a local subset. Strong results show that this subset is useful, not that all relevant dependencies have been captured.

The paper reports training duration and describes efficient parallel probability calculation during training. It does not establish a complete practical speed comparison for compression and decompression against all baselines. Parallel evaluation of probabilities on a known symbol volume is a different operation from recovering unknown symbols during decoding.

Finally, the suggested possibility of generating images by sampling latent symbols remains future work. The compression results do not demonstrate the quality, diversity, or reliability of such generated images. A probability distribution useful for coding an encoder’s outputs is not, on its own, evidence for a successful image-generation system.

### What came after

[Video Compression With Rate-Distortion Autoencoders](https://md.research.elamur.ai/free/en/papers/habibian-2019-video-compression-rate-distortion-autoencoders/), published in 2019, is a later citing work. Its title places the rate–distortion auto-encoder framework in video compression, extending the application setting beyond individual still images.

The citation establishes a connection to this paper, but does not by itself specify which components were adopted or changed. It would be unjustified to infer that the later work reused the same importance map, masked network, quantizer, or training objectives. No detailed account of those choices or its results is available in the citation information.

The meaningful connection is therefore at the level of the research problem: learned compression must balance the quality of a reconstruction against the cost of its representation. This paper makes that balance responsive to conditional probability estimates during learning. The later citing work places rate–distortion auto-encoders in another compression setting, while its precise treatment of conditional coding requires evidence from that work itself.

The original authors also identify directions beyond their demonstrated system. A stronger context network could potentially reduce coding cost further, and sampling from the learned latent distribution could be explored as a route to image generation. These remain proposed extensions in the paper. Its established contribution is the joint learning arrangement: the representation is trained with feedback from the probability estimator that will be used to describe it.

## Cite

Cite as Fabian Mentzer, Eirikur Agustsson, Michael Tschannen, Radu Timofte and Luc Van Gool. 2018. Conditional Probability Models for Deep Image Compression. IEEE Computer Society Conference on Computer Vision and Pattern Recognition/Proceedings - IEEE Computer Society Conference on Computer Vision and Pattern Recognition/Proceedings.

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.1109/cvpr.2018.00462](https://doi.org/10.1109/cvpr.2018.00462) · [arXiv 1801.04260](https://arxiv.org/abs/1801.04260)

```bibtex
@inproceedings{mentzer2018conditional,
  title = {{Conditional Probability Models for Deep Image Compression}},
  author = {Fabian Mentzer, Eirikur Agustsson, Michael Tschannen, Radu Timofte and Luc {Van Gool}},
  booktitle = {IEEE Computer Society Conference on Computer Vision and Pattern Recognition/Proceedings - IEEE Computer Society Conference on Computer Vision and Pattern Recognition/Proceedings},
  year = {2018},
  doi = {10.1109/cvpr.2018.00462},
  eprint = {1801.04260},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.1109/cvpr.2018.00462}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
