The Fruits & Vegetables Detection App is a Flask web application powered by a YOLOv5 deep learning model trained with PyTorch.
It detects 32+ classes of fruits and vegetables from images or webcam input and provides calorie information for each item.
This project highlights skills in Computer Vision, Flask Web Development, and AI-powered applications.
- πΌοΈ Upload Image Detection β Upload an image and get bounding boxes with detected fruits/vegetables.
- π₯ Live Webcam Detection β Real-time detection directly in the browser.
- π¦ 32+ Supported Classes β Apple, Banana, Tomato, Mango, Potato, Strawberry, and more.
- π YOLOv5 Model β Custom-trained weights (
best.pt) for accurate detection. - π Calorie Information β Each detected item shows nutritional values.
- π¨ Flask + HTML Templates β Lightweight UI with Bootstrap/Tailwind-ready design.
- PyTorch β Deep learning framework
- YOLOv5 β Object detection model
- Flask β Web framework for serving the app
- OpenCV / NumPy β Image processing utilities
- HTML + Jinja2 β Templates for UI rendering
git clone https://github.com/your-username/fruits-vegetables-detection.git
cd fruits-vegetables-detection
- Install Dependencies
pip install -r requirements.txt
- Run the Flask App
python app.py
The app will start on http://127.0.0.1:5000/
π Project Structure
fruits-vegetables-detection/
βββ images/ # Static images (hero, backgrounds, etc.)
β βββ hero-bg.jpg
β
βββ templates/ # HTML templates
β βββ index.html # Home page (upload detection)
β βββ live.html # Live webcam detection
β βββ result.html # Display results
β
βββ weights/ # Model weights
β βββ best.pt # YOLOv5 trained model
β
βββ app.py # Flask application
βββ data.yaml # Dataset configuration file
βββ requirements.txt # Python dependencies
βββ README.md # Project documentation
π Optimizations
Custom YOLOv5 training with 32 classes of fruits/vegetables.
Lightweight Flask API with minimal latency.
Reusable calorie lookup function.
Separate HTML templates for clean UI organization.
π Deployment (Future Scope)
Backend (Flask) β Deploy on Render, Heroku, or AWS EC2.
Frontend Templates β Can be extended with React / modern UI later.
Configure environment variables for production.
π€ Contributing Contributions are welcome! Fork this repo, create a branch, and submit a PR.
π License This project is licensed under the MIT License.
π¨βπ» Author Built with β€οΈ by Syed Abdul Qadeer Currently pursuing Full-Stack Web Development @ Masai School #dailylearning #masaiverse
π Tags Flask Β· PyTorch Β· YOLOv5 Β· Computer Vision Β· Machine Learning Β· Deep Learning Β· Object Detection Β· Fruits Detection Β· Vegetables Detection Β· Calorie Tracking Β· Portfolio Project