This project is a full-stack fruit detection application that uses YOLOv8m for fruit classification and bounding box detection. Users can upload fruit images, detect fruits like mango, apple, banana, orange, and strawberry, and classify them as fresh or rotten. Results are displayed on the frontend and can be saved as a PDF report including detection coordinates.
- 🧠 YOLOv8m-based object detection
- 🍓 Detect & classify fruits as fresh or rotten
- 📤 Upload images via frontend
- 📄 Export results as PDF with bounding box coordinates
- 🔗 Uses Roboflow for image annotation
- ⚡ Backend built with Flask
- 🌐 Frontend built with Next.js
- 🍎 Apple
- 🍌 Banana
- 🥭 Mango
- 🍊 Orange
- 🍓 Strawberry
Each fruit is classified into:
- ✅ Fresh
- ❌ Rotten
- Model: YOLOv8m (Ultralytics)
- Annotation: Roboflow
- Frontend: Next.js (React-based)
- Backend: Flask (Python)
- PDF Generation: Python libraries like
fpdforreportlab
-
Navigate to the backend folder:
cd backend -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the required dependencies:
pip install -r requirements.txt
-
Start the Flask server:
python app.py
-
Navigate to the frontend folder:
cd frontend -
Install Node.js dependencies:
npm install
-
Start the frontend development server:
npm run dev
Download the trained YOLOv8m model (best.pt) from the link below and place it inside the model folder in the backend:
🔗 Download YOLOv8m Model from Google Drive
The application generates a PDF containing:
- Detected fruit names and freshness status
- Confidence scores
- Bounding box coordinates (x, y, width, height)
These PDFs are saved automatically in the /results folder after each detection.
Fruit-Detection-Project/
├── backend/
│ ├── app.py
│ ├── model/
│ │ └── best.pt
│ ├── requirements.txt
│ └── ...
├── frontend/
│ ├── pages/
│ ├── components/
│ └── ...
├── README.md
This project is licensed under the MIT License.
Feel free to use, modify, and distribute.
PRs and suggestions are welcome. If you find a bug or want to add a feature, feel free to open an issue or submit a pull request!
Feel free to reach out with questions or feedback.