---
kind: concept
slug: thin-plate-spline
title: Thin-plate spline (TPS) warp
summary: >-
  A smooth 2-D mapping or surface built from point pairs or samples, with an affine part plus radial basis terms. An exact TPS warp moves image content for animation and gives lower keypoint error than affine motion, with slightly worse identity error. A smoothing TPS, with cross-validation, splits photogrammetry displacement error into systematic and random parts.
tags: [warping, interpolation, smoothing, keypoints, image-animation, motion-model, error-analysis]
papers: ["2203.14367", "2610.01438"]
related: [unsupervised-keypoint-detection, equivariance-constraint, multi-scale-feature-fusion, image-registration, bundle-adjustment, multi-view-reconstruction, outlier-rejection]
status: draft
updated_at: 2026-11-01
---

## Overview

A thin-plate spline is a smooth mapping of the plane, built from a set of
control points. Among the mappings that pass exactly through a set of
control-point pairs, it is the one that bends the plane the least. It has a
closed form: an affine part plus a weighted sum of radial basis terms
U(r) = r² log r² over the control points [arxiv:2203.14367 §3.1]
[arxiv:2203.14367 eq. 1] [arxiv:2203.14367 eq. 2] [arxiv:2203.14367 eq. 3].

Both papers on this page use the name for a smooth surface fitted over 2-D
points, but for different jobs:

- **Warping.** The exact-interpolation form maps one image onto another. The
  paper on image animation uses it as a motion model: it predicts K groups of
  five keypoints for each image and fits one TPS per group, so the warp follows
  the keypoints' non-linear motion [arxiv:2203.14367 §3.1]. Card:
  [Thin-Plate Spline Motion Model for Image Animation](/papers/2203.14367).
- **Smoothing.** A smoothing version fits noisy samples on a grid and is used
  as an estimator of the spatially correlated part of an error. The
  photogrammetry paper applies it to displacement nodes with 10-fold
  cross-validation [arxiv:2610.01438 §2.4.3]. Card:
  [The Impact of Processing Parameters on High-Accuracy Measurements in UAV Photogrammetry](/papers/2610.01438).

The two uses differ in what they promise. The warp passes through its control
pairs exactly, and the paper states this as its constraint [arxiv:2203.14367
eq. 1]. The photogrammetry paper uses a smoothing parameter of 1 and calls it
"corresponding to a cubic spline interpolant". It does not say whether its fit
passes exactly through the nodes [arxiv:2610.01438 §2.4.3]. Do not treat the
smoothing variant as an exact warp.

## Variants

### TPS per keypoint group (the paper's motion model)

Each group of five source and driving keypoints defines one TPS. The paper
states the fit as minimising bending energy under exact interpolation
[arxiv:2203.14367 eq. 1]. The K TPS warps and one affine background warp are
combined per pixel. A softmax over K+1 contribution maps sums to one, and the
flow is the weighted sum of the K+1 transforms [arxiv:2203.14367 eq. 5]
[arxiv:2203.14367 eq. 6] [arxiv:2203.14367 §3.1].

The paper also drops TPS fields at random during early training. Each field
is kept with probability 1 − P, and the kept terms are rescaled by 1/(1 − P)
[arxiv:2203.14367 eq. 7] [arxiv:2203.14367 eq. 8] [arxiv:2203.14367 §3.1]. The
paper gives no value for P and says dropout is removed after several epochs
[arxiv:2203.14367 §3.1]. Card:
[Thin-Plate Spline Motion Model for Image Animation](/papers/2203.14367).

Measured on TaiChiHD, this variant replaces the affine motion of the baseline
(MRAA). Its first ablation step gives AKD 4.96 against 5.41 for MRAA, with L1
unchanged at 0.048 and AED worse at 0.153 against 0.149 [arxiv:2203.14367
tab. 4]. Dropout, multi-resolution masks and the two auxiliary losses bring the
full model to AKD 4.57 [arxiv:2203.14367 tab. 4].

### Affine motion per keypoint (the baseline it replaces)

The comparison baseline, MRAA, moves each keypoint with a local affine piece.
The paper argues that one affine piece per keypoint cannot represent a curved,
non-linear motion such as a lip opening, so it proposes TPS instead
[arxiv:2203.14367 §1] [arxiv:2203.14367 §2]. MRAA has no card in this wiki, so
its numbers are used only as reported in the paper's tables
[arxiv:2203.14367 tab. 1].

