CNN-Based Age Prediction System
Trained a CNN-based age prediction model using PyTorch, the UTK dataset, and a ResNet10 architecture to predict ages with an average error of ±4 years—optimized via hyperparameter tuning and deployed with a Streamlit UI for real-time inference.
In plain English
Given a photo of a person’s face, predict their age. It’s a classic computer-vision benchmark and the kind of project most ML practitioners build at some point — the interesting parts are the loss function (age is continuous, so this is regression, not classification), the dataset bias (most face datasets skew young and Western), and the deployment surface (a model that lives in a Jupyter notebook isn’t a product).
I trained a convolutional neural network (a ResNet10 architecture, in PyTorch) on the UTK dataset — about 9,000 face images labeled with age, gender, and ethnicity. The model achieves an average prediction error of ±4 years on held-out test images. Then I wrapped it in a Streamlit web UI so anyone can drop in a photo and see the prediction live, instead of needing to run the model from a notebook.
The hyperparameter tuning improved accuracy by 28% over the initial baseline — most of that came from learning-rate scheduling and proper regularization, not from fancy architecture changes.
Technical introduction
This project leverages a CNN-based approach to predict age from facial images using PyTorch and the UTK dataset. Utilizing a ResNet10 architecture, the model processes over 9,000 images to achieve an average prediction error of ±4 years. Through extensive hyperparameter optimization—including learning rate scheduling and regularization—the model’s accuracy improved by 28%, and a Streamlit UI was developed for real-time demographic analysis.
Output
Here is a screenshot from the Streamlit UI demonstrating real-time age prediction:

Models Used
- ResNet10 CNN Architecture for age prediction
- PyTorch for model training and inference
- Streamlit for deploying a real-time user interface
Training
- CNN Model Training
- Includes data preprocessing, model training, and hyperparameter tuning.
Requirements
- python 3.8+
- pytorch
- torchvision
- pandas
- numpy
- streamlit
- matplotlib or seaborn (for visualization)