Zyra ADAS

Real-time object detection and lane tracking on Android with on-device NCNN inference

Status
Live
Version
0.1.0-phase6
Platform
Android app
License
MIT
01 · Problem

L2 driver assistance in cars is expensive, yet most of the work is computer vision on a small SoC that phones already have. Zyra uses the phone's camera, GPU and sensors to run perception in shadow mode, with no vehicle control.

02 · Architecture

How it is put together.

Zyra ADAS is an Android app that runs a shadow-mode L2 ADAS on a phone: it watches the road and predicts what an L2 system would do, without controlling the vehicle. A Flutter UI talks over dart:ffi to a C++17 NDK engine that runs YOLOv8 object detection with NCNN (Vulkan or CPU fallback) and a classical Hough-based lane detector. All inference runs on the device; the README states the app uploads no frames and needs no sign-in.

Flutter UIlib/features/Dart FFI bridgelib/core/ffi/Native engineandroid/app/src/main/cpp/sr…YOLOv8 detectorandroid/app/src/main/cpp/sr…Hough lane detectorandroid/app/src/main/cpp/sr…camera frames (Riverpod AsyncNotifier)camera frames (Riverpod…submit_frame (extern "C" ABI)submit_frame (extern "C…pending framepending frameY planeY planedetection batch (dets + lanes + ms)detection batch (dets +…laneslanesFlutter UIlib/features/Dart FFI bridgelib/core/ffi/Native engineandroid/app/src/main/cpp/sr…YOLOv8 detectorandroid/app/src/main/cpp/sr…Hough lane detectorandroid/app/src/main/cpp/sr…camera frames (Riverpod AsyncNotifier)camera frames (Riverpod…submit_frame (extern "C" ABI)submit_frame (extern "C…pending framepending frameY planeY planedetection batch (dets + lanes + ms)detection batch (dets +…laneslanes
FIG. 01Modules and data flows, from the repository layout and documentation.
  1. 1

    Flutter UI

    Vehicle select and drive screens with camera preview, lane and detection overlay painters, FPS and status bars

    lib/features/
  2. 2

    Dart FFI bridge

    ZyraEngine opens libzyra_perception.so; submitFrame passes YUV planes, pollDetections returns a detection batch

    lib/core/ffi/
  3. 3

    Native engine

    Producer/consumer worker with a bounded queue and mutex-guarded result slot

    android/app/src/main/cpp/src/engine.cpp
  4. 4

    YOLOv8 detector

    YUV preprocess and letterbox, NCNN inference, per-class NMS and COCO-to-Zyra class mapping

    android/app/src/main/cpp/src/detector.cpp
  5. 5

    Hough lane detector

    Y plane, ROI, Canny, HoughLinesP, line fit

    android/app/src/main/cpp/src/lane.cpp
03 · Capabilities

Specification.

Object detection
YOLOv8 via NCNN; pedestrians, cyclists, cars, trucks, motorcycles, auto-rickshaws, traffic lights, traffic signs
Lane tracking
Canny + HoughLinesP + trapezoid ROI + weighted line fit, confidence-keyed overlay
Inference backend
NCNN with Vulkan FP16 + Winograd; automatic CPU fallback
Vehicle profiles
Car or Scooter; mount height, max decel and FCW TTC thresholds passed to the engine
Frame scheduling
Single-producer single-consumer bounded queue; older frame dropped on overrun
Native bridge
dart:ffi to a single shared object, libzyra_perception.so (arm64-v8a)
Cloud dependency
None; all inference on device
Minimum device
Android 11 (API 30), arm64-v8a, 4 GB RAM
Runs on
Flutter Android app with a C++ NDK engine; built as an APK and installed on a physical device
Stack
  • Dart
  • Flutter
  • Riverpod
  • C++17
  • Android NDK
  • CMake
  • NCNN
  • OpenCV Mobile
  • YOLOv8
  • pnnx
04 · Changelog

Releases.

  1. v0.1.0-phase6
    v0.1.0 Phase 6: Detection + Lane Tracking