September 2019
Intermediate to advanced
420 pages
10h 29m
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 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 64-pixel ...
Read now
Unlock full access