### Smoothing TPS with cross-validation (error decomposition)

The photogrammetry paper compares two processing settings by the errors of
their derived displacement maps. To split each displacement error into a
systematic and a random part, it uses thin-plate smoothing splines on the grid
nodes, with smoothing parameter 1 and 10-fold cross-validation [arxiv:2610.01438
§2.4.3]. The nodes are divided at random into ten equal subsets. For each
subset, the other nine are used to predict its nodes. The predicted value is
the systematic part. The random part is the total error minus the systematic
part [arxiv:2610.01438 §2.4.3]. The paper summarises systematic error by the
median absolute error across time intervals, and random error by RMSE
[arxiv:2610.01438 §2.4.3].

The paper gives no formula or library for the smoothing spline. Its kernel and
the exact meaning of the parameter value 1 are therefore not stated.

This is a diagnostic, not a warp. Its numbers compare the two processing
settings, and say nothing about which smoothing method is best. The baseline
setting has a median absolute systematic vertical error of 14 mm, and the
enhanced setting 7 mm. The random part is 6 to 7 mm for both [arxiv:2610.01438
§3.2] [arxiv:2610.01438 tab. 5]. Card:
[The Impact of Processing Parameters on High-Accuracy Measurements in UAV Photogrammetry](/papers/2610.01438).

## When to use which

Two papers stand behind this page. The table states only what their tables and
text support. All numbers are author-reported.

| Situation | Use | Why |
|---|---|---|
| Keypoint trajectories are curved (for example, an open mouth) | TPS per keypoint group | The paper says affine pieces cannot represent such motion [arxiv:2203.14367 §1]. The TPS step lowers AKD from 5.41 to 4.96 on TaiChiHD [arxiv:2203.14367 tab. 4]. |
| Identity or appearance accuracy (AED) is the main metric | Compare both models on your data before choosing | On TaiChiHD and TED-talks the baseline has the lower AED, and the TPS step alone raises AED from 0.149 to 0.153 [arxiv:2203.14367 tab. 1] [arxiv:2203.14367 tab. 4]. On VoxCeleb the TPS model has the lower AED, at 0.125 against 0.136 [arxiv:2203.14367 tab. 1]. |
| Source and driving identities differ strongly | Not a good fit, per the paper | The paper says the method does not work well when the identity mismatch is extreme [arxiv:2203.14367 §4.2] [arxiv:2203.14367 §5]. |
| Limited training budget | Plan for days of training | The authors report about 3 days on two RTX 3090 GPUs for most datasets, and about 8 days for TED-talks [arxiv:2203.14367 §4.2]. |
| Need a fixed number of keypoints for every dataset | K = 10 and N = 5 per group | The paper uses K = 10 across its comparison [arxiv:2203.14367 tab. 1] and five keypoints per group [arxiv:2203.14367 §3.1]. Lower K gives less accuracy in the paper's matched-dimension table [arxiv:2203.14367 tab. 3]. |
| Need an exact warp that passes through each control pair | Exact TPS, not the smoothing form | The warp constraint is exact interpolation [arxiv:2203.14367 eq. 1]. The photogrammetry paper does not say its fit is exact [arxiv:2610.01438 §2.4.3]. |
| Gridded displacements with noise, and you need to separate systematic from random error | Smoothing TPS with 10-fold cross-validation | The method attributes to the systematic part whatever neighbouring nodes predict, and the rest to the random part [arxiv:2610.01438 §2.4.3]. The paper uses it to compare processing settings: systematic vertical error 14 mm against 7 mm, random 6 to 7 mm [arxiv:2610.01438 §3.2]. |

## Implementation sketch

The TPS fit and the blend of the K+1 warps for animation, then the smoothing
split for error analysis. The paper's loss and training details are in the card
and not repeated here. Points that differ from the text are covered under
Contradictions.

```pseudocode
# Fit one TPS per keypoint group, source and driving  [§3.1] [eq. 1-3]
# Input:  kp_source, kp_driving: (K, 5, 2) control points per group
# Output: K warp fields sampled on the grid

def fit_tps(kp_source, kp_driving):
    # Radial kernel between control points: U(r) = r^2 log r^2  [eq. 3]
    kernel = radial_kernel(pairwise_distance(kp_driving))
    # Solve for the affine part and radial weights that interpolate
    # the pairs with minimal bending energy  [eq. 1] [eq. 2]
    affine, weights = solve_linear_system(kernel, kp_driving, kp_source)
    return evaluate_tps(affine, weights, grid)    # (K, H, W, 2)
```

