"Dedrone costs $50,000. This runs on a MacBook Air."
Real-time drone detection and tracking built on YOLO26 MLX — running entirely on Apple Silicon with no cloud, no internet, and no $50k hardware contract.
Built for the YOLO26 MLX Build Challenge (Enterprise track) in response to a real pain point: unauthorized drones are an active and growing threat for law enforcement, correctional facilities, and event security. Existing commercial solutions cost $50k–$500k+ and require cloud infrastructure. DroneWatch runs on a $600 Mac mini.
- Real-time detection from webcam or video file — YOLO26n fine-tuned on 418 drone/bird/plane images
- Persistent track IDs — drones keep their ID even when briefly occluded
- Permanent drone lock — once confirmed as a drone, the track never downgrades (handles bird/drone overlap)
- Audio alert — fires a ping on first detection with 3-second cooldown to avoid spam
- Annotated video recording — saves evidence MP4 with bounding boxes and track IDs
- 100% on-device — MLX Metal acceleration on M1–M4, no internet required
# Clone and install
git clone https://github.com/jesusr04/drone-detection.git
cd drone-detection
python -m venv .venv && source .venv/bin/activate
pip install -e . --no-deps
pip install numpy opencv-python lap scipy
# Run live detection (built-in webcam)
python detect_drones.py
# iPhone as webcam via Continuity Camera
python detect_drones.py --source 1
# Run on a video file
python detect_drones.py --source path/to/video.mp4
# Save annotated output video
python detect_drones.py --source 0 --save
# Use retrained weights with faster tracker
python detect_drones.py --model runs/train/exp/best.safetensors --conf 0.25 --tracker bytetrack| Flag | Default | Description |
|---|---|---|
--model |
models/yolo26n-drone.safetensors |
Path to model weights |
--source |
0 |
Camera index or video file path |
--conf |
0.20 |
Detection confidence threshold |
--tracker |
configs/dronewatch.yaml |
Tracker config (bytetrack for faster) |
--save |
off | Save annotated video to results/ |
Press q to quit.
Camera / Video File
↓
cv2.VideoCapture
↓
YOLO26n-MLX (fine-tuned on drones)
model.track(persist=True)
↓
Permanent drone lock logic
└── 4 consecutive detections → confirmed drone
└── Confirmed tracks never downgrade (handles bird/drone overlap)
↓
Alert: audio ping + console log
↓
Annotated frame → live display + optional saved video
Dataset: 418 labeled images (Bird / Drone / Plane) from Roboflow, supplemented with personal drone footage.
python retrain.py
# Weights saved to runs/train/exp/best.safetensorsConfig: configs/drone.yaml
| Split | Images |
|---|---|
| Train | 318 |
| Val | 77 |
| Test | 23 |
Classes: Bird (0), Drone (1), Plane (2)
- Apple Silicon Mac (M1–M4) — MLX is Apple Silicon only
- Python 3.10–3.12
- macOS 12+
- Camera access granted in System Settings → Privacy & Security → Camera
- YOLO26 MLX — pure MLX YOLO26 implementation by webAI
- MLX — Apple's ML framework
- OpenCV — video capture and display
- ByteTrack / BoT-SORT — multi-object tracking with persistent IDs
AGPL-3.0 — see LICENSE