1 | initial version |
you could try to use different, shorter features instead of lbph.
opencv's dnn supports using the openface model, which makes a 128 float feature from an (bgr) image:
// https://storage.cmusatyalab.org/openface-models/nn4.small2.v1.t7
dnn::Net net = readNet("nn4.small2.v1.t7");
// for each image:
Mat inputBlob = dnn::blobFromImage(img, 1./255, Size(96,112), Scalar(), true, false);
net.setInput(inputBlob);
Mat res = net.forward().clone();
// now cache the result Mat's in some database, and do your own
// nearest neighbour search using e.g.
// L2 norm:
float dist = norm(a,b);
// or a simple dot:
float dist = a.dot(b);
// or cosine distance:
float x = a.dot(b);
float y = a.dot(a);
float z = b.dot(b);
float dist = - x / sqrt(y*z);