Skip to content

adityanaulakha/Build-with-India-Space-Station-Hackathon

Repository files navigation

🛰️ OrbitalVision: Multi-Camera AI Detection System

Build-with-India-Space-Station-Hackathon 2025

Python YOLOv8 Streamlit DeepSORT License

An advanced real-time object detection system powered by Custom YOLOv8 models with DeepSORT tracking capabilities and Streamlit dashboard for comprehensive multi-mode detection operations. Designed for detecting space-critical objects including Fire Extinguishers, Tool Boxes, and Oxygen Tanks.


🌌 Project Overview

HackByte Detection Dashboard delivers a comprehensive object detection solution with multiple operational modes:

  • Custom YOLOv8 Models trained for space-critical object detection (FireExtinguisher, ToolBox, OxygenTank)
  • Multi-Mode Detection supporting images, videos, webcam, and batch processing
  • DeepSORT Object Tracking for persistent object identification across frames
  • Interactive Web Dashboard with real-time performance monitoring
  • Eco Mode Optimization for resource-efficient processing
  • Advanced Visualization with confidence scores and detection analytics

🎯 Key Features

Multi-Modal Detection Engine

  • Custom YOLOv8 Models: Three model variants (Nano/Eco, Small, Medium) for different performance needs
  • Six Detection Modes:
    • 📸 Image Detection: Single image analysis with confidence scoring
    • 🎥 Video Detection: Frame-by-frame video processing with export capabilities
    • 📷 Multiple Images: Batch processing of multiple images simultaneously
    • 📹 Webcam Detection: Real-time live camera feed processing
    • 🌱 Eco Mode: Resource-optimized detection for energy efficiency
    • 🎯 DeepSORT Tracking: Advanced object tracking across video frames

🚀 Advanced Detection Capabilities

  • Multi-Model Architecture: Choose between Nano (Eco), Small, and Medium models
  • Real-Time Processing: Live webcam detection with FPS monitoring
  • Object Tracking: Persistent object identification using DeepSORT algorithm
  • Confidence Filtering: Adjustable detection thresholds for optimal results
  • Export Functionality: Save detection results and annotated videos

📊 Interactive Dashboard

  • Home Page: Comprehensive project overview with performance metrics
  • Model Selection: Dynamic switching between YOLOv8 model variants
  • Live Statistics: Real-time detection counts and performance monitoring
  • Visual Analytics: Annotated results with bounding boxes and confidence scores
  • Resource Monitoring: GPU status, memory usage, and processing speed

🏗️ Project Structure

HackByte_Dataset/
├── 📱 Home.py                   # Main Dashboard Home Page
├── 📱 app.py                    # Standalone Detection Application
├── 🔍 predict.py                # YOLOv8 Prediction Engine
├── 🛠️ train.py                  # Model Training Pipeline
├── 🛠️ train_new.py              # Enhanced Training Script
├── 📊 visualize.py              # Detection Visualization Tools
├── 🔧 utils.py                  # Utility Functions (YOLO & DeepSORT)
├── 🎯 get_pages.py              # Page Navigation Handler
├── 📋 classes.txt               # Object Classes (FireExtinguisher, ToolBox, OxygenTank)
├── 📋 requirements.txt          # Python Dependencies
├── 📋 packages.txt              # Additional Package List
├── 🎯 yolo_params.yaml          # YOLO Configuration Parameters
├── 📦 yolov8*.pt               # Pre-trained YOLOv8 Model Weights
│
├── 📁 pages/                    # Streamlit Pages Directory
│   ├── 📸 image_detection.py   # Single Image Detection Page
│   ├── 🎥 video_detection.py   # Video Processing Page
│   ├── 📷 multiple_images.py   # Batch Image Processing Page
│   ├── 📹 webcam_detection.py  # Live Webcam Detection Page
│   ├── 🌱 eco_mode.py          # Resource-Optimized Detection Page
│   └── 🎯 deep_sort.py         # Object Tracking Page
│
├── 📁 data/                     # Training and Validation Data
│   ├── 📁 train/               # Training Dataset
│   ├── 📁 val/                 # Validation Dataset
│   └── 📁 test/                # Test Dataset
│
├── 📁 output/                   # Detection Results and Exports
│   ├── 🖼️ *.jpg               # Processed Images
│   └── 🎥 *.mp4               # Processed Videos
│
├── 📁 runs/                     # Model Training Outputs
│   └── 📁 detect/              # Detection Results
│       ├── 📁 Nano/            # Nano Model Training Results
│       ├── 📁 predict*/        # Prediction Results
│       └── 📁 train*/          # Training Checkpoints
│
├── 📁 shared/                   # Shared Resources
│   └── 🔧 yolo_loader.py       # Model Loading Utilities
│
├── 📁 trained_model_outputs/    # Custom Trained Models
│   ├── 📁 multi_object_improved/
│   ├── 📁 multi_object_improved2/
│   └── 📁 multi_object_improved3/
│
└── 📁 ENV_SETUP/               # Environment Setup Scripts (Windows)
    ├── create_env.bat          # Virtual Environment Creation
    ├── install_packages.bat    # Package Installation
    └── setup_env.bat           # Complete Setup Script

🚀 Quick Start Guide

1. Environment Setup (Windows)

# Navigate to project directory
cd HackByte_Dataset

# Run automated setup (Windows)
ENV_SETUP\setup_env.bat

# Or manual setup:
python -m venv hackbyte-env
hackbyte-env\Scripts\activate

2. Dependencies Installation

# Install required packages
pip install -r requirements.txt

# Key dependencies include:
# - ultralytics (YOLOv8)
# - streamlit (Web Dashboard)
# - deep-sort-realtime (Object Tracking)
# - opencv-python (Computer Vision)
# - Pillow (Image Processing)

# Verify YOLOv8 installation
python -c "from ultralytics import YOLO; print('YOLOv8 ready!')"

3. Launch Detection Dashboard

# Start the main Streamlit dashboard
streamlit run Home.py

# Or run standalone application
streamlit run app.py

# Application will be available at:
# 🌐 Local URL: http://localhost:8501
# 🔗 Network URL: http://192.168.x.x:8501

🎮 Detection Modes

📸 Image Detection

# Single image analysis with model selection
# Features:
- Upload JPG, JPEG, PNG images
- Choose between Nano, Small, Medium models
- Real-time confidence scoring
- Annotated result visualization
- Detection statistics display

Usage Steps:

  1. Navigate to "Image Detection" page
  2. Select YOLOv8 model variant (Nano/Small/Medium)
  3. Upload your image file
  4. View detection results with bounding boxes
  5. Review confidence scores and detected classes

🎥 Video Detection

# Frame-by-frame video processing
# Supported formats: MP4, MOV, AVI, MKV
# Features:
- Video upload and processing
- Model selection (Nano/Small/Medium)
- Confidence threshold adjustment
- Annotated video export
- Frame-by-frame analysis

📷 Multiple Images

# Batch processing of multiple images
# Features:
- Upload multiple images simultaneously
- Batch detection analysis
- Individual result visualization
- Comprehensive detection summary
- Export processed results

📹 Webcam Detection

# Real-time camera feed processing
# Features:
- Live webcam detection
- Real-time FPS monitoring
- Dynamic model switching
- Camera index selection
- Live detection overlay

🌱 Eco Mode

# Resource-optimized detection
# Features:
- Energy-efficient processing
- Optimized for low-power devices
- Reduced computational overhead
- Maintained detection accuracy

🎯 DeepSORT Tracking

# Advanced object tracking
# Features:
- Multi-object tracking across frames
- Persistent object ID assignment
- Track visualization and statistics
- Video upload support
- Track export capabilities

🧠 Model Specifications

Custom YOLOv8 Architecture

  • Target Classes: 3 specialized objects
    • 🧯 FireExtinguisher: Critical safety equipment detection
    • 🧰 ToolBox: Equipment and tool identification
    • 🫁 OxygenTank: Life support system monitoring

Model Variants

# Available model options:
model_options = {
    "Nano (Eco Mode)": YOLO("models/Nano/weights/best.pt"),     # Lightweight, fast
    "Small": YOLO("models/Small/weights/best.pt"),              # Balanced performance
    "Medium": YOLO("models/Medium/weights/best.pt")             # High accuracy
}

Training Configuration

  • Architecture: YOLOv8 with custom classification head
  • Training Data: Space-environment synthetic dataset
  • Model Weights: Custom trained weights in runs/detect/ directory
  • Input Resolution: Configurable via yolo_params.yaml

🔧 DeepSORT Integration

Object Tracking Pipeline

# DeepSORT tracking implementation (utils.py)
def load_tracker():
    return DeepSort(max_age=30)

def detect_and_track(frame, model, tracker):
    # YOLO detection
    results = model(frame, verbose=False)[0]
    
    # Prepare detections for DeepSORT
    detections = []
    for r in results.boxes.data.tolist():
        x1, y1, x2, y2, score, class_id = r
        detections.append(([x1, y1, x2-x1, y2-y1], score, model.names[int(class_id)]))
    
    # Update tracks
    tracks = tracker.update_tracks(detections, frame=frame)
    return tracks

Tracking Features

  • Multi-Object Tracking: Track multiple objects simultaneously
  • ID Persistence: Maintain object identities across frames
  • Track Visualization: Display tracking paths and IDs
  • Track Statistics: Analyze object movement patterns

⚙️ Configuration

YOLO Parameters (yolo_params.yaml)

# Model configuration
model_path: "models/Nano/weights/best.pt"
confidence_threshold: 0.5
iou_threshold: 0.45
max_detections: 100
input_size: 640

