FairFace is a Deep Learning project aimed at identifying and mitigating algorithmic bias in facial detection systems. Standard CNNs often perform poorly on underrepresented groups (e.g., darker skin tones or specific gender/age groups) due to dataset imbalance.
This project implements a Debiasing Variational Autoencoder (DB-VAE) to learn the latent structure of facial features and automatically re-weight training examples during learning, ensuring fair classification accuracy across all demographics.
- The Bias: Models trained on skewed datasets (like CelebA) tend to learn features correlated with the majority class (e.g., Light Skin / Female), leading to high error rates for minorities.
- The Fix (DB-VAE):
- Latent Learning: A VAE learns a low-dimensional representation of faces (Latent Space).
- Automated Re-sampling: The model identifies images in "sparse" regions of the latent space (underrepresented faces) and increases their sampling probability during training.
- Result: The classifier sees "hard" or "rare" examples more often, reducing bias without needing manual labeling of attributes.
- Architecture: Convolutional VAE (Encoder-Decoder) with a Classification Head.
-
Loss Function:
- VAE Loss: Reconstruction Loss + KL Divergence (for latent learning).
- Classification Loss: Cross-Entropy (for face detection).
-
Debiasing Algorithm: Adaptive re-sampling based on the estimated latent distribution
$Q(z|x)$ .
- Clone the repository:
git clone [https://github.com/mariamashraf731/FairFace-DBVAE.git](https://github.com/mariamashraf731/FairFace-DBVAE.git)
- Install Dependencies:
pip install -r requirements.txt
- Run the Analysis:
jupyter notebook notebooks/Debiasing_Facial_Detection.ipynb
- Language: Python
- Deep Learning: TensorFlow / Keras
- Concepts: Unsupervised Learning, VAEs, Latent Space Analysis, Algorithmic Fairness.