Tutorials · AI
How to Run AI Inference in Containers on a NavEdge Edge Server
Run AI models next to the cameras and sensors instead of in a distant cloud: lower latency, less WAN traffic and video that never leaves the site. Package the model in a container and deploy it with Docker Compose.
Before you start
- A NavEdge edge server with Docker (and a GPU or AI accelerator if your model needs one)
- An inference image from your AI vendor or your own build
- Camera RTSP URLs on the camera VLAN
Step by step
Check the accelerator
If the edge server has an NVIDIA GPU, install the NVIDIA Container Toolkit and confirm containers can see it.
docker run --rm --gpus all nvidia/cuda:12.4.1-base-ubuntu22.04 nvidia-smiDescribe the service
Pin the image version, give it the GPU, mount the models read-only and pass camera URLs as configuration, not in the image.
services: inference: image: registry.example.com/vision/detector:3.2.0 restart: unless-stopped environment: CAMERAS: rtsp://analytics:${CAM_PW}@10.1.30.101/stream2,rtsp://analytics:${CAM_PW}@10.1.30.102/stream2 EVENTS_URL: http://10.1.99.30:8080/events volumes: ["./models:/models:ro"] deploy: resources: reservations: devices: [{ driver: nvidia, count: 1, capabilities: [gpu] }]
Use a read-only camera account
Create a dedicated camera user with view-only rights for the analytics service, and store its password in .env, not in Git.
Start and watch
Start the stack and watch latency, frames per second and GPU load.
docker compose up -d docker compose logs -f inference nvidia-smi --query-gpu=utilization.gpu,memory.used --format=csv -l 5
Send events, not video
Forward only events and metadata to the VMS, NVR or business system; keep raw video on site.
Update models safely
Treat a new model like new software: test it on one site, compare accuracy, then roll out with a new image tag and keep the previous tag for rollback.
Commands are generic, industry-standard examples. Exact syntax and menu names vary by model and firmware; check your device's manual on the Documentation page.
Pro tips
- Use the camera's sub-stream (lower resolution) when the model does not need full resolution: it saves CPU/GPU and LAN bandwidth.
- Check the licence terms of the models you deploy.
FAQ
Frequently asked questions
Edge or cloud AI?
Edge suits real-time alerts, privacy-sensitive video and sites with limited uplinks. Cloud suits training and analysis across many sites. Many projects use both.
Keep learning
Related guides
Docker Compose for edge applications
Read more →Secure Docker containers on the edge
Read more →Put containers on VLANs with macvlan
Read more →How to Use NavCloud AI Insights to Fix Problems Before Users Notice
NavCloud AI Insights turns alarms, inventory and telemetry from every site into a network health index and a short, prioritised list of findings with the action that fixes each one.
Read more →How to Set Up AI Smart Events on IP Cameras (Intrusion, Line Crossing, Human/Vehicle)
AI cameras classify people and vehicles on the camera itself, so you get far fewer false alarms from trees, rain and animals. Configure smart events and record only what matters.
Read more →How to Plan the Network for AI Cameras and Video Analytics
AI video means more streams, higher resolutions and analytics servers pulling video from many cameras. Size bandwidth, PoE and storage before you install.
Read more →Stuck on a step?
Ask Navijin technical support or an authorised partner for help with your configuration.