Pixel-Adaptive Convolutional Neural Networks

Hang Su, Varun Jampani, Deqing Sun, Orazio Gallo, Erik G. Learned-Miller, Jan Kautz

Abstract

Convolutions are the fundamental building blocks of CNNs. The fact that their weights are spatially shared is one of the main reasons for their widespread use, but it is also a major limitation, as it makes convolutions content-agnostic. We propose a pixel-adaptive convolution (PAC) operation, a simple yet effective modification of standard convolutions, in which the filter weights are multiplied with a spatially varying kernel that depends on learnable, local pixel features. PAC is a generalization of several popular filtering techniques and thus can be used for a wide range of use cases. Specifically, we demonstrate state-of-the-art performance when PAC is used for deep joint image upsampling. PAC also offers an effective alternative to fully-connected CRF (Full-CRF), called PAC-CRF, which performs competitively compared to Full-CRF, while being considerably faster. In addition, we also demonstrate that PAC can be used as a drop-in replacement for convolution layers in pre-trained networks, resulting in consistent performance improvements.

Introduction

Standard Convolutional Neural Networks (CNNs) rely on two core properties: spatial sharing and being content-agnostic. While spatial sharing allows for efficient computation and translation invariance, the content-agnostic nature of standard filters is a significant limitation. In tasks such as semantic segmentation or depth upsampling, the optimal filter for a pixel on a sharp edge should ideally differ from one in a flat region.

Standard CNNs typically address this by learning a vast number of filters to account for every possible local variation, which is both memory-intensive and data-hungry. Pixel-Adaptive Convolution (PAC) addresses this by making the convolution operation itself adaptive to image content without sacrificing the efficiency of the 2D grid structure.

The Pixel-Adaptive Convolution (PAC) Operation

In a standard convolution, the output at a specific pixel is a weighted sum of its neighbors. PAC modifies this by multiplying the standard filter weights by an adapting kernel $K$ that varies spatially based on local features.

Conceptual overview of the Pixel-Adaptive Convolution (PAC) operation.

The Mathematical Framework

The PAC operation is defined as: $v'_i = \sum K(f_i, f_j) W[p_i - p_j] v_j + b$

Where:

  • The Kernel ($K$): Typically a Gaussian function measuring the similarity between features $f_i$ and $f_j$ at different pixel locations.
  • The Features ($f$): These can be basic inputs like RGB color and pixel coordinates, or "deep features" learned dynamically by the network.

By design, PAC acts as a learnable bilateral filter. If neighboring pixels possess significantly different features (e.g., they lie on opposite sides of an object boundary), the kernel $K$ becomes small, preventing the convolution from blurring information across that edge. This makes PAC inherently "content-aware."

Applications: Joint Image Upsampling

One of the primary strengths of PAC is in joint upsampling tasks, where a low-resolution map (like depth) is upsampled using a high-resolution guidance image (like RGB). The authors utilize a transposed version of PAC (PAC$^{\intercal}$) to achieve this.

Architecture for deep joint upsampling using PAC transposed (PAC-T) layers.

In this architecture, a guidance network extracts features from the high-resolution image, which then inform the PAC$^{\intercal}$ layers in the decoder. This allows the upsampling process to respect the sharp boundaries present in the guidance image.

Key Insights and Generalization

PAC is not merely a specialized trick; it is a generalization of several existing filtering techniques. By adjusting the kernel and weights, PAC can reduce to a standard convolution, a bilateral filter, or various forms of pooling (such as average or detail-preserving pooling).

Unlike previous attempts to create content-adaptive convolutions that relied on high-dimensional "lattices," PAC operates entirely on the 2D pixel grid. This makes it significantly faster and easier to integrate into modern deep learning frameworks like PyTorch.

Layer Hot-Swapping

A particularly practical application is "layer hot-swapping." Because PAC generalizes standard convolution, one can take a pre-trained model (e.g., an FCN-8s), replace its final convolution layers with PAC layers, and fine-tune the result. This allows the model to leverage local content to refine predictions with minimal additional parameters.

Experimental Results

The researchers evaluated PAC across several benchmarks, demonstrating its versatility:

  • Joint Depth Upsampling (NYU Depth V2): PAC achieved state-of-the-art results for $16\times$ upsampling with an RMSE of 8.09, significantly outperforming the previous best (DJF) at 10.21.
  • Efficient CRFs (Pascal VOC): The proposed PAC-CRF is substantially faster than traditional "Full-CRF" methods. On Pascal VOC, PAC-CRF required only 78ms compared to 629ms for Full-CRF, while providing a higher mIoU boost (+2.62 vs +2.45).
  • Semantic Segmentation: By hot-swapping layers in a pre-trained FCN-8s, the authors improved test mIoU from 67.20 to 69.18 with virtually no change in parameter count.

Conclusion and Future Work

While PAC offers significant advantages, the authors noted a "gridding" effect when using dilated PAC filters, a common phenomenon in dilated convolutions that can introduce noise near boundaries. Future research may explore complex non-Gaussian kernel functions or extend PAC to video processing, where temporal features could be used to maintain consistency across frames.

Summary updated

BibTeX
@inproceedings{su2019pixel,
  author = {Hang Su and Varun Jampani and Deqing Sun and Orazio Gallo and Erik G. Learned-Miller and Jan Kautz},
  title = {{Pixel-Adaptive Convolutional Neural Networks}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2019},
  url = {https://openreview.net/forum?id=TBqgJx0lawaW},
}
Figure