load_sample_images#

sklearn.datasets.load_sample_images()[source]#

加载用于图像操作的样本图像。

加载 chinaflower

用户指南 中了解更多信息。

返回:
dataBunch

Dictionary-like object, with the following attributes.

imagesndarray 列表,形状为 (427, 640, 3)

两个示例图像。

filenameslist

图像的文件名。

DESCRstr

The full description of the dataset.

示例

加载数据并可视化图像

>>> 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')