Skip to content

lanarkite99/Aircraft-Detection

Repository files navigation

✈️ Aircraft Detection with YOLOv10

This repository contains a high-accuracy computer vision model for real-time detection and classification of 43 types of military aircraft using YOLOv10 (from Ultralytics). The model achieves approximately 88% mean Average Precision (mAP) on a custom dataset of over 20,000 labeled images, covering fighters, bombers, helicopters, UAVs, and more.

Docker Python YOLO SaladCloud

🎯 Overview

This project implements an aircraft detection system using a custom-trained YOLOv10m model. Upload videos through an intuitive Gradio interface and receive annotated videos with detected aircraft highlighted in real-time.

Live Demo: https://tamarillo-oregano-aexisuv87wlchtmj.salad.cloud/gradio

🎬 Demo

Watch Demo Video

✨ Features

  • YOLOv10m Model: 15.3M parameters, 136 layers, optimized for accuracy and speed
  • **Real-World Focus: Optimized for challenging aerial environments with weather variations, occlusions, and diverse angles.
  • Web Interface: User-friendly Gradio UI for video upload and processing
  • REST API: FastAPI backend with health monitoring endpoints
  • Cloud Deployment: Containerized and deployed on SaladCloud
  • Production Ready: Comprehensive health probes and logging

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Gradio UI     β”‚  ← User uploads video
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  FastAPI Server β”‚  ← Handles requests
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  YOLOv10m Model β”‚  ← Inference engine
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Annotated Video β”‚  ← Output with detections
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“‹ Requirements

  • Python 3.10+
  • CUDA 11.8+ (for GPU acceleration)
  • Docker (for containerization)
  • 4GB+ RAM
  • GPU with 8GB+ VRAM (optional but recommended)

Performance

Dataset: Custom-curated collection of 20k+ images sourced from public military aviation datasets. Metrics: mAP@0.5: ~88% Inference Speed: ~30 FPS on RTX 3060 (cloud); targeted <10ms on Jetson Orin.

Classes (partial list):

Fighters: F-16, F-22, Su-27, MiG-29 Bombers: B-52, B-1B, Tu-95 Helicopters: AH-64 Apache, CH-47 Chinook UAVs: MQ-9 Reaper, RQ-4 Global Hawk (Full list in classes.yaml)

πŸš€ Quick Start

Local Development

  1. Clone the repository
git clone https://github.com/lanarkite99/Aircraft-Detection.git
cd Aircraft-Detection
  1. Install dependencies
pip install -r requirements.txt
  1. Download the model (if not included)
 best_90-100_colab.pt
  1. Run the application
# Option 1: Run with Gradio interface only
python app.py

# Option 2: Run with FastAPI + Gradio
uvicorn main:app --host 0.0.0.0 --port 7860
  1. Access the interface

Docker Deployment

  1. Build the Docker image
docker build -t aircraft-detection .
  1. Run the container
docker run -p 7860:7860 aircraft-detection
  1. With GPU support
docker run --gpus all -p 7860:7860 aircraft-detection

Deploy to SaladCloud

  1. Push image to registry
docker tag aircraft-detection ghcr.io/lanarkite99/yolo-gradio:latest
docker push ghcr.io/lanarkite99/yolo-gradio:latest
  1. Configure SaladCloud deployment
  • Image: ghcr.io/lanarkite99/yolo-gradio:latest
  • Port: 7860
  • GPU: RTX 3090 or RTX A5000
  • Resources: 8 vCPU, 16GB RAM
  1. Set up health probes
Startup Probe:
  Path: /started
  Initial Delay: 120s
  Period: 15s
  Timeout: 30s

Readiness Probe:
  Path: /ready
  Initial Delay: 180s
  Period: 15s

Liveness Probe:
  Path: /live
  Initial Delay: 180s
  Period: 30s

πŸ“ Project Structure

Aircraft-Detection/
β”œβ”€β”€ app.py                    # Gradio interface and YOLO inference
β”œβ”€β”€ main.py                   # FastAPI server with health probes
β”œβ”€β”€ Dockerfile                # Container configuration
β”œβ”€β”€ requirements.txt          # Python dependencies
β”œβ”€β”€ best_90-100_colab.pt     # Trained YOLOv10m model weights
└── README.md                 # This file

πŸ”§ Configuration

Model Parameters

# Inference settings (app.py)
conf=0.35              # Confidence threshold
imgsz=640              # Input image size (480 for CPU)
vid_stride=1           # Frame sampling rate (2 for CPU)
max_det=300            # Maximum detections per image
half=True              # FP16 inference (GPU only)

Server Settings

# FastAPI configuration (main.py)
host="0.0.0.0"         # Listen on all interfaces
port=7860              # Default port
workers=1              # Uvicorn workers

πŸ“Š Model Details

  • Architecture: YOLOv10m
  • Parameters: 15,340,381
  • Layers: 136
  • GFLOPs: 59.0
  • Training: Custom dataset (airplane detection)
  • Framework: Ultralytics YOLO

HW Recommendations

-Training: GPU (e.g., RTX 30-series, 16GB VRAM). -Inference: CPU/GPU; Edge: NVIDIA Jetson Orin Nano (8GB).

πŸ” API Endpoints

Endpoint Method Description
/ GET API information
/gradio GET Gradio web interface
/started GET Startup probe
/ready GET Readiness probe
/live GET Liveness probe
/health GET Health check

πŸ› Troubleshooting

Common Issues

  1. NumPy Compatibility Error
# Solution: Pin NumPy version
pip install "numpy<2.0.0,>=1.23.0"
  1. Model Not Found
# Ensure model file exists
ls -lh best_90-100_colab.pt
  1. CUDA Out of Memory
# Reduce batch size or image size
imgsz=480  # Instead of 640
  1. Probe Failures on SaladCloud
  • Increase startup probe initial delay to 120s+
  • Verify image URL includes full path: ghcr.io/username/repo:tag
  • Check container logs for startup errors

πŸ“ Dependencies

Core

  • torch==2.2.0 - Deep learning framework
  • ultralytics>=8.0.0 - YOLO implementation
  • numpy<2.0.0 - Array operations

Web Framework

  • fastapi - REST API server
  • uvicorn[standard] - ASGI server
  • gradio - Web UI framework

Computer Vision

  • opencv-python-headless - Video processing
  • pillow - Image operations
  • imageio-ffmpeg - Video encoding

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is open source and available under the MIT License.

πŸ™ Acknowledgments

  • Ultralytics for YOLOv10 implementation
  • Gradio for the web interface framework
  • SaladCloud for cloud GPU infrastructure
  • PyTorch team for the deep learning framework

πŸ“§ Contact

Project Link: https://github.com/lanarkite99/Aircraft-Detection


Note: This project uses a custom-trained model. The model weights (best_90-100_colab.pt) are specific to aircraft detection and were trained on a specialized dataset.

About

Detect 47 types of military Aircraft using YOLOv10

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors