In [25]:
from sklearn.datasets import fetch_lfw_people
people = fetch_lfw_people(min_faces_per_person=20, resize=0.7)
image_shape = people.images[0].shape

print("image shape=",image_shape)
fig, axes = plt.subplots(2, 5, figsize=(15, 8),
                         subplot_kw={'xticks': (), 'yticks': ()})
for target, image, ax in zip(people.target, people.images, axes.ravel()):
    ax.imshow(image)
    ax.set_title(people.target_names[target])
print("people.images.shape: {}".format(people.images.shape))
print("클래스 개수: {}".format(len(people.target_names)))
# 각 타겟이 나타난 횟수 계산
counts = len(people.target)
print("counts=", counts)
names = people.target_names
print("names=",len(names))


image shape= (87, 65)
people.images.shape: (3023, 87, 65)
클래스 개수: 62
counts= 3023
names= 62

In [32]:
print(len(people.target))


3023

In [ ]: