Parametric Texture Synthesis

Parametric texture synthesis creates a new image of the same texture as an input sample by matching a fixed set of statistics. The statistics are the parameters of the model, which is where the name comes from. Analysis computes them once from the input. Synthesis starts from random noise and changes it until its statistics equal the input’s. The goal is a generative model of the “infinite texture” that the sample was cropped from. Any image with the right statistics is a valid output. The method returns one member of the set of images with equal model response.

Heeger & Bergen (SIGGRAPH 1995) match marginal statistics: the histogram of every subband of an oriented multiscale pyramid, plus the pixel histogram. Step 1 builds the pyramid of the input and of a noise image. Step 2 matches the histogram of each noise subband to the input’s (the slides call each subband a channel). Step 3 collapses the pyramid and repeats. The method tests Bergen’s conjecture. Matching the mean amplitude of band-pass filter responses mimics human texture perception a little. Matching their full histograms (the marginal statistics) should then do better.

Portilla & Simoncelli (2000) show that marginal statistics are not enough. Neighboring filter responses are correlated, since an edge at low resolution causes an edge at high resolution. Their model also matches second-order (joint) statistics: correlations between coefficients at neighboring positions, orientations and scales of a complex wavelet pyramid.

Gatys et al. (NIPS 2015) use a pretrained CNN (VGG) as the filter bank. At layer , the feature maps, each flattened to positions, form a matrix . The texture statistics are the Gram matrices

at layers conv1_1, pool1, pool2, pool3 and pool4. Entry measures how strongly features and respond together, summed over all positions . With the Gram matrices of the image being synthesized, that image minimizes

where weights layer . The network stays fixed, and gradient descent changes the pixels.

All three models use statistics that ignore position. They reproduce stationary textures (whose statistics are the same at every location) well and fail on long-range structure such as wood grain or marble. Adding a content term to the Gram loss gives neural style transfer.

Normalization of the Gram Loss

The slides write without constants. The paper divides by , so layers of different sizes contribute on similar scales. The constant does not change which image matches one layer best. It does change the effective weight of each layer in the sum.

Intuition

A texture sample is a small crop of something that could continue forever, such as gravel, bark or a brick wall. Copying the crop cannot produce a larger or different patch. A parametric model summarizes the texture with a fixed list of numbers instead. If the list captures what human vision uses to judge texture, then any image with the same numbers looks like the same texture. Synthesis becomes a search. Start from white noise and change it until its numbers match the input’s.

The choice of statistics sets the difficulty. With too few statistics, many images that look nothing like the texture share them, as with plain pixel histograms in 9.3. Texture Histograms. With too many, only the input itself matches, and the method copies instead of generating. Heeger and Bergen use per-subband histograms of a pyramid, because each subband isolates one scale and orientation, like the V1-style filter banks. The figure shows their loop. Portilla and Simoncelli add joint statistics, and Gatys et al. replace the hand-designed pyramid with learned CNN features.

\usepackage{tikz}
\begin{document}
\definecolor{tgt}{HTML}{2F80ED}
\definecolor{syn}{HTML}{D9483B}
\definecolor{mid}{HTML}{8A8A8A}
\begin{tikzpicture}[>=latex, box/.style={draw, rounded corners, align=center, minimum height=1cm, inner sep=4pt, text width=2.7cm}]
\node[box, tgt] (in) at (0,2.4) {input texture};
\node[box, tgt] (pin) at (4,2.4) {pyramid of the input};
\node[box, tgt] (hin) at (8,2.4) {target histogram\\ of every subband};
\node[box, syn] (noise) at (0,0) {white noise image $x^{(0)}$};
\node[box, syn] (pn) at (4,0) {Step 1:\\ pyramid of $x^{(k)}$};
\node[box, syn] (match) at (8,0) {Step 2: match each\\ subband histogram};
\node[box, syn] (coll) at (8,-2.4) {Step 3:\\ collapse the pyramid};
\node[box, syn] (next) at (4,-2.4) {new image $x^{(k+1)}$};
\draw[->, thick, tgt] (in) -- (pin);
\draw[->, thick, tgt] (pin) -- (hin);
\draw[->, thick, tgt] (hin) -- (match);
\draw[->, thick, syn] (noise) -- (pn);
\draw[->, thick, syn] (pn) -- (match);
\draw[->, thick, syn] (match) -- (coll);
\draw[->, thick, syn] (coll) -- (next);
\draw[->, thick, syn] (next) -- node[right, mid] {repeat} (pn);
\node[tgt, anchor=west] at (-1.4,3.5) {analysis (once)};
\node[syn, anchor=west] at (-1.4,-3.5) {synthesis (iterated)};
\end{tikzpicture}
\end{document}

Properties

(Histogram Matching) Each noise subband is remapped through two cumulative histograms, which keeps the rank order of its values.

Let be the cumulative histogram of a noise subband and that of the same subband of the input. Each noise coefficient is replaced by

In words, the -th smallest noise coefficient takes the value of the -th smallest target coefficient. This is the CDF trick behind histogram equalization in point processing, followed by the inverse of the target’s CDF. The map is monotone, so large noise values stay where they were and only the distribution of values changes.

