CoolFace
Apppublic

glisicstefan/age-estimation-resnet50

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes
App README

Age Estimation using ResNet50

A deep learning project focused on predicting human age from facial images using the UTKFace dataset. This project follows a modular software engineering approach, separating data processing, model architecture, and training logic.

๐Ÿš€ Key Features

  • โ€”Transfer Learning: Leverages a pre-trained ResNet50 model for robust feature extraction.
  • โ€”Modular Architecture: Clean code structure with specialized scripts for data setup, model building, and training logic.
  • โ€”Data Augmentation: Implements RandomHorizontalFlip, RandomRotation, and ColorJitter to improve model generalization and reduce overfitting.
  • โ€”Optimized Training: Two-stage training process, including an initial run followed by fine-tuning with a reduced learning rate.

๐Ÿ“Š Performance

The model achieves a Mean Absolute Error (MAE) of 4.67 years on the test set. This means that, on average, the model's prediction is within ~4.7 years of the actual age.

Training StageTrain MAETest MAE
Initial Training (LR: 1e-4)4.915.40
Fine-Tuning (LR: 1e-5)3.924.67

๐Ÿง  Inference Pipeline

To ensure high accuracy, the application follows a robust inference workflow:

  1. 1.Face Detection: Uses OpenCV (Haar Cascades) to locate and crop the face from the input image. This removes background noise and mimics the UTKFace dataset format.
  2. 2.Preprocessing: The cropped face is resized to 224x224 and normalized using ImageNet statistics.
  3. 3.Age Estimation: The ResNet50 model processes the face and outputs a continuous value.
  4. 4.Post-processing: The result is rounded to the nearest integer for a user-friendly experience.

๐Ÿ’ป Web Interface

The project includes an interactive web dashboard built with Gradio.

  • โ€”Input: Upload an image or use your webcam.
  • โ€”Output: Real-time age estimation displayed as a clean label.

๐Ÿ› ๏ธ Installation & Usage

  1. 1.Clone the repository:
bash
   git clone [https://github.com/glisicstefan/age-estimation-resnet50.git](https://github.com/glisicstefan/age-estimation-resnet50.git)
   cd age-estimation-resnet50