Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Aircraft Component Detector

Intelligent Computer Vision System for Aircraft Maintenance & Component Analysis

A deep learning framework demonstrating how to build automated aircraft component detection systems using YOLOv8, Grounding DINO, and advanced vision-language models for real-world maintenance and analysis applications.

Author: Ishan

Python YOLOv8 PyTorch License


🎯 Project Overview

This comprehensive framework detects 40+ aircraft components including cylinders, magnetos, carburetors, fuel systems, engine components, and airframe structures. It demonstrates:

  • Real-time Detection: YOLOv8-based object detection with configurable confidence thresholds
  • Automated Labeling: Grounding DINO vision-language model for AI-powered annotation
  • Data Pipeline: Web scraping, image cleaning, and dataset organization
  • Web Deployment: Interactive Flask API for inference and visualization
  • Production Architecture: End-to-end system from raw data to deployment

Key Achievement: A complete ML system demonstrating automated pipeline architecture that transforms raw aircraft imagery into annotated datasets and production-ready models without manual labeling.

📦 What's Included in This Repository

Available on GitHub ✅:

  • aircraft_detector_app.py - Flask REST API web application
  • yolo_detector.py - YOLOv8 detection inference engine
  • autolabel_grounding_dino.py - Vision-language auto-labeling framework
  • data_cleaner.py - Image validation and preprocessing utilities
  • scrape.py & scrape_engine_bay_detailed.py - Web scraping engines
  • aircraft_components/ - Sample component reference images
  • latest_scripts/ - Core ML pipeline components
  • requirements.txt - All Python dependencies
  • Documentation: DATA_PREP_GUIDE.md, PIPELINE_GUIDE.md, DATASET_SOURCES.md, OPENIMAGES_GUIDE.md
  • Complete source code and inline documentation

Not Included (excluded by .gitignore) ❌:

  • *.pt model files (auto-downloaded on first run via Ultralytics)
  • datasets_prepared/ - Large processed datasets (multi-GB)
  • runs/ - Training artifacts and checkpoints
  • aircraft_labeled/ - Labeled training data
  • Raw image collections from scrapers
  • Google Open Images V7 dataset copy

🏗️ Architecture & Core Components

The project implements a complete 4-phase ML pipeline architecture:

Phase 1️⃣ Data Collection (scrape*.py) ✅

Available: Scraping engine source code

  • Method: Web scraping from Wikimedia Commons, Flickr, DuckDuckGo
  • Technology: duckduckgo_search, requests, custom scraping logic
  • Datasets: Designed to integrate with Roboflow, Zenodo, OpenImages
  • Output: Structured image collection pipeline
  • Note: ❌ Actual datasets not included (download via provided scripts)

Phase 2️⃣ Data Organization & Cleaning (data_cleaner.py) ✅

Available: Data preprocessing source code

  • Functionality: Image validation, format standardization, corruption detection
  • Organization: Structured directory creation for training datasets
  • Metadata: JSON inventory and tracking support
  • Note: ❌ Processed datasets directory excluded (generate by running pipeline)

Phase 3️⃣ Automated Component Labeling (autolabel_grounding_dino.py) ✅

Available: Vision-language labeling framework

  • Method: Grounding DINO for intelligent auto-annotation
  • Features:
    • Generates bounding box annotations programmatically
    • Detects 40+ aircraft component types
    • YOLO-compatible output format
    • No manual labeling required
  • Technology: Hugging Face transformers, autodistill, segment-anything
  • Note: ❌ Auto-labeled datasets not included (generate by running script)

Phase 4️⃣ Model Training & Deployment ✅

Available: Detection inference engine + Flask deployment

  • Detection (yolo_detector.py):
    • YOLOv8 inference with configurable thresholds
    • Type-safe Detection objects with JSON serialization
    • CPU/GPU support
  • Web API (aircraft_detector_app.py):
    • Flask REST API for image upload
    • Interactive web UI for real-time detection
    • JSON-based results export
  • Note: ❌ Trained model weights and training scripts not included (use YOLOv8 fine-tuning)

💻 Tech Stack

Category Technology
ML Framework PyTorch 2.0+, Ultralytics YOLOv8
Vision Models Grounding DINO, Segment Anything, YOLOv8
Language Model Hugging Face Transformers
Backend Flask, Python 3.8+
Data Processing OpenCV, Pillow, Scikit-learn
APIs & SDKs Roboflow, Hugging Face Hub
Deployment Docker-ready, REST API

🚀 Quick Start

Prerequisites

  • Python 3.8 or higher
  • 4GB+ RAM (8GB+ recommended for advanced features)
  • GPU optional (NVIDIA CUDA 11.8+) for faster inference
  • Internet connection (downloads YOLOv8 models on first run)

Installation

# Clone repository
git clone https://github.com/Ish45883/AI-Aircraft-component-detector.git
cd AI-Aircraft-component-detector

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

Note: YOLOv8 model files (~40MB) will be automatically downloaded on first detection call.

Basic Usage ✅ Available on GitHub

1. Detect Components in an Image

from latest_scripts.yolo_detector import YoloDetector
import cv2

