Title: | Sparse Vector Field Consensus for Vector Field Learning |
---|---|
Description: | The sparse vector field consensus (SparseVFC) algorithm (Ma et al., 2013 <doi:10.1016/j.patcog.2013.05.017>) for robust vector field learning. Largely translated from the Matlab functions in <https://github.com/jiayi-ma/VFC>. |
Authors: | Jingmeng Cui [aut, cre] |
Maintainer: | Jingmeng Cui <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.1.2 |
Built: | 2024-11-09 03:21:48 UTC |
Source: | https://github.com/sciurus365/sparsevfc |
A dataset containing the vectors for the church photos.
church
church
A list with three components:
The position of points in the first photo.
The position of points in the second photo.
The indices for the correct point pairs.
https://github.com/jiayi-ma/VFC
Ma et al. (2013) doi:10.1016/j.patcog.2013.05.017; Zhao et al. (2011) doi:10.1109/CVPR.2011.5995336
Normalize the data so that the mean of the vectors is 0 and the variance of the vectors is 1. Here the variance of vectors is calculated by interpreting the deviation as the Euclidean distance, which means the trace of the (population) covariance matrix is 1.
norm_vecs(x)
norm_vecs(x)
x |
The matrix to be normalized. Each row of |
The normalized matrix with two attributions scale
and mean
, which are used for normalization.
norm_vecs(matrix(seq(1, 100), ncol = 2))
norm_vecs(matrix(seq(1, 100), ncol = 2))
Predicted values based on VFC
objects.
## S3 method for class 'VFC' predict(object, newdata, ...)
## S3 method for class 'VFC' predict(object, newdata, ...)
object |
A |
newdata |
A vector specifying the position. |
... |
Not in use. |
A vector.
The main function for the SparseVFC algorithm.
See References
for more information.
SparseVFC( X, Y, M = 16, MaxIter = 500, gamma = 0.9, beta = 0.1, lambda = 3, theta = 0.75, a = 10, ecr = 1e-05, minP = 1e-05, silent = TRUE )
SparseVFC( X, Y, M = 16, MaxIter = 500, gamma = 0.9, beta = 0.1, lambda = 3, theta = 0.75, a = 10, ecr = 1e-05, minP = 1e-05, silent = TRUE )
X |
The position of the vectors. |
Y |
The value of the vectors. |
M |
The number of the basis functions used for sparse approximation. Default value is 16. |
MaxIter |
Maximum iteration times. Default value is 500. |
gamma |
Percentage of inliers in the samples. This is an initial value for EM iteration, and it is not important. Default value is 0.9. |
beta |
Parameter of Gaussian Kernel, |
lambda |
Represents the trade-off between the goodness of data fit and smoothness of the field. Default value is 3. |
theta |
If the posterior probability of a sample being an inlier is larger than theta, then it will be regarded as an inlier. Default value is 0.75. |
a |
Parameter of the uniform distribution. We assume that the outliers obey a uniform distribution |
ecr |
The minimum limitation of the energy change rate in the iteration process. Default value is 1e-5. |
minP |
The posterior probability Matrix P may be singular for matrix inversion. We set the minimum value of P as |
silent |
Should the messages be suppressed? Default value is |
A VFC
object, which is a list containing the following elements:
A matrix of the positions of kernels.
A matrix of the input vectors.
The input value of beta
.
A matrix of the estimated vectors.
A matrix of the coefficients of each kernel.
A vector of the posterior probability of the input vectors (Y
) being an inlier.
A vector of indices of the inliers.
The of the estimations weighted by
P
.
The algorithm is described in Ma et al. (2013) doi:10.1016/j.patcog.2013.05.017. This function is translated with permission from Jiayi Ma's Matlab function at https://github.com/jiayi-ma/VFC. Also see Zhao et al. (2011) doi:10.1109/CVPR.2011.5995336 for the earlier VFC algorithm.
data(church) set.seed(1614) VecFld <- SparseVFC(norm_vecs(church$X), norm_vecs(church$Y) - norm_vecs(church$X)) predict(VecFld, c(0, 0))
data(church) set.seed(1614) VecFld <- SparseVFC(norm_vecs(church$X), norm_vecs(church$Y) - norm_vecs(church$X)) predict(VecFld, c(0, 0))