AI-Powered Safety Equipment Detection System for Space Stations
A complete full-stack solution combining YOLOv8-based object detection with a cross-platform mobile application for real-time safety equipment monitoring in space station environments.
ok2.mp4
- Overview
- Features
- Architecture
- Quick Start
- AI Engine Setup
- Mobile App Setup
- API Documentation
- Model Performance
- Project Structure
- Deployment
- Contributing
SafeOrbit is an intelligent safety monitoring system designed for space station environments. It combines advanced computer vision with a modern mobile interface to detect and track critical safety equipment in real-time.
- AI Engine: YOLOv8m-based object detection model achieving 86.4% mAP@0.5
- Mobile App: Cross-platform React Native application with on-device ML inference
- REST API: FastAPI backend for model serving and real-time predictions
- ONNX Runtime: On-device inference for iOS, Android, and web platforms
The system identifies 7 critical safety equipment classes:
| Class ID | Equipment | Purpose |
|---|---|---|
| 0 | Oxygen Tank | Emergency oxygen supply |
| 1 | Nitrogen Tank | Nitrogen storage |
| 2 | First Aid Box | Medical emergency kit |
| 3 | Fire Alarm | Fire detection system |
| 4 | Safety Switch Panel | Emergency control panel |
| 5 | Emergency Phone | Emergency communication |
| 6 | Fire Extinguisher | Fire suppression equipment |
- High Accuracy: 86.7% mAP@0.5, 95.52% precision
- Real-time Processing: Fast inference with ONNX optimization
- Multi-platform: CPU and GPU support with automatic fallback
- Domain Adaptation: Optimized for real-world space station imagery
- Cross-platform: iOS, Android, and web support via React Native
- Live Scanning: Real-time camera-based object detection
- On-device ML: ONNX Runtime for privacy and speed
- Secure Authentication: Clerk-based authentication system
- Analytics Dashboard: Visual insights and scanning history
- Offline Capable: Core detection works without internet
- TypeScript: 100% type-safe codebase
- Modern UI: Tailwind CSS via NativeWind
- Production Ready: Comprehensive logging and error handling
- Well Documented: Extensive documentation and code comments
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Mobile App (React Native) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β’ Expo Router navigation β
β β’ On-device ONNX inference β
β β’ Real-time camera scanning β
β β’ Analytics dashboard β
β β’ Clerk authentication β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β REST API (FastAPI) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β’ /predict endpoint β
β β’ Base64 image processing β
β β’ CORS handling β
β β’ Health checks β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AI Engine (YOLOv8m) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β’ YOLOv8m architecture β
β β’ Custom trained weights (204 epochs) β
β β’ ONNX export support β
β β’ CPU/GPU inference β
β β’ Advanced augmentation pipeline β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Python: 3.8 or higher
- Node.js: 18.x or higher
- Git: Latest version
- Expo CLI: For mobile development
- CUDA (optional): For GPU acceleration
git clone https://github.com/Namann-14/safeorbit.git
cd safeorbitcd ai-engine
pip install -r requirements.txtCreate .env file (optional):
MODEL_PATH=results/improved_model/train/weights/best.pt
DEVICE=cpuStart the API server:
python api.pyThe API will be available at http://localhost:8000
cd expo
npm installConfigure environment variables in .env.local:
EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_key_here
EXPO_PUBLIC_API_BASE_URL=http://localhost:8000Start the development server:
npm run dev- API Documentation: http://localhost:8000/docs
- Mobile App: Scan QR code with Expo Go or press
i/afor simulator
The AI engine includes comprehensive training scripts and configurations.
Basic Training:
cd ai-engine
python train.pyAdvanced Training with Optimization:
python scripts/train.py --config configs/train_config.yamlMaster Pipeline (Complete Automation):
python scripts/master_pipeline.pyconfigs/dataset.yaml: Dataset paths and class definitionsconfigs/train_config.yaml: Training hyperparametersconfigs/augmentation_config.yaml: Data augmentation settings
Python API:
from ultralytics import YOLO
model = YOLO('results/improved_model/train/weights/best.pt')
results = model.predict('image.jpg', conf=0.25)Command Line:
python predict.py --source image.jpg --conf 0.25FastAPI Endpoint:
curl -X POST "http://localhost:8000/predict" \
-H "Content-Type: application/json" \
-d '{"image": "base64_encoded_image", "confidence": 0.25}'python -c "from ultralytics import YOLO; YOLO('results/improved_model/train/weights/best.pt').export(format='onnx')"iOS Simulator (macOS only):
npm run iosAndroid Emulator:
npm run androidWeb Browser:
npm run webPhysical Device:
npm run dev
# Scan QR code with Expo Go app- Authentication: Sign up, sign in, password reset, email verification
- Live Scanning: Real-time camera-based object detection
- Dashboard: Analytics with charts and statistics
- Scan History: Review past detections with details
- Settings: User preferences and account management
expo/
βββ app/ # Application screens
β βββ (auth)/ # Authentication flows
β βββ (tabs)/ # Main tabbed interface
β βββ index.tsx # Entry point
βββ components/ # Reusable UI components
β βββ ui/ # Base UI primitives
β βββ dashboard/ # Dashboard components
β βββ settings/ # Settings components
βββ lib/ # Utilities and configuration
β βββ api-config.ts # API client setup
β βββ storage.ts # AsyncStorage helpers
β βββ utils.ts # Utility functions
βββ assets/
βββ models/
βββ best.onnx # ONNX model for on-device inference
Detect objects in an image.
Request:
{
"image": "base64_encoded_image",
"confidence": 0.25,
"use_tta": true
}Response:
{
"objects": [
{
"name": "FireExtinguisher",
"confidence": 0.95,
"bbox": {
"x": 100,
"y": 150,
"width": 200,
"height": 300
}
}
],
"inference_time": 0.245,
"image_size": [640, 480]
}Check API health status.
Response:
{
"status": "healthy",
"model_loaded": true,
"model_path": "results/improved_model/train/weights/best.pt"
}Visit http://localhost:8000/docs for Swagger UI with interactive API testing.
| Metric | Value |
|---|---|
| mAP@0.5 | 86.7% |
| mAP@0.5:0.95 | 76.3% |
| Precision | 95.52% |
| Recall | 74.31% |
Results demonstrate strong detection capabilities across all 7 safety equipment classes with high precision and competitive recall rates.
- Model: YOLOv8m (medium variant)
- Epochs: 204 (stopped due to CUDA OOM)
- Image Size: 640x640
- Batch Size: Adaptive based on GPU memory
- Optimizer: AdamW with cosine learning rate schedule
- Augmentations: Advanced pipeline including mixup, mosaic, and spatial transforms
safeorbit/
βββ ai-engine/ # AI/ML Backend
β βββ api.py # FastAPI server
β βββ predict.py # Inference script
β βββ train.py # Training script
β βββ requirements.txt # Python dependencies
β βββ configs/ # Configuration files
β βββ scripts/ # Advanced training scripts
β βββ utils/ # Utility modules
β βββ results/ # Training outputs
β βββ improved_model/
β βββ train/
β βββ weights/
β βββ best.pt # Best model checkpoint
β
βββ expo/ # Mobile Application
βββ app/ # App screens and routes
βββ components/ # UI components
βββ lib/ # Utilities and config
βββ assets/ # Static assets
β βββ models/
β βββ best.onnx # ONNX model
βββ package.json # Node dependencies
βββ tsconfig.json # TypeScript config
Docker:
FROM python:3.8-slim
WORKDIR /app
COPY ai-engine/ .
RUN pip install -r requirements.txt
CMD ["python", "api.py"]Production Server:
uvicorn api:app --host 0.0.0.0 --port 8000 --workers 4iOS:
eas build --platform iosAndroid:
eas build --platform androidWeb:
npm run build:webContributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License.
- YOLOv8: Ultralytics for the excellent object detection framework
- Expo: For simplifying cross-platform mobile development
- React Native Community: For comprehensive ecosystem and support
Project Maintainer: Namann-14
Repository: github.com/Namann-14/safeorbit
Built with β€οΈ for safer space exploration