Toggle Menu
Prev Up Next

scikit-learn 1.3.2
Other versions

Please cite us if you use the software.

# `sklearn.datasets`.load_sample_images

sklearn.datasets.load_sample_images()

  Load sample images for image manipulation.

  Loads both, `china` and `flower`.

  Read more in the User Guide.

  Returns:
    data `Bunch`

      Dictionary-like object, with the following attributes.

      imageslist of ndarray of shape (427, 640, 3)

        The two sample image.

      filenameslist

        The filenames for the images.

      DESCRstr

        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()
      >>> len(dataset.images)
      2
      >>> first_img_data = dataset.images[0]
      >>> first_img_data.shape
      (427, 640, 3)
      >>> first_img_data.dtype
      dtype('uint8')