(Why the Loop Repeats) Editing the subbands and collapsing does not produce an image whose subbands match.

The pyramid is overcomplete, meaning it has more coefficients than the image has pixels. An arbitrary set of edited subbands is the pyramid of no image at all. Collapsing maps the edits back to an image, and the subbands of that image have drifted from the matched histograms. Heeger and Bergen also match the pixel histogram after each collapse. The loop repeats until the histograms stop changing much.

(Marginals Miss Alignment) Matching each subband on its own keeps how many strong responses there are but not where they line up across scales.

A sharp edge in the input gives large coefficients at the same location in every scale band. Histogram matching treats each band separately, so nothing places the large fine-scale values on top of the large coarse-scale values. The result has soft blobs where the input has crisp boundaries. Heeger and Bergen’s own failure cases include wood grain, red coral, hay and marble. An inhomogeneous input (one whose statistics change across the image) also fails, since one set of histograms averages its regions into a blotchy mix. Portilla and Simoncelli restore the alignment by matching correlations across positions, orientations and scales.

(Reading the Gram Matrix) The diagonal of measures how strongly each feature fires, and the off-diagonal entries measure which features fire together.

The diagonal entry is the energy of feature map , close to the mean amplitude in Bergen’s conjecture. An off-diagonal entry is large when features and are active at the same positions. It plays the role of Portilla and Simoncelli’s joint statistics. Each entry is an inner product of two rows of , and the sum over removes all position information. Permuting the positions, for example by a circular shift, leaves unchanged. Its size, , does not depend on the image size. With maps at the five layers, the symmetric matrices hold distinct numbers in total.

\usepackage{tikz}
\begin{document}
\definecolor{rowi}{HTML}{2F80ED}
\definecolor{rowj}{HTML}{D9483B}
\definecolor{mid}{HTML}{8A8A8A}
\begin{tikzpicture}[>=latex]
\draw[mid, fill=white] (0,0) rectangle (1.6,1.6);
\draw[mid, fill=white] (0.25,0.25) rectangle (1.85,1.85);
\draw[mid, fill=white] (0.5,0.5) rectangle (2.1,2.1);
\node[align=center] at (1.05,-0.55) {$N_l$ feature maps,\\ each $H_l \times W_l$};
\draw[->, thick, mid] (2.4,1.0) -- node[above, black] {\small flatten} (3.5,1.0);
\fill[rowi!35] (4.6,1.25) rectangle (8.3,1.5);
\fill[rowj!35] (4.6,0.5) rectangle (8.3,0.75);
\draw (3.8,0.2) rectangle (8.3,1.8);
\node[rowi, anchor=west] at (3.85,1.375) {\small row $i$};
\node[rowj, anchor=west] at (3.85,0.625) {\small row $j$};
\node at (6.05,2.15) {$F^l$: $N_l$ rows, $M_l = H_l W_l$ columns};
\node at (6.05,-0.25) {\small column $k$ = one spatial position};
\node at (9.25,1.0) {$\cdot\,(F^l)^{\top} =$};
\draw (10.2,0.2) rectangle (11.8,1.8);
\fill[rowi!35] (10.2,1.25) rectangle (11.8,1.5);
\fill[rowj!35] (10.95,0.2) rectangle (11.2,1.8);
\fill[mid] (10.95,1.25) rectangle (11.2,1.5);
\draw (10.2,0.2) rectangle (11.8,1.8);
\node at (11.0,2.15) {$G^l$: $N_l \times N_l$};
\draw[->, mid] (11.075,1.375) -- (12.4,1.9) node[right, black] {$G^l_{ij} = \sum_k F^l_{ik} F^l_{jk}$};
\node[align=left, anchor=west] at (11.9,0.7) {\small inner product of\\ \small rows $i$ and $j$};
\end{tikzpicture}
\end{document}

(Optimizing Pixels) Gatys synthesis backpropagates the loss to the input pixels and keeps every network weight fixed.

The gradient comes from the same backpropagation used in training, carried one step further to the image. The paper starts from random noise and runs the L-BFGS optimizer, a gradient-based relative of gradient descent that also estimates curvature. Different noise seeds give different textures with the same statistics. Every new texture needs its own optimization of many forward and backward passes, so synthesis is slow.

(Synthesis as Projection) The lecture reads later generative models as texture synthesis with better statistics.

The lecture conjectures that GANs might be learning the “right” features to match for natural images. In this view a trained discriminator replaces a fixed statistic. Diffusion and flow matching models move noise step by step onto the set of natural images. The lecture draws both as projecting noise onto an image manifold. Texture synthesis fits the same picture, with noise moved onto the set of images with equal model response. 8.6. Flow-Based Image Editing uses this projection to edit drawings and photos.

Examples

(Easy) Stripes Versus Crossings

A CNN layer has two feature maps along one image row of four positions. Feature 1 detects vertical edges and feature 2 detects horizontal edges. A striped fabric gives , where the two features fire at different positions. A woven grid gives , where they fire at the same positions:

Each row lists one feature’s responses at the four positions.

(Medium) Matching a Brick Subband

One subband of a brick-wall texture is sparse. Most coefficients are near , and a few are large where mortar lines cross the filter. Eight of its coefficients are . The same subband of the noise image holds .

See Also