Paper commentary
Semantic Image Synthesis with Spatially-Adaptive Normalization
Spatially-adaptive normalization keeps segmentation layouts from washing out in image synthesis
- Problem Generators feed the segmentation mask into the first layer, and the normalization layers that follow can wash away its label layout. The output then loses the input structure.
- Method SPADE replaces plain normalization with a layer that normalizes activations per channel. It then scales and shifts them with spatially varying maps predicted from the mask, so the layout stays in every layer.
- Results On COCO-Stuff, the SPADE generator reaches 37.4 mIoU and 22.6 FID in Table 1. CRN reaches 23.7 mIoU and 70.4 FID.
Why normalization erases the label layout
Many conditional generators for semantic image synthesis feed the segmentation mask into the first layer and then process it through stacks of convolution, normalization and nonlinearity layers. The concern is that the normalization layers in such stacks reduce the mask's label structure before it reaches the output.
Consider a module that applies convolution to a mask in which every pixel has the same label. The convolution output is then uniform, with a different constant value for each label. Applying InstanceNorm to that uniform output gives all zeros whatever the label is, so the label information is gone. The argument covers any network that applies convolution and then normalization to the mask, including a variant that concatenates the mask at every intermediate layer.
The authors illustrate the effect empirically for pix2pixHD, where two different uniform maps produce two identical outputs. The argument is analytical, and the empirical illustration is given for pix2pixHD only.
Spatially-adaptive denormalization
SPADE normalizes each channel of the activations in the same way as Batch Normalization, and then modulates the normalized values with scale and bias that come from the segmentation mask. The difference from Batch Normalization is in the modulation step, where the scale and bias are functions of the mask and vary across the spatial grid.
For a site with sample index n, channel c and spatial position (y, x) in layer i, the output is computed as follows. \[ \gamma^{i}_{c,y,x}(m)\,\frac{h^{i}_{n,c,y,x}-\mu^{i}_{c}}{\sigma^{i}_{c}}+\beta^{i}_{c,y,x}(m) \] Here h^i_{n,c,y,x} is the activation before normalization, and the channel mean mu^i_c and standard deviation sigma^i_c are taken over the batch and the spatial positions of that channel.
The mean is the average of h over n, y and x, and the standard deviation is computed from the mean of the squared activations minus the squared mean, with the same averaging.
The scale gamma and the bias beta are learned functions of the mask m, and they are produced at every position (c, y, x) of the layer. The mask is turned into these maps by a simple two-layer convolutional network, whose design the paper gives in its appendix.
SPADE includes Conditional BatchNorm as a special case: if the mask is replaced by a class label and the modulation becomes spatially invariant, the layer reduces to Conditional BatchNorm. Replacing the mask with a real image, making the modulation spatially invariant and setting N = 1 gives AdaIN. Because the modulation adapts to the mask, the authors argue that SPADE is better suited to semantic image synthesis than either special case.
Building the SPADE generator
Since the modulation layers already carry the label layout, the mask does not need to enter at the first layer, so the encoder part used in earlier architectures is removed. The resulting network is lighter, and it can accept a random vector as its input, which gives a route to multi-modal synthesis.
The generator is a sequence of SPADE residual blocks with upsampling layers, which follows the ResNet block design. Each block works at a different scale, so the mask is downsampled to the resolution of each block before it is used.
Training reuses the multi-scale discriminator and loss of pix2pixHD, except that the least squares term is replaced by the hinge loss. Spectral Norm is applied to all the layers of the generator and discriminator, and the ADAM solver is used with β1 = 0 and β2 = 0.999. The learning rates are set to 0.0001 for the generator and 0.0004 for the discriminator.
Several ResNet-based discriminators from recent unconditional GANs were tried, and they gave similar results at a higher GPU memory cost. Adding SPADE to the discriminator also gave similar performance.
Multi-modal and style-guided synthesis
A separate encoder processes a real image into a random vector, and the generator takes that vector as its noise input, so the encoder and generator together form a variational autoencoder. Training adds a KL-Divergence loss term to the encoder.
At test time, the same encoder serves as a style guidance network: the embedding of a style image replaces the input noise, which controls the global appearance of the output. Different noise samples applied to a fixed mask give outputs with different appearances but the same layout.
Datasets and evaluation protocol
COCO-Stuff has 118,000 training images and 5,000 validation images with 182 semantic classes. ADE20K has 20,210 training images and 2,000 validation images with 150 semantic classes, and ADE20K-outdoor is the outdoor subset of it. Cityscapes has 3,000 training images and 500 validation images of street scenes in German cities. Flickr Landscapes has 41,000 collected photos and 1,000 validation samples, and its input masks are computed with a pretrained DeepLabV2 instead of manual annotation.
Each synthesized image is passed through a segmentation model, and the predicted mask is compared with the input mask, using mIoU and pixel accuracy. The segmentation networks are DeepLabV2 for COCO-Stuff, UperNet101 for ADE20K and DRN-D-105 for Cityscapes. Realism is measured with FID between the distribution of synthesized images and that of real images.
The baselines are pix2pixHD, CRN and SIMS, and CRN and pix2pixHD were trained with the authors' implementations. SIMS requires many queries to the training set, so its results are the authors' own where available and are not reported for COCO-Stuff and ADE20K.
Quantitative comparison with leading methods
In Table 1, the SPADE generator reaches 37.4 mIoU and 22.6 FID on COCO-Stuff, against 23.7 mIoU and 70.4 FID for CRN and 14.6 mIoU and 111.5 FID for pix2pixHD. The running text gives the COCO-Stuff mIoU as 35.2 and says the FID is 2.2 times better than the previous leading method, so the text and the table report different COCO-Stuff values for the same method.
On ADE20K, ADE20K-outdoor and Cityscapes, the SPADE generator has higher mIoU and accu than the CRN, pix2pixHD and SIMS entries in Table 1 where those are reported. The FID is lower than the baselines on the datasets except Cityscapes, where SIMS reaches 49.7 against 71.8 for the SPADE generator.
The authors attribute the low SIMS FID to its stitching of real image patches, so the output distribution matches real images more closely. They attribute its weaker segmentation scores on Cityscapes to the absence of a training patch for every query, so the copied objects often do not match the input segments.
Human preference study
Amazon Mechanical Turk workers saw one input mask and two outputs from different methods, and chose the output that looked more like a corresponding image of the mask. Each dataset used 500 randomly generated questions, each answered by 5 workers, and only workers with a lifetime approval rate above 98% took part.
The percentage of users favoring the SPADE generator over CRN is 79.76 on COCO-Stuff, 76.66 on ADE20K, 66.04 on ADE20K-outdoor and 63.60 on Cityscapes. Against pix2pixHD the values are 86.64 on COCO-Stuff, 83.74 on ADE20K, 79.34 on ADE20K-outdoor and 53.64 on Cityscapes, and against SIMS they are 85.70 on ADE20K-outdoor and 51.52 on Cityscapes.
SPADE against pix2pixHD++ and mask concatenation
The strong baseline pix2pixHD++ combines the useful training techniques found for pix2pixHD, but it does not use SPADE. Models that concatenate the mask at all intermediate layers are included as an alternative to SPADE.
On COCO-Stuff, the decoder-style model with SPADE reaches 35.2 mIoU, while the decoder with concatenated masks reaches 31.9 and pix2pixHD++ reaches 32.7. Adding SPADE to pix2pixHD++ raises COCO-Stuff mIoU to 34.4, and on Cityscapes it gives 62.2, against 57.1 for the concatenation variant.
On ADE20K, pix2pixHD++ with SPADE reaches 39.0 mIoU, slightly above the decoder-style SPADE model at 38.5, so the decoder-style model is not the best on that dataset.
Generator design choices
Feeding random noise into the generator instead of the downsampled segmentation map gives similar scores: 35.3 against 35.2 on COCO-Stuff, 38.3 against 38.5 on ADE20K and 61.6 against 62.3 on Cityscapes. The authors conclude that the modulation by SPADE alone gives enough signal about the input mask.
Reducing the convolution acting on the mask from 3x3 to 1x1 lowers mIoU to 32.7 on COCO-Stuff, 35.9 on ADE20K and 59.9 on Cityscapes, from 35.2, 38.5 and 62.3 with the 3x3 kernel. The authors suggest that a 1x1 kernel hurts because it cannot use the context of the label.
Changing the parameter-free normalization to BatchNorm gives 33.7 on COCO-Stuff, and InstanceNorm gives 33.9, against 35.2 for the default setting. Varying the number of parameters from 141M to 61M leaves COCO-Stuff mIoU between 35.2 and 35.3.
Limitations
Table 1 and the running text disagree on the COCO-Stuff mIoU of the SPADE generator, giving 37.4 and 35.2, and the stated FID factor of 2.2 times is not restated from the table entries. The FID factor appears only in the text.
Flickr Landscapes appears in the qualitative results and in the multi-modal figures, but it has no row in Table 1. Its input masks come from DeepLabV2, so the evaluation depends on that model's predictions.
The segmentation-based scores depend on the segmentation model chosen for each dataset, and these models differ across datasets. SIMS is absent from COCO-Stuff and ADE20K, and where it is compared its values are the authors' own. The human study uses one question per dataset setting and a fixed set of workers, with 500 questions per dataset.
SIMS results often deviate from the input mask, for example the swimming pool shape in one row of the ADE20K-outdoor comparison.
Paper info
- Authors
- Taesung Park, Ming-Yu Liu, Ting-Chun Wang, Jun-Yan Zhu
- Venue
- arXiv · Preprint
- First published
- 2019-3-18
- Added
- 2026-11-12
- Updated
- 2019-11-5
- Version
- v2
- arXiv
- 1903.07291
- Category
- cs.CV · cs.AI · cs.GR · 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
Taesung Park, Ming-Yu Liu, Ting-Chun Wang, Jun-Yan Zhu (2019). Semantic Image Synthesis with Spatially-Adaptive Normalization. arXiv:1903.07291v2. https://arxiv.org/abs/1903.07291v2
BibTeX
@misc{park2019semantic,
title = {{Semantic Image Synthesis with Spatially-Adaptive Normalization}},
author = {Taesung Park and Ming-Yu Liu and Ting-Chun Wang and Jun-Yan Zhu},
year = {2019},
eprint = {1903.07291},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1903.07291v2}
}