fiftyone.utils.fiw#

Utilities for working with the Families in the Wild dataset.

Copyright 2017-2025, Voxel51, Inc.

Classes:

FIWDatasetImporter([dataset_dir, shuffle, ...])

Importer for Faces in the Wild-formatted datasets stored on disk.

Functions:

get_pairwise_labels(samples[, label_type])

Gets a list of all pairs of people that are related and the label of their relation, either through the "kinships" or "relationships" field.

get_identifier_filepaths_map(samples)

Creates a mapping of family_id/member_id identifier to a list of filepaths for each person.

download_fiw_dataset(dataset_dir, split[, ...])

Downloads and extracts the Families in the Wild dataset.

class fiftyone.utils.fiw.FIWDatasetImporter(dataset_dir=None, shuffle=False, seed=None, max_samples=None)#

Bases: BatchDatasetImporter

Importer for Faces in the Wild-formatted datasets stored on disk.

See this page for format details.

Methods:

import_samples(dataset[, tags])

Imports samples and labels stored on disk following the format of the Families in the Wild dataset.

close(*args)

Performs any necessary actions after the last sample has been imported.

get_dataset_info()

Returns the dataset info for the dataset.

setup()

Performs any necessary setup before importing the first sample in the dataset.

Attributes:

has_dataset_info

Whether this importer produces a dataset info dictionary.

import_samples(dataset, tags=None)#

Imports samples and labels stored on disk following the format of the Families in the Wild dataset.

Parameters:
Returns:

a list of IDs of the samples that were added to the dataset

close(*args)#

Performs any necessary actions after the last sample has been imported.

This method is called when the importer’s context manager interface is exited, DatasetImporter.__exit__().

Parameters:

*args – the arguments to DatasetImporter.__exit__()

get_dataset_info()#

Returns the dataset info for the dataset.

By convention, this method should be called after all samples in the dataset have been imported.

Returns:

a dict of dataset info

property has_dataset_info#

Whether this importer produces a dataset info dictionary.

setup()#

Performs any necessary setup before importing the first sample in the dataset.

This method is called when the importer’s context manager interface is entered, DatasetImporter.__enter__().

fiftyone.utils.fiw.get_pairwise_labels(samples, label_type='kinships')#

Gets a list of all pairs of people that are related and the label of their relation, either through the “kinships” or “relationships” field.

Example:

[
   ["F0009/MID2", "F0009/MID4", "sibling"],
   ...
]
Parameters:
Returns:

a list of triplets containing the identifier of person 1, identifier of person 2, and their kinship or relationship

fiftyone.utils.fiw.get_identifier_filepaths_map(samples)#

Creates a mapping of family_id/member_id identifier to a list of filepaths for each person.

Example:

{
    "F0325/MID4": [
        "/path/to/fiftyone/fiw/train/data/F0325/MID4/P03451_face4.jpg",
        ...
    ],
    ...
}
Parameters:

samples – a fiftyone.core.collections.SampleCollection

Returns:

a dict mapping family_id/member_id identifiers to a list of filepaths containing images of the corresponding person

fiftyone.utils.fiw.download_fiw_dataset(dataset_dir, split, scratch_dir=None, cleanup=False)#

Downloads and extracts the Families in the Wild dataset.

Any existing files are not re-downloaded.

Parameters:
  • dataset_dir – the directory to output the final dataset

  • split – the split being loaded

  • scratch_dir (None) – a scratch directory to use to store temporary files

  • cleanup (True) – whether to cleanup the scratch directory after extraction