2013-04-09 44 views
-1

我正在嘗試使用python構建面部識別的代碼。現在我可以將我的所有數據庫圖像放入一個二維數組中,以便能夠對它們應用主成分分析(PCA)。我在matplotlib中找到了一個名爲PCA的類,但我想知道如何將它用於人臉識別。如何使用matplotlib中的類PCA進行人臉識別?

這裏所提到的類的描述:

class matplotlib.mlab.PCA(a) 
compute the SVD of a and store data for PCA. Use project to project the data onto a reduced set of dimensions 

Inputs: 

a: a numobservations x numdims array 
Attrs: 

a a centered unit sigma version of input a 

numrows, numcols: the dimensions of a 

mu : a numdims array of means of a 

sigma : a numdims array of atandard deviation of a 

fracs : the proportion of variance of each of the principal components 

Wt : the weight vector for projecting a numdims point or array into PCA space 

Y : a projected into PCA space 

The factor loadings are in the Wt factor, ie the factor loadings for the 1st principal component are given by Wt[0] 

回答

1

他們關鍵概念是你項目面臨到一個更高維空間,然後測量在這個空間他們之間的距離。

我是從這個文件引用(看起來像一個分配的一類):

http://www.umiacs.umd.edu/~knkim/KG_VISA/PCA/FaceRecog_PCA_Kim.pdf

「PCA計算這是由它的培訓載體,這些基向量代表的空間的基礎上,。實際上,由PCA計算得到的特徵向量是在訓練向量的最大方差的方向上,如前所述,我們稱之爲特徵臉

每個特徵臉可以被看作一個特徵。臉部空間,它的矢量到臉部空間描述的重要性o f臉上的每一個特徵。臉部通過其特徵臉係數(或權重)表示在臉部空間中。我們只能通過在臉部空間中使用其小權重向量來處理大輸入向量,面部圖像。這意味着我們可以用一些錯誤來重建原始的人臉,因爲圖像空間的維度比臉部空間的維度大得多。

在本報告中,我們只考慮面部識別。訓練集中的每個臉部都被轉換成臉部空間,其組件被存儲在內存中。臉部空間必須填充這些已知的臉部。輸入面被賦予系統,然後投影到面部空間。該系統計算的距離存儲的所有面孔「

有幾個可用的教程,這裏是我的最愛:。

+0

雖然這些鏈接可能會回答問題,最好在這裏包含答案的重要部分,並提供參考鏈接。如果鏈接頁面更改,則僅鏈接答案可能會失效。 – Matsemann 2013-05-22 16:50:33