█

AI/TLDR

Buy me a coffee
Buy me a coffee

CosmoEdge

A C++ edge AI engine that turns video models into deployable analytics apps on Sophon, Rockchip and x86

Vision & UnderstandingOpen source
Language
C++
License
Apache-2.0
$git clone https://github.com/cosmo-wander-ai/cosmo-edge.git
IN SHORT

What is CosmoEdge?

CosmoEdge is an open-source edge AI engine for video. It sits in the Vision & Understanding category of the Multimodal Generation tools and is open-source, written in C++ and licensed Apache-2.0. To get started: clone and start on x86.

Overview

CosmoEdge is an open-source edge AI engine for video. Its core is a C++17 runtime that handles multi-channel media, inference scheduling, on-screen display (OSD), tasks and events, and on top of it sits a web console where you compose the application: which model runs on which camera, which rules turn detections into alarms, and where those alarms go. The project describes its aim as going beyond model serving to a full application layer for model import, visual orchestration, alarms and event delivery.

CosmoEdge AI Video Analysis live view of a construction site with pedestrian boxes labelled helmet or nohelmet, a per-stage pipeline duration overlay, and an Event Records panel of No Safety Helmet alarms
The safety-helmet sample in Live Display: per-stage timings from decode to encode on the left, alarm snapshots on the right.CosmoEdge Quick Start guide ↗

One engine architecture targets several hardware families, but each build selects a single inference backend and uses model artifacts generated for that platform: Sophon BM1688 and CV186X through BMRT with `.nn` models, Rockchip RK3576 and RV1126B through RKNN with `.rknn` models (plus RKLLM on RK3576), and x86 Linux or Windows through ONNX Runtime with `.onnx` models. An Apple Silicon macOS path runs as a Docker preview under `linux/amd64` emulation for a single local-video workflow. Beyond conventional detection, classification and tracking, it supports prompt-driven vision: VLM state judgment and GroundingDINO open-vocabulary detection, including optional VLM review before a detection alarm is reported.

The v1.1 release ships a public benchmark pack covering single and concurrent mixed workloads, a controlled 72-hour dual-CV profile and validated VLM performance on BM1688, CV186X and RK3576, with the methodology and source commits recorded. The core engine and console are Apache-2.0; certified hardware, commercial preset models and the Model Guard encryption for Sophon Protected packages sit outside that boundary, and the project states that Open and Protected packages expose the same application features.

What it does

  • Native C++17 runtime for multi-channel video decode, inference scheduling, tracking, zones, counters, OSD and alarm snapshots
  • Browser-based visual orchestration: chain input processing, model inference and rule nodes into a business flow, with detection areas and parameter validation
CosmoEdge Region Intrusion business flow: Start, Video Decode, Object Detection, Tracking, Category Filter and Region Alarm nodes grouped as input processing, model inference and rule judgment, with the Region Alarm configuration panel open
A Region Intrusion pipeline in the visual editor, with the Region Alarm node set to Exception Alarm and Target Region Stay.CosmoEdge pipeline orchestration tutorial ↗
  • Prompt-driven vision with VLM state judgment and GroundingDINO open-vocabulary detection alongside conventional CV pipelines
  • Platform backends for Sophon (BMRT), Rockchip (RKNN with MPP/RGA media paths) and x86 (ONNX Runtime), each with target-specific model artifacts
  • Event delivery and management through REST, WebSocket, MQTT and HTTP webhooks, plus model management and event history
  • Model porting path for importing your own trained models, and an agent-assisted development guide for handing porting or integration tasks to a coding agent

Getting started

No edge hardware is needed to try it: the x86 mode runs the same UI and workflow in Docker, with lower throughput than an NPU deployment. Device builds are packaged per chip.

Clone and start on x86

On Linux, bring the stack up with Docker Compose; Windows uses its own compose file. Docker Compose V1 users can replace `docker compose` with `docker-compose`.

bashbash
git clone https://github.com/cosmo-wander-ai/cosmo-edge.git
cd cosmo-edge

# Linux
sudo docker compose -f docker-compose.x86.yml up -d --build
# Windows: docker compose -f docker-compose.x86.windows.yml up -d --build

Or use the macOS Docker Preview

Apple Silicon Macs run a single local-video workflow under linux/amd64 emulation.

bashbash
./scripts/macos-docker-preview.sh doctor
./scripts/macos-docker-preview.sh up
./scripts/macos-docker-preview.sh status

Open the console and create a task

Browse to http://localhost:8080 (http://127.0.0.1:8080 on the Mac preview), then follow the Scenario Configuration tutorial to create your first AI detection task.

Build a package for an edge device

Sophon builds export each chip under `build_output/public-runtime/<chip>/` with `TARGET_CHIP` and `SHA256SUMS`; Rockchip builds export under `build_output/<chip>/`. RV1126B needs a prepared target model overlay.

bashbash
# Sophon BM1688 / CV186X
./scripts/docker-compose.sh -f docker-compose.sophon.yml run --rm cosmo-sophon-package --chip bm1688
./scripts/docker-compose.sh -f docker-compose.sophon.yml run --rm cosmo-sophon-package --chip cv186x

# Rockchip RK3576
./scripts/docker-compose.sh -f docker-compose.rockchip.yml pull cosmo-rockchip-package
COSMO_TARGET_CHIP=rk3576 ./scripts/docker-compose.sh \
  -f docker-compose.rockchip.yml run --rm cosmo-rockchip-package
ls -lh build_output/rk3576/

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

CosmoEdge Live Display with a GroundingDINO overlay on a stairwell camera, boxing a person and garbage inside a drawn alarm region, with corridor garbage events listed on the right
GroundingDINO open-vocabulary boxes for a corridor garbage-detection task.CosmoEdge VLM guide ↗
  • Run multi-camera safety analytics such as no-safety-helmet or region-intrusion alarms on a Sophon or Rockchip box at the edge
  • Describe what to look for in a prompt with GroundingDINO or a VLM instead of training a new detector for every object
  • Push structured alarm events from cameras into existing systems over MQTT, WebSocket, REST or HTTP webhooks
  • Prototype a video analytics pipeline on an x86 laptop in Docker before porting the models to an NPU target

How CosmoEdge compares

CosmoEdge alongside other open-source vision & understanding tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
PaddleOCR★ 93.5kA toolkit for detecting and recognizing text in images across many languages, plus document parsing.
OpenCV★ 91.8kThe long-standing open-source computer-vision library for C++, Python and Java; version 5 rewrote the DNN engine and added ONNX-based LLM and VLM inference in-library.
Ultralytics YOLO★ 63.9kA framework for training and running YOLO models for real-time object detection, segmentation, and tracking.
YOLOv5★ 58.3kUltralytics' PyTorch repo for training, running and exporting YOLOv5 object-detection, instance-segmentation and classification models with plain scripts and PyTorch Hub.
Supervision★ 51.8kA Python toolkit for processing, annotating, and visualizing detections and segmentations from many vision models.
MediaPipe★ 38kGoogle's on-device ML framework: ready-to-run vision, text and audio tasks with one cross-platform API for Android, iOS, web, desktop and edge.
MMDetection★ 33.1kAn OpenMMLab toolbox with many object detection and instance segmentation algorithms for research and production.
CosmoEdge★ 2.1kA C++ edge AI engine that turns video models into deployable analytics apps on Sophon, Rockchip and x86