hsinfu's Blog

[Unix] compile and install opencv2.4.2 in user-mode

#下載 opencv source code

git clone https://github.com/Itseez/opencv 

#列出所有 tag

cd opencv
git tag 

# source code 退回 2.4.2 版本

git reset --hard 2.4.2

# 將 cmake build 到 release 資料夾

mkdir release
cd release

# 可自行修改 library 安裝路徑 EX. /home/user/opencv2.4.2

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/home/user/opencv2.4.2 ..

# 開始 compile

make

# 如果 compile 有這個 bug (modules/highgui/src/cap_ffmpeg_impl.hpp:845:10: error: use of enum ‘CodecID’ without previous declaration)

# 請用 sed 取代修復 bug 後再重新 compile

sed -i 's/CodecID/AVCodecID/g' ../modules/highgui/src/cap_ffmpeg_impl.hpp && make

# 安裝 library 到安裝路徑

make install

# vim ~/.bashrc export LD_LIBRARY_PATH=library安裝路徑/lib:$LD_LIBRARY_PATH 並立即更新

vim ~/.bashrc
  export LD_LIBRARY_PATH=/home/user/opencv2.4.2/lib:$LD_LIBRARY_PATH
source ~/.bashrc


[Summarization] Towards good practice in large-scale learning for image classification

“Towards good practice in large-scale learning for image classification,” F. Perronnin, Z. Akata, Z. X. I. Harchaoui, and C. Schmid, CVPR 2012

這篇算是一篇 engineer 的 paper,因為這篇 paper 比較了目前所有 large-scale image classification 的方法,並提出以他們的 "good practices" 可以在 ImageNet Dataset 上面,做的比當時的 state-of-the-art 更好(16.7% -> 19.1%)

以下這是他們所提出的 "good practices"

他們藉由實驗,還提出許多有趣的結果,比如說

  1. state-of-the-art 用的 high dimensional image descriptors with linear classifiers 的效果其實跟 low dimensional bag-of-visual-words (BOV) with non-linear classifiers 是一樣的。

  2. 在 high dimensional 的 image descriptors 裡面,Fisher vector 的效果最好。

  3. independent one-vs-rest binary classifier for each class 在 training 的速度上有相當大的優勢,因為是 independent 所以可以很簡單的 parallel。

以下這張是他們在 ImageNet Dataset 比較好跟比較差的結果

[Summarization] Deep neural networks for acoustic modeling in speech recognition: The shared views of four research groups

Hinton, Geoffrey, et al. "Deep neural networks for acoustic modeling in speech recognition: The shared views of four research groups." Signal Processing Magazine, IEEE 29.6 (2012): 82-97

這篇 paper 主要是介紹 如何用 DNN + HMM 取代原本 speech recognition 上的 state-of-the-art method GMM + HMM 。而用 DNN 取代 GMM 在 performance 上會有一個 large margin 的進展,因此大多數做語音辨識的,目前都採用 DNN + HMM 這個 architecture ,如下圖所示,而目前聲音的 observation 大多是取 MFCC or PLP 這兩個 feature 當 input。

*HMM = Hidden Markov Models
*DNN = Deep Neural Networks
*GMM = Gaussian Mixture Models
*MFCC = Mel Frequency Cepstral Coefficients
*PLP = Perceptual Linear Predictive coefficients

而這篇 paper 提出將 training 分成兩步驟,

  1. layers of feature detectors are initialized, one layer at a time, by fitting a stack of generative models, each of which has one layer of latent variables. These generative models are trained without using any information about the HMM states that the acoustic model will need to discriminate

  2. each generative model in the stack is used to initialize one layer of hidden units in a DNN and the whole network is then discriminatively fine-tuned to predict the target HMM states

這篇 paper 先在 TIMIT 這個相對小的 database 上做實驗可以看出分成兩個步驟後,效果有顯著的提昇,再應用到別的 dataset 上做實驗。以下這邊是他們的實驗結果

[Summarization] Spectral Hashing

Yair Weiss, Antonio Torralba, and Robert Fergus. Spectral Hashing. Neural Information Processing Systems, 2008

這篇 paper 蠻數學的,應用到許多 Laplacian 等等。而這篇 paper 從 Semantic hashing 開始講起,Semantic hashing 是要找出一個較 compact 的 binary code 去代表原本的 feature point,而兩個 binary code 的 hamming distance 越接近的,有越像的 semantic 意涵。

