A high-performance real-time person and object tracking system built in Rust, using:
- OpenCV (video processing & rendering)
- ONNX Runtime (YOLO inference)
- SORT algorithm (multi-object tracking)
SentinelVision detects objects in video streams, assigns persistent tracking IDs, and renders real-time annotated output with RED bounding boxes.
Here are some example detections from the system:
- ๐ฅ Video input support (file or webcam)
- ๐ง Real-time person/object detection using YOLO (ONNX)
- ๐ง HOG fallback detector (OpenCV-based)
- ๐ฏ Multi-object tracking using SORT
- ๐ Persistent tracking IDs across frames
- ๐ด RED bounding box visualization (strict requirement)
- ๐ Real-time labels (ID | class | confidence)
- ๐ผ Optional video output recording
- โก Optimized for real-time performance (20โ30 FPS target)
๐ง Active development โ core pipeline (OpenCV + ONNX Runtime + YOLO + SORT tracking) is being actively implemented and stabilized
Video Input (Webcam / File)
โ
Frame Capture (OpenCV)
โ
Preprocessing (Resize / Normalize / Letterbox)
โ
ONNX Runtime Inference (YOLO)
โ
Detection Post-processing (Confidence Filtering + NMS)
โ
SORT Tracking (Kalman Filter + IoU + Hungarian Matching)
โ
Track Management (ID lifecycle handling)
โ
Rendering (RED bounding boxes + labels)
โ
Display / Optional Video Output
- Rust ๐ฆ
- OpenCV (Rust bindings)
- ONNX Runtime (ORT)
- YOLOv8 / YOLOv5 (ONNX models)
- HOG-based fallback detector (OpenCV)
-
SORT algorithm:
- Kalman Filter (motion prediction)
- IoU matching (data association)
- Hungarian assignment
sentinelvision/
โ
โโโ src/
โ โโโ main.rs # Pipeline orchestration
โ โโโ config.rs # Configuration & constants
โ โโโ video.rs # Video capture & frame handling
โ โโโ detector.rs # YOLO ONNX inference + HOG fallback
โ โโโ tracker.rs # Track lifecycle manager
โ โโโ sort.rs # SORT algorithm implementation
โ โโโ bbox.rs # Geometry + IoU utilities
โ โโโ renderer.rs # Visualization (RED bounding boxes)
โ โโโ utils.rs # Helper utilities
โ
โโโ models/
โ โโโ yolov8.onnx
โ
โโโ data/
โ โโโ input.mp4
โ
โโโ output/
โ โโโ output.mp4
โ
โโโ Cargo.toml
โโโ README.md
SentinelVision uses YOLO in ONNX format via ONNX Runtime.
Create virtual environment:
python -m venv venv
source venv/bin/activate # Linux / macOS
# OR
venv\Scripts\activate # WindowsInstall dependencies:
pip install ultralyticsfrom ultralytics import YOLO
model = YOLO("yolov8n.pt")This automatically downloads pretrained weights.
Recommended models:
- yolov8n.pt โ fastest (recommended)
- yolov8s.pt โ balanced
- yolov8m.pt โ more accurate
from ultralytics import YOLO
model = YOLO("yolov8n.pt")
model.export(
format="onnx",
opset=12,
simplify=True,
dynamic=False,
imgsz=640
)mv yolov8n.onnx models/yolov8.onnxFinal structure:
models/
โโโ yolov8.onnx
Expected ONNX input:
[1, 3, 640, 640]
If different, update preprocessing in:
src/detector.rs
cargo run --release -- data/input.mp4cargo run --release -- 0Each detection:
[x, y, width, height, confidence, class_id]
Each tracked object:
ID: <id> | <class> | <confidence>
All objects MUST be drawn using:
- Color: RED (BGR = 0, 0, 255)
- Thickness: 2โ3 px
- Label placed above bounding box
- Must include tracking ID
Enable debug outputs:
- Detection-only view
- Tracking-only view
- Frame-level logging
Optional debug artifacts:
- Saved frames with overlays
- Detection counts per frame
- Track counts per frame
- 20โ30 FPS real-time processing
- Minimal memory allocations
- Lightweight SORT tracking
- Frame skipping allowed if needed
- Occlusion may cause ID switches
- CPU-only inference may reduce FPS
- YOLO model quality affects accuracy
- Lighting conditions impact detection reliability
- DeepSORT (appearance embeddings)
- Multi-camera tracking
- GPU acceleration (CUDA/OpenCL)
- REST API for analytics
- Event detection (loitering, intrusion)
- Face recognition module
SentinelVision is built with:
- Minimal dependencies
- Explicit control over each pipeline stage
- Performance-first architecture
- No unnecessary abstractions
- Production-oriented Rust design
- Prefer
stdfirst - Avoid unnecessary crates
- No Python runtime dependency
- No heavy ML frameworks beyond ONNX Runtime
- Keep architecture minimal and explicit
Rules:
- Do NOT change architecture without discussion
- Do NOT add unnecessary dependencies
- Keep modules minimal and focused
- Maintain Rust idioms and performance focus
- Ensure changes do not break pipeline flow



