# UAV Drone Detection & Tracking **CV Spring 2026 — Assignment 3** ## Overview This project implements a full drone detection and tracking pipeline on two UAV test videos. Drones are detected frame-by-frame using a deep learning object detector, and their positions are tracked across frames using a Kalman filter. The final output is an annotated video per input showing the detector bounding box and a 2D trajectory polyline superimposed on the footage. ## Dataset & Detector Rather than fine-tuning from scratch, a pre-trained YOLOv8x model specifically trained on drone imagery was sourced from HuggingFace (`doguilmak/Drone-Detection-YOLOv8x`). This model was trained on a dedicated drone detection dataset and outputs a single class: `drone`. This approach was chosen over fine-tuning a base COCO model because the base YOLOv8 weights have no drone class — falling back to semantically incorrect labels like `kite` and `airplane`. Inference was run at confidence threshold 0.25 and NMS IoU 0.45 across all frames at 5fps. ## Kalman Filter Design The tracker uses a 4D constant-velocity state vector `[cx, cy, vx, vy]` where `cx, cy` is the bounding box center and `vx, vy` is estimated velocity. Measurements are the 2D center `[cx, cy]` extracted from detector output each frame. | Parameter | Value | Rationale | |-----------|-------|-----------| | Motion model | Constant velocity | Drones move smoothly between frames at 5fps | | R (measurement noise) | 10 × I₂ | Moderate trust in detector output | | Q (process noise) | 0.5 × I₄ | Allows gradual velocity changes | | MAX_MISSED | 10 frames | ~2 seconds gap tolerance before track reset | When the detector misses the drone, the filter predicts forward using the velocity estimate. After 10 consecutive missed frames the track is dropped and re-initialized on the next detection. ## Failure Cases - **Fast motion:** At 5fps a fast-moving drone can shift significantly between frames, causing the constant-velocity model to lag behind sharp direction changes. - **Occlusion:** Short occlusions are handled by prediction-only coasting. Longer occlusions exceed MAX_MISSED and cause a track reset. - **Single-object assumption:** The pipeline takes the highest-confidence detection per frame. Scenes with multiple drones would require multi-object tracking with Hungarian assignment. ## Output Videos - `drone_video_1_tracked.mp4` - `drone_video_2_tracked.mp4`