scikit-learn: Face recognition example is broken
When executed without alteration, the example code here throws an exception. I have confirmed that the images downloaded successfully. Using Python 2.7.6, sklearn 0.15.1, numpy 1.8.1, scipy 0.13.3
$ python face_recognition.py
===================================================
Faces recognition example using eigenfaces and SVMs
===================================================
The dataset used in this example is a preprocessed excerpt of the
"Labeled Faces in the Wild", aka LFW_:
http://vis-www.cs.umass.edu/lfw/lfw-funneled.tgz (233MB)
.. _LFW: http://vis-www.cs.umass.edu/lfw/
Expected results for the top 5 most represented people in the dataset::
precision recall f1-score support
Gerhard_Schroeder 0.91 0.75 0.82 28
Donald_Rumsfeld 0.84 0.82 0.83 33
Tony_Blair 0.65 0.82 0.73 34
Colin_Powell 0.78 0.88 0.83 58
George_W_Bush 0.93 0.86 0.90 129
avg / total 0.86 0.84 0.85 282
2014-08-26 13:30:49,451 Loading LFW people faces from /home/jim/scikit_learn_data/lfw_home
2014-08-26 13:30:49,454 Loading face #00001 / 01140
Traceback (most recent call last):
File "eigenface.py", line 52, in <module>
lfw_people = fetch_lfw_people(min_faces_per_person=70, resize=0.4)
File "/usr/local/lib/python2.7/dist-packages/sklearn/datasets/lfw.py", line 277, in fetch_lfw_people
min_faces_per_person=min_faces_per_person, color=color, slice_=slice_)
File "/usr/local/lib/python2.7/dist-packages/sklearn/externals/joblib/memory.py", line 481, in __call__
return self._cached_call(args, kwargs)[0]
File "/usr/local/lib/python2.7/dist-packages/sklearn/externals/joblib/memory.py", line 428, in _cached_call
out, metadata = self.call(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/sklearn/externals/joblib/memory.py", line 673, in call
output = self.func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/sklearn/datasets/lfw.py", line 202, in _fetch_lfw_people
faces = _load_imgs(file_paths, slice_, color, resize)
File "/usr/local/lib/python2.7/dist-packages/sklearn/datasets/lfw.py", line 156, in _load_imgs
face = np.asarray(imread(file_path)[slice_], dtype=np.float32)
IndexError: 0-d arrays can only use a single () or a list of newaxes (and a single ...) as an index
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 16 (10 by maintainers)
Commits related to this issue
- Fixes #3594. — committed to mth4saurabh/scikit-learn by mth4saurabh 9 years ago
- Fixes #3594. — committed to mth4saurabh/scikit-learn by mth4saurabh 9 years ago
- Fixes #3594. — committed to mth4saurabh/scikit-learn by mth4saurabh 9 years ago
- Fixes #3594. — committed to mth4saurabh/scikit-learn by mth4saurabh 9 years ago
- Fixes #3594. — committed to mth4saurabh/scikit-learn by mth4saurabh 9 years ago
- Fixes #3594. — committed to mth4saurabh/scikit-learn by mth4saurabh 9 years ago
- Merge pull request #5071 from mth4saurabh/fix-issue-3594 [MRG] Fixes #3594. — committed to scikit-learn/scikit-learn by jnothman 9 years ago
Yes I’ve tried it. But it is still not working. I’ve tried to read a file from the downloaded data set and even, it didn’t work properly. I’ve tried as follows:
I believe sharon.shape should output (512,512) or something similar.