An open API service indexing awesome lists of open source software.

https://github.com/youhanasheriff/pocket_ai

Real-time YOLO11 obstacle detection for edge devices โ€” depth estimation, spatial reasoning, and spoken guidance (<30ms)
https://github.com/youhanasheriff/pocket_ai

accessibility computer-vision edge-ai onnx python real-time yolo

Last synced: 8 days ago
JSON representation

Real-time YOLO11 obstacle detection for edge devices โ€” depth estimation, spatial reasoning, and spoken guidance (<30ms)

Awesome Lists containing this project

README

          

# Pocket AI Guardian ๐Ÿ‘๏ธ๐Ÿ”Š

**Offline, real-time obstacle-detection assistant that turns a camera feed into spoken navigation guidance โ€” built to run on the edge.**

Pocket AI Guardian is a modular, fully on-device pipeline that detects navigation hazards (obstacles, doors, stairs, people, โ€ฆ) from a live camera and speaks concise, prioritized guidance. It runs without a network connection and is tuned to the latency and memory budgets of edge hardware (RDK X5 / Qualcomm QCS6490) as well as desktops.

> **Pipeline:** Camera โ†’ YOLO11 detection โ†’ spatial reasoning โ†’ template instructions โ†’ TTS / console

## Highlights
- **Real-time on-device inference** โ€” YOLO11 detector with a **desktop profile** (FP16/FP32, 640px, 20โ€“40 FPS target) and an **edge profile** (INT8, 320px, 15โ€“25 FPS target), selected automatically or via `--profile`.
- **Spatial reasoning** โ€” turns raw detections into distance/direction context and prioritizes by safety level.
- **Optional depth estimation** โ€” INT8 ONNX depth model, with a heuristic fallback for lower latency.
- **Spoken guidance** โ€” offline text-to-speech using a "latest-wins" single-slot model with deduplication, priority, and a cooldown so the user isn't overwhelmed.
- **Fully offline** โ€” no network calls at inference time.

## Detection classes
`closed_door` ยท `door` ยท `elevator` ยท `escalator` ยท `footpath` ยท `obstacle` ยท `person` ยท `wall`

Each class maps to a **safety level** (high / medium / low) that drives alert priority โ€” e.g. `obstacle`, `person`, and `escalator` are high-priority.

## Architecture
```
camera โ†’ detector (YOLO11) โ†’ spatial โ†’ validator โ†’ instructor โ†’ tts / console
โ†‘
depth (ONNX, optional)
```

| Module | Role |
|---|---|
| `pipeline/detector.py` | YOLO11 object detection |
| `pipeline/depth.py` | Depth estimation (INT8 ONNX + heuristic fallback) |
| `pipeline/spatial.py` | Distance / direction reasoning |
| `pipeline/validator.py` | Safety-rule validation |
| `pipeline/instructor.py` | Template-based instruction generation |
| `pipeline/tts.py` | Offline text-to-speech (latest-wins, dedup, cooldown) |
| `pipeline/orchestrator.py` | Wires the pipeline together |
| `config.py` | Single source of truth: hardware profiles, classes, thresholds |

## Quick start
```bash
pip install -r requirements.txt

python main.py # webcam, auto-detect hardware
python main.py --source 0 --show # webcam with OpenCV preview
python main.py --source image.jpg # single image
python main.py --profile edge # force edge profile (INT8, 320px)
python main.py --profile desktop # force desktop profile
python main.py --list-models # show available models
python main.py --conf 0.35 # custom confidence threshold
python main.py --cooldown 3.0 # instruction cooldown (seconds)
python main.py --save-logs # save JSONL detection logs to logs/
```

## Tech stack
- **Vision:** Ultralytics YOLO11, OpenCV, NumPy
- **Edge inference:** ONNX Runtime (INT8 models)
- **TTS:** pyttsx3 (offline)
- **Hardware targets:** Desktop (Mac/PC), RDK X5 (10 TOPS BPU), Qualcomm QCS6490 (12 TOPS NPU)
- **Bundled models:** `models/vision/obstacle_desktop.pt` (YOLO11), `models/depth/depth_small_int8.onnx`

## Tests
```bash
pytest tests/
```

## Docs
See [`docs/`](docs/) for the architecture overview, deployment guide, technical execution plan, and training report.

---
*Part of an edge-AI research line exploring assistive, real-time AI on resource-constrained hardware. See also [models-edge-devices](https://github.com/youhanasheriff/models-edge-devices).*