git clone https://github.com/indrikutis/FacialBiometrics.git
cd FacialBiometrics
python -m venv venv
venv\Scripts\activate
source venv/bin/activate
pip install -r requirements.txt
GitHub link to the repository:
https://github.com/serengil/deepface
- img_file_paths: "File_paths/file_paths.csv"
- output_filename = "DeepFace_analysis_results.xlsx"
- dataset_name = 'subjects_0-1999_72_imgs' - used for the results sheet to indicate the dataset
- image_sampling_rate = 0.7
- Age
- Gender: Male, Female
- Race: asian, white, middle eastern, indian, latino and black
- Emotion : angry, fear, neutral, sad, disgust, happy and surprise
- opencv
- ssd
- dlib
- mtcnn
- retinaface
- mediapipe
- yolov8
- yunet
- fastmtcnn
GitHub link to the repository:
https://github.com/dchen236/FairFace
The model extracts aligned faces from the image and saves to detected_faces folder.
- img_file_paths: "File_paths/file_paths.csv"
- output_filename = "DeepFace_analysis_results.xlsx"
- dataset_name = 'subjects_0-1999_72_imgs' - used for the results sheet to indicate the dataset
- image_sampling_rate = 0.7
- Age group: 0-2, 3-9, 10-19, 20-29, 30-39, 40-49, 50-59, 60-69, 70+
- Gender: Male, Female
- Race7: White, Black, Latino_Hispanic, East, Southeast Asian, Indian, Middle Eastern
- Race4: White, Black, Asian and Indian
The models and scripts were tested on a device with 8Gb GPU, it takes under 2 seconds to predict the 5 images in the test folder.
Face attribute extration dataset.
Attributes are stored in the file name: [age]_ [gender]_ [race]_[date&time].jpg
Attributes:
- Age: 0 to 116
- Gender: 0 (male) or 1 (female)
- Race: integer from 0 to 4, denoting White, Black, Asian, Indian, and Others (like Hispanic, Latino, Middle Eastern).
- Date and time:m in the format of yyyymmddHHMMSSFFF, showing the date and time an image was collected to UTKFace
- Single image per person
Age estimation, face recognition and verification dataset.
Attributes:
- Age (with the age gap up to 45 years)
- Several images per person
Face recognition and verification dataset.
Attributes:
- Several images per person
The script takes a directory path and generates a .csv file with one column 'Image Paths', containing the full paths of all images found within the directory to be analyzed.
- Results Folder: The folder where the prepared dataset and associated files will be stored. Example:
"File_paths"
- Root Directory Path: The root directory path containing the raw images of the dataset. Example:
"C:/path/to/dataset"
- CSV Filename: The name of the CSV file where the dataset information will be saved. Example:
"File_paths/lfw_all_subset_photos.csv"
python "Tool scripts\Generate_file_paths.py"
Deepface framework to extract the facial attributes.
- Image File Paths: The file containing the paths to the images in the dataset. Example:
"File_paths/lfw_all_subset_photos.csv"
- Output Filename: The name of the Excel file where the analysis results will be saved. Example:
"DeepFace_analysis_results_lfw_all_subset_photos_1_sampling.xlsx"
- Dataset Name: A unique identifier for the dataset being analyzed. Example:
"lfw_all_subset_photos"
- Image Sampling Rate: The rate at which images are sampled during the analysis. Example:
0.3
python "Tool scripts\Deepface.py"
Fairface framework to extract the facial attributes.
- Input CSV: The CSV file containing information about the dataset. Example:
"File_paths/lfw_all_subset_photos.csv"
- Dataset Name: A unique identifier for the dataset being analyzed. Example:
"lfw_all_subset_photos"
- Output Filename: The name of the Excel file where the analysis results will be saved. Example:
"FairFace_analysis_results_1_lfw_all_subset_photos.xlsx"
- Image Sampling Rate: The rate at which images are sampled during the analysis. Example:
1
python "Tool scripts\Fairface.py"
Generates UTKFace dataset info file with image_name, age, gender, race.
- Dataset Path: The path to the UTKFace dataset. Example:
"C:/path/to/UTKFace_dataset"
- Output Excel Path: The path and filename for the Excel file where the dataset information will be saved. Example:
"Dataset_info/UTKFace_dataset_info.xlsx"
python "Tool scripts\UTKFace.py"
Generates UTKFace dataset info file with image_name, age.
- Dataset Path: The path to the FGNET dataset. Example:
"C:/path/to/FGNET_dataset"
- Output Excel Path (Dataset Info): The path and filename for the Excel file where the dataset information will be saved. Example:
"Dataset_info/FGNET_dataset_info.xlsx"
- Output CSV Path (Image Pairs): The path and filename for the CSV file containing image pairs. Example:
"FGNET_image_pairs.csv"
python "Tool scripts\FGNET.py"
Merges the results of the FairFace analysis and the UTKFace dataset information in order to output the age, gender, race accuracies and demographic distributions. NOTE: FGNET dataset does not have model predictions by race since it only encodes the age
- FairFace Analysis Results File Path: The path to the FairFace analysis results Excel file. Example:
"Tool_results/FairFace_analysis_results_UTKFace_all.xlsx"
- UTKFace Dataset Info File Path: The path to the UTKFace dataset information Excel file. Example:
"Dataset_info/UTKFace_dataset_info.xlsx"
- Merged Results File Name: The name of the Excel file where the merged results will be saved. Example:
"UTKFace_FairFace_merged_results_1.xlsx"
- Age Range for Analysis: The specified age range for the analysis. Example:
5
- Analysis Tool Used: The tool used for the analysis (e.g., 'FairFace', 'DeepFace'). Example:
'FairFace'
Face verification and recognition requires generating image pairs. All the generates pairs are of the true correct pairs by matching every image with every other image from the same subsets.
- Root Folder: The root folder containing the LFW Subset dataset. Example:
"C:/path/to/lfw_dataset"
- Folder Name for Output: The folder where the generated CSV file will be stored. Example:
"File_paths"
- CSV File Path: The path and filename for the CSV file containing image pairs. Example:
"image_pairs_lfw_subset.csv"
Deepface framework performs face recognition verification on pairs of images from the LFW and FGNET datasets and saves the results in an Excel file.
- Root Folder for Results: The root folder where the results will be stored. Example:
"Face_recognition_results/"
- CSV File Path for Image Pairs: The path to the CSV file containing pairs of images. Example:
"File_paths/image_pairs_lfw_subset.csv"
- Sampling Rate: The rate at which image pairs are sampled during the verification. Example:
1
- Excel File Path for Results: The path and filename for the Excel file where the verification results will be saved. Example:
"Face_recognition_results/verification_results_lfw_subset_1_sampling.csv"
python Face_recognition_scripts/Generate_image_pairs.py
Face recognition is performed on the set of image pairs generated in the step before.
- Source Path: The path to the original LFW dataset. Example:
C:/path/to/lfw_dataset
- Destination Path: The path where the image subset will be stored. Example:
C:/path/to/lfw_dataset_subset/
- Maximum Total Images to Copy: The maximum total number of images to copy to the subset. Example:
500
- Database Path for Face Recognition: The path to the database for face recognition. Example:
C:/path/to/lfw_all_subset_photos
- Model Name for Face Recognition: The name of the face recognition model to be used. Example:
VGG-Face
- Output CSV Path for Face Recognition Results: The path and filename for the CSV file where face recognition results will be saved. Example:
Face_recognition_results/face_recognition_results_FGNET.csv
- Accuracy CSV Path: The path and filename for the CSV file where face recognition accuracy will be saved. Example:
Face_recognition_results/face_recognition_accuracy_lfw_th_0.7_subset.csv
python Face_recognition_scripts/Face_recognition.py
- Attribute File Path: The path to the attribute analysis data file. Example:
"Tool_results/FairFace_analysis_results_1_lfw_all_subset_photos.xlsx"
- Verification Results Path: The path to the CSV file containing face recognition verification results. Example:
"Face_recognition_results/verification_results_lfw_subset_1_sampling.csv"
- Merged Dataframe Path: The path and filename for the CSV file where the merged results will be saved. Example:
"Bias_analysis_results/Fairface_bias_analysis_results_1_lfw_all_subset_photos.csv"
python Bias_assessment.py