This is documentation for an old release of Scikit-learn (version 0.22). Try the latest stable release (version 1.6) or development (unstable) versions.

sklearn.datasets.load_sample_images

sklearn.datasets.load_sample_images()[source]

Load sample images for image manipulation.

Loads both, china and flower.

Read more in the User Guide.

Returns
dataBunch

Dictionary-like object with the following attributes : ‘images’, the two sample images, ‘filenames’, the file names for the images, and ‘DESCR’ the full description of the dataset.

Examples

To load the data and visualize the images:

>>>
>>> from sklearn.datasets import load_sample_images
>>> dataset = load_sample_images()     #doctest: +SKIP
>>> len(dataset.images)                #doctest: +SKIP
2
>>> first_img_data = dataset.images[0] #doctest: +SKIP
>>> first_img_data.shape               #doctest: +SKIP
(427, 640, 3)
>>> first_img_data.dtype               #doctest: +SKIP
dtype('uint8')