davidsandberg / facenet

Face recognition using Tensorflow
MIT License
13.74k stars 4.8k forks source link

classifier or nearest search algorithm? #606

Open niu-niu opened 6 years ago

niu-niu commented 6 years ago

Project Brief:

For example,I got 50 users' pictures,aligned and got the trained classifier pickle file. Now, I want to add few more people's pictures as new user to my face recognition system(with implementing the openCV, it can do real time recognition)

Solutions

  1. Solution one:Add those new pictures to the existing user folder. then retrain the classifier ,get the new pickle file for real time recognition. Con: It works Pro:if the number of existing user is huge, then it will cost too much time to retrain.
  2. Then, I goes to the solution two. Using the" SKLearn SGD partial fit". It allows me to specific starting class. Which means I need to load the existing classifier pickle file and combine with the newly dumped one(with partial fit). Con: It seems can't work. Pro: fast
  3. Solution three. leave the classifier. Once we get the 128d vector representation, the facenet and tensowflow's work is done. I just need to get the the vector of the new user and add it to the database. After that, I just to need to use nearest distance algorithm to find the one that has the nearest euclidean distance. (KD-tree or LSH), though, the kd-tree itself is not perfectly for high dimensional vector space. Con: the accuracy of the face recognition is no longer rely on facenet and the classifier, but, the search algorithm.
    Pro: maybe fast.

Questions:

  1. anyone tried the SGD partial fit? it normally build for increment train for the model, not the for classifier model.
  2. for solution three. this method is often used in dlib and SFIT project. Does anyone tried any of those algorithms?
C-Jaewon commented 6 years ago

Did you solve this problem?

adnanit035 commented 3 years ago

I have tried solutions 1 and 2. Solution 1 is awesome for the low dataset. I tried with a maximum of 40000 thousand people dataset with a single image for each person. The accuracy of the recognition was 100% but it takes a lot of time in classification and the pickle file size was 8 GB.

I tried with SGD partial fit on the same dataset. It takes less time and also pickle size were too small but recognition precision was extremely bad.