Transfer learning image classifier that sorts natural-scene photos into six categories — buildings, forest, glacier, mountain, sea, street — using two pretrained CNN backbones, ResNet50 and InceptionV3. The best-performing model is deployed as an interactive Gradio app.
- Dataset: Intel Image Classification (~17K images, 6 classes)
- Backbones: ResNet50 and InceptionV3, both pretrained on ImageNet
- Training strategy: two-stage transfer learning
- Feature extraction — backbone frozen, train a new classification head
- Fine-tuning — unfreeze the top ~30 backbone layers, continue training at a much lower learning rate
- Callbacks:
EarlyStopping,ModelCheckpoint,ReduceLROnPlateau - Augmentation: random flip, rotation, zoom, and contrast — applied to the training set only
- Deployment: Gradio app — upload a photo, get the top-3 predicted classes with confidence scores
Evaluated on a held-out test set of 3,000 images:
| Model | Accuracy | Precision | Recall | F1-score | Parameters | Pred. Time (ms/image) |
|---|---|---|---|---|---|---|
| ResNet50 | 92.60% | 0.9260 | 0.9260 | 0.9257 | 23,600,006 | 8.50 |
| InceptionV3 | 91.80% | 0.9178 | 0.9180 | 0.9176 | 21,815,078 | 9.60 |
ResNet50 was selected for deployment — it's more accurate and faster at inference, with no efficiency trade-off in InceptionV3's favor.
| Class | ResNet50 | InceptionV3 |
|---|---|---|
| buildings | 0.93 | 0.92 |
| forest | 0.99 | 0.99 |
| glacier | 0.87 | 0.86 |
| mountain | 0.88 | 0.87 |
| sea | 0.96 | 0.95 |
| street | 0.94 | 0.93 |
Both models struggle most with glacier vs. mountain — visually similar snow/rock textures lead to the highest cross-class error rate (66–71 misclassifications out of ~550 images per model). A secondary, smaller confusion appears between buildings and street.
.
├── notebook.ipynb # Full pipeline: EDA → training → evaluation → Gradio
├── app.py # Standalone Gradio app (loads the saved model, no retraining)
├── deployment_config.json # Class names, image size, and model path used by app.py
└── report.docx # Short written report (results, graphs, comparison, conclusion)
Note: the saved model file (
best_resnet50_final.keras, ~210 MB) is not included in this repo — it exceeds GitHub's file size limits. See Model below for the download link.
best_resnet50_final.keras is hosted on Kaggle as the notebook's Output (it's generated by running the training notebook, not manually uploaded elsewhere):
- Open the Kaggle notebook
- Go to the Output tab
- Download
best_resnet50_final.keras - Place it in this repo's root folder, next to
app.pyanddeployment_config.json, before running the app
pip install tensorflow gradio numpy pillow
python app.pyThen open the printed local URL (e.g. http://127.0.0.1:7860) in your browser and upload an image.
The full training/evaluation notebook (data exploration, two-stage transfer learning, evaluation, Gradio section) is also available on Kaggle: Intel-Scene-Classification-TransferLearning
TensorFlow / Keras · scikit-learn · Gradio · pandas · seaborn · matplotlib