Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Combine classifiers ??? And also how to train KNN classifier with GPU ? #787

Open
xSNYPSx opened this issue Mar 27, 2019 · 2 comments

Comments

@xSNYPSx
Copy link

xSNYPSx commented Mar 27, 2019

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 ?

@xSNYPSx xSNYPSx changed the title Combine classifiers ??? How to Combine classifiers ??? And also how to train KNN classifier with GPU ? Mar 28, 2019
@xSNYPSx
Copy link
Author

xSNYPSx commented Mar 29, 2019

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 👍

@leonardofmed
Copy link

leonardofmed commented May 31, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants