Linear regression
f(z)=wTz
minwΣi(f(xi)−yi)2+λ||w||2
w=(XTX+λI)−1XTy
w∗=(XHX+λI)−1XHy
Circulant matrices
X=FHdiag(x^)F
x^=F(x)
xi in linear regression corresponds to a vector x=[x1,...,xn]
So, we can use circulant matrice X to represent the vector x.
Compute w^∗
XHX=FHdiag(x^∗)FFHdiag(x^)F
XHX=FHdiag(x^∗⋅x^)F
However, this formula isn’t used in the code. The following one is used.
kernel trick
w=Σiαiφ(xi)
φT(x)φ(x′)=k(x,x′)
k is the kernel function (Gaussian or Polynomial)
f(z)=wTϕ(z)
w=Σiαiϕ(xi)
f(z)=[Σiαiϕ(xi)]ϕ(z)=Σi[αiϕ(xi)ϕ(z)]
f(z)=Σiαik(z,xi)
then we need to compute α
compute α
α=(K+λI)−1
compute the response map of current frame
z represent the current frame
Kz=C(kxz)
use circulant matrice K to represent the kernel correlation kxz
summary
- image patch => hog feature
- hog feature => fft
- kf = gaussian_correlation(xf, xf, kernel.sigma); (compute the kernel correlation of the first frame)
- alphaf = yf ./ (kf + lambda); (compute α
- kzf = gaussian_correlation(zf, model_xf, kernel.sigma); (second frame)
response = real(ifft2(model_alphaf .* kzf));
as illustrated in the formula