# Initialize detector (downloads YOLOv8n model on first use)
detector = YoloDetector(model_path="yolov8n.pt")

# Load image and detect
image = cv2.imread("path/to/aircraft/image.jpg")
detections = detector.detect_bgr(image, conf=0.25)

# Process results
for detection in detections:
    label = detection.label
    confidence = detection.confidence
    bbox = detection.bbox_xyxy  # (x1, y1, x2, y2)
    print(f"Found: {label} @ Confidence: {confidence:.1%}")

2. Launch Interactive Web UI

python aircraft_detector_app.py

Access at http://localhost:5000

Features:

  • Upload aircraft images for real-time detection
  • Adjust confidence threshold dynamically
  • View annotated results with bounding boxes
  • Export detections as JSON
  • Clean web interface for quick analysis

3. Auto-Label Your Own Images ✅ Available on GitHub

from latest_scripts.autolabel_grounding_dino import GroundingDinoLabeler

labeler = GroundingDinoLabeler()
# Use for generating annotations on custom datasets
# See script for complete usage examples

4. Scrape Aircraft Images from Web ✅ Available on GitHub

# Scrape aircraft images from multiple sources
python scrape_engine_bay_detailed.py

# Clean and validate collected images
python data_cleaner.py --input scraped_images/ --output cleaned_images/

Extended Pipeline & Data Processing

The repository includes reference scripts for building complete pipelines with your own datasets:

# Phase 1: Download datasets from multiple sources
python scripts/download_datasets.py --sources roboflow zenodo

# Phase 2: Organize and prepare datasets
python scripts/organize_scraped_images.py
python scripts/convert_formats.py

# Phase 3: Auto-label your images with Grounding DINO
python scripts/phase3_batch_autolabel.py --input ./images --output ./annotations

# Phase 4: Train YOLO on your annotated dataset
python scripts/phase4_train_yolo.py --data dataset.yaml --epochs 50

📖 See Complete Documentation:

  • PIPELINE_GUIDE.md - Full pipeline walkthrough with detailed steps
  • DATA_PREP_GUIDE.md - Data collection and preparation workflow
  • DATASET_SOURCES.md - Information on data sources and licensing
  • OPENIMAGES_GUIDE.md - Working with large-scale OpenImages dataset

These scripts demonstrate the complete architecture—adapt them for your custom datasets and use cases.


📁 Project Structure

AI-Aircraft-component-detector/                    # Repository root
├── aircraft_detector_app.py                       # ✅ Flask web application
├── data_cleaner.py                                # ✅ Image cleaning utility
├── requirements.txt                               # ✅ Python dependencies
├── scrape.py                                      # ✅ Web scraping engine
├── scrape_engine_bay_detailed.py                  # ✅ Advanced scraping
│
├── latest_scripts/                                # ✅ Core ML components
│   ├── yolo_detector.py                          # ✅ Detection inference engine
│   ├── autolabel_grounding_dino.py               # ✅ Auto-labeling framework
│   ├── aircraft_classes.yaml                     # ✅ Component class definitions
│   ├── labeling_optimized.py                     # Annotation optimization
│   ├── train.py                                  # Training orchestration
│   └── roboflow_label.py                         # Roboflow dataset integration
│
├── aircraft_components/                           # ✅ Sample component reference images
│   └── [aircraft component images]
│
├── DATA_PREP_GUIDE.md                             # ✅ Data preparation documentation
├── DATASET_SOURCES.md                             # ✅ Dataset sources & licensing
├── OPENIMAGES_GUIDE.md                            # ✅ OpenImages integration guide
├── PIPELINE_GUIDE.md                              # ✅ Complete pipeline documentation
│
├── scripts/                                       # Reference pipeline scripts
│   ├── download_datasets.py                      # Multi-source dataset downloader
│   ├── organize_scraped_images.py                # Image organization utility
│   ├── convert_formats.py                        # Format conversion tools
│   ├── phase3_batch_autolabel.py                 # Batch auto-labeling
│   └── phase4_train_yolo.py                      # YOLO training orchestration
│
├── google_open_images_v7/                         # ❌ Large dataset (not in repo)
├── datasets_prepared/                             # ❌ NOT INCLUDED (multi-GB)
├── runs/                                          # ❌ NOT INCLUDED (artifacts)
└── aircraft_labeled/                              # ❌ NOT INCLUDED (labeled data)

✅ Available on GitHub:

  • Core detection & inference code
  • Auto-labeling framework
  • Web application API
  • Data cleaning & scraping utilities
  • Complete documentation & guides
  • Component reference images

❌ Not Included (too large):

  • *.pt model files (downloaded on first run)
  • Large datasets (Roboflow, Zenodo, OpenImages copies)
  • Training artifacts (runs/ directory)
  • Raw image collections
  • Processed dataset directories

🎓 Detected Components

The system can identify 40+ aircraft components across multiple categories:

Engine Components

  • Cylinders, Pistons, Spark Plugs
  • Magnetos, Carburetors, Fuel Pumps
  • Alternators, Starter Motors
  • Oil Filters, Air Filters
  • Exhaust Systems, Intake Manifolds

