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

Warnings raised when running demos/classifier.py train #239

Closed
JPFrancoia opened this issue Feb 22, 2017 · 2 comments
Closed

Warnings raised when running demos/classifier.py train #239

JPFrancoia opened this issue Feb 22, 2017 · 2 comments

Comments

@JPFrancoia
Copy link

Context of the issue

I started playing around with openface a few days ago, mainly for face detection/recognition. It's a fantastic tool, very efficient for face detection. I started with this tuto: https://medium.com/@ageitgey/machine-learning-is-fun-part-4-modern-face-recognition-with-deep-learning-c3cffc121d78#.vydgh0t19

However, I would like to train the algorithm to recognize faces from a personal selection of photos (step 4 in the above tutorial).

I'm kinda stuck (for now) when I run:

python ./demos/classifier.py train ./generated-embeddings/

I'm very likely stuck here because I use python3. See config section for more details.
I'm willing to help solve #172.

That said, I'm just opening this issue because of some warnings when I try to run the command above.

Expected behavior.

No warning should be raised.

Actual behavior.

Three warnings are raised:

/home/djipey/.local/share/virtualenvs/face/lib/python3.6/site-packages/sklearn/lda.py:6: DeprecationWarning: lda.LDA has been moved to discriminant_analysis.LinearDiscriminantAnalysis in 0.17 and will be removed in 0.19
  "in 0.17 and will be removed in 0.19", DeprecationWarning)

/home/djipey/.local/share/virtualenvs/face/lib/python3.6/site-packages/sklearn/cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
  "This module will be removed in 0.20.", DeprecationWarning)

/home/djipey/.local/share/virtualenvs/face/lib/python3.6/site-packages/sklearn/grid_search.py:43: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. This module will be removed in 0.20.
  DeprecationWarning)

Steps to reproduce.

Create directory training-images, and then one sub-directory for each person to be identified. Put several pictures of each person in the corresponding directory. Then run:

python ./util/align-dlib.py ./training-images/ align outerEyesAndNose ./aligned-images/ --size 96;
./batch-represent/main.lua -outDir ./generated-embeddings/ -data ./aligned-images/;
python ./demos/classifier.py train ./generated-embeddings/

OS and hardware information.

My config: python 3.6.0, Archlinux, in a virtualenv. scikit-learn==0.18.1

Solution

Changing imports at the top of classifier.py:

# from sklearn.lda import LDA
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA

# from sklearn.grid_search import GridSearchCV
from sklearn.model_selection import GridSearchCV

Sooner or later, classifier.py will stop working with the newest version of sklearn. I'm willing to make a PR, but I would like to know if changing these lines will cause issues with python2.

@qacollective
Copy link
Contributor

qacollective commented Feb 24, 2017

Hi @JPFrancoia,

Good work on this write up - very thorough!

I happened to have the Python2 OpenFace docker container running while I read your issue and made your updates to the code to test if there would be any bugs.

The change to the LDA import works fine but the GridSearchCV one fails.

I've currently got a pull request in to @bamos for upgrading the OpenFace code for Python3. After that I have another pull request for him containing changes to the Dockerfiles to build the required OpenFace environment for Python3.

So what I've done is add your code changes above to the relevant files (classifier.py, lfw-classification-unknown.py, websocket-server.py) in the Dockerfiles branch of my OpenFace repo. When my changes are merged (which builds OpenFace with Python3, latest dlib, opencv, torch etc) then these code changes will flow through too - which seems appropriate given the nature of the PR (upgrade the environment, and the code to match).

You can check out the changes here:
https://github.com/qacollective/openface/pull/1/files

Andrew

@JPFrancoia
Copy link
Author

Perfect, that sounds great !

@bamos bamos closed this as completed Oct 16, 2017
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

3 participants