我覺得這篇 paper 的一大貢獻是證明了這個 Semantic hashing 的問題是 NP-hard 的,而且提出以 spectral method (subset of thresholded eigen- vectors of the graph Laplacian) 來簡化該問題,在 efficiency 和 performance 上都比當時的 state-of-the-art 還要好上一個 large gap。

從上圖右側可以看出來 Spectral hashing 比其他的要好上取多,而從左側可以看出 Spectral hashing 可以相容於其他方法,並進一步與之結合,達到更高的準確率。

[Summarization] Representation Learning: A Review and New Perspectives

"Representation Learning: A Review and New Perspectives," Yoshua Bengio, Aaron Courville, Pascal Vincent, arXiv:1206.5538

這是一篇對 Representation Learning(其中包含許多 Deep Learning 基本的 model) 很完整的 tutorial, 大致上從 machine learning 開始講起,開始講為什麼 Representation Learning 重要,之前的 Representation 都是由工人智慧開發出某種特定的演算法來找最好的 Representation,而近幾年開始,由於 data 的迅速增長和 computing power 的大幅進步,我們可以從 data 中自動學出對於該 data set 最好的 representation (Deep Learning),而這個自動學習的方法比傳統的工人智慧開發的演算法還要好上許多,因此這個領域又紅了起來。

而這篇其實有一大部分介紹了許多 Deep Learning 的 model (包含 Restricted Boltzmann Machines (RBMs), Sparse Auto-Encoders, Denoising Auto-Encoders, Contractive Auto-Encoders 等等)

[Summarization] Nonlinear dimensionality reduction by locally linear embedding & A global geometric framework for nonlinear dimensionality reduction

"Nonlinear dimensionality reduction by locally linear embedding," Roweis & Saul, Science, 2000.
J.B. Tenenbaum, "A global geometric framework for nonlinear dimensionality reduction," Science, 2000 (ISOMAP)

第一篇 paper 提出一種 unsupervised learning 的方法 locally linear embedding (LLE) 來找出 compact representations of high-dimensional data。

其演算法步驟如下

而這是他們做在人臉上的結果

第二篇 paper 提出一個 Nonlinear Dimensionality Reduction by using Global Geometric Framework。
其演算法如下

而其對人臉的實驗結果如下


[Summarization] A Survey on Transfer Learning

S. J. Pan and Q. Yang, “A Survey on Transfer Learning,” IEEE TKDE, 2010

這篇 paper 中定義了什麼是 Transfer Learning

而不同 Transfer Learning 的 setting 大致上可以由下圖去分類

其中我覺得比較有意思的是 Transfer Learning 的 approaches 分類(子軒學長上課是由這部份切入講解的),將所有 Transfer Learning 相關的 papers 分類,讓我們好理解。

[Summarization] Online dictionary learning for sparse coding

Mairal et al. Online dictionary learning for sparse coding. ICML 2009.

Sparse coding : 找出一組最具代表性的 dictionary basis set ,希望能夠達到用越少 basis 可以組合出原本的 feature 。

而這篇 paper 著重在如何使這個 dictionary learning 的過程能夠更快速,達到 online 化,即可以一邊新增新的 data 進來,一邊學出新增 data 後更好的 dictionary,其方法主要是靠著 stochastic approximations, paper 中也證明了會 converge,而且由實驗證明速度會比較快,也會學到更好的 dictionary 有更好的 performance 。

相關演算法如下:


[Summarization] Latent Dirichlet allocation

"Latent Dirichlet allocation," D. Blei, A. Ng, and M. Jordan. . Journal of Machine Learning Research, 3:993–1022, January 2003

這篇 paper 提出一個新的 generative probabilistic model of a corpus (latent Dirichlet allocation, LDA),它是一個三層 hierarchical 的貝氏模型,有別於 PLSA ,LDA 加入 document topic 的 inference。

下圖為 LDA 的 graphical model representation

下圖可以看出 LDA 比 PLSA 還要好上許多

[Summarization] Probabilistic latent semantic indexing

Probabilistic latent semantic indexing (T. Hofmann, SIGIR, 1999)

這篇 paper 提出以機率的方法( EM-algorithm 配合 貝氏定理)去計算出 P(d,w) 的機率,有別於之前的 Latent Semantic Indexing(LSI)是用 Singular Value Decomposition (SVD) 的方法。

maximization of the log-likelihood function

而 P(d,w) 可以藉由貝氏定理分解成

然後由 EM-algorithm
E-step:


M-step: