Skip to content

aaravpatel0/DroneInterception

Repository files navigation

Drone Detection

YOLOv8-based drone detection, dataset preparation, live camera inference, and position estimation.

This repository is the working home for my drone detection project. It includes the dataset pipeline, model training scripts, inference tools, camera calibration, and position visualization.

Demo Media

I will add project videos and images here as the build progresses.

assets/
|-- demo-video.mp4
|-- training-results.png
|-- drone-build.jpg
`-- live-detection-preview.png

Suggested README media spots:

  • Live webcam detection clip
  • Training result chart or confusion matrix
  • Example label preview image
  • Drone hardware photo
  • Short video of dry-run tracking or serial tracking

Project Structure

DroneDetection/
|-- drone_detector/              # YOLOv8 training, evaluation, inference, and live tracker
|-- dataset_toolkit/             # Public/uploaded dataset research and conversion tools
|-- .vscode/tasks.json           # Helpful VSCode tasks for tracking and training
|-- JOURNAL.md                   # Progress log for build notes, tests, and future media
`-- README.md

The folder names are intentionally short and human-readable:

  • drone_detector is the main model and tracking app.
  • dataset_toolkit is for collecting, cleaning, converting, and merging datasets.
  • drone_detector/live_tracker runs live camera detection and position estimation.
  • archived/arduino_turret_firmware_legacy.zip keeps the old turret firmware out of the active project.

What It Does

  • Prepares Roboflow-style YOLO datasets for a single drone class.
  • Cleans labels, checks corrupted images, and generates visual label previews.
  • Trains a YOLOv8 model with guarded preflight and smoke-test steps.
  • Evaluates the trained checkpoint and saves a reusable model file.
  • Runs inference on images, videos, URLs, or a webcam.
  • Tracks the best detected drone in a frame and estimates its 3D position.
  • Estimates approximate drone position when the drone size and camera FOV are known.

Quick Start

Clone the repo and enter the detector folder:

git clone https://github.com/aaravpatel0/DroneDetection.git
cd DroneDetection\drone_detector

Create a Python environment for local runs:

python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install -r requirements.txt

Place Roboflow YOLOv8 exports here:

drone_detector/data/roboflow_raw/Drone1
drone_detector/data/roboflow_raw/Drone2
drone_detector/data/roboflow_raw/Drone3

Run the safe local workflow:

python preflight_check.py --fix-dirs
python preflight_check.py
python merge_roboflow_datasets.py
python clean_dataset.py
python preview_labels.py --split train --count 20
python preflight_check.py --smoke-train

Train only after the smoke train passes:

python train_yolov8.py --device auto
python evaluate_model.py --device auto

Run inference:

python run_inference.py --source 0
python run_inference.py --source path\to\video.mp4

Docker Training

The Docker workflow is the safest path for the home training PC.

cd DroneDetection\drone_detector
.\scripts\docker_build.ps1
.\scripts\docker_cpu_check.ps1
.\scripts\docker_gpu_check.ps1
.\scripts\docker_preflight_gpu.ps1
.\scripts\docker_merge.ps1
.\scripts\docker_clean.ps1
.\scripts\docker_preview.ps1
.\scripts\docker_smoke_train_gpu.ps1

Start full GPU training only after the smoke train passes:

.\scripts\docker_train_gpu.ps1
.\scripts\docker_eval_gpu.ps1

If GPU Docker is not available, use the CPU scripts in drone_detector/scripts. CPU training works, but it is much slower.

Live Tracking

Dry-run mode shows detections and prints the serial commands without opening the Arduino port:

cd DroneDetection\drone_detector
python live_tracker\turret_tracker.py --source 0 --dry-run --show

Live serial mode:

python live_tracker\turret_tracker.py --source 0 --port COM3 --show

The preview can estimate red x, green y, and blue z distance from the camera origin using the configured 10.5 in visible width, 2.5 in height, and Logitech C525 focal estimate.

The tracker uses:

drone_detector/models/production_drone_model.pt

If that file is missing, it falls back to:

drone_detector/models/drone_roboflow_best.pt

Arduino Control

The old turret firmware has been archived here:

archived/arduino_turret_firmware_legacy.zip

The active Arduino direction will become drone control after the control mapping is defined.

Safety Note

This project is for visual detection, tracking, calibration, and flight-control experimentation.

More Documentation

  • drone_detector/README.md: detailed training, Docker, inference, and tracker instructions.
  • drone_detector/TRAINING_RUNBOOK.md: step-by-step home training PC runbook.
  • drone_detector/live_tracker/README.md: tracker wiring, tuning, and serial command notes.
  • dataset_toolkit/README.md: dataset research, conversion, merging, and smoke-test workflow.
  • JOURNAL.md: progress log and places to attach future media.

About

if yk yk

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors