This project trains a deep learning model to predict age, gender, and race from facial image.
Dataset UTKFace Dataset on Kaggle
Facial images are labeled with:
- Age: 0–116
- Gender: 0 (Male), 1 (Female)
- Race: 0 (White), 1 (Black), 2 (Asian), 3 (Indian), 4 (Others)
- Extracts age, gender, and race from filenames
- Filters unwanted race categories and saves the cleaned dataset to
Images.csv
- Resizes images to 168x168 pixels
- Normalizes pixel values to the [0,1] range
- Uses a CNN built with TensorFlow/Keras
- Includes Conv2D, MaxPooling, Dense, and Dropout layers
- Optimized using Adam and mean squared error (MSE) loss
- Evaluates model performance on a test split
- Predicts age on new images (e.g.,
Sharif.png
)
pip install numpy pandas matplotlib tensorflow pillow scikit-learn opencv-python
- Place the
UTKFace
dataset in the working directory - Run the script to preprocess, train, and evaluate
- Use the trained model for inference
Images.csv
with processed data- Trained model with evaluation metrics
- Data distribution and prediction insights throughout this README
Sharif