Deploy a real-time edge application on COSMOS that ingests a live street-camera
video stream, runs a deep-learning instance-segmentation model (Mask R-CNN), and
produces a frame-annotated output video.
This tutorial demonstrates how to run a GPU-accelerated, real-time object-masking
pipeline on a COSMOS edge node using live video from a street camera installed on
Amsterdam Avenue, New York. The video is ingested as an H.265 stream (640 × 480,
30 fps, 1024 Kbps); a containerised Mask R-CNN back-end (based on
facebookresearch/maskrcnn-benchmark)
processes each frame and overlays segmentation masks on detected objects. The
result is written to an output AVI file.
The tutorial exercises COSMOS's ability to host latency-sensitive edge workloads
co-located with real-world sensing infrastructure.
Note: As of the original source, live video ingestion was pending IRB
approval. The steps below reflect the tutorial as originally written; the live
video feed section may still be gated by that approval process.
After completing this tutorial you will be able to:
| Difficulty | Intermediate |
| Estimated time | TODO: verify |
| Domain / sandbox | bed.cosmos-lab.org |
| Topic group | Misc |
| Last verified | Not re-tested (migrated 2026-06-20) |
Background knowledge
smartcity.py).Account & access
bed.cosmos-lab.org — see Make a reservation.Devices / nodes
| Resource | Role | Qty | Notes |
|---|---|---|---|
| srv3-lg1.bed.cosmos-lab.org | Edge compute / inference node | 1 | GPU recommended; hosts the Mask R-CNN container |
Disk images
| Image | Load onto | Provides |
|---|---|---|
| baseline.ndz | srv3-lg1.bed.cosmos-lab.org | Base OS; container runtime must be installed or pre-baked |
Software components
| Component | Version | Source |
|---|---|---|
| maskrcnn-benchmark container | TODO: verify | Pre-configured container (see Experimental setting below) |
| Python | TODO: verify | Provided inside container |
| smartcity.py | TODO: verify | Located at /maskrcnn-benchmark/demo/ inside container |
Spectrum / RF / special
Not applicable.
A single COSMOS BED server node (srv3-lg1.bed.cosmos-lab.org) acts as the edge
compute host. It receives a live H.265 video stream from a camera on Amsterdam
Avenue, NY (640 × 480, 30 fps, 1024 Kbps) over the COSMOS network, processes
each frame through the Mask R-CNN inference pipeline running inside a container,
and writes the annotated output to output.avi on the local filesystem.
Create a reservation for bed.cosmos-lab.org — see Make a reservation.
Log into the console:
ssh <username>@console.bed.cosmos-lab.org
Load the image onto the node:
omf load -t srv3-lg1.bed.cosmos-lab.org -i baseline.ndz -r 40
Turn the node on:
omf tell -a on -t srv3-lg1.bed.cosmos-lab.org
Confirm the node is up:
omf stat -t srv3-lg1.bed.cosmos-lab.org
SSH into the node from the console:
ssh root@srv3-lg1.bed.cosmos-lab.org
Download the pre-configured Mask R-CNN container in order to minimise
experimental setup effort.
Enter the container:
Note: Live video ingestion was pending IRB approval at the time this
tutorial was written. Confirm current status before proceeding with the live
camera feed.
Inside the container, change to the demo directory:
cd /maskrcnn-benchmark/demo
python smartcity.py
After the script completes, an output video file named output.avi will be
created in the current directory. This file records the real-time processing
result frame-by-frame. (Output is written to a file rather than streamed
directly because of the slow forwarding speed over X11.)
From the console (or your local machine), copy the output file:
scp root@srv3-lg1.bed.cosmos-lab.org:/maskrcnn-benchmark/demo/output.avi ./
Open and review output.avi with any video player.
python smartcity.py runs to completion and produces output.avi.output.avi shows segmentation masks overlaid on detected objects inomf tell -a offh -t srv3-lg1.bed.cosmos-lab.org
(No omf save is needed unless you have modified the image or container and
want to preserve the changes.)
| Symptom | Likely cause | Fix |
|---|---|---|
Node does not respond after omf tell -a on |
Image load incomplete or node unreachable | Re-run omf load; verify with omf stat |
| Container fails to start | Container image not downloaded or GPU driver mismatch | Verify container download step; check GPU driver availability on node |
smartcity.py exits immediately with a video source error |
Live video feed not yet available (IRB pending) | Confirm IRB approval status; substitute a local test video file if available |
output.avi is empty or zero-length |
No frames processed | Check Python error output; confirm video source path inside the script |
Author(s): COSMOS team · Last verified: Not re-tested (migrated 2026-06-20) · Tested image/release: baseline.ndz · Tags: edge, deep-learning, computer-vision, mask-rcnn, smart-city, bed, video