(dataset, seed=None, shuffle=True,
    alt_subfolder='no_faces', alt_label='Unknown', use_alt=False)
return df
Generate a dataframe containing labeled image paths.
    Labels are extracted from folder names in dataset.
    Images in subfolders can be labled differently from parent.
    
    Parameters:
    dataset - (str) path to dataset contains images in named folders.
    seed - (int) seed for random operations.
    shuffle - (boolean) to randomly shuffle rows of dataframe.
    alt_subfolder - (str) subfolder with images that can have alternate labels.
    alt_label - (str) alternate label.
    use_alt - (boolean) to use alt images with an alt label.

    Returns:
    df - dataframe containing labeled image paths as rows.
Generate a dataframe containing labeled image paths.
    Labels are extracted from folder names in dataset.
    Images in subfolders can be labled differently from parent.
    
    Parameters:
    dataset - (str) path to dataset contains images in named folders.
    seed - (int) seed for random operations.
    shuffle - (boolean) to randomly shuffle rows of dataframe.
    alt_subfolder - (str) subfolder with images that can have alternate labels.
    alt_label - (str) alternate label.
    use_alt - (boolean) to use alt images with an alt label.
Generate a dataframe containing labeled image paths . Labels are extracted from folder names in dataset . Images in subfolders can be labled differently from parent . Parameters : dataset - ( str ) path to dataset contains images in named folders . seed - ( int ) seed for random operations . shuffle - ( boolean ) to randomly shuffle rows of dataframe . alt_subfolder - ( str ) subfolder with images that can have alternate labels . alt_label - ( str ) alternate label . use_alt - ( boolean ) to use alt images with an alt label .
def get_dataframe(dataset, seed=None, shuffle=True,
    alt_subfolder='no_faces', alt_label='Unknown', use_alt=False):
    """
    Generate a dataframe containing labeled image paths.
    Labels are extracted from folder names in dataset.
    Images in subfolders can be labled differently from parent.
    
    Parameters:
    dataset - (str) path to dataset contains images in named folders.
    seed - (int) seed for random operations.
    shuffle - (boolean) to randomly shuffle rows of dataframe.
    alt_subfolder - (str) subfolder with images that can have alternate labels.
    alt_label - (str) alternate label.
    use_alt - (boolean) to use alt images with an alt label.

    Returns:
    df - dataframe containing labeled image paths as rows.
    """
    logger.info(f'Getting dataframe with alt_label: {use_alt}.')
    imagePaths = glob(dataset + '**/*.*', recursive=True)
    filenames = []
    labels = []

    for imagePath in imagePaths:
        filename = os.path.abspath(imagePath)
        filenames.append(filename)
        label = imagePath.split(os.path.sep)[-2]
        # if alt subfolder name is found...
        if label == alt_subfolder:
            if use_alt: # ...label as alt
                label = alt_label
            else: # ...label as parent folder name
                label = imagePath.split(os.path.sep)[-3]
        labels.append(label)

    d = {'filename': filenames, 'class': labels}
    df = pd.DataFrame(data=d)

    if shuffle:
        df = df.sample(frac=1, random_state=seed).reset_index(drop=True)

    return df
def get_dataframe ( dataset , seed = None , shuffle = True , alt_subfolder = 'no_faces' , alt_label = 'Unknown' , use_alt = False ) : logger . info ( f'Getting dataframe with alt_label: {use_alt}.' ) imagePaths = glob ( dataset + '**/*.*' , recursive = True ) filenames = [ ] labels = [ ] for imagePath in imagePaths : filename = os . path . abspath ( imagePath ) filenames . append ( filename ) label = imagePath . split ( os . path . sep ) [ - 2 ] # if alt subfolder name is found... if label == alt_subfolder : if use_alt : # ...label as alt label = alt_label else : # ...label as parent folder name label = imagePath . split ( os . path . sep ) [ - 3 ] labels . append ( label ) d = { 'filename' : filenames , 'class' : labels } df = pd . DataFrame ( data = d ) if shuffle : df = df . sample ( frac = 1 , random_state = seed ) . reset_index ( drop = True ) return df