Face_recognition: How to Combine classifiers ??? And also how to train KNN classifier with GPU ?

Created on 27 Mar 2019  路  2Comments  路  Source: ageitgey/face_recognition

I read instruction from here and train classifier to recognize my dataset.
https://github.com/ageitgey/face_recognition/wiki/Face-Recognition-Accuracy-Problems
https://github.com/ageitgey/face_recognition/blob/master/examples/face_recognition_knn.py

I have question - if we have a way to combine classifiers from different pc ?
I collecting dataset on different computers and automatically train classifier, so for example
pc#1 train classifier for 100 womans
pc#2 train classifier for 100 mans

I need combine this two to get 1 that recognize 100 womans and 100 mans I trained on different pc before

And also how to train KNN classifier with GPU ? I have dataset up to 1 million photos and my cpu tells me this is much for him, my 2*1080ti idle.....

And my third question - trained_knn_model.clf rewriting every time I retrain my classifier. How to learn it without rewriting, just updating ?

Most helpful comment

I think I solve my third problem with updating trained_knn_model.clf file
You need to change line 105
with open(model_save_path, 'wb') as f:
to this
with open(model_save_path, 'ab') as f:

So now train function will not rewriting, but will add information to the end of file trained_knn_model.clf

I hope it will help people who wants to retrain their models, but do not want to lose pretrained information 馃憤

All 2 comments

I think I solve my third problem with updating trained_knn_model.clf file
You need to change line 105
with open(model_save_path, 'wb') as f:
to this
with open(model_save_path, 'ab') as f:

So now train function will not rewriting, but will add information to the end of file trained_knn_model.clf

I hope it will help people who wants to retrain their models, but do not want to lose pretrained information 馃憤

This does not seem to work. From what I've observed the 'predict' function continues to use only the first part of what has been trained and ignores the next trainings.

What I did to test this:

  • Change distance_threshold to 0.4
  • Train a model with 50 pictures of the same person
  • Test with some other pictures: lots of detections.
  • Delete the model, train again with only 2 images
  • Test: 0 detection
  • Train again, updating the file, with the other part of pictures (48 remaining files)
  • Test: 0 detection

Probably in the first time that the .clf file is created a beginning and an end is defined. When the file is updated it should only insert new elements after this 'end', making these new elements useless.

Was this page helpful?
0 / 5 - 0 ratings