RipeRoute: Banana Grading and Shelf-Life Estimation
Final-year project. A deep learning model that classifies bananas into four ripeness classes (unripe, ripe, overripe, rotten), then maps the result to a grade (A, B, C or Reject), an estimated shelf life, and a shipping decision.
Model
- Architecture: EfficientNet-B0 (ImageNet pretrained), 4-class head
- Input: 224 x 224 RGB image, ImageNet normalisation
- Files:
best_effnetb0.pth: trained on clean augmented imageseffnetb0_noise_aug.pth: fine-tuned with added noise and blur
Dataset
Banana Ripeness Classification Dataset by S.M. Shahriar (Kaggle, Apache 2.0): 13,478 images (train 11,793 / valid 1,123 / test 562). https://www.kaggle.com/datasets/shahriar26s/banana-ripeness-classification-dataset
Results (test set, 562 images)
| Model | Accuracy | Macro F1 |
|---|---|---|
| EfficientNet-B0 (original) | 98.9% | 0.99 |
| ResNet50 (comparison) | 98.9% | 0.99 |
| EfficientNet-B0 (noise fine-tuned) | 99.5% | not recorded |
Robustness (noise fine-tuned model): blur 98.9%, noise (sigma 25) 98.8%, grayscale 83.5%. Before fine-tuning, noise accuracy was 23.8%.
Limitations
- The dataset is single-source with uniform backgrounds and contains pre-augmented copies, so real-world accuracy may be lower.
- On a photo of a banana bunch on the plant, confidence dropped to 83.6%.
- Grayscale accuracy is 83.5%, so the model relies heavily on colour.
- Noise robustness was tested only with synthetic Gaussian noise.
- Shelf-life values, transit times and the A/B/C mapping are assumed example values, not an official standard.
- Image-based only: internal quality, finger length and defects are not assessed.
Usage
See app.py for the full pipeline (Grad-CAM, grading, PDF report).
Run it with pip install -r requirements.txt and python app.py.