GitHunt
AK

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

  1. Clone the Repository
git clone https://github.com/AksharKher-30/AeroDetect.git
cd drone-detection-app
  1. Install Dependencies
pip install -r requirements.txt

Make sure you have Python 3.8+ and pip installed on your system.

  1. Start the Web Server
uvicorn app.main:app --reload

Visit: 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.pt

best.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

๐Ÿš€ Working Demo

demo.mp4