```pseudocode
# Blend the K+1 warps per pixel into one flow  [eq. 5] [eq. 6]
# Input:  K TPS grids and one affine background grid
# Output: flow (H, W, 2) used to warp the source

def blend_warps(tps_grids, affine_grid, logits):
    # Softmax across the K+1 transforms, per pixel  [eq. 5]
    weights = softmax(concat([logits_bg, logits_tps]), axis=transforms)
    # Flow is the weighted sum of the transforms  [eq. 6]
    return sum(weights[j] * grids[j] for j in range(K + 1))
```

```pseudocode
# Split one error component into systematic and random parts  [§2.4.3]
# Input:  node positions (N, 2), total error per node (N,)
# Output: systematic part (N,), random part (N,)

def split_error(nodes, total_error):
    # Ten random, equal subsets of the nodes  [§2.4.3]
    folds = random_partition(nodes, num_folds=10)
    systematic = zeros_like(total_error)
    for held_out in folds:
        # Smoothing TPS, smoothing parameter 1, fitted on nine subsets.
        # The paper gives no formula or library for this fit  [§2.4.3]
        model = fit_smoothing_tps(nodes[~held_out], total_error[~held_out],
                                  smoothing=1)
        # Prediction at the held-out nodes is the systematic part  [§2.4.3]
        systematic[held_out] = model.predict(nodes[held_out])
    # Random part is what the systematic part does not explain  [§2.4.3]
    return systematic, total_error - systematic
```

## Contradictions

Within the first paper, the motion dimension it reports does not match its own
formula. The formula K·(6 + 5·2) + 6 gives 38, 70 and 134 for K = 2, 4 and 8.
The text gives 118 for K = 8 [arxiv:2203.14367 §4.3]. The comparison in tab. 3
depends on this count [arxiv:2203.14367 tab. 3].

Within the second paper, the smoothing parameter 1 is called a smoothing spline
and, in the same sentence, "corresponding to a cubic spline interpolant"
[arxiv:2610.01438 §2.4.3]. The paper does not say whether the fitted surface
passes through the nodes. This is a wording conflict inside one paper, and it
matters for whether the method is an exact warp. It is not a conflict between
papers. The card's pitfalls list it.

The paper text and the released code of the first paper differ in several
places. These are paper-versus-code differences, not disagreements between
papers:

- TPS direction. The paper writes the constraint as the source keypoints
  mapped to the driving keypoints [arxiv:2203.14367 eq. 1]. The code fits the
  warp from driving to source and uses it directly as a sampling grid
  [code: modules/util.py#L20-L22] [code: modules/dense_motion.py#L71-L76].
- Dropout rescaling. Equation 7 divides the kept TPS terms by 1 − P. The
  code divides the logits by 1 − P after the exponential, so the kept terms
  are not rescaled as equation 7 requires [code: modules/dense_motion.py#L109-L116].
- Loss weights and reduction. The paper's total is an unweighted sum of
  absolute-value terms [arxiv:2203.14367 eq. 14]. The code weights each term
  by 10 and takes means [code: config/taichi-256.yaml#L100-L108].
- Ridge and epsilon. The paper's constraint is exact interpolation. The code
  adds 0.01 times the identity before the solve and adds 1e-9 inside the
  logarithm [code: modules/util.py#L41-L42] [code: modules/util.py#L27-L29].

Implementers should pick either the text or the code for each point and say
which one they chose. The card's pitfalls list these in full.

## Papers

- [Thin-Plate Spline Motion Model for Image Animation](/papers/2203.14367):
  replaces the affine motion of keypoints with one TPS per group of five
  keypoints, adds dropout on the TPS fields and multi-resolution occlusion
  masks, and reports lower keypoint error on TaiChiHD, TED-talks and VoxCeleb.
- [The Impact of Processing Parameters on High-Accuracy Measurements in UAV Photogrammetry](/papers/2610.01438):
  uses a smoothing thin-plate spline with 10-fold cross-validation to split
  displacement error into systematic and random parts, and reports how eight
  processing parameters change the systematic and random errors.
