https://github.com/shervinnd/wheat_detection
Wheat Detection uses YOLO11 to identify wheat heads in images from the GlobalWheat2020 dataset. This project automates dataset download, model training, and inference with bounding box visualization. Ideal for precision agriculture, it supports crop monitoring with an easy-to-use Python script. πΎπ
https://github.com/shervinnd/wheat_detection
agriculturetech aiinagriculture computervision cropmonitoring datascience deeplearning globalwheat2020 imageprocessing machinelearning objectdetection precisionagriculture python ultralytics wheatdetection yolo
Last synced: about 1 month ago
JSON representation
Wheat Detection uses YOLO11 to identify wheat heads in images from the GlobalWheat2020 dataset. This project automates dataset download, model training, and inference with bounding box visualization. Ideal for precision agriculture, it supports crop monitoring with an easy-to-use Python script. πΎπ
- Host: GitHub
- URL: https://github.com/shervinnd/wheat_detection
- Owner: shervinnd
- License: mit
- Created: 2025-08-17T07:37:48.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2025-08-17T08:19:08.000Z (about 2 months ago)
- Last Synced: 2025-08-17T09:21:08.331Z (about 2 months ago)
- Topics: agriculturetech, aiinagriculture, computervision, cropmonitoring, datascience, deeplearning, globalwheat2020, imageprocessing, machinelearning, objectdetection, precisionagriculture, python, ultralytics, wheatdetection, yolo
- Language: Jupyter Notebook
- Homepage:
- Size: 273 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Wheat Detection with YOLO ππΎ
Welcome to the **Wheat Detection** project! This repository uses the
YOLO11 model to detect wheat heads in agricultural images, leveraging
the GlobalWheat2020 dataset. Perfect for precision agriculture and crop
monitoring! π±## π Overview
This project implements wheat head detection using the Ultralytics YOLO
framework. It includes downloading the GlobalWheat2020 dataset, training
a YOLO11n model, and performing inference on uploaded images. The
results are visualized with bounding boxes around detected wheat heads.
πΎ## π Features
- π₯ Downloads and organizes the GlobalWheat2020 dataset
- π οΈ Trains a YOLO11n model for wheat head detection
- πΌοΈ Performs inference on uploaded images
- π Visualizes results with bounding boxes using Matplotlib
- βοΈ Easy-to-use Python script for end-to-end workflow## π Requirements
- Python 3.8+
- Ultralytics YOLO (`pip install ultralytics`)
- Matplotlib
- NumPy
- Pillow
- Google Colab (optional for running in the cloud βοΈ)Install dependencies:
``` bash
pip install ultralytics matplotlib numpy pillow
```## π οΈ Installation
1. Clone the repository:
``` bash
git clone https://github.com/shervinnd/wheat-detection.git
cd wheat-detection
```2. Install required packages:
``` bash
pip install -r requirements.txt
```3. Run the script in a Python environment or Google Colab:
``` bash
python wheat_detection.py
```## π Dataset
The project uses the **GlobalWheat2020** dataset:
- Images and annotations are downloaded from Zenodo and Ultralytics.
- The dataset is organized into `images`, `labels`, and `annotations`
directories.
- A YAML file (`GlobalWheat2020_subset.yaml`) is created for training
and validation subsets.## π§ Model Training
The script trains a pre-trained **YOLO11n** model on the GlobalWheat2020
dataset for 5 epochs. Adjust the number of epochs or image size as
needed:``` python
model.train(data="GlobalWheat2020_subset.yaml", epochs=5, imgsz=640)
```## π Inference
Upload an image to perform wheat head detection:
1. The script prompts for image upload.
2. Results are displayed with bounding boxes using Matplotlib.Example:
``` python
results = model("path/to/image.jpg")
for result in results:
img = result.plot()
plt.imshow(img)
plt.show()
```## π Results
The trained model outputs bounding boxes around wheat heads in images.
Results are saved in the `runs/detect` directory.Contributions are welcome! π Feel free to:
- Open issues for bugs or feature requests
- Submit pull requests with improvements
- Add new datasets or enhance the model## π License
This project is licensed under the MIT License. See the LICENSE file for
details.## π¬ Contact
For questions or feedback, reach out via GitHub Issues or email at
shervindanesh8282@gmail.comHappy wheat detecting! πΎπ