sklearn.datasets
.fetch_lfw_people¶
-
sklearn.datasets.
fetch_lfw_people
(data_home=None, funneled=True, resize=0.5, min_faces_per_person=0, color=False, slice_=(slice(70, 195, None), slice(78, 172, None)), download_if_missing=True, return_X_y=False)[source]¶ Load the Labeled Faces in the Wild (LFW) people dataset (classification).
Download it if necessary.
Classes
5749
Samples total
13233
Dimensionality
5828
Features
real, between 0 and 255
Read more in the User Guide.
- Parameters
- data_homeoptional, default: None
Specify another download and cache folder for the datasets. By default all scikit-learn data is stored in ‘~/scikit_learn_data’ subfolders.
- funneledboolean, optional, default: True
Download and use the funneled variant of the dataset.
- resizefloat, optional, default 0.5
Ratio used to resize the each face picture.
- min_faces_per_personint, optional, default None
The extracted dataset will only retain pictures of people that have at least
min_faces_per_person
different pictures.- colorboolean, optional, default False
Keep the 3 RGB channels instead of averaging them to a single gray level channel. If color is True the shape of the data has one more dimension than the shape with color = False.
- slice_optional
Provide a custom 2D slice (height, width) to extract the ‘interesting’ part of the jpeg files and avoid use statistical correlation from the background
- download_if_missingoptional, True by default
If False, raise a IOError if the data is not locally available instead of trying to download the data from the source site.
- return_X_yboolean, default=False.
If True, returns
(dataset.data, dataset.target)
instead of a Bunch object. See below for more information about thedataset.data
anddataset.target
object.New in version 0.20.
- Returns
- datasetdict-like object with the following attributes:
- dataset.datanumpy array of shape (13233, 2914)
Each row corresponds to a ravelled face image of original size 62 x 47 pixels. Changing the
slice_
or resize parameters will change the shape of the output.- dataset.imagesnumpy array of shape (13233, 62, 47)
Each row is a face image corresponding to one of the 5749 people in the dataset. Changing the
slice_
or resize parameters will change the shape of the output.- dataset.targetnumpy array of shape (13233,)
Labels associated to each face image. Those labels range from 0-5748 and correspond to the person IDs.
- dataset.DESCRstring
Description of the Labeled Faces in the Wild (LFW) dataset.
- (data, target)tuple if
return_X_y
is True New in version 0.20.