Skip to content

Machine learning project for classifying different types of fruits using image datasets and deep learning models. This project was carried out by students as part of a course report.

License

Notifications You must be signed in to change notification settings

quan831/Fruit-Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

30 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🍎 Fruit Detection (YOLOv8)

Real-time fruit detection powered by YOLOv8, using a custom fruit dataset split into train/val/test.
Built for quick deployment and clean reproducibility.


πŸš€ Features

  • 🧠 YOLOv8n model trained on a custom fruit dataset from Roboflow
  • 🧩 Custom Split: dataset manually divided into train, val, and test sets
  • 🎯 Pretrained Weights: runs directly using best.pt without retraining
  • πŸ’» Simple Interface: just run one Python file - no complex setup needed

πŸ“„ Essay Report

The full essay report has been uploaded to Google Drive.
You can access it here πŸ‘‰
πŸ”— Download Essay Report


πŸ‰ Dataset Overview

The dataset contains 6 fruit classes used for object detection:

Class Description
🍍 Pineapple Tropical fruit with spiky skin and sweet yellow flesh.
πŸ’ Cherry Small red fruit often appearing in pairs.
πŸ₯­ Mango Yellow-orange fruit with smooth skin and sweet aroma.
πŸ‘ Plum Round fruit with smooth skin, purple or red when ripe.
πŸ… Tomato Red juicy fruit often mistaken for a vegetable.
πŸ‰ Watermelon Large green fruit with red interior and black seeds.

πŸ—‚ Project Structure

Fruits-Detection/
β”œβ”€β”€ program.py               # Main entry point for running detection
β”œβ”€β”€ requirements.txt         # Python dependencies
β”œβ”€β”€ LICENSE
β”œβ”€β”€ SECURITY.md
β”‚
β”œβ”€β”€ weights/
β”‚   β”œβ”€β”€ best.pt              # Trained YOLOv8 model weights
β”‚   └── last.pt
β”‚
└── dataset_fruits/
    β”œβ”€β”€ data.yaml            # Dataset configuration for YOLOv8
    β”œβ”€β”€ README.dataset.md    # Info on dataset source & how val set was created
    β”œβ”€β”€ README.roboflow.txt  # Original Roboflow export metadata (source information)
    β”œβ”€β”€ train/               # Training images & labels
    β”œβ”€β”€ valid/               # Validation images & labels
    └── test/                # Test images & labels

βš™οΈ Installation

1️⃣ Clone the repository

git clone https://github.com/quan831/Fruit-Detection.git
cd Fruit-Detection

2️⃣ (Optional) Create virtual environment

python -m venv venv
# Activate:
# Windows
venv\Scripts\activate
# macOS / Linux
source venv/bin/activate

3️⃣ Install dependencies

pip install -r requirements.txt

▢️ Run Detection

🧩 Option 1 β€” Detect via Script

python program.py

Make sure your working directory includes:

  • weights/best.pt
  • dataset_fruits/data.yaml

The program loads the YOLOv8 model and runs inference directly.

🧠 Option 2 β€” Run in Spyder (Recommended for GUI)

  1. Open Anaconda Navigator β†’ Launch Spyder
  2. Open program.py
  3. Hit Run (F5) to start detection
  4. Check outputs and logs inside the console or generated output folder (if any)

🧠 Model Details

  • Model: best.pt (trained YOLOv8n)
  • Framework: Ultralytics YOLOv8 (Python)
  • Dataset: Custom split version of Roboflow fruit dataset
  • Train/Val/Test Ratio: defined manually in README.dataset.md

πŸ“Έ Preview

  • Image Detection Interface: Preview 1
  • Real-time Camera Detection Interface: Preview 2

🧾 License

This project is licensed under the MIT License.


πŸ›‘ Security

See SECURITY.md for details on responsible disclosure.


πŸ’– Credits


🌟 Show Your Support

If this repo helps you, please give it a ⭐ on GitHub - it really motivates me!


πŸ‘€ Authors

  • Nguyα»…n Minh QuΓ’n (Leader)
  • HoΓ ng Quα»‘c KhΓ‘nh
  • LΓͺ HoΓ ng Lan
  • Triệu YαΊΏn Vi

About

Machine learning project for classifying different types of fruits using image datasets and deep learning models. This project was carried out by students as part of a course report.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

  •  

Languages