Built to order

Weed Detection in Crop Fields using YOLO

This project builds a real-time YOLOv8 object detector that spots weeds in crop-field photographs — enabling precision spot-spraying instead of wasteful broadcast herbicide use — trained and evaluated on the DeepWeeds dataset of 17,509 rangeland images across 8 weed species. It ships with a complete training notebook, the trained detector, and an interactive web demo where you load a field capture, see weed detections with confidences, and get a zone-wise spray map. mAP evaluation, the edge-deployment path and the herbicide-saving story are all documented for a confident viva. Suitable for

Weed Detection in Crop Fields using YOLO — project thumbnail preview
More project photos (2)

The problem

Weeds compete with crops for water, nutrients and light, and the standard response — broadcast herbicide spraying — wastes chemical, money and soil health on empty ground. Precision agriculture flips this: detect exactly where the weeds are, and spray only there. That needs a detector that runs in real time on a sprayer or drone, which is exactly what YOLO was designed for. The DeepWeeds dataset (17,509 images, 8 weed species from Australian rangelands) is the standard benchmark, and this project fine-tunes YOLOv8 on it with documented augmentation, evaluates with mAP@0.5 overall and per species, and wraps the detector in an interactive web demo: load a field capture, see weed boxes with confidence bars, and get a zone-wise spray map showing which zones need treatment and which can be skipped. The herbicide-saving arithmetic gives the project a compelling real-world story.

How it works

  1. DeepWeeds images are organized with YOLO-format annotations across the 8 weed species plus the negative (weed-free) class.
  2. YOLOv8n pre-trained on COCO is fine-tuned at 640×640 with mosaic augmentation for 150 epochs.
  3. Validation mAP@0.5 is tracked each epoch; the best checkpoint is kept and evaluated once on the test split, overall and per species.
  4. The detector is exported to ONNX; inference runs at ~52 FPS, fast enough for a moving sprayer rig.
  5. Detections below the 0.45 confidence threshold are filtered; remaining boxes are counted per zone for the spray map.
  6. The web demo loads the detection pipeline (representative outputs on sample captures) and renders boxes, confidences and the spray map interactively.

Tech stack:

  • Python 3, PyTorch, Ultralytics YOLOv8
  • OpenCV (image handling)
  • NumPy, Matplotlib (analysis)
  • Jupyter Notebook (training & evaluation)
  • HTML5, CSS, JavaScript (detection demo)
  • DeepWeeds dataset (Olsen et al.)

Dataset & model details

  • Dataset: DeepWeeds (Olsen et al., 2019) — 17,509 rangeland images, 8 weed species (parthenium, lantana, siam weed, rubber vine, prickly acacia, snake weed and others) plus a negative class; standard train/val/test splits published with the dataset.
  • Task: Object detection; input = 640×640×3 field photograph, output = bounding boxes with weed-species labels and confidences.
  • Model: YOLOv8n (3.2M parameters) fine-tuned from COCO weights; mosaic augmentation; NMS IoU 0.5 (design target).
  • Metrics: mAP@0.5 of 0.863 overall on the test split (design target for the built-to-order training run), per-species AP table. No metric is claimed as measured until the training run is executed for the order.
Parameter Value
Dataset 17,509 images, 8 weed species + negative (DeepWeeds)
Input 640 × 640 field photograph
Detector YOLOv8n, 3.2M parameters, COCO pre-trained
mAP@0.5 0.863 (design target, not a measured claim)
Training 150 epochs with mosaic augmentation (expected)
Inference Approximately 52 FPS on GPU (expected)
Model file Approximately 6 MB (.pt), ONNX export included (expected)
Demo Single-file web app; detection on sample captures

Project features

  • [Field detection web demo] Load a field capture and see YOLO weed boxes with species labels and confidence bars plus a spray advisory.
  • [YOLOv8 fine-tuning] COCO pre-trained YOLOv8n fine-tuned on DeepWeeds at 640×640 with mosaic augmentation for real-time field inference.
  • [Per-species AP analysis] mAP@0.5 overall plus per-species average precision, honestly showing which weeds are hardest.
  • [Spray-map mode] Rank field zones by weed density into spray / spot-treat / skip — the precision-agriculture payoff, quantified.
  • [Edge-deployment path] Export to ONNX/TFLite documented for a sprayer-mounted camera + Jetson/Raspberry Pi rig.
  • [Herbicide-saving estimate] Zone-wise treatment vs broadcast spraying compared, giving the project a measurable impact story.
  • [Full training notebook] Data preparation, training, validation, mAP evaluation and detection visualization in one reproducible notebook.

What is included

  • Complete training & evaluation Jupyter notebook
  • Trained YOLOv8 detector weights + ONNX export
  • Interactive field-detection web demo with spray map
  • mAP evaluation tables and per-species AP plots
  • Project report PDF (background, detection theory, methodology, results)
  • PPT presentation for final review
  • Viva Q&A preparation document (YOLO architecture, mAP, NMS, augmentation, edge deployment)

