A comprehensive real-time vision-language processing system featuring Microsoft Florence-2 for multimodal understanding, integrated with speech recognition, object tracking, and interactive voice commands for edge deployment scenarios. We will primarily test lightweight models deployable on Edge devices and run a comparitive analysis of each. The repository will continuously be updated as we go through each of the models. As per the latest update we have a completed a pipelin on the Florence2 model, the most promising one yet.
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # Linux/macOS
# .venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Optional GPU acceleration (if supported)
pip install flash-attn --no-build-isolation
# Download and extract Vosk speech recognition model
wget https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip
unzip vosk-model-small-en-us-0.15.zip
python main.py
python main.pyconfig.py)The system supports multiple Florence-2 vision tasks triggered by semantic voice commands:
| Task Category | Voice Commands | Florence-2 Task |
|---|---|---|
| Object Detection | "detect objects", "find items", "what objects are present" | <OD> |
| Image Captioning | "describe image", "what do you see", "caption this" | <CAPTION> |
| Dense Captioning | "detailed description", "comprehensive caption" | <DETAILED_CAPTION> |
| OCR | "read text", "extract words", "what does it say" | <OCR> |
| Segmentation | "segment objects", "create masks" | <REGION_PROPOSAL> |
Key settings in config.py:
# Audio Configuration
WAKE_WORD = "wake up" # Trigger phrase
SAMPLE_RATE = 16000 # Audio sampling rate
# Processing Settings
MIN_PROCESS_INTERVAL = 0.5 # Throttling between commands
SEMANTIC_MATCH_THRESHOLD = 0.6 # Speech-to-task matching sensitivity
# Model Settings
PROC_SIZE_DEFAULT = (224, 224) # Default processing resolution
PROC_SIZE_REFERRING = (480, 480) # High-res for complex tasks
main.py: Application entry point and orchestrationmodels.py: Model loading and management (Florence-2, Whisper, SentenceTransformers)audio.py: Audio capture and Vosk wake-word detectioncommand_processor.py: Speech-to-vision pipeline coordinationprocessor.py: Semantic task mapping from speech to Florence-2 tasksvideo.py: Webcam capture, tracking, and visualizationtracker.py: ByteTracker configuration and object trackingutils.py: Bounding box parsing and image processing utilitiesstate.py: Thread-safe global state managementMicrophone → Vosk (Wake Word) → Audio Recording → Whisper (STT)
↓
Semantic Mapping → Florence-2 Task Selection → Image Processing
↓
Webcam Frame → Florence-2 Model → Results (Captions/Detections/Masks)
↓
ByteTracker → Visual Overlay → Display
microsoft/Florence-2-base - Primary vision-language modelopenai/whisper-small - Speech transcriptionall-MiniLM-L6-v2 - Semantic similarity for task mappingvosk-model-small-en-us-0.15 - Offline wake-word detectionThe system uses multiple threads for concurrent processing:
Access real-time statistics via the state management system:
from state import get_stats, get_state_summary
# Get processing statistics
stats = get_stats()
print(f"Avg processing time: {stats['processing_time_avg']:.3f}s")
# Get system state summary
summary = get_state_summary()
print(f"Objects detected: {summary['detection_count']}")
processor.py:task_prompts["<NEW_TASK>"] = [
"custom command 1",
"custom command 2"
]
command_processor.py:elif task_code == "<NEW_TASK>":
# Custom processing logic
custom_result = process_custom_task(parsed_answer)
The modular architecture supports adding new VLM models:
models.pycommand_processor.pyprocessor.pySee requirements.txt for complete dependency list. Key packages:
torch>=2.3 - Deep learning frameworktransformers>=4.45 - Hugging Face model libraryultralytics>=8.0.20 - Object trackingopencv-python>=4.9.0 - Computer visionsounddevice==0.5.2 - Audio capturevosk>=0.3.45 - Speech recognitionsentence-transformers>=2.2.2 - Semantic similarityThis project code is released under the MIT License. Individual pre-trained models retain their original licenses:
Contributions welcome! Please see our contributing guidelines for:
Model Loading Errors:
Audio Issues:
sounddeviceVideo Issues:
cv2.VideoCapture(1)Performance Issues:
config.pyMIN_PROCESS_INTERVAL for slower systemsFor detailed logs, set environment variable: LOG_LEVEL=DEBUG
2 commits
Python
100.0%
A comprehensive real-time vision-language processing system featuring Microsoft Florence-2 for multimodal understanding, integrated with speech recognition, object tracking, and interactive voice commands for edge deployment scenarios. We will primarily test lightweight models deployable on Edge devices and run a comparitive analysis of each. The repository will continuously be updated as we go through each of the models. As per the latest update we have a completed a pipelin on the Florence2 model, the most promising one yet.
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # Linux/macOS
# .venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Optional GPU acceleration (if supported)
pip install flash-attn --no-build-isolation
# Download and extract Vosk speech recognition model
wget https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip
unzip vosk-model-small-en-us-0.15.zip
python main.py
python main.pyconfig.py)The system supports multiple Florence-2 vision tasks triggered by semantic voice commands:
| Task Category | Voice Commands | Florence-2 Task |
|---|---|---|
| Object Detection | "detect objects", "find items", "what objects are present" | <OD> |
| Image Captioning | "describe image", "what do you see", "caption this" | <CAPTION> |
| Dense Captioning | "detailed description", "comprehensive caption" | <DETAILED_CAPTION> |
| OCR | "read text", "extract words", "what does it say" | <OCR> |
| Segmentation | "segment objects", "create masks" | <REGION_PROPOSAL> |
Key settings in config.py:
# Audio Configuration
WAKE_WORD = "wake up" # Trigger phrase
SAMPLE_RATE = 16000 # Audio sampling rate
# Processing Settings
MIN_PROCESS_INTERVAL = 0.5 # Throttling between commands
SEMANTIC_MATCH_THRESHOLD = 0.6 # Speech-to-task matching sensitivity
# Model Settings
PROC_SIZE_DEFAULT = (224, 224) # Default processing resolution
PROC_SIZE_REFERRING = (480, 480) # High-res for complex tasks
main.py: Application entry point and orchestrationmodels.py: Model loading and management (Florence-2, Whisper, SentenceTransformers)audio.py: Audio capture and Vosk wake-word detectioncommand_processor.py: Speech-to-vision pipeline coordinationprocessor.py: Semantic task mapping from speech to Florence-2 tasksvideo.py: Webcam capture, tracking, and visualizationtracker.py: ByteTracker configuration and object trackingutils.py: Bounding box parsing and image processing utilitiesstate.py: Thread-safe global state managementMicrophone → Vosk (Wake Word) → Audio Recording → Whisper (STT)
↓
Semantic Mapping → Florence-2 Task Selection → Image Processing
↓
Webcam Frame → Florence-2 Model → Results (Captions/Detections/Masks)
↓
ByteTracker → Visual Overlay → Display
microsoft/Florence-2-base - Primary vision-language modelopenai/whisper-small - Speech transcriptionall-MiniLM-L6-v2 - Semantic similarity for task mappingvosk-model-small-en-us-0.15 - Offline wake-word detectionThe system uses multiple threads for concurrent processing:
Access real-time statistics via the state management system:
from state import get_stats, get_state_summary
# Get processing statistics
stats = get_stats()
print(f"Avg processing time: {stats['processing_time_avg']:.3f}s")
# Get system state summary
summary = get_state_summary()
print(f"Objects detected: {summary['detection_count']}")
processor.py:task_prompts["<NEW_TASK>"] = [
"custom command 1",
"custom command 2"
]
command_processor.py:elif task_code == "<NEW_TASK>":
# Custom processing logic
custom_result = process_custom_task(parsed_answer)
The modular architecture supports adding new VLM models:
models.pycommand_processor.pyprocessor.pySee requirements.txt for complete dependency list. Key packages:
torch>=2.3 - Deep learning frameworktransformers>=4.45 - Hugging Face model libraryultralytics>=8.0.20 - Object trackingopencv-python>=4.9.0 - Computer visionsounddevice==0.5.2 - Audio capturevosk>=0.3.45 - Speech recognitionsentence-transformers>=2.2.2 - Semantic similarityThis project code is released under the MIT License. Individual pre-trained models retain their original licenses:
Contributions welcome! Please see our contributing guidelines for:
Model Loading Errors:
Audio Issues:
sounddeviceVideo Issues:
cv2.VideoCapture(1)Performance Issues:
config.pyMIN_PROCESS_INTERVAL for slower systemsFor detailed logs, set environment variable: LOG_LEVEL=DEBUG
2 commits
Python
100.0%