Paper commentary
Conditional Image Generation with PixelCNN Decoders
- Problem PixelCNN trails PixelRNN in likelihood because its masked convolutions leave a blind spot and widen their visible context only slowly with depth.
- Method Replaces the rectified linear units with gated units, combines a horizontal and a vertical convolutional stack to remove the blind spot, and adds a term computed from a latent vector h to model p(x|h).
- Results Reached 3.03 bits/dim test NLL on CIFAR-10 and 3.83 bits/dim test NLL on ImageNet 32x32.
Why the original PixelCNN falls short
PixelCNN factorises the joint distribution of an image into a product of conditionals over pixels in raster order, and each conditional is computed by a masked convolutional network. Because convolutions can be evaluated in parallel, all these conditionals can be predicted at once during training, whereas sampling must proceed one pixel at a time.
PixelRNN generally gives better likelihoods. One possible reason the authors give is that each LSTM layer can see the whole neighbourhood of earlier pixels, while the visible neighbourhood of a PixelCNN grows only linearly with the depth of the stack. Stacking enough layers softens this limit, according to the same discussion.
The authors also point to the multiplicative units inside the LSTM gates as a possible source of PixelRNN's advantage in modelling complex interactions.
Gated units and the two-stack layout
The first change replaces the rectified linear units between masked convolutions with a gated activation. The unit computes a tanh branch and a sigmoid branch from convolutions of the same input and multiplies them elementwise. In the notation of the layer, \(y = \tanh(W_{k,f} * x) \odot \sigma(W_{k,g} * x)\), where k is the layer index, σ is the sigmoid, ⊙ is the elementwise product and * is the convolution.
The authors motivate the gate by the multiplicative interactions in LSTM gates, and point to earlier feed-forward gated designs, such as highway networks, grid LSTM and neural GPUs, which have generally helped performance.
The second change targets the blind spot. A horizontal stack conditions on the current row so far, while an unmasked vertical stack conditions on all rows above, and the outputs of the two stacks are combined after each layer. The vertical stack can grow its receptive field as a rectangle without a blind spot. The horizontal stack may read the vertical stack, but the reverse connection is excluded, since it would let a pixel see content below or to its right.
Figure 1 (bottom right) illustrates the two stacks.
The horizontal stack keeps a residual connection, following the original PixelCNN, but the vertical stack does not, because adding one there did not improve results in initial experiments. The unit's convolutions for the two gate branches are merged into one masked convolution, which splits the 2p feature maps into two groups of p.
Conditioning on a latent vector h
For conditioning, the model learns p(x|h), the distribution of images that match a given high-level description h, instead of the unconditional factorisation. The conditioning enters the gated unit before its nonlinearities, giving \(y = \tanh(W_{k,f} * x + V_{k,f}^T h) \odot \sigma(W_{k,g} * x + V_{k,g}^T h)\) at every layer. When h is a one-hot class encoding, the term \(V^T h\) acts as a class-dependent bias added at every layer.
Because this term does not depend on the pixel's position, it suits information about what should appear in the image but not where. An animal or object can then appear in varied positions, poses and backgrounds.
Unmasked 1x1 convolutions of s then add a location-dependent term to the gated unit, and the paper states this 1x1 convolution explicitly.
The same conditional decoder can replace the deconvolutional decoder of a traditional convolutional auto-encoder, and the complete network is trained end-to-end. The authors expect this to improve reconstructions and to move low-level pixel statistics out of the code h, leaving the encoder to carry more high-level content.
Unconditional likelihoods on CIFAR-10 and ImageNet
On CIFAR-10, Gated PixelCNN reaches 3.03 bits/dim test NLL, against 3.14 for PixelCNN and 3.00 for PixelRNN, where lower is better. That is 0.11 bits/dim better than PixelCNN, and the authors describe this as a substantial effect on the visual quality of samples. The gated model is close to PixelRNN but slightly above it, and all models in the comparison were tuned for the best validation score.
On ImageNet, the test NLL is 3.83 bits/dim at 32x32, against 3.86 for PixelRNN, and 3.57 bits/dim at 64x64, against 3.63 for PixelRNN. The PixelRNN values are the published results from the original work, not a rerun, and the authors describe the gated model as state-of-the-art on ImageNet 32x32 and 64x64.
The ImageNet model has 20 layers, 384 hidden units per layer and 5x5 filters. It was trained with 200K synchronous updates over 32 GPUs in TensorFlow, with a total batch size of 128. The authors report similar performance to the Row LSTM PixelRNN in less than half the training time, which was 60 hours on 32 GPUs. They attribute the gap in favour of the gated model to underfitting in the larger comparison models, and to the simpler PixelCNN scaling better, which they offer as a belief.
Class-conditional ImageNet samples
The condition is a one-hot vector \(h_i\) for the i-th class, and the model learns \(p(x|h_i)\). The label carries only about log(1000)≈ 0.003 bits per pixel for a 32x32 image.
The likelihood did not change much when the class was supplied, although the authors observed a clear improvement in the visual quality of the samples, as noted in earlier work.
A single class-conditional model produces samples for eight classes, including African elephant, coral reef, sorrel horse and lawn mower. The samples of different classes are visually distinct, and the corresponding objects, animals and backgrounds appear in each. This assessment is qualitative.
Within one class the samples differ in viewpoint and lighting, and the authors say that roughly 1000 images from each animal or object were enough for the model to produce new renderings of it.
Portrait embeddings and new faces
The embedding network was trained on a large database of portraits from Flickr, cropped with a face detector, using a triplet loss. The loss makes the embedding of one person closer to other images of that person than to the embeddings of other people. Image quality varied widely, since many photos were taken on phones in poor lighting. The Conditional PixelCNN was then trained on the pairs of images and embeddings to model p(x|h).
For a person not in the training set, \(h = f(x)\) from one image is used to generate new portraits of that person. The samples keep many facial features of the source image and vary in pose and lighting, as observed qualitatively.
The authors also decode linear interpolations between the embeddings of two images. Each row uses a single random seed in sampling, which gives smooth transitions between the endpoints.
PixelCNN decoder in an auto-encoder
The comparison uses 32x32 ImageNet patches, with a PixelCNN auto-encoder and a convolutional auto-encoder trained to optimise MSE. Both models use a 10 or 100 dimensional bottleneck.
For the PixelCNN model several conditional reconstructions are sampled from each bottleneck, so one input yields several outputs.
The authors had predicted that the bottleneck would carry qualitatively different information with a PixelCNN decoder, and they read these samples as support for that prediction.
Limitations
The conditional experiments are judged by eye. Class-conditional samples, portrait samples and auto-encoder reconstructions have no likelihood or reconstruction score in this text. For the class label, the likelihood gain was small, while the visual gain was the main effect the authors report.
On CIFAR-10 the gated model does not beat PixelRNN, which reached 3.00 bits/dim against 3.03 for the gated model.
The PixelRNN comparison numbers come from the original published work, so the ImageNet comparison is against published results rather than a matched rerun. The underfitting explanation for the ImageNet gap is a belief offered by the authors and is not tested in the paper's text.
The portrait experiment uses one embedding network trained with a triplet loss, and the auto-encoder experiment uses one patch dataset with 10 and 100 dimensional bottlenecks.
Paper info
- Authors
- Aaron van den Oord, Nal Kalchbrenner, Oriol Vinyals, Lasse Espeholt, Alex Graves, Koray Kavukcuoglu
- Venue
- arXiv · Preprint
- First published
- 2016-6-16
- Added
- 2026-10-20
- Updated
- 2016-6-18
- Version
- v2
- arXiv
- 1606.05328
- Category
- cs.CV · cs.LG
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Aaron van den Oord, Nal Kalchbrenner, Oriol Vinyals, Lasse Espeholt, Alex Graves, Koray Kavukcuoglu (2016). Conditional Image Generation with PixelCNN Decoders. arXiv:1606.05328v2. https://arxiv.org/abs/1606.05328v2
BibTeX
@misc{oord2016conditional,
title = {{Conditional Image Generation with PixelCNN Decoders}},
author = {Aaron van den Oord and Nal Kalchbrenner and Oriol Vinyals and Lasse Espeholt and Alex Graves and Koray Kavukcuoglu},
year = {2016},
eprint = {1606.05328},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1606.05328v2}
}