Limitations & prerequisites

  • 0.863 mAP is a design target for the training run, stated honestly — the report documents the actual achieved figure after training.
  • DeepWeeds covers Australian rangeland species; Indian field weeds differ and the report notes the domain-transfer caveat.
  • Small seedlings and heavy occlusion lower detection reliability; the per-species table shows this.
  • The herbicide-saving estimate is arithmetic on the demo zones, not a field trial measurement — stated as such.
  • The demo replays representative detections on sample captures offline; the shipped detector is trained on DeepWeeds during the build.

Frequently Asked Questions

Which dataset is used and why?

DeepWeeds — 17,509 images across 8 weed species with published splits. It is the standard benchmark for in-field weed detection, collected with a real ground-rover camera rather than lab photos.

Why YOLOv8n, the smallest model?

A sprayer rig needs real-time inference on modest hardware — 52 FPS on the nano model beats a slower, slightly more accurate large model for this use case. The trade-off is documented.

How does the spray map save herbicide?

Zones are classified spray / spot-treat / skip by weed density; skipping clean zones avoids broadcast waste. The demo quantifies the saving on its 8 zones (~55%).

Will it work on Indian farms?

The species differ, so retraining or fine-tuning on local weed images is needed — listed as the honest next step, with the pipeline ready for it.

Can it run on a Raspberry Pi?

The ONNX/TFLite export path is documented for exactly this; expected FPS on edge hardware is discussed in the report.

Is this project suitable for a final-year project?

Yes — for Computer Science, IT and AI/ML programs. It covers object detection, real-dataset training and a deployable precision-agriculture application. Suitable for B.E./B.Tech final-year projects in Computer Science, IT and AI & Machine Learning.

Components & software requirements
  • Python 3, PyTorch, Ultralytics YOLOv8
  • OpenCV (image handling)
  • NumPy, Matplotlib (analysis)
  • Jupyter Notebook (training & evaluation)
  • HTML5, CSS, JavaScript (detection demo)
  • DeepWeeds dataset (Olsen et al.)

Dataset & model details

  • Dataset: DeepWeeds (Olsen et al., 2019) — 17,509 rangeland images, 8 weed species (parthenium, lantana, siam weed, rubber vine, prickly acacia, snake weed and others) plus a negative class; standard train/val/test splits published with the dataset.
  • Task: Object detection; input = 640×640×3 field photograph, output = bounding boxes with weed-species labels and confidences.
  • Model: YOLOv8n (3.2M parameters) fine-tuned from COCO weights; mosaic augmentation; NMS IoU 0.5 (design target).
  • Metrics: mAP@0.5 of 0.863 overall on the test split (design target for the built-to-order training run), per-species AP table. No metric is claimed as measured until the training run is executed for the order.
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download abstract (PDF)

Related guides

All guides
Illustration of object tracking showing video frames with bounding boxes and persistent ID labels following people and vehicles, comparing motion prediction and appearance matching.B.E./B.Tech Computer Science and Electronics students building video analytics projects — people counting, vehicle tracking, sports analysis — who have detection working and need

Object Tracking: DeepSORT and ByteTrack Explained

Detection finds objects per frame; tracking keeps their identities across frames. This guide explains tracking-by-detection, Kalman motion models, DeepSORT's appearance embeddings vs ByteTrack's low-confidence box recovery, tracking metrics (HOTA, IDF1, ID switches), and the tuning parameters that determine real-world quality.

Read guide
Illustration of image segmentation showing U-Net's U-shaped encoder-decoder with skip connections producing pixel masks, alongside Mask R-CNN detecting instances with masks.B.E./B.Tech Computer Science and AI/ML students moving from image classification or detection to pixel-level understanding — medical imaging, defect detection, autonomous driving

Image Segmentation: U-Net and Mask R-CNN

When projects need pixel-level answers, segmentation delivers. This guide explains semantic vs instance vs panoptic segmentation, U-Net's encoder-decoder with skip connections, Mask R-CNN's parallel mask head, Dice and IoU evaluation, paired augmentation, and how to choose the right architecture for your data and question.

Read guide
Illustration of Whisper speech-to-text showing sound waves flowing into a neural network and emerging as transcribed text with timestamps and speaker labels.B.E./B.Tech Computer Science and AI/ML students adding speech-to-text to projects — voice assistants, meeting transcription, accessibility tools

Whisper for Speech-to-Text in Student Projects

Whisper transcribes speech in dozens of languages with no training required. This guide covers how it works, choosing among model sizes, running it locally with faster-whisper, handling hour-long audio, timestamps and speaker diarization, multilingual quirks, and honest evaluation with word error rate.

Read guide
Get a quotation