End-to-end Optimized Image Compression
Paper · 2016 · Johannes Ballé, Valero Laparra and Eero P. Simoncelli
Summary
Making an image file smaller means deciding which differences from the original a viewer can live with. That decision is made partly by the representation that the codec rounds and stores. If representing a clean edge requires several precisely balanced numbers, rounding those numbers separately can leave visible ripples or breaks. Ballé, Laparra and Simoncelli ask whether a codec can learn a representation in which rounding is cheaper in bits and less damaging to the image. They train the transformation that produces the numbers, the transformation that turns them back into pixels, and the probability estimates used to charge for storing them.
The encoder applies successive stages of filtering, spatial sub-sampling and local gain control. In each stage, the strength of a response depends on the other filter responses at the same location. The encoder rounds the final responses to integers and compresses them into a bitstream. Rounding blocks ordinary gradient-based training, so the authors substitute uniform noise while fitting the codec. The width of the noise matches the quantization bins. This gives the training procedure a continuous estimate of both the cost of storing the rounded values and the damage that rounding would cause. Each desired balance between file size and reconstruction error is trained separately. Evaluation uses integer rounding and measures the size of the resulting files.
On held-out images, including the Kodak test set, the learned codec generally improves on JPEG and JPEG 2000 in peak signal-to-noise ratio, especially at low rates, although the ranking varies with the image and rate. The authors report more consistent gains in visual appearance and in multi-scale structural similarity, a score that compares image structure across scales. In a heavily compressed example, the learned codec and JPEG 2000 both report a rate of 0.113 bit/px. Their structural similarity scores are 0.9039 and 0.8860, respectively. The learned reconstruction loses fine texture but keeps many contours smooth and edges sharp. The distinction matters because the codec was trained to reduce mean squared pixel error. Its visual advantage emerged under that objective, with no structural similarity score guiding the updates.
Deep dive: End-to-end Optimized Image Compression
Ballé and colleagues train an image codec from end to end, using noise during training to learn how to trade file size against reconstruction quality. · about 38 minutes to read
The problem and its context
What a codec can afford to lose
A lossless code assigns shorter descriptions to common outcomes and longer descriptions to uncommon ones. Its success depends on how well the coder represents the probabilities of what it has to store. In lossy image compression, the designer can also change the outcomes themselves. Several possible originals can share one stored description, and the decoder can reconstruct a single image to represent them all. Choosing how to group the originals determines how much accuracy is surrendered before lossless coding begins.
The paper calls the cost of describing the discrete representation its rate. Distortion measures the distance between the input image and the reconstruction. A storage or transmission constraint can make a small rate essential, while an application that prizes fidelity can tolerate a larger file. The engineering problem is to reach a good tradeoff at the operating point the application needs. A low-distortion reconstruction at a generous rate says little about how well the same design will perform when it has far fewer bits.
In principle a quantizer could consider whole image vectors and learn which images ought to share descriptions. This would allow the effect of changing one pixel to depend on changes elsewhere. The paper treats direct optimization of such a high-dimensional quantizer as intractable. A practical codec needs a structure that reduces the problem to manageable operations while still allowing related image features to be represented together.
Why conventional codecs transform the image
Transform coding changes coordinates before quantizing. Its typical form, as described in the paper, applies a linear transformation, quantizes the resulting coefficients separately and compresses the discrete values with a lossless entropy code. JPEG works with a discrete cosine transform on pixel blocks. JPEG 2000 uses a multiscale orthogonal wavelet decomposition. In each case the coordinates presented to the quantizer have structure that the original pixels lack. The paper describes a design tradition in which the transform, quantizer and entropy code are often tuned separately, with manual choices helping determine how the parts fit.
One reason to use an orthogonal linear transform is to reduce correlation. Knowing one response then tells the coder less about the expected signed value of another. But responses can still depend on one another in other ways. The magnitude of a filter response, for instance, can help indicate whether nearby or related responses are likely to be large. Removing linear correlation leaves dependencies of that kind for the entropy coder to handle or for the codec to leave unused.
The same issue matters for distortion. A contour can be expressed by a combination of localized basis functions. Independent rounding changes the coefficients that make up that combination and can alter the feature in ways that reflect the basis functions. The authors discuss blocking, aliasing and ringing as visible consequences of the way linear transform coefficients are quantized. Their question is whether a transform learned for the eventual coding objective can organize the coefficients so that low precision has a different effect on image structure.
Why local gain control was a candidate
The proposed transform draws on earlier work on joint nonlinear gain control inspired by biological vision. In a local gain control operation, the response of one filter is adjusted according to the activity of a group of filters. The adjustment can vary from one image location to another. A filter response in a quiet patch and a numerically similar response in a patch with strong activity across channels can therefore be mapped to different values. Earlier studies cited in the paper found that nonlinear normalization could reduce higher-order dependencies among linear responses. The authors’ previous work had used generalized divisive normalization, or GDN, to make local image response distributions more Gaussian while reducing dependencies.
The paper also points to earlier uses of local normalization in block transform coding and in convolutional networks for recognition. In the work it discusses, the normalization parameters had not been fitted to the task itself. Here these parameters are part of the codec’s optimization. The filters can change which patterns produce strong responses, and the normalization can change how those responses interact. Both choices receive feedback from the same costs that govern the rest of the compressor.
The authors distinguish this input-dependent operation from the batch normalization used in some training procedures. In their account of batch normalization, the same scaling applies across locations and the scaling parameters are generally fixed after training, leaving an affine operation on the data. GDN continues to respond to local channel activity when the trained codec processes a new image. The spatial variation is part of what the encoder computes for that image.
There was also a choice about how to judge errors. In earlier work, the authors had used a perceptual transformation fitted separately to grayscale judgments. The present study gives the analysis and synthesis transforms more flexibility and uses mean squared error as the distortion target. This gives the paper a comparison with familiar codecs under a familiar error measure and allows the authors to fit a color codec without relying on a perceptual distortion measure they considered unreliable for that purpose.
Other routes to a learned representation
The discussion places the method alongside two other efforts to learn image representations for compression. The hierarchical approach by Gregor and colleagues was trained for a generative objective. Its route to compressed images involved quantizing the representation and dropping levels of the hierarchy. The paper questions how directly that procedure targets rate and distortion. It also notes that the work supplied entropy estimates in place of rates measured from a working entropy-coded bitstream, making the comparison to established codecs harder to interpret.
The recurrent approach by Toderici and colleagues produces a binary representation directly and can use a single representation across operating points. Ballé and colleagues identify that reuse as an advantage over their own separate fits. They raise a different question about whether the recurrent formulation necessarily finds the best rate–distortion tradeoffs. For the present paper, the priorities are a direct objective for each desired tradeoff and a path from the representation learned under that objective to a complete coded file.
The method, step by step
From pixels to bits and back
The analysis transform is the part of the encoder that converts pixels into a collection of feature channels. Filtering gives each channel a response to image structure, sub-sampling reduces the number of locations represented, and local normalization changes each response using activity in other channels. Repeating the stages lets later filters work with responses that already combine spatial patterns and local adjustments. The last stage produces the continuous coefficients that the quantizer will round.
The quantizer rounds each coefficient independently. A lossless entropy coder turns the resulting integers into a bitstream. At the receiving end, the entropy decoder recovers those same integers, and the synthesis transform turns them into an image. Loss occurs when a range of continuous coefficient values is replaced by the same integer. Entropy coding preserves that integer exactly. The synthesis transform is trained to make a good reconstruction with the information left in the integers.
Encoding and reconstructing an image
The steps in order.
The method puts the flexibility of quantization into the transformations around the rounding operation. An integer represents a regularly shaped bin along a coefficient axis. A group of integers therefore identifies a region with regular boundaries in coefficient space. The set of images that the analysis transform sends into such a region can have a more complicated shape. Filters mix information across locations and channels, and the nonlinearities change how that mixture depends on the input. Simple scalar quantization after such a transformation can act like a restricted, learnable form of vector quantization in image space.
The encoder and decoder use separate parameters. The decoder is designed along the lines of an inverse, but its task is to reconstruct from rounded coefficients. It can learn which reconstruction works well for the images that share a code, even if the exact inverse of the unrounded transform would be a different operation. Training adjusts the encoder and decoder jointly, so a change in how the encoder represents a feature can be accompanied by a change in how the decoder renders it.
The analysis transform
y = gₐ(x; φ)
Here x is the input image written as a vector of pixel intensities and y is the vector of continuous coefficients. The function gₐ is the analysis transform and φ collects its trainable parameters. The semicolon separates the data argument from the parameters. The paper describes x as belonging to ℝᴺ and y as having M components. ℝ denotes the real numbers, N counts the input values and M counts the values sent to the quantizer.
The analysis transform has three stages. Each starts with a bank of spatial filters. A filter for an output channel can draw from every input channel to that stage. The result of the filtering step includes an additive bias, which is why the operation is affine.
vᵢ⁽ᵏ⁾(m, n) = Σⱼ (hₖ,ᵢⱼ ∗ uⱼ⁽ᵏ⁾)(m, n) + cₖ,ᵢ
Here k indexes the stage, i indexes an output channel and j indexes an input channel. The coordinates m and n locate a response on the spatial grid. The map uⱼ⁽ᵏ⁾ supplies the input to the stage in channel j, and vᵢ⁽ᵏ⁾ is the filtered response. The kernel hₖ,ᵢⱼ connects the two channels. The operator ∗ denotes two-dimensional convolution, Σⱼ sums over incoming channels, and cₖ,ᵢ is the bias added to the output channel at every location.
Next the stage retains responses on a coarser grid. It then normalizes the set of responses available at each retained position.
wᵢ⁽ᵏ⁾(m, n) = vᵢ⁽ᵏ⁾(sₖm, sₖn)
The factor sₖ specifies the spacing of the retained positions along each spatial direction. The output wᵢ⁽ᵏ⁾ is the sub-sampled version of vᵢ⁽ᵏ⁾ in channel i at stage k. A retained location (m, n) reads from (sₖm, sₖn) on the denser grid.
uᵢ⁽ᵏ⁺¹⁾(m, n) = wᵢ⁽ᵏ⁾(m, n) / √(βₖ,ᵢ + Σⱼ γₖ,ᵢⱼ [wⱼ⁽ᵏ⁾(m, n)]²)
The output uᵢ⁽ᵏ⁺¹⁾ is the input to the next stage. The corresponding sub-sampled response wᵢ⁽ᵏ⁾ is the numerator. In the square root, βₖ,ᵢ sets the baseline for that output channel and γₖ,ᵢⱼ weights the squared response of channel j in its denominator. The superscript ² denotes squaring. The sum uses responses at the same coordinates m, n, and √ takes the positive square root. The initial stack of stage inputs is the image, and the final stack of normalized outputs is the code vector y. The filters h, biases c, offsets β and weights γ from all stages form φ.
With this denominator, the magnitude of activity in a channel can affect the gain of other channels regardless of the sign of that activity. A channel can contribute to its own denominator as well. Two retained locations with the same response in the numerator can yield different outputs if the other channels respond differently. The normalization is joint across channels and local on the spatial grid. The convolutions leading up to it give each response a spatial neighborhood, so the operation can depend on more than the value of a single pixel.
The synthesis transform
x̂ = gₛ(ŷ; θ)
Here x̂ is the reconstructed image, gₛ is the synthesis transform and θ denotes its trainable parameters. The input ŷ contains the quantized coefficient values, interpreted as real numbers for computation by the decoder. Hats mark reconstructed or synthesis-side quantities in the formulas that follow.
The decoder also uses three stages. They follow the inverse order of operations within a stage. First comes an approximate inverse to divisive normalization, then an expansion of the spatial grid and finally a convolution. The authors call the first operation inverse generalized divisive normalization, or IGDN. They derive its form by taking one step of an earlier iterative inversion procedure, with independently fitted parameters for the decoder.
ŵᵢ⁽ᵏ⁾(m, n) = ûᵢ⁽ᵏ⁾(m, n) · √(β̂ₖ,ᵢ + Σⱼ γ̂ₖ,ᵢⱼ [ûⱼ⁽ᵏ⁾(m, n)]²)
The maps ûᵢ⁽ᵏ⁾ and ŵᵢ⁽ᵏ⁾ are the input to IGDN and its output in channel i of synthesis stage k. The symbols m, n again index the spatial position, and Σⱼ sums across input channels j. The learned baseline β̂ₖ,ᵢ and channel weights γ̂ₖ,ᵢⱼ define the square-root gain. Here · denotes multiplication of the channel response by that gain.
v̂ᵢ⁽ᵏ⁾(m, n) = { ŵᵢ⁽ᵏ⁾(m/ŝₖ, n/ŝₖ) if m/ŝₖ and n/ŝₖ are integers, 0 otherwise }
Here v̂ᵢ⁽ᵏ⁾ is the expanded grid, ŵᵢ⁽ᵏ⁾ is the input map to that expansion and ŝₖ is the upsampling factor for stage k. The divided coordinates must both land on the original grid for a response to be copied into position (m, n). The value 0 fills the other positions. The channel index i is retained throughout the expansion.
ûᵢ⁽ᵏ⁺¹⁾(m, n) = Σⱼ (ĥₖ,ᵢⱼ ∗ v̂ⱼ⁽ᵏ⁾)(m, n) + ĉₖ,ᵢ
The filter ĥₖ,ᵢⱼ takes an expanded input channel j into output channel i at stage k. The operator ∗ again denotes spatial convolution, and Σⱼ combines the filtered channels. The symbol ĉₖ,ᵢ is the synthesis bias. The output ûᵢ⁽ᵏ⁺¹⁾ goes to the next stage, with the final one producing x̂. The synthesis filters, biases and normalization parameters together form θ. On either side of the codec, taking or expanding the spatial grid can be implemented together with the adjacent convolution.
Choosing the balance between rate and distortion
The authors set their objective around the performance of the complete codec. One term charges for the expected length of the discrete description, using its entropy as the target. The other charges for errors in the reconstruction. The relative weight of these terms determines how expensive an improvement in the image can be before the optimizer favors the shorter description.
L[gₐ, gₛ, P_q] = −E[log₂ P_q(q)] + λ E[d(z, ẑ)]
The functional L is the loss to minimize. The functions gₐ and gₛ provide the analysis and synthesis transforms, and P_q(q) is the probability assigned to the vector of stored integers q. The negative base-2 logarithm gives that outcome’s ideal coding cost in bits under the probability assignment. The notation E denotes an expectation over images, estimated in training with the image set. The function d measures distortion between the transformed reference z and transformed reconstruction ẑ. The parameter λ weights that distortion relative to rate.
The paper allows for a fixed perceptual transform gₚ that maps the input and reconstruction to a space where distances can be judged. Its actual experiment makes this transform the identity. The reference z then equals the input x, and the reconstruction ẑ equals x̂. The authors describe their distortion measure as mean squared error and express the discrepancy with squared Euclidean notation.
d(z, ẑ) = ‖z − ẑ‖₂²
The difference z − ẑ is the vector of image errors under the identity transform. The symbol ‖·‖₂ denotes the Euclidean norm of its argument, and the superscript ² squares that norm. Squared error gives larger discrepancies more weight. The image-level distortion term used for rate–distortion training is then averaged over examples through E.
A choice of λ specifies what training should seek. Larger values make reconstruction errors more costly. In the paper’s geometric account, each fixed value defines lines of equal loss in a plot of rate against distortion. Moving such a line towards lower cost until it reaches the attainable region identifies the desired point on its convex boundary.
slope = −1/λ
Here slope is the change in distortion per change in rate along an equal-loss line, with rate on the horizontal axis. The negative sign indicates that a line of constant loss allows higher rate only if distortion falls. The quantity λ is the distortion weight. This construction describes the target of the optimization. It gives the different values of λ a role without requiring them to correspond to predetermined file sizes.
Why training uses noise
ŷᵢ = qᵢ = round(yᵢ)
The index i now ranges over all entries of the code vector, including channels and spatial positions. The operation round replaces a continuous value yᵢ with its nearest integer qᵢ. The quantity ŷᵢ is that same value used as a real input to synthesis. The bin width is one, with representing values at the bin centers.
For an image source, the probability of an integer is the probability of all the continuous outputs that round to it. The paper writes that relationship for a single coefficient as an integral.
P_{qᵢ}(n) = ∫[n − 1/2, n + 1/2] p_{yᵢ}(t) dt, n ∈ ℤ
The symbol P_{qᵢ} is the discrete probability assignment for coefficient qᵢ. The integer n is the bin center, and ℤ is the set of integers. The function p_{yᵢ} is the density of the continuous response yᵢ. The integration variable t ranges over all values inside the bin, and dt is the integration element. The two limits place the bin boundaries half a unit to either side of n.
This rounding rule creates two problems for gradient-based fitting. For a small change in a coefficient within its bin, the stored value stays the same, and the decoder receives the same input. At a bin boundary the stored value jumps. A local derivative through rounding is therefore zero almost everywhere and gives no direction for improving the encoder. The same obstacle affects the gradient of the rate term, which depends on the rounded value as well.
The proposed training procedure adds a separate uniform perturbation to each feature coefficient. The perturbations are drawn independently from the same distribution, with the width of the rounding bin. The synthesis transform sees the perturbed coefficients and learns to reconstruct the image from them. A small change in the analysis output remains a small change in the decoder’s training input even when a deployed codec would still round to the same integer.
ỹ = y + Δy
Here ỹ is the perturbed vector used during training, y is the continuous analysis output and Δy is the vector of independent uniform noise samples. The noise is centered on zero. Its unit width gives the same interval used to measure probability around each rounding-bin center.
The choice of a uniform perturbation also connects the rate estimate to rounding. The density of a perturbed coefficient at a given value averages the original density over a bin-width interval about that value. Evaluated at an integer, that interval is the rounding bin. Since the averaging width is one, the resulting density value equals the probability assigned to the integer. The paper gives the corresponding vector relationship.
p_{ỹ}(n) = P_q(n), n ∈ ℤᴹ
The notation p_{ỹ} denotes the continuous density of the perturbed vector, while P_q is the mass function of the integer vector. Here n denotes a vector of integers, M is its number of entries, and ℤᴹ is the set of such vectors. The equality is at lattice points. It explains why the density is a useful continuous interpolation of the probabilities at the quantization bins. It gives an argument for using differential entropy as an approximation to discrete entropy, with the quality of the approximation left for empirical testing.
The distortion argument is related but distinct. Independent uniform noise approximates marginal moments of quantization error. The decoder’s reconstruction error can then be evaluated with perturbed values in place of rounded ones, giving training an error signal that varies continuously with its inputs. The resulting error estimate need not agree image by image with the error produced by rounding. The experiment examines that agreement separately from the agreement between the two rate terms.
Learning the coefficient densities
The training objective uses a product of marginal densities, so each coefficient is charged using its own density instead of a joint probability that depends explicitly on the values of other coefficients. Making that assumption useful is part of the job of the analysis transform. The density family for an individual coefficient remains flexible. The authors use a linear spline, which stores values at sample points and joins neighboring values with line segments. Convolution with the uniform perturbation smooths the underlying response distribution, and a finer spline grid can approximate that smoothed density more closely.
L(θ, φ) = E_{x,Δy}[−Σᵢ log₂ p_{ỹᵢ}((gₐ(x; φ) + Δy)ᵢ; ψ⁽ⁱ⁾) + λ d(gₚ(gₛ(gₐ(x; φ) + Δy; θ)), gₚ(x))]
The loss L shown here is the continuous version used to update the transforms. The expectation E_{x,Δy} is over the training images x and noise draws Δy. The index i selects an entry of the perturbed analysis output, and Σᵢ sums the coding charges. The density p_{ỹᵢ} for that entry has spline parameters ψ⁽ⁱ⁾. The logarithm log₂ expresses the rate term on a bit scale. The analysis transform gₐ depends on φ, and the synthesis transform gₛ uses θ. The fixed mapping gₚ places the reconstruction and original in the space used by the distance function d. The coefficient λ gives the distortion term its weight. The spline parameters are fitted alongside the transform parameters using their own update rule.
The interaction between the terms matters. If the encoder changes the distribution of a coefficient, the spline is updated to represent the new distribution. The encoder can benefit from producing values that concentrate probability and can be described cheaply, provided the decoder still reconstructs well enough. The decoder in turn receives a direct incentive to make better use of the perturbed values. In this way the rate estimate follows the representation as it changes, and the representation can respond to the coding charges that the estimate assigns.
Training data, capacity and parameter updates
The authors use 6507 images from ImageNet for fitting. They exclude images with excessive saturation. They add a small uniform perturbation to the remaining images to account for the quantization of pixel values, then downsample and crop them to 256 × 256 pixels. The crop and downsampling amounts are randomized subject to the original size. They require resampling factors below 0.75 and discard images too small to meet the constraint. This reduces high-frequency noise and existing compression artifacts. The perturbation applied to the input images in preprocessing serves a different role from the coefficient noise that stands in for the codec’s rounding operation.
In the basic grayscale analysis transform, the first filtering stage uses 128 filters of size 9 × 9 and downsamples by a factor of 4 in each spatial direction. The later stages retain the channel count. Each 5 × 5 × 128 filter extends across all input channels, and its output is downsampled twofold in each dimension. The paper describes the final output as having half the dimensionality of the input for this grayscale architecture. The corresponding synthesis stages expand the spatial grids. Color uses a separately trained system whose first stage receives the three RGB channels. The paper reports increased channel counts of 256 for the largest grayscale distortion weights and 192 for the RGB system.
The three analysis stages use fixed GDN exponents and a symmetric matrix of channel weights. The paper relates the fixed exponents to its earlier Gaussianization work, where allowing the exponents to vary helped control the tails of the distributions. The authors choose a simpler form here. The decoder uses the same types of constraints on its separately trained IGDN parameters.
γₖ,ᵢⱼ = γₖ,ⱼᵢ
The weight γₖ,ᵢⱼ links input channel j to the normalization of channel i at stage k. The weight on the right exchanges the channel indices. Symmetry is enforced during training by averaging the parameter matrix with its transpose after each update. The synthesis weights receive the analogous treatment.
The transforms are updated with Adam: A Method for Stochastic Optimization. The starting step size α is 10⁻⁴. When improvements in both rate and distortion stagnate, the step size is lowered by a factor of 10, down to 10⁻⁷. The authors parameterize the spatial filters by their discrete cosine transform coefficients. They also renormalize the filters after each gradient step to remove an ambiguity in how scale is divided between the filter and the neighboring gain-control operation. For an analysis filter, the normalization spans its spatial positions and input channels. For a synthesis filter, it spans spatial positions and output channels.
βₖ,ᵢ = (β′ₖ,ᵢ)² − 2⁻¹⁰
Here βₖ,ᵢ is the effective normalization offset for channel i in stage k, and β′ₖ,ᵢ is the parameter updated by the optimizer. Squaring is indicated by ², and 2⁻¹⁰ is the subtraction used in the parameterization. The authors project the primed parameter onto [2⁻⁵, ∞) after each step, where ∞ indicates that the interval has no upper bound. The squared form reduces the size of gradients near the lower end, where updates had been prone to instability. The paper uses the same treatment for the channel weights and the corresponding IGDN parameters.
Each marginal spline uses 10 sampling points per unit interval. A parameter vector stores the density values at those points. The authors use ordinary stochastic gradient descent for these parameters. The appendix gives a separate objective based on the negative expected density evaluated at the perturbed responses.
L_ψ(ψ⁽⁰⁾, ψ⁽¹⁾, …) = −E_{ỹ}[Σᵢ p_{ỹᵢ}(ỹᵢ; ψ⁽ⁱ⁾)]
The symbol L_ψ denotes the spline fitting loss. The arguments ψ⁽⁰⁾, ψ⁽¹⁾, … enumerate the parameter vectors for the marginal densities, and ψ⁽ⁱ⁾ belongs to entry i. The density p_{ỹᵢ} is evaluated at the noisy coefficient ỹᵢ. The sum Σᵢ combines the density evaluations, and E_{ỹ} averages over perturbed responses. The minus sign turns an increase in expected density into a decrease in the written objective. The splines are renormalized after each update. Every 10⁶ gradient steps, the authors use the observed training responses to adjust the interval covered by the spline approximation.
Training is repeated for each chosen λ. That yields a separate analysis transform, synthesis transform and set of marginal probability estimates for each operating point. The probability estimates are also used to initialize the deployed entropy coder. The values learned for one tradeoff can differ in the filters, channel interactions and coding probabilities together.
Turning probabilities into a bitstream
The trained codec uses context-adaptive binary arithmetic coding, or CABAC, to compress the rounded values. Its probability estimates start from the continuous marginal splines evaluated at the integers, using the relationship between the noisy density and the rounding bins. During coding, decisions share an adaptive probability description across the spatial positions in a channel. The coder processes coefficients channel by channel and traverses each spatial grid in raster order.
Arithmetic coding works with binary decisions in this implementation. The first decision asks whether the coefficient equals the mode, the most probable value. If the answer is yes, the coefficient is fully specified. Otherwise the next decision establishes which side of the mode contains the value. The coder tests candidate integers along that side until the coefficient is identified or the boundary of the modeled range is reached. For an out-of-range value it codes the excess beyond the relevant bound with an exponential Golomb code outside the arithmetic engine. The decoder follows the same decisions to recover the signed integer.
The stream also carries the image dimensions as two 16-bit integers, a one-bit choice between grayscale and RGB, and λ as a 16-bit integer. These fields bypass arithmetic coding. The stored λ selects the transform parameters and initial probabilities, which the experiment assumes the encoder and decoder already share. This makes the measured file size include the per-image information required to use an installed codec at the selected operating point.
The connection to variational autoencoders
The paper derives the training loss from compression and then examines why it resembles variational inference. In that setting, one seeks a tractable approximation to the distribution of latent variables given an observed image. The paper connects its construction to Auto-Encoding Variational Bayes and the work of Rezende and colleagues on stochastic back-propagation. The shared mathematical step is to optimize an expectation over a continuous distribution whose samples depend on the encoder.
D_KL(q ‖ p_{y|x}) = E_{y∼q}[log q(y|x)] − E_{y∼q}[log p_{x|y}(x|y)] − E_{y∼q}[log p_y(y)] + const.
The quantity D_KL is the Kullback–Leibler divergence from the approximate posterior q(y|x) to the desired posterior p_{y|x}. The notation ‖ separates the two distributions in this divergence. Here x is fixed as the observed image, y is the latent variable, and y∼q indicates sampling from the approximate posterior. The appearance of q in this equation refers to the approximate posterior. In the discrete codec equations it denotes the stored integer vector. The density p_{x|y} gives the likelihood of the observation conditional on the latent variable, p_y is the prior on that variable, log denotes a logarithm, and const. collects terms independent of the approximate posterior for the observation.
The paper instantiates the likelihood, prior and approximate posterior using elements already present in the continuous training objective. For squared error, the decoder specifies the center of a Gaussian likelihood. The tradeoff parameter fixes its spread.
p_{x|ỹ}(x|ỹ; λ, θ) = N(x; gₛ(ỹ; θ), (2λ)⁻¹ I)
Here p_{x|ỹ} is the conditional density of image x given the perturbed latent vector ỹ. The notation N denotes a multivariate Gaussian density evaluated at x. Its mean is the decoder output gₛ(ỹ; θ). Its covariance is (2λ)⁻¹ I, where I is the identity matrix and the superscript ⁻¹ denotes the reciprocal of the scalar multiplying it. The distortion weight λ thus controls the spread around the synthesis output.
p_{ỹ}(ỹ; ψ⁽⁰⁾, ψ⁽¹⁾, …) = ∏ᵢ p_{ỹᵢ}(ỹᵢ; ψ⁽ⁱ⁾)
The density p_{ỹ} plays the role of the prior. The operator ∏ᵢ multiplies the marginal densities p_{ỹᵢ} across the entries of ỹ. Each factor is evaluated at the component ỹᵢ and uses its density parameters ψ⁽ⁱ⁾. The arguments on the left are the collection of those parameter vectors.
q(ỹ|x; φ) = ∏ᵢ U(ỹᵢ; yᵢ, 1), with y = gₐ(x; φ)
The density q(ỹ|x; φ) is the approximate posterior for the noisy coefficient vector given the image. The product ∏ᵢ runs over coefficient entries. Each factor U is a uniform density evaluated at ỹᵢ on an interval of width 1, centered at yᵢ. Those centers are the entries of the analysis output y, found by applying gₐ to x with parameters φ.
The posterior factors have fixed width, so the expected log density of that posterior is constant with respect to the learned centers. The negative log likelihood then supplies the squared reconstruction penalty, and the negative log prior supplies the rate term, with a common logarithm convention and additive terms independent of the fitted transforms. In the compression setting the likelihood spread expresses a decision about how much reconstruction error is acceptable. It is fixed for a particular tradeoff. Fitting an image distribution for its own sake gives that spread a different role, since there the goal is to explain the observed data.
The paper also gives a way to extend the analogy under conditions on a perceptual transform and distance. Its construction uses an affine, invertible perceptual map and a translation-invariant distance, with a normalizable exponential of the negative distortion.
p_{x|ỹ}(x|ỹ; λ, θ) = exp[−λ d(gₚ(gₛ(ỹ; θ)), gₚ(x))] / Z(λ)
The notation exp denotes the exponential. Inside it, d measures the distance between the perceptually transformed decoder output and the transformed original. The functions gₛ and gₚ are the synthesis and perceptual transforms, θ parameterizes synthesis, and λ still weights the distortion. The normalizing factor Z(λ) makes the conditional density integrate to one over x. Under the stated construction it need not be calculated to fit the transforms. The paper cautions that a general perceptual error may fail to yield a normalizable density. The operational codec relies on the discrete bitstream and the training surrogate can be understood directly from rate and reconstruction error.
Experiments and results
What was tested and how it was scored
The main test collection is Kodak, an uncompressed image set with 24 images in the appendix’s aggregate analyses. The authors also evaluate familiar compression test images named Lena, Barbara, Peppers and Mandrill, and use photographs from their own collection. The test images are separate from the ImageNet images used to train the transforms and estimate the coefficient densities. Both grayscale and RGB results are discussed. The unit of comparison is an encoded image, reconstructed from integers recovered from the bitstream.
The baselines are JPEG and JPEG 2000. The JPEG comparisons use 4:2:0 chroma sub-sampling. For JPEG 2000 the authors use OpenJPEG with its default multiple component transform. The appendix’s low-rate image pairs select the smallest available JPEG 2000 rate that is at least as large as the rate of the proposed method. Elsewhere the paper examines curves across rate settings. An image pair gives a direct visual comparison around a chosen file size. The curves show how the comparison can change as the file-size budget grows.
Rate is reported in bits per pixel or as the actual byte count of the file. Quality is measured with peak signal-to-noise ratio, or PSNR, and multi-scale structural similarity, or MS-SSIM. For color, the authors evaluate PSNR after converting RGB to Y’CbCr with the JPEG-defined conversion matrix. Luma represents the brightness-related component and chroma represents the color-difference components. MS-SSIM is evaluated on the resulting luma. It can reflect differences in the structure of a reconstruction that are less evident in a squared pixel discrepancy.
PSNR = 10 log₁₀(255² / MSE)
Here PSNR is the peak signal-to-noise ratio in decibels, log₁₀ is the base-10 logarithm and 255 is the peak sample value used in the paper’s expression. The symbol ² means squared and MSE is mean squared error for the component being evaluated. Higher PSNR corresponds to smaller squared error on that component. The rate still has to be considered alongside the score, since a codec typically has more freedom to lower its error when it can spend more bits.
A low-rate comparison with both baselines
The main visual example comes from a heavily compressed image of 752 × 376 pixels. The proposed method uses 3986 bytes at 0.113 bit/px, JPEG 2000 uses 4004 bytes at 0.113 bit/px, and JPEG uses 4283 bytes at 0.121 bit/px. These are the reported rates of the compared files, and the byte counts show that the shared displayed rate for the learned codec and JPEG 2000 does not imply identical file sizes. JPEG uses more bytes than either in this example.
Luma MS-SSIM on the paper’s heavily compressed test image
The learned codec scores highest at a reported rate shared with JPEG 2000 and below JPEG’s rate.
The numbers
| System or setting | MS-SSIM |
|---|---|
| JPEG | 0.8079 |
| JPEG 2000 | 0.8860 |
| Learned codec (this paper) | 0.9039 |
The PSNR measurements give the same ranking for this example. The learned method records luma PSNR of 27.01 dB and chroma PSNR of 34.16 dB. JPEG 2000 records 26.61 dB on luma and 33.88 dB on chroma. JPEG reaches 24.85 dB on luma and 29.23 dB on chroma. These are measurements of the single reconstructed image at the reported file sizes. In the corresponding rate curves the paper plots the luma scores across multiple operating points.
The visual distinction is clearest near contours and edges. At this rate the proposed reconstruction sheds fine texture and some small patterns. The remaining outlines often look smooth and the prominent transitions can keep their sharpness. The JPEG and JPEG 2000 reconstructions show more visible artifacts around such structures. The authors attribute the appearance of those artifacts to imbalances among the quantized coefficients used to combine localized linear basis functions.
The paper also shows crops of an image across several rates, with the rates matched by column. The progression illustrates how the character of the errors changes as the budget falls. In the baselines, coarsening the coefficients increasingly reveals structures associated with the linear basis. In the learned reconstruction, contours and other features tend to become simpler. The authors see this as a means of concealing the quantization from a viewer, even as information about the original is lost.
Variation across individual images
A personal-collection RGB example shows a larger separation from JPEG 2000 at low rate. The proposed method uses 3749 bytes at 0.106 bit/px and attains luma PSNR of 32.43 dB and luma MS-SSIM of 0.9767. JPEG 2000 uses 3769 bytes at 0.107 bit/px, with luma PSNR of 29.49 dB and luma MS-SSIM of 0.9520. The paper’s discussion of this image also describes the relative rate at comparable mean squared error along the curve. It gives approximately 50% of the bits required by JPEG 2000 at low rates and about 30% at high rates. Those percentages describe this image and depend on the part of the curve being compared.
A different RGB example from the same collection shows a case in which the squared-error comparison is much closer at the illustrated operating point. Both files have the same reported rate and exactly the same reported size. The learned codec gets 23.38 dB luma PSNR and JPEG 2000 gets 23.24 dB. Their structural similarity scores separate more visibly.
Luma MS-SSIM at 0.167 bit/px on a personal-collection RGB test image
The learned codec achieves a higher structural similarity score at the same file size.
The numbers
| System or setting | MS-SSIM |
|---|---|
| JPEG 2000 | 0.8803 |
| Learned codec (this paper) | 0.9219 |
Both files in this comparison are 5908 bytes. Across the curve for this image, the paper reports a slight advantage over JPEG 2000 at low rates in squared-error performance and a disadvantage at high rates. The example therefore serves two purposes. The near-equal luma PSNR at the displayed point coexists with a clearer MS-SSIM improvement, and the ordering by pixel error changes elsewhere on the curve. The metric and the operating point both matter.
In another personal RGB photograph, the proposed method and JPEG 2000 both report 0.084 bit/px. The learned codec has a file size of 2978 bytes and gives 22.93 dB luma PSNR and 0.8326 MS-SSIM. The JPEG 2000 file uses 2980 bytes and gives 22.53 dB and 0.8225, respectively. The direction agrees with the main example, with a smaller separation in the scores. The collection includes examples where the rate benefit is stronger and others where the advantage is chiefly visible in the structural score.
The pattern across the test set
The authors report better PSNR rate–distortion performance than both baselines for most of the test images, particularly at low rates. They report higher MS-SSIM and improved visual appearance throughout the tested images and rates. The PSNR statement allows for exceptions, including the high-rate behavior of the personal photograph just discussed. The visual and structural statements concern the authors’ inspection and the measurements within their evaluation. The compressed examples are important to that interpretation because a higher structural score does not identify which details a reconstruction preserved or discarded.
The appendix also plots rate–distortion curves summarized over the Kodak images. The learned codec’s results are grouped by λ, giving each aggregate point a set of images encoded with the same transforms. JPEG results are grouped by its quality setting. JPEG 2000 can be grouped by target rate or target quality, and the paper shows that these procedures yield substantially different average curves despite using the same implementation. The authors make the individual results and compressed images available for inspection. Their account of the comparison relies on those individual curves to show the range of behaviors behind an aggregate point.
What the ablations show
The paper gives a preliminary comparison of activation functions, along with controlled analyses of the training relaxation, entropy coding and the effect of averaging evaluation curves. Each examines a different link in the evidence. The relaxation comparison asks whether a training quantity resembles its discrete counterpart. The coding comparison asks how much the entropy coder gains by adapting online. The activation discussion asks how efficiently different nonlinearities can achieve comparable compression, and the averaging analysis asks how the apparent result depends on the way operating points are paired.
How closely the training surrogate tracks rounding
The authors compare the distortion after synthesizing from rounded coefficients with the distortion after synthesizing from noise-perturbed coefficients. For rate, they compare the sum of discrete marginal entropies with the sum of differential entropies of the noisy marginals. These comparisons use 2169 images sampled from the training set and settings of λ between 32 and 2048, inclusive. The experiment checks the quantities the optimizer sees against the corresponding quantities under quantization. The subsequent compression comparison uses separate test images and actual files.
The relaxed distortion term appears approximately unbiased and has relatively small variance in the reported scatter plots. The rate term shows a different pattern. At the coarser quantization operating points, differential entropy tends to overestimate discrete entropy. The bias diminishes at finer operating points. The quantizer still uses a unit bin width. Coarse and fine here describe how those bins relate to the coefficient distributions learned at the different operating points.
This check supports using the surrogate to fit a range of tradeoffs, while showing where the rate approximation drifts. The authors explain that a constant bias in a term would change the effective tradeoff associated with a nominal λ without changing the attainable compression performance. The observed bias at coarse operating points is a reason to measure actual rates after training. The experiment compares the two costs under fitted transforms. It leaves open how a different differentiable training objective would alter the transforms or the test curves.
How much the entropy coder gains by adapting
The appendix compares the adaptive arithmetic coder with a simulated non-adaptive alternative. The non-adaptive estimate uses the discrete probabilities obtained from the training procedure, which also supply the initial probabilities for the adaptive coder. The comparison is averaged across the 24 Kodak images for each value of λ. It holds the learned representation and quantization fixed while varying the treatment of the coefficient probabilities during coding.
The authors find a relatively small gain from online adaptation. This particular adaptive coder shares a probability description across spatial positions within each channel and follows a simple raster scan. Those choices give it a limited way to respond to image structure. The result indicates that the tested online adjustment adds little beyond a well-designed fixed probability description for these coefficients. It leaves room for an entropy coder that uses richer spatial context.
The comparison uses an entropy calculation to simulate the non-adaptive alternative. As a result, it explains the size of the adaptation effect under that reference and should be read alongside the end-to-end comparison, where file sizes come from actual implementations. The entropy coding experiment changes the representation’s description length while leaving its decoded integer values in place. It provides evidence about rate and does not assign credit for the contours or other visual properties of the reconstruction.
What is known about the choice of activation
The authors report preliminary tests with simpler rectified-linear and sigmoidal activations. Other activations can produce a qualitatively similar kind of reconstruction in the tests they describe. The authors also observe that rectified linear units generally require substantially more parameters or stages to reach comparable rate–distortion performance. Their tentative interpretation is that GDN and IGDN use processing stages efficiently. A joint operation can express a dependency among channels directly, whereas a pointwise operation applies separately to each of its inputs.
The paper does not give a systematic set of numerical results that matches capacity, stage count and training conditions across the activation choices. Its evidence supports a provisional efficiency claim with respect to the settings tried. The observation about qualitatively similar reconstructions also matters for attribution. It leaves the favorable appearance compatible with more than one nonlinear architecture. The full codec comparison changes the representation, its objective and its learned synthesis together, so a visual advantage in that comparison cannot by itself identify the contribution of one layer.
The authors give a further explanation for the handling of contours. They interpret the initial analysis stage as an overcomplete linear representation with localized, oriented filters, followed by the remainder of the transform acting as a complex quantizer. Overcompleteness means that this initial representation retains more responses than a complete linear basis would require. The authors suggest that such filters make it easier to represent contours over a range of positions, orientations and scales. This is an interpretation of the learned architecture and its images. The paper gives no controlled removal of overcompleteness or orientation tuning to measure how much each contributes.
Why the averaging choice changes the curves
The Kodak aggregate illustrates how an evaluation procedure can change the apparent comparison even when the underlying codec is held fixed. For JPEG 2000, the implementation can target either rate or quality. The authors checked that selecting settings in these ways did not change the curve for an individual image. At the aggregate level, grouping by a target rate collects images at similar file-size budgets, while grouping by a target quality collects images at a common requested quality. The two procedures combine different points on the underlying curves.
The resulting average JPEG 2000 curves differ substantially. The authors also note that selecting the same target rates for every codec can emphasize some parts of the overall rate range more than others. Their analysis makes the comparison easiest to read in terms of individual curves and clearly identified operating points. It also explains why the paper’s observations about the distribution of wins across images carry information that is hard to recover from a single mean curve.
Limitations
Limits identified by the authors
One operating point requires one fitted set of parameters. The bitstream signals the chosen λ and the decoder uses the corresponding transforms and initial probabilities. This supports use at different rates through multiple fits. The same learned representation is not demonstrated as a single representation covering the tested tradeoffs. The authors recognize the practical advantage of the recurrent approach discussed in their comparison, which seeks shared representation across rates.
The architecture was chosen with limited exploration. The authors describe their choices of filter sizes, channel counts and downsampling structure as somewhat ad hoc and leave open whether other architectures improve performance. Their observations about alternative activations are explicitly provisional. They mention possible deployment benefits if local gain control can deliver the same results with fewer processing stages, but the paper does not test an embedded deployment. They also describe high training cost and argue that using fitted transforms is efficient. That account is based on the operations required at encoding and decoding, with no comparative timing measurements reported.
The probability description is simplified. It uses independent marginals for the relaxed objective, with relatively crude spatial adaptation in the bitstream coder. The authors expect the adaptive advantage of that coder to be smaller than for a more elaborate system such as the entropy coder used by JPEG 2000. The appendix also finds limits in aggregate evaluations, since choices about matching rates or qualities can give visibly different averages. A broad claim from one summary curve would obscure this sensitivity.
The distortion used in training is squared error. The authors chose it partly because they lacked a reliable perceptual metric for the color setting and thought squared error made the baseline comparison easier to interpret. They suggest that a perceptual objective could yield further visual improvements, referring to their earlier work. The present paper evaluates perceptual quality after training and leaves that proposed change untested for this architecture. It also notes that the mathematical link to a variational likelihood depends on the distortion having a suitable form.
Limits visible in the evaluation
The reported visual advantage is bounded by the chosen images, rate settings and comparisons. The test set includes uncompressed Kodak images, familiar examples and personal photographs. The paper presents visual examples and luma MS-SSIM. It gives no formal viewer study for this codec. MS-SSIM provides independent evidence from a structural metric, but the reported color tests do not use it to assess structure directly in the chroma components. The eye can also value details that a metric gives little weight. The paper’s own examples describe a loss of fine patterns and textures even in visually favorable reconstructions.
The baseline comparison is with the JPEG and JPEG 2000 configurations described in the experiment. The results establish how the methods compare under those choices and give evidence about the contrast between nonlinear and linear transform coding in that setup. They do not cover every possible design based on those standards. The absence of a full architectural ablation also limits causal conclusions. The learned transform, normalization, objective and decoder all contribute to the behavior of the complete system. Their individual effects cannot be recovered just from the size of the overall advantage.
The files include per-image header information. The installed transforms and initial probability descriptions are assumed to be shared. Consequently, the byte counts are costs of sending individual images with that codec already available. They do not measure what it would cost to include all learned parameters in a self-contained delivery to a receiver that lacks them. The distinction is particularly relevant when interpreting small files and the use of separate parameter sets for different operating points.
Finally, the geometry of the rate–distortion objective describes the desired tradeoff over attainable settings. It does not establish that stochastic training finds a global optimum or that the set of fitted operating points exhausts the possibilities of the architecture. The training approximation is checked against discrete quantities and the output is checked against established codecs. These are empirical tests of a complete solution. The stronger claim of optimality over nonlinear transforms, quantizers and codes remains beyond the experiment.
What came after
From still images to video
Video Compression With Rate-Distortion Autoencoders carries the rate–distortion autoencoder framing into video compression. The link in the research question is direct. Ballé and colleagues train an encoder and decoder around the cost of describing the encoded representation and the error in what comes back. In video, the object being coded extends over time, so the representation and its reconstruction have to account for a sequence of images. The later work’s stated framing connects both costs to an autoencoder for that setting. Its title identifies the extension without establishing that it uses the same gain control, quantization relaxation or entropy code.
Learning a description when the pixels must be recovered exactly
Practical Full Resolution Learned Lossless Image Compression applies learning to a different point in the image-coding problem. Its stated target is lossless compression at full resolution. In the lossy setup, the learned representation can discard detail when the bit savings outweigh the measured distortion. In a lossless problem the recovered image must be exact, so the design has to find a shorter description subject to that requirement. This connects to the original paper’s discussion of discrete probabilities and description length. It changes the role of reconstruction error from a variable cost in training to an exactness requirement.
Fidelity as a coding objective for sound
High Fidelity Neural Audio Compression takes learned compression to audio and names fidelity as the goal for the reconstructed signal. The common question is how to learn a representation worth transmitting when quality depends on how the decoded signal is perceived. The image paper makes that question concrete by showing that pixel error, a structural image metric and the visible character of artifacts can give different views of the same operating point. Audio moves the fidelity question to a different signal and perceptual setting. The title supports that connection without specifying which of the image codec’s operations are reused.
A citation from the study of computation
Demystifying Parallel and Distributed Deep Learning: An In-Depth Concurrency Analysis cites the image-compression paper from a study of concurrency in deep learning. The connection available here is through computation rather than a stated extension of the codec. Ballé and colleagues distinguish the work of fitting many transform parameters over an image collection from executing fitted transforms to encode or decode an image. Concurrency analysis addresses the execution of deep learning workloads, a question that can be asked about training independently of the codec’s rate–distortion results. The citation establishes a connection between the papers. It does not on its own establish that the later work analyzed this codec, parallelized one of its operations or used its compression objective.
Cite
Cite as Johannes Ballé, Valero Laparra and Eero P. Simoncelli. 2016. End-to-end Optimized Image Compression. arXiv (Cornell University).
@misc{balle2016end,
title = {{End-to-end Optimized Image Compression}},
author = {Johannes Ballé, Valero Laparra and Eero P. Simoncelli},
year = {2016},
doi = {10.48550/arxiv.1611.01704},
eprint = {1611.01704},
archivePrefix = {arXiv},
url = {https://doi.org/10.48550/arxiv.1611.01704}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/balle-2016-end-end-optimized-image-compression/