YOFLO
Real-time object detection and visual Q&A using Microsoft Florence-2. Like YOLO, but with language understanding.
Install
pip install yoflo
Quick Start
# Download model and run object detection on webcam
python -m yoflo -dm -od
# Or use the daemon for repeated fast queries
python -m yoflo.daemon start --model large
python -m yoflo.daemon query --image photo.jpg --action detect
python -m yoflo.daemon query --image photo.jpg --question "Is there a cat?" --action ask
Features
Object Detection (-od)
Detect objects in video streams or images.
# Detect all objects
python -m yoflo -dm -od
# Filter to specific classes
python -m yoflo -dm -od person car dog
# From RTSP stream
python -m yoflo -dm -od -rtsp rtsp://192.168.1.100:554/stream
# From YouTube live stream
python -m yoflo -dm -od -yt "https://www.youtube.com/watch?v=..."
Yes/No Questions (-ph)
Ask binary questions about what the model sees.
python -m yoflo -dm -ph "Is the door open?"
python -m yoflo -dm -ph "Is anyone wearing a hard hat?"
Inference Chains (-ic)
Ask multiple questions per frame. Returns PASS if 2+ are true.
python -m yoflo -dm -ic "Is there a person?" "Are they seated?" "Are they at a desk?"
Headless Mode (-hl)
No GUI window. Use on servers or for better performance (~20% faster).
python -m yoflo -dm -od -hl
Screenshot on Detection (-ss)
Auto-save timestamped screenshots when objects are detected.
python -m yoflo -dm -od cat -ss
Logging (-lf)
Write detections to alerts.log.
python -m yoflo -dm -od -lf
Video Recording (-r)
Record video based on triggers.
# Record when objects detected
python -m yoflo -dm -od -r od
# Record when inference is "yes", stop on "no"
python -m yoflo -dm -ph "Is there motion?" -r infy
# Record when inference is "no", stop on "yes"
python -m yoflo -dm -ph "Is the area clear?" -r infn
Multi-Camera (-wi, -rtsp)
Monitor multiple feeds simultaneously.
# Multiple webcams
python -m yoflo -dm -od -wi 0 1 2
# Multiple RTSP streams
python -m yoflo -dm -od -rtsp rtsp://cam1/stream rtsp://cam2/stream
Inference Rate Control (-il, -ir)
# Limit to 5 inferences per second
python -m yoflo -dm -od -il 5
# Display inference rate
python -m yoflo -dm -od -ir
Pretty Print (-pp)
Formatted detection output instead of raw JSON.
python -m yoflo -dm -od -pp
4-Bit Quantization (-4bit)
Reduce VRAM usage with quantized model.
python -m yoflo -dm -od -4bit
PTZ Camera Control
Control pan/tilt/zoom cameras via HID (USB) or ONVIF (IP network).
HID PTZ (Logitech PTZ Pro, etc.):
pip install hid
# Manual PTZ control with keyboard
python -m yoflo -dm -od -ptz
# Auto-track an object class
python -m yoflo -dm -od person -ptz track -to person
ONVIF PTZ (Hikvision, Dahua, Axis, most IP cameras):
pip install onvif-zeep
# or: pip install yoflo[onvif]
# Connect to ONVIF camera and auto-track
python -m yoflo -dm -od person -onvif 192.168.1.100 -onvif-user admin -onvif-pass password -to person
# ONVIF will auto-detect the camera's RTSP stream if no other source specified
| Flag | Description |
|---|---|
-ptz |
Enable HID PTZ (USB cameras) |
-onvif HOST |
Enable ONVIF PTZ (IP cameras) |
-onvif-port N |
ONVIF port (default: 80) |
-onvif-user USER |
ONVIF username (default: admin) |
-onvif-pass PASS |
ONVIF password |
-to CLASS |
Object class to auto-track |
Daemon Mode
Keep the model loaded in memory for fast repeated queries. No 90-second reload each time.
# Start daemon (loads model once)
python -m yoflo.daemon start --model large
# Query instantly
python -m yoflo.daemon query --image photo.jpg --action detect
python -m yoflo.daemon query --image "https://youtube.com/watch?v=..." --action detect
python -m yoflo.daemon query --image photo.jpg --question "Do you see a car?" --action ask
# Check status
python -m yoflo.daemon status
# Stop daemon
python -m yoflo.daemon stop
Python client:
from yoflo.client import YofloClient
client = YofloClient()
detections = client.detect("image.jpg")
answer = client.ask("image.jpg", "Is there a person?")
Model Options
| Model | Size | Flag |
|---|---|---|
| Florence-2-base-ft | 233M params | --model base |
| Florence-2-large-ft | 770M params | --model large |
Use -dm to auto-download, or -mp /path/to/model for local models.
All Flags
| Flag | Description |
|---|---|
-dm |
Download model from HuggingFace |
-mp PATH |
Use local model directory |
-od [CLASSES] |
Object detection (optional class filter) |
-ph QUESTION |
Yes/no question |
-ic Q1 Q2 ... |
Inference chain (multiple questions) |
-hl |
Headless mode (no display) |
-ss |
Screenshot on detection |
-lf |
Log to alerts.log |
-ir |
Display inference rate |
-il N |
Limit to N inferences/second |
-pp |
Pretty print output |
-wi 0 1 2 |
Webcam indices |
-rtsp URL ... |
RTSP stream URLs |
-yt URL |
YouTube live stream URL |
-r od|infy|infn |
Recording trigger mode |
-4bit |
4-bit quantization |
-ptz [track] |
HID PTZ control (USB cameras) |
-onvif HOST |
ONVIF PTZ control (IP cameras) |
-onvif-port N |
ONVIF port (default: 80) |
-onvif-user USER |
ONVIF username |
-onvif-pass PASS |
ONVIF password |
-to CLASS |
Object class to track |
Requirements
- Python 3.8+
- CUDA GPU with 8GB+ VRAM (16GB recommended for large model)
- Works on Windows, Linux, macOS
License
MIT
Metadata
Release files for yoflo 1.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yoflo-1.4.0.tar.gz | 21.6 kB | Without provenance | Details for yoflo-1.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yoflo-1.4.0-py3-none-any.whl | Python 3 | none | any | Details for yoflo-1.4.0-py3-none-any.whl |
Total release size: 44.8 kB
Release files / yoflo-1.4.0.tar.gz
| Download URL | yoflo-1.4.0.tar.gz |
|---|---|
| Size | 21.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
94636850165b7b3a683f9f76cccb84e7ee544ff1e7f9ee8bc0ec378311e7b2fe
|
|
BLAKE2b-256 checksum How to use checksums |
17bec62633bbac90d325feec5cccfb001484f4634178dd01fdaa5ac90725c1c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / yoflo-1.4.0-py3-none-any.whl
| Download URL | yoflo-1.4.0-py3-none-any.whl |
|---|---|
| Size | 23.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
58741489eaf6d1cf734bc5b519ea79ce816090494f82dab35c554b2358f8a1c9
|
|
BLAKE2b-256 checksum How to use checksums |
5bd2811be427e316959dce3abd40d0abe2967047a37c568fde2572ebc87b549a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for yoflo 1.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.