arXiv(opens in a new tab)cs.CVJun 2020Cited by 17 papers on PaperVantageClassic Paper

Manuscript Offprint

arXiv:2006.10739

Fourier Features Let Networks Learn High Frequency Functions in Low Dimensional Domains

Matthew Tancik, Pratul P. Srinivasan, Ben Mildenhall, Sara Fridovich-Keil, Nithin Raghavan, Utkarsh Singhal, Ravi Ramamoorthi, Jonathan T. Barron, Ren Ng

Abstract

We show that passing input points through a simple Fourier feature mapping enables a multilayer perceptron (MLP) to learn high-frequency functions in low-dimensional problem domains. These results shed light on recent advances in computer vision and graphics that achieve state-of-the-art results by using MLPs to represent complex 3D objects and scenes. Using tools from the neural tangent kernel (NTK) literature, we show that a standard MLP fails to learn high frequencies both in theory and in practice. To overcome this spectral bias, we use a Fourier feature mapping to transform the effective NTK into a stationary kernel with a tunable bandwidth. We suggest an approach for selecting problem-specific Fourier features that greatly improves the performance of MLPs for low-dimensional regression tasks relevant to the computer vision and graphics communities.

1 Introduction

A recent line of research in computer vision and graphics replaces traditional discrete representations of objects, scene geometry, and appearance (e.g. meshes and voxel grids) with continuous functions parameterized by deep fully-connected networks (also called multilayer perceptrons or MLPs). These MLPs, which we will call “coordinate-based” MLPs, take low-dimensional coordinates as inputs (typically points in R3\mathbb{R}^3) and are trained to output a representation of shape, density, and/or color at each input location (see Figure 1). This strategy is compelling since coordinate-based MLPs are amenable to gradient-based optimization and machine learning, and can be orders of magnitude more compact than grid-sampled representations. Coordinate-based MLPs have been used to represent images [28, 38] (referred to as “compositional pattern producing networks”), volume density [27], occupancy [24], and signed distance [32], and have achieved state-of-the-art results across a variety of tasks such as shape representation [9, 10, 12, 13, 17, 26, 32], texture synthesis [15, 31], shape inference from images [22, 23], and novel view synthesis [27, 29, 35, 37].

We leverage recent progress in modeling the behavior of deep networks using kernel regression with a neural tangent kernel (NTK) [16] to theoretically and experimentally show that standard MLPs are poorly suited for these low-dimensional coordinate-based vision and graphics tasks. In particular, MLPs have difficulty learning high frequency functions, a phenomenon referred to in the literature as “spectral bias” [3, 33]. NTK theory suggests that this is because standard coordinate-based MLPs correspond to kernels with a rapid frequency falloff, which effectively prevents them from being able to represent the high-frequency content present in natural images and scenes.

A few recent works [27, 44] have experimentally found that a heuristic sinusoidal mapping of input coordinates (called a “positional encoding”) allows MLPs to represent higher frequency content.

∗^{*} Authors contributed equally to this work.

Preprint. Under review.

Figure

No Fourier features

γ(v)=v\gamma(\mathbf{v}) = \mathbf{v}

(a) Coordinate-based MLP

With Fourier features

γ(v)=FF(v)\gamma(\mathbf{v}) = \mathrm{FF}(\mathbf{v})

Figure

(x,y)(x,y)

(b) Image regression

(x,y)→RGB(x,y)\rightarrow RGB

(c) 3D shape regression

(x,y,z)→occupancy(x,y,z)\rightarrow occupancy

(d) MRI reconstruction

(x,y,z)→density(x,y,z)\rightarrow density

(e) Inverse rendering

(x,y,z)→RGB, density(x,y,z)\rightarrow RGB,\ density

Figure 1: Fourier features improve the results of coordinate-based MLPs for a variety of high-frequency low-dimensional regression tasks, both with direct (b, c) and indirect (d, e) supervision. We visualize an example MLP (a) for an image regression task (b), where the input to the network is a pixel coordinate and the output is that pixel's color. Passing coordinates directly into the network (top) produces blurry images, whereas preprocessing the input with a Fourier feature mapping (bottom) enables the MLP to represent higher frequency details.

We observe that this is a special case of Fourier features [34]: mapping input coordinates v\mathbf{v} to γ(v)=[a1cos⁡(2πb1Tv),a1sin⁡(2πb1Tv),…,amcos⁡(2πbmTv),amsin⁡(2πbmTv)]T\gamma(\mathbf{v}) = \left[a_1 \cos(2\pi \mathbf{b}_1^\mathrm{T} \mathbf{v}), a_1 \sin(2\pi \mathbf{b}_1^\mathrm{T} \mathbf{v}), \ldots, a_m \cos(2\pi \mathbf{b}_m^\mathrm{T} \mathbf{v}), a_m \sin(2\pi \mathbf{b}_m^\mathrm{T} \mathbf{v})\right]^\mathrm{T} before passing them into an MLP. We show that this mapping transforms the NTK into a stationary (shift-invariant) kernel and enables tuning the NTK's spectrum by modifying the frequency vectors bj\mathbf{b}_j, thereby controlling the range of frequencies that can be learned by the corresponding MLP. We show that the simple strategy of setting aj=1a_j = 1 and randomly sampling bj\mathbf{b}_j from an isotropic distribution achieves good performance, and that the scale (standard deviation) of this distribution matters much more than its specific shape. We train MLPs with this Fourier feature input mapping across a range of tasks relevant to the computer vision and graphics communities. As highlighted in Figure 1, our proposed mapping dramatically improves the performance of coordinate-based MLPs. In summary, we make the following contributions:

  • We leverage NTK theory and simple experiments to show that a Fourier feature mapping can be used to overcome the spectral bias of coordinate-based MLPs towards low frequencies by allowing them to learn much higher frequencies (Section 4).

  • We demonstrate that a random Fourier feature mapping with an appropriately chosen scale can dramatically improve the performance of coordinate-based MLPs across many low-dimensional tasks in computer vision and graphics (Section 5).

References (39)