An interactive web app to classify fruits and vegetables from images using a deep learning model based on VGG-16 + Transfer Learning. The app is built using Streamlit and runs entirely in your browser – no setup required!
- 🧠 Abstract
- 🚀 Key Features
- 🍅 Classes Covered
- 🧠 Methodology
- 📈 Performance
- ⚙️ Installation & Usage
- 📁 Project Structure
- 🛣 Future Scope
- 📜 License & 📧 Contact
The Fruit & Vegetable Classifier app enables users to upload or test sample images and classify them into 36 distinct categories (fruits or vegetables). It uses a fine-tuned VGG-16 convolutional model trained on an image dataset. With options for detailed prediction display, model confidence, and a clean UI, it’s suitable for educational demos, farming tech, and retail assistance.
- 📤 Upload any
.jpg,.jpeg, or.pngimage. - 🍅 Classifies the image into one of 36 known food classes.
- 🧠 Differentiates between fruit and vegetable categories.
- 📈 Optionally shows model confidence score.
- 🧾 Sample image selector for instant testing.
- ⚙️ Powered by VGG-16 and Transfer Learning.
- 🧼 Intuitive Streamlit UI with sidebar controls.
Beetroot, Bell Pepper, Cabbage, Capsicum, Carrot, Cauliflower, Chilli Pepper, Corn, Cucumber, Eggplant, Garlic, Ginger, Jalepeno, Lettuce, Onion, Paprika, Peas, Potato, Raddish, Soy Beans, Spinach, Sweetcorn, Sweetpotato, Tomato, Turnip
Apple, Banana, Grapes, Kiwi, Lemon, Mango, Orange, Pear, Pineapple, Pomegranate, Watermelon
[ Uploaded Image or Sample ]
│
▼
[ Resize to 224x224x3 ]
│
▼
[ VGG-16 + Transfer Learning ]
│
▼
[ Dense Layer + Softmax ]
│
▼
[ Predicted Label + Category + Confidence Score ]
- ✅ Model: VGG-16 (Keras Applications)
- 🧠 Training Accuracy: ~97%
- 🎯 Validation Accuracy: ~92%
- 🧪 Top-1 Prediction: Shown with confidence %
Make sure you have Python 3.7+ installed.
pip install streamlit pillow numpy tensorflowAlternatively, use:
pip install -r requirements.txtDownload vgg.h5 and place it in the same directory as app.py.
streamlit run app.pyOpen your browser at: http://localhost:8501
fruit-veg-classifier/
├── app.py # Streamlit app
├── vgg.h5 # Pre-trained VGG model
├── requirements.txt # Python dependencies
├── README.md # This file
└── upload_image/ # Sample image folder
- 🔍 Add Grad-CAM visualizations for explainability
- 📱 Deploy as mobile app (using Kivy / React Native)
- 🎯 Add multi-label support for images with multiple items
- 🌐 Enable cloud-based inference for large-scale use
License: MIT Author: Akshwin T 📧 akshwint.2003@gmail.com 🔗 LinkedIn | GitHub
⭐ Found it useful? Star the repo and share it!