# Supervised Descent Method and its Applications to Face Alignment

https://github.com/wanglin193/SupervisedDescentMethod （看起来作者对sdm实现的不错）

1.)

http://xiong828.github.io/sdm.html
2. )
superviseddescent C++11版本的实现:
http://patrikhuber.github.io/superviseddescent/

## SDM方法（Supervised Descent Method ）

### Derivation of SDM

$f\left({x}_{0}+\mathrm{\Delta }x\right)=||h\left(d\left({x}_{0}+\mathrm{\Delta }x\right)\right)-{\mathrm{\Phi }}_{\ast }|{|}_{2}^{2}$

$f\left({x}_{0}+\mathrm{\Delta }x\right)\approx f\left({x}_{0}\right)+{J}_{f}\left({x}_{0}{\right)}^{T}\mathrm{\Delta }x+\frac{1}{2}\mathrm{\Delta }{x}^{T}H\left({x}_{0}\right)\mathrm{\Delta }x$

$\mathrm{\Delta }{x}_{1}=-{H}^{-1}{J}_{f}=-2{H}^{-1}{J}_{h}^{T}\left({\mathrm{\Phi }}_{0}-{\mathrm{\Phi }}_{\ast }\right)$

,这里${\mathrm{\Phi }}_{0}=h\left(d\left({x}_{0}\right)\right)$$\Phi_0=h(d(x_0))$.
$R=-2{H}^{-1}{J}_{h}^{T}，\mathrm{\Delta }{\mathrm{\Phi }}_{0}={\mathrm{\Phi }}_{0}-{\mathrm{\Phi }}_{\ast }$$R=-2H^{-1}J_h^T，\Delta \Phi_0=\Phi_0-\Phi_*$,于是R可看作$\mathrm{\Delta }{x}_{1}$$\Delta x_1$$\mathrm{\Delta }{\mathrm{\Phi }}_{0}$$\Delta \Phi_0$的线性回归系数。但是，我们知道在测试阶段，${\mathrm{\Phi }}_{\ast }$$\Phi_*$是未知的，但是固定的。因此我们不再使用${\mathrm{\Phi }}_{\ast }$$\Phi_*$做训练，而是改用下面的公式：
$\begin{array}{rlr}\mathrm{\Delta }{x}_{1}& =& -2{H}^{-1}{J}_{h}^{T}\left({\mathrm{\Phi }}_{0}-{\mathrm{\Phi }}_{\ast }\right)\\ \mathrm{\Delta }{x}_{1}& =& -2{H}^{-1}{J}_{h}^{T}{\mathrm{\Phi }}_{0}+\left(-2{H}^{-1}{J}_{h}^{T}\right)\left(-{\mathrm{\Phi }}_{\ast }\right)\\ \mathrm{\Delta }{x}_{1}& =& R{\mathrm{\Phi }}_{0}+{b}_{0}\end{array}$

$\begin{array}{}\text{(1)}& {x}_{k}={x}_{k-1}+{R}_{k-1}{\mathrm{\Phi }}_{k-1}+{b}_{k-1}\phantom{\rule{1em}{0ex}}\left(1\right)\end{array}$
,使得对于训练图片集，${x}_{k}$$x_k$将收敛到${x}_{\ast }$$x_*$.

### Learning for SDM

$\begin{array}{c}arg\\ {R}_{0}\end{array}\begin{array}{c}min\\ {b}_{0}\end{array}\sum _{{d}^{i}}\int p\left({x}_{0}^{i}\right)||\mathrm{\Delta }{x}^{i}-{R}_{0}{\mathrm{\Phi }}_{0}^{i}-{b}_{0}|{|}^{2}d{x}_{0}^{i}$

$\begin{array}{c}arg\\ {R}_{0}\end{array}\begin{array}{c}min\\ {b}_{0}\end{array}\sum _{{d}^{i}}\sum _{{x}_{0}^{i}}||\mathrm{\Delta }{x}^{i}-{R}_{0}{\mathrm{\Phi }}_{0}^{i}-{b}_{0}|{|}^{2}$

$\begin{array}{c}arg\\ {R}_{k}\end{array}\begin{array}{c}min\\ {b}_{k}\end{array}\sum _{{d}^{i}}\sum _{{x}_{k}^{i}}||\mathrm{\Delta }{x}_{\ast }^{ki}-{R}_{k}{\mathrm{\Phi }}_{k}^{i}-{b}_{k}|{|}^{2}$