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.
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
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_detectoris the main model and tracking app.dataset_toolkitis for collecting, cleaning, converting, and merging datasets.drone_detector/live_trackerruns live camera detection and position estimation.archived/arduino_turret_firmware_legacy.zipkeeps the old turret firmware out of the active project.
- Prepares Roboflow-style YOLO datasets for a single
droneclass. - 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.
Clone the repo and enter the detector folder:
git clone https://github.com/aaravpatel0/DroneDetection.git
cd DroneDetection\drone_detectorCreate a Python environment for local runs:
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install -r requirements.txtPlace 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-trainTrain only after the smoke train passes:
python train_yolov8.py --device auto
python evaluate_model.py --device autoRun inference:
python run_inference.py --source 0
python run_inference.py --source path\to\video.mp4The 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.ps1Start full GPU training only after the smoke train passes:
.\scripts\docker_train_gpu.ps1
.\scripts\docker_eval_gpu.ps1If GPU Docker is not available, use the CPU scripts in drone_detector/scripts. CPU training works, but it is much slower.
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 --showLive serial mode:
python live_tracker\turret_tracker.py --source 0 --port COM3 --showThe 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
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.
This project is for visual detection, tracking, calibration, and flight-control experimentation.
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.