sklearn.datasets.load_sample_images()

sklearn.datasets.load_sample_images() [source]

Load sample images for image manipulation. Loads both, china and flower.

Returns:

data : Bunch

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:

1
2
3
4
5
6
7
8
9
>>> from sklearn.datasets import load_sample_images
>>> dataset = load_sample_images()    
>>> len(dataset.images)               
2
>>> first_img_data = dataset.images[0]
>>> first_img_data.shape              
(427, 640, 3)
>>> first_img_data.dtype              
dtype('uint8')
doc_scikit_learn
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.