Skip to content

About

Real-time person detection and GPS geolocation from thermal drone video — ROS2 Humble + YOLOv8 + Flask

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Drone Tracker

Real-time person detection and GPS geolocation from thermal drone video

ROS2 Humble Python 3.10 YOLOv8 PyTorch OpenCV Flask License: MIT

Drone Tracker demo

Overview

Drone Tracker is a ROS2-based pipeline that processes thermal drone video to detect, track, and geolocate people in real time. Each detected person is assigned a persistent tracking ID and a GPS coordinate derived from the drone's telemetry (altitude, orientation, FOV), then displayed on an interactive web map.

The system was developed for search-and-rescue and surveillance use cases using DJI thermal cameras. The YOLO detection model was trained via transfer learning on a custom thermal dataset of ~5,000 images.


Features

  • Thermal person detection — YOLOv8x fine-tuned on ~5,000 thermal frames from DJI drones
  • Persistent tracking — Multi-object tracking with stable IDs across frames
  • GPS geolocation — Pixel-to-GPS conversion using drone altitude, yaw/pitch/roll, and camera FOV
  • Kalman filter — Trajectory smoothing on GPS coordinates to reduce jitter
  • Interactive map — Real-time Leaflet.js dashboard showing person markers, trajectories, and drone FOV
  • DJI SRT parsing — Automatic parsing of DJI .SRT telemetry files (GPS, altitude, gimbal angles, focal length)
  • One-command launch — Single ros2 launch command starts the full pipeline

ROS2 Packages

Package Description
drone_bringup Launch package — starts the full pipeline with one command
drone_tracker_msgs Custom message types: DroneState, PersonDetection, PersonLocation and their arrays
video_publisher_node Reads MP4 + SRT, publishes frames and telemetry
yolo_detection_node YOLOv8 inference with persistent tracking
georeferencing_node Pixel → GPS georeferencing with Kalman smoothing
map_server_node Data aggregation and JSON/image export for the web dashboard
drone_tracker_utils Shared utilities: GeoCalculator, SRTParser, FOVVisualizer
ROS2 node graph

Detection Model

The YOLO model is trained separately in the detection/ directory using a custom pipeline built on a proprietary thermal dataset:

  • Base model: YOLOv8x (pretrained on COCO)
  • Dataset: Custom thermal dataset — ~4,900 annotated frames from DJI thermal cameras (3,437 train / 736 val / 737 test)
  • Classes: person (1 class)
  • Transfer learning: Phase 1 — frozen backbone, head-only training on the custom dataset
  • Fine-tuning: Phase 2 — full model unfreezing with low learning rate and advanced augmentation (mosaic, mixup, cosine LR)
  • Quantization: ONNX FP16 export for optimized deployment (validation in progress)

See detection/README.md for the full training pipeline.


Requirements

  • ROS2 Humble
  • Python 3.10+
  • CUDA-capable GPU (recommended for real-time inference)
pip install ultralytics opencv-python flask folium numpy

Or install all dependencies:

pip install -r detection/requirements.txt
pip install -r web/requirements.txt

Installation

# Clone the repository
git clone https://github.com/<your-username>/drone-tracker.git
cd drone-tracker

# Install ROS2 dependencies
rosdep install --from-paths src --ignore-src -r -y

# Build
colcon build
source install/setup.bash

Usage

Launch the full pipeline

# Default video
ros2 launch drone_bringup drone_tracker.launch.py

# Specify video and SRT
ros2 launch drone_bringup drone_tracker.launch.py \
    video_path:=/path/to/video.MP4

# All options
ros2 launch drone_bringup drone_tracker.launch.py \
    video_path:=/path/to/video.MP4 \
    conf_threshold:=0.4 \
    use_kalman:=true \
    keep_history:=true

Launch parameters

Parameter Default Description
video_path (configured in launch file) Path to thermal MP4
srt_path (derived from video_path) Path to SRT telemetry; auto-derived if omitted
publish_rate 30 Video publish rate in Hz
conf_threshold 0.5 YOLO confidence threshold
iou_threshold 0.45 IoU threshold for NMS
fov_horizontal 50.5 Camera horizontal FOV in degrees
use_kalman true Enable Kalman filter for GPS smoothing
max_distance 1000.0 Maximum accepted GPS distance in meters
keep_history false Store full trajectory history
output_dir /tmp/drone_map_data Output directory for JSON and image exports

Open the dashboard

# In a separate terminal
cd web && python3 app.py

# Open in browser
http://localhost:5000

Project Structure

drone_ws/
├── src/                          # ROS2 packages
│   ├── drone_bringup/            # Launch package
│   ├── drone_tracker_msgs/       # Custom messages
│   ├── drone_tracker_utils/      # Shared utilities
│   ├── video_publisher_node/     # Video + telemetry publisher
│   ├── yolo_detection_node/      # YOLOv8 inference + tracking
│   ├── georeferencing_node/      # Pixel → GPS conversion
│   └── map_server_node/          # Data aggregation + export
├── detection/                    # Model training pipeline (YOLOv8)
├── web/                          # Flask web dashboard
├── scripts/                      # Debug and utility tools
└── docs/                         # Extended notes and project state

Georeferencing Algorithm

  1. Receive detection centroid in pixel space (640×512)
  2. Normalize to [-0.5, 0.5] range
  3. Compute subtended angle using horizontal/vertical FOV
  4. Apply drone orientation corrections (yaw, pitch — roll reserved)
  5. Calculate horizontal displacement in meters using trigonometry
  6. Convert meter offset → lat/lon delta
  7. Apply Kalman filter for temporal smoothing
  8. Reject results with distance > max_distance meters

Roadmap

Status Item
In progress Inference time optimization — target < 25 ms per frame
In progress Model weight reduction via pruning and quantization
Planned Multispectral model training (thermal + RGB fusion)
Planned Paper submission — proposed title tied to the multispectral model
Planned Synthetic SAR dataset generation for data augmentation and viability comparison

License

MIT License — see LICENSE for details.


Built with ROS2 Humble · YOLOv8 · Python 3.10

About

Real-time person detection and GPS geolocation from thermal drone video — ROS2 Humble + YOLOv8 + Flask

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages