model_training
small object detection on RTSP cameras
2 min readupdated
A complete pipeline for training and deploying real-time systems designed to find custom objects in video streams from IP cameras. The system trains and compares two architectures: RF-DETR and Ultralytics YOLO26, then exports the best weights to ONNX for integration into video analytics pipelines. The repository includes scripts for frame extraction, semi-automatic annotation via Grounding DINO, dataset preparation with scene-based splitting, and inference with tracking. This tool will be useful for computer vision engineers and video surveillance system developers.
Key features
- Two architectures: Comparing and training RF-DETR and YOLO26 models on a single dataset.
- ONNX export: Ready-to-use model converters for integration into frame processing pipelines.
- Full cycle: Scripts ranging from video capture and annotation to quality evaluation and live inference.
- Data management: Utility toolsets for frame slicing, RTSP stream simulation, and hard negative mining.
What you can do
- Run real-time detection on an RTSP stream from a camera or webcam using the inference script.
- Train your own YOLO26 or RF-DETR model on frames gathered from a camera to detect specific objects.
- Evaluate the quality of trained models on held-out test scenes and compare mAP metrics.
- Export weights to the ONNX format with verification through the detection pipeline.
Example
from huggingface_hub import snapshot_download
repo = snapshot_download("crockrocks/model_training")
from ultralytics import YOLO
results = YOLO(f"{repo}/runs/yolo/demo_yolo26s_freeze10/weights/best.pt").predict("frame.jpg", imgsz=960, conf=0.4)Read more
DetailsDemo run metrics (Open Images V7): RF-DETR-S achieves 0.705–0.719 mAP50-95, while YOLO26s reaches up to 0.533.
Licensing is mixed: YOLO26 weights are distributed under AGPL-3.0, and RF-DETR under Apache-2.0.
Requirements depend on the chosen architecture and input frame resolution (resolutions from 512 to 960 pixels are supported).










Comments