Airframe & Structural

  • Wings, Fuselage, Tail Section
  • Wing Spars, Longerons
  • Propellers, Landing Gear
  • Cockpit Windows, Control Surfaces

Avionics & Systems

  • Engine Instruments
  • Navigation Equipment
  • Electrical Systems
  • Hydraulic Components

See latest_scripts/aircraft_classes.yaml for complete class definitions.


📊 Performance & Results

  • Component Detection: 40+ aircraft component types with high precision
  • Inference Speed: Real-time detection on CPU (30-100ms per image)
  • GPU Support: Accelerated inference with NVIDIA CUDA
  • Model Size: YOLOv8n optimized for edge deployment (~3-4MB)
  • Memory Efficiency: ~100-200MB RAM for inference
  • Auto-Labeling: AI-powered annotations via Grounding DINO (no manual effort)

Available Benchmark (reference):

  • Dataset: 1,052+ aircraft images
  • Training: Standard YOLOv8n configuration
  • Optimization: CPU and GPU-compatible architecture

🔧 Configuration

Environment Variables

Create a .env file in the project root:

ROBOFLOW_API_KEY=your_api_key_here
FLASK_ENV=production
CONFIDENCE_THRESHOLD=0.25

Model Configuration

Edit latest_scripts/aircraft_classes.yaml to customize:

  • Component class definitions
  • Detection thresholds
  • Training parameters

📚 Resources & Documentation

📖 In-Repository Guides (included):

🌐 External Framework Documentation:


🤝 Integration & APIs ✅ Available on GitHub

REST API Endpoints

POST /detect
  - Upload image for detection
  - Parameters: image (file), conf (float, 0-1)
  - Returns: JSON with detections, annotated image

GET /health
  - System health check
  - Returns: status, model info

Python SDK

from latest_scripts.yolo_detector import YoloDetector, Detection

detector = YoloDetector("yolov8n.pt")
detections: List[Detection] = detector.detect_bgr(cv2_image, conf=0.25)

for det in detections:
    x1, y1, x2, y2 = det.bbox_xyxy
    print(f"{det.label}: {det.confidence:.1%}")

🛠️ Development Features

Quality & Reliability

  • ✅ Type hints throughout codebase
  • ✅ Modular, reusable components
  • ✅ Comprehensive error handling
  • ✅ Logging and monitoring ready
  • ✅ Configuration management

Scalability

  • 📦 Multi-source data integration
  • 🔄 Batch processing pipelines
  • ⚙️ Hardware-agnostic (CPU/GPU support)
  • 🎯 Optimized inference engine

Production Ready

  • 🚀 Flask REST API
  • 📊 JSON output serialization
  • 🔐 Environment-based configuration
  • 📈 Model versioning support

🎯 Use Cases

  1. Aviation Maintenance: Technicians use the web UI to identify components in maintenance photos
  2. Documentation Systems: Automated component tagging in technical manuals
  3. Training Programs: Educational tool for aviation engineers and technicians
  4. Quality Control: Automated verification in manufacturing and restoration facilities
  5. Research: Computer vision research on specialized domain detection

📈 Future Enhancements

  • Multi-model ensemble for higher accuracy
  • Real-time video stream processing
  • Component anomaly detection
  • Advanced metrics dashboard
  • Mobile app deployment
  • Edge device optimization (TensorRT, ONNX)

📝 License

This project is licensed under the MIT License - see LICENSE file for details.

Data Sources License Compliance:

  • Roboflow: CC BY 4.0
  • Zenodo: CC BY
  • OpenImages: CC BY 4.0 / CC BY-SA 4.0

👤 Author & Contact

Ishan | Full-Stack ML Engineer

  • 🎯 Computer Vision & Deep Learning specialist
  • 🚀 Production ML systems & scalable deployment
  • ✈️ Aircraft component detection & aerospace research
  • 💻 End-to-end ML pipeline architecture

Repository: github.com/Ish45883/AI-Aircraft-component-detector


📞 Contributing & Support

For questions, issues, or contributions:

  1. Check the code: Review script docstrings and inline comments for implementation details
  2. Review the architecture: Examine the phase components to understand the design
  3. Run examples: Use the available scripts to see the framework in action
  4. Adapt & extend: The architecture is designed to be modifiable for custom domains

Contributions are welcome! Feel free to submit issues or pull requests.


🏆 Key Achievements

Complete Framework: End-to-end architecture from data collection to deployment ✅ Zero Manual Labeling: AI-powered auto-annotation using Grounding DINO
Production Quality: REST API + interactive web interface ready to deploy ✅ Generalized Design: Adaptable for any object detection domain beyond aircraft ✅ Clean Codebase: Type hints, modular architecture, reusable components ✅ Optimized Performance: Lightweight YOLOv8n for real-time inference on CPU


Last Updated: May 2026 | GitHub: Ish45883/AI-Aircraft-component-detector | Status: Active Development

About

A deep learning framework demonstrating how to build automated aircraft component detection systems using YOLOv8, Grounding DINO, and advanced vision-language models for real-world maintenance and analysis applications.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages