Project
Cassava Disease Classifier
I used a pretrained ResNet50 to extract features from cassava leaf photos, trained a Random Forest to classify disease from those features, and built a Streamlit interface for testing predictions.
How it’s built View architectureHow it’s built
Cassava Disease Classifier · Hybrid ResNet50 plus Random Forest classifier for cassava leaf disease
I built a cassava leaf disease classifier that uses a frozen ImageNet ResNet50 as a feature extractor and a 100-tree Random Forest on the pooled features, trained on 7,508 leaf images across 5 classes. The hybrid reached 0.89 test accuracy against 0.59 for a Random Forest on raw pixels, and I serve it through a Streamlit app with upload, camera and sample-image tabs.
- training images in 5 classes
- 7,508
- test accuracy (hybrid ResNet50 + RF)
- 0.89
- baseline accuracy (RF on raw pixels)
- 0.59
- held-out test images (20% split)
- 1,502
Technology and what it does here
- TensorFlow / Keras ResNet50
- ImageNet weights, include_top=False, pooling='avg', extracts 2048-d features from 224x224 images
- scikit-learn RandomForestClassifier
- 100 trees classify disease from ResNet50 features; also the raw-pixel baseline
- Streamlit
- App.py inference UI with upload, camera capture and sample-image tabs plus probability charts
- joblib
- Persists and loads the trained forest as models/hybrid_model.pkl
- Kaggle (Tesla T4 GPU)
- Notebook training environment, per notebook device logs
- matplotlib / seaborn
- ROC, precision-recall, confusion matrix and feature-importance plots in the notebook
Implementation details
- Inference reuses the exact notebook preprocessing (resize to 224x224, resnet50.preprocess_input) before calling the forest, with a predict fallback if predict_proba is unavailable.
- The notebook compares the hybrid model against a pixel-level Random Forest on the same split with per-class ROC and PR curves.
- Per-class test F1 for the hybrid ranges from 0.85 (brown spot) to 0.93 (mosaic) (notebook cell 15 output).
Prototype architecture
The image classifier uses a pretrained vision model as a feature extractor and a separate Random Forest for disease predictions.
Technologies
- Python
- ResNet50
- Random Forest
- Streamlit
