sklearn.datasets : cant return the correct number of class

Mary Source

I am trying to using sklearn.datasets with CNN model in Keras to train it on Labeled Faces in the Wild (LFW) dataset, using this code:

lfw_people = fetch_lfw_people(min_faces_per_person=30, slice_ = (slice(61,189),slice(61,189)), resize=0.5, color =True)
X = lfw_people.images
y =

target_names = lfw_people.target_names
n_classes = target_names.shape[0]

y = np.asarray(y, dtype=np.int32)

print('number of classes: ', n_classes)

this code suppose to return 34 classes, but when I run the code it returns only 26 classes

The code was originally written in python 2 however I am using python 3

I try to run it in python 2 but I encountered errors in downloading the environment, is the problem with python 3? Or is it another error?



comments powered by Disqus