Skip to content

DIMAX99/Fruit-Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🍎 Fruit Detection and Classification using YOLOv8m

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.


🚀 Features

  • 🧠 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

📸 Fruits Detected

  • 🍎 Apple
  • 🍌 Banana
  • 🥭 Mango
  • 🍊 Orange
  • 🍓 Strawberry

Each fruit is classified into:

  • ✅ Fresh
  • ❌ Rotten

🧪 Tech Stack

  • Model: YOLOv8m (Ultralytics)
  • Annotation: Roboflow
  • Frontend: Next.js (React-based)
  • Backend: Flask (Python)
  • PDF Generation: Python libraries like fpdf or reportlab

🛠️ Installation

📦 Backend (Flask)

  1. Navigate to the backend folder:

    cd backend
  2. Create and activate a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install the required dependencies:

    pip install -r requirements.txt
  4. Start the Flask server:

    python app.py

🌐 Frontend (Next.js)

  1. Navigate to the frontend folder:

    cd frontend
  2. Install Node.js dependencies:

    npm install
  3. Start the frontend development server:

    npm run dev

🧠 Model File

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


📄 Example Output

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.


📁 Project Structure

Fruit-Detection-Project/
├── backend/
│   ├── app.py
│   ├── model/
│   │   └── best.pt
│   ├── requirements.txt
│   └── ...
├── frontend/
│   ├── pages/
│   ├── components/
│   └── ...
├── README.md

📝 License

This project is licensed under the MIT License.
Feel free to use, modify, and distribute.


🙌 Contributions

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!


📬 Contact

Feel free to reach out with questions or feedback.

About

Fruit Detection using Yolov8

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published