lfw資料驗證

2021-08-04 17:54:12 字數 1970 閱讀 3101

以facenet的lfw資料驗證為例

lfw資料:

驗證資料分兩個,乙個用於開發,乙個用於最終的驗證

這裡驗證使用的是view 2的pairs.txt檔案

training, validation, and testing

view 1: development training/testing sets

view 2: performance testing configurations

pairs.txt file format

people.txt file format

pairs.txt 包含了按10交叉驗證隨機分布的測試人臉對

def calculate_roc(thresholds, embeddings1, embeddings2, actual_issame, nrof_folds=10):

assert(embeddings1.shape[0] == embeddings2.shape[0])

assert(embeddings1.shape[1] == embeddings2.shape[1])

nrof_pairs = min(len(actual_issame), embeddings1.shape[0])

nrof_thresholds = len(thresholds)

k_fold = kfold(n_splits=nrof_folds, shuffle=false)

tprs = np.zeros((nrof_folds,nrof_thresholds))

fprs = np.zeros((nrof_folds,nrof_thresholds))

accuracy = np.zeros((nrof_folds))

diff = np.subtract(embeddings1, embeddings2)

dist = np.sum(np.square(diff),1)

indices = np.arange(nrof_pairs)

for fold_idx, (train_set, test_set) in enumerate(k_fold.split(indices)):

# find the best threshold for the fold

acc_train = np.zeros((nrof_thresholds))

for threshold_idx, threshold in enumerate(thresholds):

_, _, acc_train[threshold_idx] = calculate_accuracy(threshold, dist[train_set], actual_issame[train_set])

best_threshold_index = np.argmax(acc_train)

for threshold_idx, threshold in enumerate(thresholds):

tprs[fold_idx,threshold_idx], fprs[fold_idx,threshold_idx], _ = calculate_accuracy(threshold, dist[test_set], actual_issame[test_set])

_, _, accuracy[fold_idx] = calculate_accuracy(thresholds[best_threshold_index], dist[test_set], actual_issame[test_set])

tpr = np.mean(tprs,0)

fpr = np.mean(fprs,0)

return tpr, fpr, accuracy

這裡的accuracy是使用pairs.txt中的人臉對進行10交叉驗證得到的平均準確率thresholds = np.arange(0, 4, 0.01)

tpr和fpr分別對應交叉驗證的平均tpr和平均fpr

LFW介紹整理

原 2018年03月11日 13 52 02 jobbofhe 本篇部落格主要介紹了,使用lfw資料集測是dlib模型準確率的過程。是乙個小白入門的介紹,大神可自行繞過。1.人臉檢測測試資料庫 fddb 2.人臉識別測試資料庫 lfw 3.lfw 人臉比對資料集 無約束自然場景人臉識別資料集,該資料...

人臉識別 LFW資料集介紹

labeled faces in the wild官網 lfw lfw labeled faces in the wild 人臉資料庫是由美國麻薩諸塞州立大學阿默斯特分校計算機視覺實驗室整理完成的資料庫,主要用來研究非受限情況下的人臉識別問題。lfw 資料庫主要是從網際網路上蒐集影象,而不是實驗室,...

資料驗證技巧

在學生資訊管理系統中,有很多地方都需要驗證輸入資訊的,比如說姓名不能輸入空的,學號只能輸入數字,年月日只能按照規定的的方式輸入。那麼我們來看看常用的幾種資料驗證 1.判斷連線已經開啟 動態連線資料庫時,需要隨時開啟資料庫,並將其關閉,否則再次開啟時將出現 物件開啟時,不允許操作 的提示。那麼如何判斷...