happynear / happynear/FaceVerification

Follow your step,but only get 73% verification correct rate

Open
#11 38 comments 0 reactions 0 assignees View on GitHub
Dominant language
MATLAB
Stars
447
Forks
230
PR merge metrics
No merged PRs in 30d

Description

First, thank you for your contribution.

I follow your step, used CASIA data and 'mnist_siamese_solver.prototxt', 'CASIA_train_test.prototxt' in 'caffe_proto' folder training CNN without mean file by caffe. After 500,000 iterations, validation set accuracy rate is about 72%. Cnn seems already fitting.

Then, I write matlab code to extracting features and L2 Classification for LFW dataset. But only get 73% verification correct rate.

The matlab code is:

``` matlab
dr_lfw_features = [];
for i= 1:length(fileLines)
im = imread( fileLines{i} );
im = rgb2gray(im);
im = imresize(im, [100 100]);
im = single(im);
im = im /128.0;
im = im';
drop5_data = net.forward({im});
drop5_data = reshape(drop5_data{1}, 1, 320);
fprintf('iamge is %s, i = %d\n', fileLines{i}, i);
dr_lfw_features = [dr_lfw_features; drop5_data];
end

load('pairlist_lfw.mat');
test_Intra = pairlist_lfw.IntraPersonPair;
test_Extra = pairlist_lfw.ExtraPersonPair;
test_pair = [test_Intra; test_Extra];

F1_index = test_pair(:,1);
F2_index = test_pair(:,2);

AllFeature1 = dr_lfw_features(F1_index, :);
AllFeature2 = dr_lfw_features(F2_index, :);

num = length(AllFeature1);
F1 = AllFeature1;
F1 = bsxfun(@rdivide, F1, sqrt(sum(F1.^2,2)));
F2 = AllFeature2;
F2 = bsxfun(@rdivide, F2, sqrt(sum(F2.^2,2)));
thresh2 = zeros(num,1);
for i = 1:num
thresh2(i) = pdist2( F1(i,:),F2(i,:) );
end;
figure;
hist(thresh2(1:3000), 500);
figure;
hist(thresh2(3001:end), 500);

accuracies = zeros(10,1);
for i=1:10
test_idx = [(i-1) * 300 + 1 : i*300, (i-1) * 300 + 3001 : i*300 + 3000];
train_idx = 1:6000;
train_idx(test_idx) = [];
bestc=256;
same_label = ones(6000,1);
same_label(3001:6000) = 0;
cmd = [' -t 0 -h 0'];
model = svmtrain(same_label(train_idx),thresh2(train_idx),cmd);
[class, accuracy, deci] = svmpredict(same_label(test_idx),thresh2(test_idx),model);
accuracies(i) = accuracy(1);
end;
mean(accuracies)
cmd = [' -t 0 -h 0'];
model = svmtrain(same_label,thresh2,cmd);
[class, accuracy, deci] = svmpredict(same_label,thresh2,model);
```

By hist histogram, you can see the same data threshold and different data threshold obviously inseparable.

I think there are errors in this matlab code, do you have any good suggestions?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.