This is my attempt to use a convolutional neural network multi-output model that classifies images of people based on their ethnicity and predicts their age and gender.
The project explores multi-task learning, where a shared CNN backbone learns general facial features and three output heads specialise in classification (ethnicity and gender) and regression (age prediction).
- Robust Data Pipeline - Engineered a tf.data pipeline with safe augmentation techniques.
- Single backbone + three prediction heads:
- Age (Regression)
- Ethnicity (Classification)
- Gender (Classification)
- Transfer Learning Comparison: Benchmarked the custom model against a fine-tuned MobileNetV2.
- Streamlit Application — Real-time face attribute prediction via image upload or live webcam.
Dataset: https://www.kaggle.com/datasets/moritzm00/utkface-cropped
The final model uses a custom VGG-style architecture with Global Average Pooling to reduce parameter bloat and improve generalization.
| Task | Output | Metric | Best Validation |
|---|---|---|---|
| Age | Regression | MAE | 0.0749 |
| Gender | Classification | Accuracy | 90.11% |
| Ethnicity | Classification | Accuracy | 75.45% |
Download model.keras from Google Drive Later, the custom model was used to build a Streamlit application that predicts the three demographics.
For full training details — including model code, metrics, plots, and experiments, see: CNN_tf_keras.ipynb (located in the repo root)
- Upload an image and get face attribute predictions
- Live webcam inference using Streamlit_WebRTC
- Lightweight & CPU-friendly deployment (uses lazy loading)
- Handles transparent (RGBA) images
Below is an example of the face-analysis prediction generated by the Streamlit app:

Follow the steps below to launch the Face Analysis Streamlit application on your local machine.
Prerequisites Make sure you have:
- Python 3.10
- Git
- OS: Works on Windows / macOS / Linux
git clone https://github.com/jatin-reddy/CNNs-for-Computer-Vision.git
cd CNNs-for-Computer-VisionmacOS / Linux
python3.10 -m venv venv
source venv/bin/activateWindows
python -m venv venv
venv\Scripts\activatepip install --upgrade pip
pip install -r requirements.txtDownload model.keras from Google Drive And then use the correct path in load_path() function on each page
streamlit run Home.pyPredictions are probabilistic and may not always be accurate.
Results should not be used for sensitive or critical decision-making.