Contact FutureLearn for Support Skip main navigation
We use cookies to give you a better experience, if that’s ok you can close this message and carry on browsing. For more info read our cookies policy.
We use cookies to give you a better experience. Carry on browsing if you're happy with this, or read our cookies policy for more information.

Constructing kernels for shape modelling

We have seen that a covariance function needs to be positive semi-definite (p.s.d) to define a valid Gaussian Process model. While this property is not easy to check, once we know that a kernel is positive semi-definite, we can use it to construct new positive semi-definite kernels using a set of rules for combining kernels. In this article (as well as in Step 4.7), we show you some examples of how these rules can be used to construct powerful models of shape deformations.

Let be two positive semi-definite kernels and a vector-valued function. Then the following rules can be used to generate new positive semi-definite kernels

  1. .
  2. .
  3. .
  4. .
  5. .
  6. , a p.s.d. kernel.

Multiscale model

We have seen that we can define a model of smooth deformation using the kernel

$$k_\sigma(x,x') = \left(\begin{array}{cc} \exp(-\frac{||x - x'||^2}{\sigma^2}) & 0 \\ 0 &\exp(-\frac{||x - x'||^2}{\sigma^2}) \end{array}\right).$$

Choosing large (compared to the domain ) in the above model leads to very smooth deformations, choosing small allows us to obtain deformations that represent more local variations.

Anatomical shape variations are usually a combination of long-ranging, smooth deformations (e.g. the movement of the thumb) and small-scale local deformations (e.g. the shape of the knuckles). Combining rule 1 and 2 allows us to build a model that combines deformation on multiple scales with varying smoothness. This is achieved by defining the kernel

$$k_\text{ms}(x,x')= \sum_{i=1}^n s_i k_{\sigma_i}(x,x'), $$

where defines the scale and the smoothness of the deformation.

Anisotropic scaling

We have already discussed how we can obtain anisotropic deformation fields using a diagonal kernel, where we scale each component individually:

$$k(x,x') = \left(\begin{array}{cc} s_1 \exp(-\frac{||x - x'||^2}{\sigma^2}) & 0 \\ 0 & s_2 \exp(-\frac{||x - x'||^2}{\sigma^2}) \end{array}\right).$$

Unfortunately, this construction can only be used to define the scale in x and y directions which have no particular significance in shape modelling. Using rule 5 with a rotation matrix , we can define the kernel

$$k_R(x,x') = R^T k(x,x') R,$$

which allows us to choose an arbitrary direction of anisotropy.

Changepoint kernels

Sometimes the shape variations in different regions of a shape have different characteristics. In our hand example, the thumb can be moved much more freely than the other fingers, which leads to wider shape variations in the thumb region. This can be incorporated into the model using a changepoint kernel. Define

$$k_{cp}(x,x')=\chi(x)\chi(x')^T \odot k_1(x,x') + (\vec{1}_{2}-\chi(x))(\vec{1}_{2}-\chi(x'))^T \odot k_2(x,x')$$

and

$$\chi(x)= \left\{ \begin{array}{ll} \vec{1}_2 & \text{if } x \in \text{thumb region} \\ \vec{0}_2 & \text{otherwise} \end{array} \right.$$

where we used the notation

$$\vec{0}_2 = \left( \begin{array}{l}0 \\ 0 \end{array} \right) \text { and } \vec{1}_{2} = \left( \begin{array}{l}1 \\ 1 \end{array} \right).$$

The function is used to select which kernel is active in a given region (ie it acts as a mask). It is easy to see that this kernel is positive semi-definite by using rule 4, together with rule 1 and rule 3.

Figure 1 shows random samples obtained from a model that is defined using the changepoint kernel. In the thumb region (in blue), we modelled large, anisotropic deformations that go mainly in the diagonal direction in order to mimic the movement of the thumb. In the rest of the area we see smooth, isotropic deformations.

Samples from a changepoint kernelFigure 1: random samples from a changepoint kernel, where the thumb region (in blue) is modelled differently from the rest of the shape.

Estimating the kernel from example data

Finally, we show that the kernel that arises from estimating the covariance function from observed deformation fields , is positive-semi definite. Recall from Step 2.4 that this covariance function is defined by

$$k_s(x,x')=\frac{1}{n}\sum_{i=1}^n (u_i(x) - \overline{u}(x)) (u_i(x') - \overline{u}(x'))^T$$

where

$$\overline{u} = \frac{1}{n}\sum_{i=1}^n u_i.$$

It is easy to see that this is a combination of rule 4 (the part inside the sum), rule 1 (the sum) and rule 2 (the scaling factor ).

Hence is just a normal, positive semi-definite kernel, which we can in turn combine with any other positive semi-definite kernel using the same rules.

This article is from the free online course:

Statistical Shape Modelling: Computing the Human Anatomy

University of Basel