CompletedPyTorch / Computer Vision
Facial Age Group Classifier (AgeGroupCNN)
An end-to-end PyTorch computer vision pipeline classifying face photos into four age cohorts, engineered with frequency-weighted loss to stop majority-class collapse.
Architecture:Custom AgeGroupCNN
Loss Fix:Weighted Cross-Entropy
Input:128x128 Grayscale
Overview
A PyTorch coursework project classifying human facial images into four age brackets while handling class imbalance.
The Problem
Because the training dataset skewed heavily toward young adults, an unweighted convolutional model learned to predict the majority class everywhere, hiding poor recall on Child and Senior cohorts.
Architecture & Implementation
Built a custom PyTorch nn.Module (AgeGroupCNN) trained on 128x128 grayscale images with a stratified train/validation split. Inverse-frequency class weights computed via scikit-learn inside nn.CrossEntropyLoss(weight=...) penalized minority-class errors properly.
Key Challenges Solved
- Diagnosing why high headline accuracy masked near-zero recall on underrepresented Child and Senior images.
- Balancing class loss weights and regularization so minority classes generalized cleanly on the validation split.
- Verifying per-class precision, recall, and confusion matrix behavior across all four cohorts.
Outcomes & Verification
- Recovered balanced per-class recall and macro-F1 across Child, Young, Middle-Aged, and Senior classes.
- Produced clean classification reports and confusion matrix diagnostics.