A unified application for text-prompted object detection and segmentation using multiple backends:
- YOLOE-26L-Seg for fast real-time inference
- YOLO-World for open-vocabulary detection via Ultralytics
- Grounding DINO for high-accuracy zero-shot detection
- SAM3 for semantic segmentation
You can run the project as either:
- Web UI (
app.py, Streamlit) - CLI (
cli.py, OpenCV window or headless mode)
- Text-prompted detection (
--prompt) - Multiple input modes: image, video, webcam
- Backend selection:
yolo,yolo-world,dino,sam - Automatic hardware selection: MPS > CUDA > CPU
- Optional output saving for image/video workflows
- Headless processing for scripts/servers
- Python
>=3.11(frompyproject.toml) - macOS, Linux, or Windows
- Optional webcam (for live mode)
- Model files in project root:
yoloe-26l-seg.pt(YOLO backend)sam3.pt(SAM backend)
curl -LsSf https://astral.sh/uv/install.sh | sh
git clone <repository-url>
cd realtime-detection-yolo26
uv sync --all-extrasuv sync --extra yolo
uv sync --extra dino --extra sampython -m venv venv
source venv/bin/activate
pip install .[yolo,dino,sam]uv run streamlit run app.pyThen open http://localhost:8501 and select backend + mode in the sidebar.
# YOLO (default)
uv run python cli.py image photo.jpg --prompt person
# Grounding DINO
uv run python cli.py image photo.jpg --type dino --prompt "person . car"
# YOLO-World
uv run python cli.py image photo.jpg --type yolo-world --prompt "person . car"
# SAM3
uv run python cli.py image photo.jpg --type sam --prompt "person"uv run python cli.py <mode> [input] --type <yolo|yolo-world|dino|sam> --prompt "<classes>" [options]image- process one imagevideo- process a video filewebcam- process live camera frames
# Save image output
uv run python cli.py image input.jpg --prompt car --output result.jpg
# Process video with frame skipping
uv run python cli.py video input.mp4 --prompt person --frame-skip 3 --output out.mp4
# Headless mode
uv run python cli.py video input.mp4 --prompt person --no-show --output out.mp4
# Webcam with a non-default camera
uv run python cli.py webcam --prompt person --camera-id 1| Option | Description | Default |
|---|---|---|
--type |
Backend: yolo, yolo-world, dino, sam |
yolo |
--prompt |
Prompt/classes string | None |
--model |
Custom model path | backend-specific |
--output, -o |
Output file path | None |
--no-show |
Disable OpenCV display | False |
--device |
auto, mps, cuda, cpu |
auto |
--camera-id |
Webcam id | 0 |
--frame-skip |
Process every Nth video frame | 1 |
--conf |
Confidence (YOLO/SAM) | 0.25 |
--box-threshold |
Box threshold (DINO) | 0.35 |
--text-threshold |
Text threshold (DINO) | 0.25 |
- Webcam: press
qto quit,sto save frame - Video preview: press
qto quit
The app auto-selects the best available device:
- MPS (Apple Silicon M1/M2/M3/M4)
- CUDA (NVIDIA GPU)
- CPU fallback
Verify detection setup:
uv run python test_device.py- Grant camera permissions to terminal/IDE
- Try a different
--camera-id(0, 1, 2...)
- Ensure
yoloe-26l-seg.pt/sam3.ptexist in project root - Or provide
--model /path/to/model.pt - YOLO-World defaults to Ultralytics
yolov8s-world.pt, which downloads automatically if needed
- Requires macOS 12.3+ and Apple Silicon
- The app falls back to CPU automatically
- First inference is slower due to model warmup
- Use
--frame-skipfor large videos - Reduce input resolution if needed
realtime-detection-yolo26/
|- app.py
|- cli.py
|- test_device.py
|- yoloe-26l-seg.pt
|- sam3.pt
|- README.md
|- ARCHITECTURE.MD
|- pyproject.toml
`- uv.lock
README.md- setup, quick start, and complete CLI usageARCHITECTURE.MD- backend architecture, device/runtime model, and design details
See the Ultralytics License for model usage terms.