Technical case study
Face Mask Detection
A notebook compares ResNet50, DenseNet121, InceptionV3, and Vision Transformer models for mask and no-mask classification.
Overview
The project compares pretrained convolutional models and a Vision Transformer on labeled images of people with and without masks.
Problem
Architecture choice changes accuracy and preprocessing requirements, even for a straightforward binary task.
Objective
Measure how several pretrained image models perform on the same mask-classification dataset.
My approach
I used the labeled folders to create image splits, adapted preprocessing to each model, and compared the resulting validation accuracies.
Technology stack
- TensorFlow
- Keras
- CNN
- ResNet50
- DenseNet121
- InceptionV3
- Vision Transformer
Architecture
-
Labeled images
Read mask and no-mask image directories.
-
Image preparation
Prepare each model’s inputs and binary labels.
-
Transfer learning
Train ResNet50, DenseNet121, InceptionV3, and Vision Transformer variants.
-
Validation
Compare predictions on the same 20% holdout.
Key engineering decisions
- Include both convolutional networks and a transformer to broaden the comparison.
- Use the notebook’s shared holdout when reporting results across architectures.
Implementation details
- Use the model-specific image dimensions and preprocessing routines.
- Train the classification outputs and record validation results in the notebook.
Results and limitations
The saved notebook shows about 99.7% for Vision Transformer and 99.3% for DenseNet121. The 20% holdout was used during training for validation, so these are validation figures. An untouched independent test set was not documented.
Lessons learned
Keep validation separate from final test evaluation when selecting among models. Otherwise the reported result can reward choices tuned to the holdout.