AksharKher-30/AeroDetect
AeroDetect is a real-time object detection project that identifies drones, helicopters, and airplanes in images and videos using a custom-trained YOLOv11n model. The project includes a web interface built with FastAPI that allows users to upload media and visualize detection results instantly.
Drone, Helicopter, and Aircraft Detection using YOLOv11n ๐
This project demonstrates an end-to-end pipeline for detecting drones, helicopters, and airplanes in both images and videos using the YOLOv11n object detection model. It features a clean web interface built with FastAPI and allows users to upload multiple images or a video file, view previews, and see real-time predictions.
๐ Project Overview
This repository provides a complete solution to:
- Detect drones, helicopters, and aircraft in both images and videos
- Use a custom-trained YOLOv11n object detection model
- Preview uploaded media and visualize detections on the web
- Run a FastAPI backend with a modern HTML/CSS/JS frontend
- Upload multiple images (batch detection) or a single video for processing
- Organize and serve predictions without saving unnecessary files permanently
๐ Project Structure
drone-detection-app/
โโโ app/
โ โโโ main.py # FastAPI app with endpoints
โ โโโ model.py # YOLOv11n model loading and prediction logic
โ โโโ utils.py # Utility functions (e.g., video processing)
โ โโโ uploads/ # Temporary storage for uploaded files
โ โโโ output/ # Stores processed video results
โ
โโโ static/
โ โโโ web.css # CSS styling for the web interface
โ โโโ web.js # JS logic for uploading, previews, detection
โ
โโโ templates/
โ โโโ web.html # Jinja2 HTML template for the main UI
โ
โโโ data/ # YOLO formatted dataset
โ โโโ images/
โ โ โโโ train/ test/ val/
โ โโโ labels/
โ โ โโโ train/ test/ val/
โ โโโ dataset.yaml
โ
โโโ csv_to_yolo.py # Converts annotation CSV to YOLO format
โโโ drone_detection.ipynb # Model training notebook
โโโ test.jpg # Example image
โโโ yolov11n.pt # Trained YOLOv11n model weights
โโโ runs_n/, runs/ # YOLO training outputs (optional)โ๏ธ Installation
- Clone the Repository
git clone https://github.com/AksharKher-30/AeroDetect.git
cd drone-detection-app- Install Dependencies
pip install -r requirements.txtMake sure you have Python 3.8+ and pip installed on your system.
- Start the Web Server
uvicorn app.main:app --reloadVisit: http://127.0.0.1:8000
๐ Data Preparation
- The dataset contains annotations in Pascal VOC (XML) format for drones, helicopters, and airplanes.
- To convert them into YOLO format, use the provided script:
python csv_to_yolo.py
This script will:
- Parse all XML annotation files from the dataset
- Convert bounding box annotations to YOLO-compatible .txt format
- Automatically place the converted .txt files into the corresponding labels/ directoies.
Ensure your dataset is structured as follows before training:
data/
โโโ images/
โ โโโ train/
โ โโโ val/
โ โโโ test/
โโโ labels/
โโโ train/
โโโ val/
โโโ test/
โ ๏ธ Make sure the image and label filenames match exactly for YOLO training or you can change the path in the code if different names of files/folder.
The trained weights will be saved under:
Aero Detect/runs_n/drone_train_n/drone_detector_n/weights/best.pt
โโโ best.pt
โโโ last.ptbest.pt is used for inference.
๐งช How to Use
After starting the webpage:
๐ Image Prediction
- Upload up to 8 images
- Preview appears instantly
- Click Detect to see prediction overlays
๐๏ธ Video Prediction
- Upload one video (MP4 format recommended)
- Preview shows the original video
- Click Detect to view the result in-place
๐ Performance
Validation results on the test set using YOLOv11n
Image size: 512, Confidence threshold: 0.35, IoU threshold: 0.5
| Class | Images | Instances | Precision | Recall | mAP@0.5 | mAP@0.5:0.95 |
|---|---|---|---|---|---|---|
| All | 603 | 497 | 0.920 | 0.928 | 0.936 | 0.592 |
| Drone | 220 | 224 | 0.887 | 0.879 | 0.874 | 0.447 |
| Helicopter | 140 | 140 | 0.985 | 0.964 | 0.981 | 0.676 |
| Airplane | 133 | 133 | 0.887 | 0.940 | 0.952 | 0.655 |