Skip to content

alaika-cyber/Augmented-Reality-Navigation-System

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧭 Augmented Reality Navigation System

Real-time AI-powered navigation assistance with obstacle detection, voice guidance, and GPS emergency alerts. Designed for visually impaired users and pedestrian safety.


🎯 How It Works

Camera Sees β†’ AI Decides β†’ Voice Speaks
  1. App Opens β†’ Camera ON, GPS ON β€” no manual setup needed
  2. Live Monitoring β†’ AI continuously analyzes the camera feed
  3. Smart Navigation β†’ Voice tells you where to go

Decision Logic

Situation Command
Path clear "Go straight"
Obstacle ahead, left free "Move left"
Obstacle ahead, right free "Move right"
All sides blocked "Stop"
Stairs detected "Stairs ahead, proceed with caution"
Vehicle approaching "Vehicle coming, stay alert"
Vehicle very close "Stop immediately"
Pothole ahead "Pothole ahead, move left/right"

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  Frontend (PWA)                  β”‚
β”‚  Camera β†’ Frame Capture β†’ WebSocket β†’ AR Overlay β”‚
β”‚  GPS β†’ Location Tracking β†’ Emergency Alerts      β”‚
β”‚  Web Speech API β†’ Voice Guidance                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚ WebSocket (binary frames)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               Backend (FastAPI)                  β”‚
β”‚  YOLOv8 Detection β†’ Decision Engine β†’ Response   β”‚
β”‚  GPS Processing β†’ Emergency Alert Generation     β”‚
β”‚  TTS Service (pyttsx3 fallback)                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Tech Stack

Layer Technology
Backend Framework FastAPI + Uvicorn
Object Detection YOLOv8 (Ultralytics)
Computer Vision OpenCV
AI Runtime PyTorch
Voice (Server) pyttsx3 (offline)
Voice (Client) Web Speech API
Frontend Vanilla JS PWA
Communication WebSocket (binary frames)
GPS Browser Geolocation API
Deployment Docker

Objects Detected

  • 🚢 Person
  • πŸš— Vehicle (car, bus, truck, motorcycle, bicycle)
  • πŸͺœ Stairs (heuristic + custom model)
  • 🧱 Wall (heuristic + custom model)
  • ⚠️ Pothole (custom model)
  • 🚧 Generic obstacles

πŸš€ Quick Start

Prerequisites

  • Python 3.10+
  • pip

1. Clone & Install

git clone https://github.com/yashab-cyber/Augmented-Reality-Navigation-System.git
cd Augmented-Reality-Navigation-System

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Linux/Mac
# venv\Scripts\activate   # Windows

# Install dependencies
pip install -r requirements.txt

2. Configure (Optional)

cp .env.example .env
# Edit .env to customize settings

3. Run

python run.py

Open http://localhost:8000 on your phone or desktop browser.

Mobile Access: Connect your phone to the same network and open http://<your-ip>:8000

4. Docker (Alternative)

docker compose up --build

πŸ“ Project Structure

β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ config.py                 # App configuration (env vars)
β”‚   β”œβ”€β”€ main.py                   # FastAPI app + WebSocket handler
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   └── schemas.py            # Pydantic models
β”‚   └── services/
β”‚       β”œβ”€β”€ __init__.py
β”‚       β”œβ”€β”€ detection.py          # YOLOv8 object detection
β”‚       β”œβ”€β”€ decision_engine.py    # Navigation logic
β”‚       β”œβ”€β”€ tts_service.py        # Text-to-Speech
β”‚       β”œβ”€β”€ gps_service.py        # GPS processing
β”‚       └── frame_processor.py    # Pipeline orchestrator
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ index.html                # Main UI
β”‚   β”œβ”€β”€ manifest.json             # PWA manifest
β”‚   β”œβ”€β”€ css/
β”‚   β”‚   └── styles.css            # Full responsive styles
β”‚   └── js/
β”‚       β”œβ”€β”€ app.js                # Main app orchestrator
β”‚       β”œβ”€β”€ camera.js             # Camera management
β”‚       β”œβ”€β”€ websocket.js          # WebSocket client
β”‚       β”œβ”€β”€ tts.js                # Client-side TTS
β”‚       β”œβ”€β”€ gps.js                # GPS module
β”‚       └── ar-renderer.js        # AR overlay renderer
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ test_decision_engine.py   # Decision logic tests
β”‚   β”œβ”€β”€ test_gps_service.py       # GPS service tests
β”‚   └── test_api.py               # API endpoint tests
β”œβ”€β”€ run.py                        # Entry point
β”œβ”€β”€ requirements.txt              # Python dependencies
β”œβ”€β”€ Dockerfile                    # Container image
β”œβ”€β”€ docker-compose.yml            # Container orchestration
β”œβ”€β”€ .env.example                  # Environment template
└── .gitignore

πŸ”Œ API Reference

REST Endpoints

Method Path Description
GET / Serve frontend app
GET /api/status System health status
POST /api/gps Update GPS coordinates
POST /api/emergency Trigger emergency alert
GET /api/location Get current location info

WebSocket (/ws)

Client β†’ Server:

Format Description
Binary (JPEG) Camera frame for detection
{"type": "frame", "data": {"image": "<base64>"}} Base64 frame
{"type": "gps", "data": {"latitude": ..., "longitude": ...}} GPS update
{"type": "emergency"} Emergency alert
{"type": "status"} Request status

Server β†’ Client:

{
  "type": "analysis",
  "data": {
    "frame_id": 42,
    "fps": 15.2,
    "detections": [
      {
        "category": "person",
        "confidence": 0.89,
        "bbox": [0.3, 0.2, 0.6, 0.9],
        "zone": "center",
        "label": "person"
      }
    ],
    "command": {
      "action": "move_left",
      "message": "Obstacle ahead. Move left.",
      "priority": 5,
      "speak": true
    }
  }
}

πŸ§ͺ Testing

pip install pytest httpx
pytest tests/ -v

βš™οΈ Configuration

All settings can be configured via environment variables or .env file:

Variable Default Description
SERVER_PORT 8000 Server port
YOLO_MODEL_PATH yolov8n.pt YOLOv8 model file
YOLO_CONFIDENCE 0.45 Detection threshold
YOLO_DEVICE cpu cpu, cuda, or mps
FRAME_SKIP 2 Process every Nth frame
TTS_COOLDOWN 2.0 Seconds between same voice messages
CUSTOM_MODEL_PATH Path to custom model for stairs/pothole/wall

GPU Acceleration

# For NVIDIA GPU
YOLO_DEVICE=cuda python run.py

# For Apple Silicon
YOLO_DEVICE=mps python run.py

πŸ”§ Custom Model Training

To improve stairs/pothole/wall detection, train a custom YOLOv8 model:

from ultralytics import YOLO

model = YOLO('yolov8n.pt')
model.train(
    data='custom_dataset.yaml',
    epochs=100,
    imgsz=640,
    classes=['stairs', 'wall', 'pothole', 'obstacle']
)

Then set CUSTOM_MODEL_PATH=runs/detect/train/weights/best.pt in your .env.


πŸ“± Mobile Deployment

The frontend is a Progressive Web App (PWA):

  1. Open the app URL on your phone's browser
  2. Tap "Add to Home Screen"
  3. The app will run fullscreen like a native app
  4. Camera and GPS permissions will be requested automatically

Note: For camera access on mobile, the app must be served over HTTPS or localhost.


πŸ“„ License

MIT License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 55.5%
  • JavaScript 28.5%
  • CSS 10.0%
  • HTML 5.4%
  • Dockerfile 0.6%