def download_lfw_dataset(dataset_dir, scratch_dir=None, cleanup=True):
    """Downloads and extracts the Labeled Faces in the Wild dataset.

    Any existing files are not re-downloaded.

    Args:
        dataset_dir: the directory to output the final dataset
        scratch_dir (None): a scratch directory to use to store temporary files
        cleanup (True): whether to cleanup the scratch directory after
            extraction
    """
    if scratch_dir is None:
        scratch_dir = os.path.join(dataset_dir, "scratch")

    # Download dataset
    images_dir = _download_videos(scratch_dir)
    test_path, train_path = _download_splits(scratch_dir)

    # Reorganize files into splits
    logger.info("Reorganizing images into splits...")

    # Test split
    logger.info("Creating test split...")
    test_folders = _load_split_info(test_path)
    with fou.ProgressBar() as pb:
        for test_folder in pb(test_folders):
            indir = os.path.join(images_dir, test_folder)
            outdir = os.path.join(dataset_dir, "test", test_folder)
            etau.move_dir(indir, outdir)

    # Train split
    logger.info("Creating train split...")
    train_folders = _load_split_info(train_path)
    with fou.ProgressBar() as pb:
        for train_folder in pb(train_folders):
            indir = os.path.join(images_dir, train_folder)
            outdir = os.path.join(dataset_dir, "train", train_folder)
            etau.move_dir(indir, outdir)

    if cleanup:
        etau.delete_dir(scratch_dir)
Downloads and extracts the Labeled Faces in the Wild dataset.

    Any existing files are not re-downloaded.

    Args:
        dataset_dir: the directory to output the final dataset
        scratch_dir (None): a scratch directory to use to store temporary files
        cleanup (True): whether to cleanup the scratch directory after
            extraction
    
fiftyone/utils/lfw.py