80/20 Keras image pipeline with normalized 128×128 inputs
Transfer Learning in Convolutional Models
A comparative transfer-learning study that adapts MobileNetV2, EfficientNetB0, and ResNet50 to binary mask detection, from dataset preparation to external validation and a real-time webcam demonstration.
Keras / CNN / F1 / Webcam
PROJECT VISUAL / VERIFIEDThree pre-trained architectures evaluated with a custom F1 metric
EfficientNetB0 delivered the strongest balance at nearly 77% accuracy
Data pipeline
Mask and non-mask images are organized into training and validation sets with Keras ImageDataGenerator. Images are normalized, resized to 128×128 pixels, and split 80% for training and 20% for validation.
This common input pipeline makes the comparison between architectures consistent and removes resolution as a source of variation.
Model adaptation
MobileNetV2, EfficientNetB0, and ResNet50 are loaded with pre-trained weights. A shared classification head adds global pooling, dropout, and a sigmoid output for binary prediction.
The base networks are initially frozen and later selectively unfrozen. Experiments with two and seven unlocked layers explore how much fine-tuning improves generalization before overfitting appears.
Evaluation and result
Each model is trained for ten epochs and compared through loss, accuracy, and a custom F1-score designed to expose imbalanced performance.
MobileNetV2 and ResNet50 reached roughly 70% accuracy but showed weak F1 values. EfficientNetB0 approached 77% accuracy with a substantially better balance between precision and recall, making it the preferred candidate.
- Training and validation curves
- External dataset validation
- Live webcam mask-detection test
Go deeper into the complete project.
Open the original associated PDF for the full methodology, code, analysis, and project evidence.