# Training parameters
epochs: 100
batch_size: 16
learning_rate: 0.01
augmentation: true

Environment Setup

# Windows environment variables (set in ENV_SETUP scripts)
set PYTHONPATH=%PYTHONPATH%;%cd%
set YOLO_MODEL_PATH=models\Nano\weights\best.pt
set STREAMLIT_SERVER_PORT=8501

📈 Performance Metrics

Model Performance

Model Variant Size Inference Speed [email protected] Memory Usage
Nano (Eco) 6MB 45ms 0.89 1.2GB
Small 22MB 65ms 0.92 2.1GB
Medium 50MB 95ms 0.94 3.5GB

Detection Classes Performance

Class Precision Recall F1-Score
FireExtinguisher 0.91 0.94 0.92
ToolBox 0.89 0.91 0.90
OxygenTank 0.93 0.92 0.92

System Requirements

  • Minimum: 8GB RAM, Intel i5 or equivalent
  • Recommended: 16GB RAM, NVIDIA GPU (CUDA support)
  • Optimal: 32GB RAM, NVIDIA RTX 3080 or higher

🛡️ Space-Critical Features

Safety Equipment Detection

  • Fire Extinguisher Detection: Critical for emergency response
  • Tool Box Identification: Equipment management and safety
  • Oxygen Tank Monitoring: Life support system oversight

Real-Time Monitoring

  • Live Detection Feed: Continuous monitoring capabilities
  • Alert System: Potential for integration with safety protocols
  • Multi-Camera Support: Comprehensive area coverage

🔧 Development Setup

Local Development

# Clone and setup
git clone https://github.com/adityanaulakha/Build-with-India-Space-Station-Hackathon.git
cd HackByte_Dataset

# Virtual environment setup
python -m venv venv
venv\Scripts\activate  # Windows
source venv/bin/activate  # Linux/Mac

# Install dependencies
pip install -r requirements.txt

# Launch development server
streamlit run Home.py --server.port 8501

Training New Models

# Train custom model
python train.py --data custom_dataset.yaml --epochs 100

# Enhanced training with new script
python train_new.py --config yolo_params.yaml

# Visualize training results
python visualize.py --source runs/detect/train*/

# Test predictions
python predict.py --source test_images/ --weights models/custom/best.pt

Model Evaluation

# Run prediction on test set
python predict.py --source data/test/images/

# Evaluate model performance
python -c "
from ultralytics import YOLO
model = YOLO('models/Nano/weights/best.pt')
model.val(data='data.yaml')
"

🚀 Deployment Options

Local Deployment

# Standard Streamlit deployment
streamlit run Home.py

# Custom port deployment  
streamlit run Home.py --server.port 8080

Docker Deployment

FROM python:3.10-slim

WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt

COPY . .
EXPOSE 8501

CMD ["streamlit", "run", "Home.py", "--server.address", "0.0.0.0"]

Cloud Deployment

  • Streamlit Cloud: Direct GitHub integration
  • AWS/GCP: Container-based deployment
  • Azure: App Service deployment

🏆 Hackathon Achievements

Innovation Highlights

  • Multi-Mode Detection: Six distinct detection modes for comprehensive coverage
  • DeepSORT Integration: Advanced object tracking capabilities
  • Space-Critical Focus: Specialized detection for safety equipment
  • User-Friendly Interface: Intuitive Streamlit dashboard

Technical Accomplishments

  • Custom YOLOv8 Training: Successfully trained on space-specific objects
  • Real-Time Performance: Optimized for live detection applications
  • Modular Architecture: Scalable and maintainable codebase
  • Comprehensive Documentation: Detailed setup and usage guides

🤝 Contributing

Development Workflow

# Fork the repository
git clone https://github.com/adityanaulakha/Build-with-India-Space-Station-Hackathon.git
cd HackByte_Dataset

# Create feature branch
git checkout -b feature/new-detection-mode

# Install development dependencies
pip install -r requirements.txt

# Make changes and test
streamlit run Home.py

# Commit and push
git add .
git commit -m "Add new detection feature"
git push origin feature/new-detection-mode

Code Structure Guidelines

  • Home.py: Main dashboard and navigation
  • pages/: Individual detection mode implementations
  • utils.py: Core detection and tracking utilities
  • models/: Trained model weights and configurations

📄 License & Attribution

MIT License © 2025 HackByte Detection Team

Developed for the Build-with-India-Space-Station-Hackathon 2025
Space-critical object detection using YOLOv8 and DeepSORT

🌟 Acknowledgments

  • HackwithIndia Organizers for the platform and competition
  • Ultralytics Team for the YOLOv8 framework
  • Streamlit Community for the web application framework
  • DeepSORT Contributors for object tracking capabilities

📞 Contact & Support


🚀 Built with ❤️ for BuildwithDelhi 2.0, 2025 🚀

Empowering real-time object detection for space-critical equipment monitoring through advanced AI

Follow Star Forks

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •