This short tutorial shows how to compute Fisher vector and VLAD encodings with VLFeat MATLAB interface.

These encoding serve a similar purposes: summarizing in a vectorial statistic a number of local feature descriptors (e.g. SIFT). Similarly to bag of visual words, they assign local descriptor to elements in a visual dictionary, obtained with vector quantization (KMeans) in the case of VLAD or a Gaussian Mixture Models for Fisher Vectors. However, rather than storing visual word occurrences only, these representations store a statistics of the difference between dictionary elements and pooled local features.

Fisher encoding

The Fisher encoding uses GMM to construct a visual word dictionary. To exemplify constructing a GMM, consider a number of 2 dimensional data points (see also the GMM tutorial). In practice, these points would be a collection of SIFT or other local image features. The following code fits a GMM to the points:

numFeatures = 5000 ;
dimension = 2 ;
data = rand(dimension,numFeatures) ; numClusters = 30 ;
[means, covariances, priors] = vl_gmm(data, numClusters);

Next, we create another random set of vectors, which should be encoded using the Fisher Vector representation and the GMM just obtained:

numDataToBeEncoded = 1000;
dataToBeEncoded = rand(dimension,numDataToBeEncoded);

The Fisher vector encoding enc of these vectors is obtained by calling the vl_fisher function using the output of the vl_gmm function:

encoding = vl_fisher(datatoBeEncoded, means, covariances, priors);

The encoding vector is the Fisher vector representation of the data dataToBeEncoded.

Note that Fisher Vectors support several normalization options that can affect substantially the performance of the representation.

VLAD encoding

The Vector of Linearly Agregated Descriptors is similar to Fisher vectors but (i) it does not store second-order information about the features and (ii) it typically use KMeans instead of GMMs to generate the feature vocabulary (although the latter is also an option).

Consider the same 2D data matrix data used in the previous section to train the Fisher vector representation. To compute VLAD, we first need to obtain a visual word dictionary. This time, we use K-means:

numClusters = 30 ;
centers = vl_kmeans(dataLearn, numClusters);

Now consider the data dataToBeEncoded and use the vl_vlad function to compute the encoding. Differently from vl_fishervl_vlad requires the data-to-cluster assignments to be passed in. This allows using a fast vector quantization technique (e.g. kd-tree) as well as switching from soft to hard assignment.

In this example, we use a kd-tree for quantization:

kdtree = vl_kdtreebuild(centers) ;
nn = vl_kdtreequery(kdtree, centers, dataEncode) ;

Now we have in the nn the indexes of the nearest center to each vector in the matrix dataToBeEncoded. The next step is to create an assignment matrix:

assignments = zeros(numClusters,numDataToBeEncoded);
assignments(sub2ind(size(assignments), nn, 1:length(nn))) = 1;

It is now possible to encode the data using the vl_vlad function:

enc = vl_vlad(dataToBeEncoded,centers,assignments);

Note that, similarly to Fisher vectors, VLAD supports several normalization options that can affect substantially the performance of the representation.

from: http://www.vlfeat.org/overview/encodings.html

最新文章

  1. python二进制相关
  2. WinForm中使用AnyCAD三维控件 の 初始化
  3. ASP.NET的分页方法(三)
  4. Android将Activity打成jar包供第三方调用(解决资源文件不能打包的问题)
  5. Today See>
  6. Delphi回调函数及其使用
  7. inux上iptables防火墙的基本应用教程
  8. UVa 727 - Equation
  9. JAVA虚拟机系列文章
  10. MySQL 避免重复数据的批量插入与批量更新
  11. iOS masonry 不规则tagView布局 并自适应高度
  12. ssh 登陆服务器原理
  13. ****** 二十八 ******、软设笔记【数据库】-分布式数据库、特点、数据存储、DBMS组成
  14. oracle数据库启动和关闭方式
  15. Ubuntu+Fedora进阶学习,指令迅速查询,Bug迅速查询(Ctrl+F)
  16. 动态赋id
  17. 12.18daily_scrum
  18. Java实现进程调度算法(一) FCFS(先来先服务)
  19. 《剑指offer》--- 两个链表的第一个公共结点
  20. 【CodeForces】713 C. Sonya and Problem Wihtout a Legend

热门文章

  1. 【Java】 int与String类型间的相互转化
  2. 2017 ACM Amman Collegiate Programming Contest 题解
  3. 1035 Password (20)(20 point(s))
  4. python实现括号匹配
  5. BeautifulSoup与Xpath解析库总结
  6. 洛谷.4238.[模板]多项式求逆(NTT)
  7. 【枚举】【贪心】Codeforces Round #482 (Div. 2) B. Treasure Hunt
  8. 浙江省队选拔 ZJOI2015 (Round 1) 解题报告
  9. 5、Redis中对Set类型的操作命令
  10. hdu 2251 Dungeon Master bfs