July 2017
Intermediate to advanced
382 pages
9h 13m
English
Like many other classic datasets, the Olivetti face dataset can be loaded using scikit-learn:
In [1]: from sklearn.datasets import fetch_olivetti_faces... dataset = fetch_olivetti_faces()In [2]: X = dataset.data... y = dataset.target
Although the original images consisted of 92 x 112 pixel images, the version available through scikit-learn contains images downscaled to 64 x 64 pixels.
To get a sense of the dataset, we can plot some example images. Let's pick eight indices from the dataset in a random order:
In [3]: import numpy as np... np.random.seed(21)... idx_rand = np.random.randint(len(X), size=8)
We can plot these example images using Matplotlib, but we need to make sure we reshape the column vectors to 64 x ...
Read now
Unlock full access