next_inactive up previous


Active Shape Model

Wei Liu (u0614581)
weiliu@sci.utah.edu


Date: March 12, 2010



Contents

introduction

This report presents how I implement Active Shape Model - a method using principal component analysis for feature extraction, and dimension reduction.

$ \vec x$ is used as vectors, and $ \mat X$ is used as matrics.

Methods

Get principal components: The ASM method assume an multivariate vector $ \vec x = \{x_1, y_1, x_2, y_2,\dots\}$ . If the original number of landmarks are $ M$ , the data vector will be $ D = 2M$ . To capture the principal components (i.e. the major modes, as stated in Cootes et al. (1998)), we use PCA and have eigen-decomposition on the covariance matrix $ \vec S$ of $ N\times D$ data matrix $ \mat X$ , which has each row as multivariate observation. The convariance matrix S is given by

$\displaystyle \mat S = \frac{1}{N}\sum_{n = 1}^{N}\mat X\T \mat X$    

The eigenvalue decomposition of convariance $ \mat S$ is

$\displaystyle \mat S \mat P = \mat P \Lambda$    

where $ \mat P$ 's columns are the eigenvectors of $ \mat S$ , and $ \Lambda$ is diagonal matrix with diagonal the eigen value of $ \mat S$ .

Projection to principal components: We can get the new coordinates (a.k.a the feature vectors) by projecting data vector $ \vec x$ to this new basis vectors and get

$\displaystyle \alpha_{ni} = \vec x_n \vec p_i$    

meaning the coordinates of data vector $ \vec x_n$ projected on the $ i$ th principal component $ \vec p_i$ .

synthetic data from principle components: We can use a 'generative model', to generate synthetic data from mean vector $ \overline x $ and principal components $ \vec p_1, \vec p_2\dots $

$\displaystyle \vec {\tilde x} = \vec {\overline x} + \mat P \vec b$    

where $ \mat P = (\vec p_1, \dots \vec p_K$ is the first $ K$ th components, and $ \vec b = (b_1, \dots, b_K$ is the weights. We use $ b = (-3\sqrt{(\lambda)}, 3\sqrt{(\lambda)})$ .

Experiments

Random tranlations: I begin the test with random translations without noisey perturbation. I use a rectangular as a base shape, and use 12 landmarks on the contour. The coordinates of landmarks are added with random number of Gaussian distribution $ \mathcal{N}(0, 0.1)$ . To make sure the translations along all direction in a isotropic way, I add different, indepent random noise on $ x$ coordinates, and $ y$ coordinates respectively. 100 sample shapes were generated.

The results in Fig.1 shows that the principal components are able to catch the most significant variance in original data samples. I see most of the variances are in the first two eigen values, and this is consistent with the fact that translation have two degree of fredom (in two orthogonal directions). The reconstructed synthetic shape indicate the major modes along those two directions. The correlation map is linearly scaled to $ (0,1)$ for visualization purpose. The checkerboard-like correlation map shows that all the $ x$ coordinates are strong correlated, and the correlation between $ x$ and $ y$ coordinates are low. This is consistent with our understanding, because during translation, all $ x$ coordinates are offset by same number, but the change of $ x$ and $ y$ coordinates are independent.

Figure 1: Shapes translated. Top from left to right: the sample shape; eigenvalue; Correlation map scaled to $ (0,1)$ . Bottom from left to right: synthetic shape using the three principal components $ 1$ , $ 2$ and $ 3$ . In each sub-plot the blue is mean shape $ \vec {\overline x}$ , red is $ \vec{\overline x} \pm \sqrt{\lambda_k}\vec p_k$ , and green is $ \vec{\overline x} \pm 3\sqrt{\lambda_k}\vec p_k$ .
\includegraphics[width = 0.24\textwidth]{toyT.eps}          \includegraphics[width = 0.24\textwidth]{toyT_ev.eps}          \includegraphics[width = 0.24\textwidth]{toyT_corr.eps}


\includegraphics[width = 0.24\textwidth]{toyT_comp1_rec.eps}          \includegraphics[width = 0.24\textwidth]{toyT_comp2_rec.eps}          \includegraphics[width = 0.24\textwidth]{toyT_comp3_rec.eps}

Random scaling: All the coordinates in $ x$ are multiplied by same scaling factor $ s$ , which is a random number of Gaussian distribution $ \cN(1, 0.1)$ .

The results in Fig.2 shows one one eigenvalue are significantly greater than zero. This is because random scaling only have one degree of freedom, and one component is enough to capture the change. Not like translation, the correlation map is hard to say something.

Figure 2: Shapes scaled. Top from left to right: the sample shape; eigenvalue; Correlation map scaled to $ (0,1)$ . Bottom from left to right: synthetic shape using the three principal components $ 1$ , $ 2$ and $ 3$ . In each sub-plot the blue is mean shape $ \vec {\overline x}$ , red is $ \vec{\overline x} \pm \sqrt{\lambda_k}\vec p_k$ , and green is $ \vec{\overline x} \pm 3\sqrt{\lambda_k}\vec p_k$ .
\includegraphics[width = 0.24\textwidth]{toyS.eps}          \includegraphics[width = 0.24\textwidth]{toyS_ev.eps}          \includegraphics[width = 0.24\textwidth]{toyS_corr.eps}


\includegraphics[width = 0.24\textwidth]{toyS_comp1_rec.eps}          \includegraphics[width = 0.24\textwidth]{toyS_comp2_rec.eps}          \includegraphics[width = 0.24\textwidth]{toyS_comp3_rec.eps}
Random translation and scaling: we first translate the shape then scale them. Fig.3 shows that the first three components capture most of the variance. This is because tranlation and scaling together have three degree of freedom. This can also be showned in the second row of Fig.3, where the first two synthetic shape represent the variance of translation, and the third represents scaling. The correlation map looks like the combination of the one in previous two scenarios.

Figure 3: Shapes translated and then scaled. Top from left to right: the sample shape; eigenvalue; Correlation map scaled to $ (0,1)$ . Bottom from left to right: synthetic shape using the three principal components $ 1$ , $ 2$ and $ 3$ . In each sub-plot the blue is mean shape $ \vec {\overline x}$ , red is $ \vec{\overline x} \pm \sqrt{\lambda_k}\vec p_k$ , and green is $ \vec{\overline x} \pm 3\sqrt{\lambda_k}\vec p_k$ .
\includegraphics[width = 0.24\textwidth]{toyTS.eps}          \includegraphics[width = 0.24\textwidth]{toyTS_ev.eps}          \includegraphics[width = 0.24\textwidth]{toyTS_corr.eps}


\includegraphics[width = 0.24\textwidth]{toyTS_comp1_rec.eps}          \includegraphics[width = 0.24\textwidth]{toyTS_comp2_rec.eps}          \includegraphics[width = 0.24\textwidth]{toyTS_comp3_rec.eps}

Random translationns, scalings with noise: See Fig.4, 5 and 6 for the counterparts of Fig.1, 2, and 3, but with additive noise. The noise is added to each elements of data vector $ \vec x$ , which means the shape after adding noise is never a rectangular shape, because of the different noise added on each $ x$ coordinate in a single shape.

In Fig.4 I see the principal compoents are still able to capture the variance. The only difference is the orientation of the variance. This is probably because I add isotropic Gaussian noise, and the basis vector in the subspace is not unique, as long as they are orthogonal to each other. However I need a more rigid explination about this.

In fig.6 we see the first component capture both the variance caused by scaling and translation, while component 3 only capture the remaining variance of scaling. This tell me we should not trust PCA too much when explaining the meaning of variance represented by each principal component.

Overall, the noised data have eigen value more spreaded along all components, instead of just concentrating on the first two or three. This is because when the data are perturbed with noise, the modes are not siginificant towards pure scaling, or translating.

Figure 4: Shapes translated then add noise. Top from left to right: the sample shape; eigenvalue; Correlation map scaled to $ (0,1)$ . Bottom from left to right: synthetic shape using the three principal components $ 1$ , $ 2$ and $ 3$ . In each sub-plot the blue is mean shape $ \vec {\overline x}$ , red is $ \vec{\overline x} \pm \sqrt{\lambda_k}\vec p_k$ , and green is $ \vec{\overline x} \pm 3\sqrt{\lambda_k}\vec p_k$ .
\includegraphics[width = 0.24\textwidth]{toyTN.eps}          \includegraphics[width = 0.24\textwidth]{toyTN_ev.eps}          \includegraphics[width = 0.24\textwidth]{toyTN_corr.eps}


\includegraphics[width = 0.24\textwidth]{toyTN_comp1_rec.eps}          \includegraphics[width = 0.24\textwidth]{toyTN_comp2_rec.eps}          \includegraphics[width = 0.24\textwidth]{toyTN_comp3_rec.eps}

Figure 5: Shapes scaled then add noise. Top from left to right: the sample shape; eigenvalue; Correlation map scaled to $ (0,1)$ . Bottom from left to right: synthetic shape using the three principal components $ 1$ , $ 2$ and $ 3$ . In each sub-plot the blue is mean shape $ \vec {\overline x}$ , red is $ \vec{\overline x} \pm \sqrt{\lambda_k}\vec p_k$ , and green is $ \vec{\overline x} \pm 3\sqrt{\lambda_k}\vec p_k$ .
\includegraphics[width = 0.24\textwidth]{toySN.eps}          \includegraphics[width = 0.24\textwidth]{toySN_ev.eps}          \includegraphics[width = 0.24\textwidth]{toySN_corr.eps}


\includegraphics[width = 0.24\textwidth]{toySN_comp1_rec.eps}          \includegraphics[width = 0.24\textwidth]{toySN_comp2_rec.eps}          \includegraphics[width = 0.24\textwidth]{toySN_comp3_rec.eps}

Figure 6: Shapes translated and then scaled, and then add noise. Top from left to right: the sample shape; eigenvalue; Correlation map scaled to $ (0,1)$ . Bottom from left to right: synthetic shape using the three principal components $ 1$ , $ 2$ and $ 3$ . In each sub-plot the blue is mean shape $ \vec {\overline x}$ , red is $ \vec{\overline x} \pm \sqrt{\lambda_k}\vec p_k$ , and green is $ \vec{\overline x} \pm 3\sqrt{\lambda_k}\vec p_k$ .
\includegraphics[width = 0.24\textwidth]{toyTSN.eps}          \includegraphics[width = 0.24\textwidth]{toyTSN_ev.eps}          \includegraphics[width = 0.24\textwidth]{toyTSN_corr.eps}


\includegraphics[width = 0.24\textwidth]{toyTSN_comp1_rec.eps}          \includegraphics[width = 0.24\textwidth]{toyTSN_comp2_rec.eps}          \includegraphics[width = 0.24\textwidth]{toyTSN_comp3_rec.eps}

Rotation with noise: To generate rotated data, I first generate a random number $ \theta$ with $ \cN(0, 0.1)$ distribution, and apply 2D rotation matrix on $ (x, y)$ pairs of coordinates. The generated shapes and eigen-decomposition are in Fig.7. We see the synthetic shape represent the rotation, but with slightly skew.

Figure 7: Shapes rotated and then add noise. Top from left to right: the sample shape; eigenvalue; Correlation map scaled to $ (0,1)$ . Bottom from left to right: synthetic shape using the three principal components $ 1$ , $ 2$ and $ 3$ . In each sub-plot the blue is mean shape $ \vec {\overline x}$ , red is $ \vec{\overline x} \pm \sqrt{\lambda_k}\vec p_k$ , and green is $ \vec{\overline x} \pm 3\sqrt{\lambda_k}\vec p_k$ .
\includegraphics[width = 0.24\textwidth]{toyRN.eps}          \includegraphics[width = 0.24\textwidth]{toyRN_ev.eps}          \includegraphics[width = 0.24\textwidth]{toyRN_corr.eps}


\includegraphics[width = 0.24\textwidth]{toyRN_comp1_rec.eps}          \includegraphics[width = 0.24\textwidth]{toyRN_comp2_rec.eps}          \includegraphics[width = 0.24\textwidth]{toyRN_comp3_rec.eps}

Real data

Copus callosum data: Run the algorithm on Copus callosum and get results in Fig. 8. I find in order to capture 90% of the variance in the data, we need at least $ 5$ components.
Figure 8: Copus callosum data. Top from left to right: the sample shape; eigenvalue; Correlation map scaled to $ (0,1)$ . Second row from left to right: synthetic shape using the three principal components $ 1$ , $ 2$ and $ 3$ . In each sub-plot the blue is mean shape $ \vec {\overline x}$ , red is $ \vec{\overline x} \pm \sqrt{\lambda_k}\vec p_k$ , and green is $ \vec{\overline x} \pm 3\sqrt{\lambda_k}\vec p_k$ . Third row is component 4 and 5.
\includegraphics[width = 0.24\textwidth]{copus.eps}          \includegraphics[width = 0.24\textwidth]{copus_ev.eps}          \includegraphics[width = 0.24\textwidth]{copus_corr.eps}


\includegraphics[width = 0.24\textwidth]{copus_comp1_rec.eps}          \includegraphics[width = 0.24\textwidth]{copus_comp2_rec.eps}          \includegraphics[width = 0.24\textwidth]{copus_comp3_rec.eps}


\includegraphics[width = 0.24\textwidth]{copus_comp4_rec.eps}          \includegraphics[width = 0.24\textwidth]{copus_comp5_rec.eps}

Handshapes data: For this data set I find four components is enough for a 90% variance.

Figure 9: handshapes data. Top from left to right: the sample shape; eigenvalue; Correlation map scaled to $ (0,1)$ . 2nd row from left to right: synthetic shape using the three principal components $ 1$ , $ 2$ and $ 3$ . In each sub-plot the blue is mean shape $ \vec {\overline x}$ , red is $ \vec{\overline x} \pm \sqrt{\lambda_k}\vec p_k$ , and green is $ \vec{\overline x} \pm 3\sqrt{\lambda_k}\vec p_k$ . bottom row is comp 4.
\includegraphics[width = 0.24\textwidth]{hands.eps}          \includegraphics[width = 0.24\textwidth]{hands_ev.eps}          \includegraphics[width = 0.24\textwidth]{hands_corr.eps}


\includegraphics[width = 0.24\textwidth]{hands_comp1_rec.eps}          \includegraphics[width = 0.24\textwidth]{hands_comp2_rec.eps}          \includegraphics[width = 0.24\textwidth]{hands_comp3_rec.eps}

\includegraphics[width = 0.24\textwidth]{hands_comp4_rec.eps}         

Conclusion

Very good method for feature extraction. When I generate the data with additive Gaussian noise, I remember about a probabilistic version of PCA Bishop et al. (2006), that reformulate PCA in a probabilistic framework. This seems promising.

Bibliography

C. M Bishop et al.
Pattern recognition and machine learning.
Springer New York:, 2006.

T.F. Cootes, G.J. Edwards, and C.J. Taylor.
Active appearance models.
In Computer Vision — ECCV’98, page 484. 1998.
URL http://www.springerlink.com/content/rkj17l4d3wen7tlm.


next_inactive up previous
Wei Liu 2010-04-01