- Camera Control
- Real-Time Pose Estimation
- Video Recording
- Configuration Management
- Processor System
- User Interface
- Performance Monitoring
- Advanced Features
The GUI supports four different camera backends, each optimized for different use cases:
- Platform: Windows, Linux
- Best For: Webcams, simple USB cameras
- Installation: Built-in with OpenCV
- Limitations: Limited exposure/gain control
- Platform: Windows, Linux
- Best For: Industrial cameras with GenTL producers
- Installation: Requires vendor CTI files
- Features: Full camera control, smart device detection
- Platform: Linux (best)
- Best For: GenICam/GigE Vision cameras
- Installation: System packages (
gir1.2-aravis-0.8)
- Platform: Windows, Linux, macOS
- Best For: Basler cameras specifically
- Installation: Pylon SDK + pypylon
- Features: Vendor-specific optimizations
- Range: 1-240 FPS (hardware dependent)
- Real-time FPS monitoring
- Automatic camera validation
- Auto mode (value = 0)
- Manual mode (microseconds)
- Range: 0-1,000,000 μs
- Real-time adjustment (backend dependent)
- Auto mode (value = 0.0)
- Manual mode (gain value)
- Range: 0.0-100.0
- Useful for low-light conditions
- Define crop region: (x0, y0, x1, y1)
- Applied before recording and inference
- Reduces processing load
- Maintains aspect ratio
- 0°, 90°, 180°, 270° rotation
- Applied to all outputs
- Useful for mounted cameras
The GUI intelligently detects available cameras:
- Backend-Specific: Each backend reports available cameras
- No Blind Probing: GenTL and Aravis query actual device count
- Fast Refresh: Only check connected devices
- Detailed Labels: Shows vendor, model, serial number
Example detection output:
[CameraDetection] Available cameras for backend 'gentl':
['0:DMK 37BUX287 (26320523)', '1:Basler acA1920 (40123456)']
- PyTorch: PyTorch-exported models
- Model selection via dropdown
- Automatic model validation
- Frame Acquisition: Camera thread → Queue
- Preprocessing: Crop, resize (optional)
- Inference: DLCLive model processing
- Pose Output: (x, y) coordinates per keypoint
- Visualization: Optional overlay on video
- Inference FPS: Actual processing rate
- Latency: Time from capture to pose output
- Last latency (ms)
- Average latency (ms)
- Queue Status: Frame buffer depth
- Dropped Frames: Count of skipped frames
- Toggle: "Display pose predictions" checkbox
- Keypoint Markers: Green circles at (x, y) positions
- Real-Time Update: Synchronized with video feed
- No Performance Impact: Rendering optimized
- Purpose: Visual ROI definition
- Configuration: (x0, y0, x1, y1) coordinates
- Color: Red rectangle overlay
- Use Cases:
- Crop region preview
- Analysis area marking
- Multi-region tracking
Visual indicators during model loading:
- "Initializing DLCLive!" - Blue button during load
- "DLCLive running!" - Green button when ready
- Status bar updates with progress
- NVENC (NVIDIA): GPU-accelerated H.264/H.265
- Codecs:
h264_nvenc,hevc_nvenc - 10x faster than software encoding
- Minimal CPU usage
- Codecs:
- Software Encoding: CPU-based fallback
- Codecs:
libx264,libx265 - Universal compatibility
- Codecs:
- MP4: Most compatible, web-ready
- AVI: Legacy support
- MOV: Apple ecosystem
- CRF (Constant Rate Factor): 0-51
- 0 = Lossless (huge files)
- 23 = Default (good quality)
- 28 = High compression
- 51 = Lowest quality
- Presets: ultrafast, fast, medium, slow
- Frame-accurate timestamps
- Microsecond precision
- Synchronized with pose data
- Stored in separate files
- Write FPS: Actual encoding rate
- Queue Size: Buffer depth (~ms)
- Latency: Encoding delay
- Frames Written/Enqueued: Progress tracking
- Dropped Frames: Quality indicator
- Configurable queue size
- Automatic overflow handling
- Warning on frame drops
- Backpressure indication
Processor-triggered recording:
- Enable: Check "Auto-record video on processor command"
- Processor Control: Custom processor sets recording flag
- Automatic Start: GUI starts recording when flag set
- Session Naming: Uses processor-defined session name
- Automatic Stop: GUI stops when flag cleared
Use Cases:
- Event-triggered recording
- Trial-based experiments
- Conditional data capture
- Remote control via socket
Single JSON file contains all settings:
{
"camera": { ... },
"dlc": { ... },
"recording": { ... },
"bbox": { ... }
}- Load: File → Load configuration (Ctrl+O)
- Save: File → Save configuration (Ctrl+S)
- Save As: File → Save configuration as (Ctrl+Shift+S)
- Auto-sync: GUI fields update from file
- Switch between experiments quickly
- Per-animal configurations
- Environment-specific settings
- Backup and version control
- Type checking on load
- Default values for missing fields
- Error messages for invalid entries
- Safe fallback to defaults
Custom pose processors for real-time analysis and control.
class MyProcessor:
"""Custom processor example."""
def process(self, pose, timestamp):
"""Process pose data in real-time.
Args:
pose: numpy array (n_keypoints, 3) - x, y, likelihood
timestamp: float - frame timestamp
"""
# Extract keypoint positions
nose_x, nose_y = pose[0, :2]
# Custom logic
if nose_x > 320:
self.trigger_event()
# Return results (optional)
return {"position": (nose_x, nose_y)}- Place processor file in
dlclivegui/processors/ - Click "Refresh" in processor dropdown
- Select processor from list
- Start inference to activate
Socket Processor (dlc_processor_socket.py):
- TCP socket server for remote control
- Commands:
START_RECORDING,STOP_RECORDING - Session management
- Multi-client support
Processors can control recording:
class RecordingProcessor:
def __init__(self):
self._vid_recording = False
self.session_name = "default"
@property
def video_recording(self):
return self._vid_recording
def start_recording(self, session):
self.session_name = session
self._vid_recording = True
def stop_recording(self):
self._vid_recording = FalseThe GUI monitors video_recording property and automatically starts/stops recording.
- Camera Settings: Backend, index, FPS, exposure, gain, crop
- DLC Settings: Model path, type, processor, options
- Recording Settings: Path, filename, codec, quality
- Bounding Box: Visualization controls
- Live camera feed
- Pose overlay (optional)
- Bounding box overlay (optional)
- Auto-scaling to window size
- Current operation status
- Error messages
- Success confirmations
- Backend selection dropdown
- Camera index/refresh
- FPS, exposure, gain spinboxes
- Crop coordinates
- Rotation selector
- Start/Stop Preview buttons
- Model path browser
- Model type selector
- Processor folder/selection
- Additional options (JSON)
- Start/Stop Inference buttons
- "Display pose predictions" checkbox
- "Auto-record" checkbox
- Processor status display
- Output directory browser
- Filename input
- Container/codec selectors
- CRF quality slider
- Start/Stop Recording buttons
- Disabled: Gray, not clickable
- Enabled: Default color, clickable
- Active:
- Preview running: Stop button enabled
- Inference initializing: Blue "Initializing DLCLive!"
- Inference ready: Green "DLCLive running!"
- Camera FPS (last 5 seconds)
- DLC performance metrics
- Recording statistics
- Processor connection status
- Throughput: FPS over last 5 seconds
- Formula:
(frame_count - 1) / time_elapsed - Display: "45.2 fps (last 5 s)"
- Inference FPS: Poses processed per second
- Latency:
- Last frame latency (ms)
- Average latency over session (ms)
- Queue: Number of frames waiting
- Dropped: Frames skipped due to queue full
- Format: "150/152 frames | inference 42.1 fps | latency 23.5 ms (avg 24.1 ms) | queue 2 | dropped 2"
- Write FPS: Encoding rate
- Frames: Written/Enqueued ratio
- Latency: Encoding delay (ms)
- Buffer: Queue size (~milliseconds)
- Dropped: Encoding failures
- Format: "1500/1502 frames | write 59.8 fps | latency 12.3 ms (avg 12.5 ms) | queue 5 (~83 ms) | dropped 2"
All components share frame timestamps:
- Camera controller generates timestamps
- DLC processor preserves timestamps
- Video recorder stores timestamps
- Enables post-hoc alignment
- Automatic detection via frame grab failure
- User notification
- Clean resource cleanup
- Restart capability
- Frame size mismatch detection
- Automatic recovery with new settings
- Warning display
- No data loss
Multi-threaded architecture:
- Main Thread: GUI event loop
- Camera Thread: Frame acquisition
- DLC Thread: Pose inference
- Recording Thread: Video encoding
Qt signals/slots ensure thread-safe communication.
- Camera release on stop/error
- DLC model unload on stop
- Recording finalization
- Thread termination
- Bounded queues prevent memory leaks
- Frame copy-on-write
- Efficient numpy array handling
- Console output for errors
- Frame acquisition logging
- Performance warnings
- Connection status
- Ctrl+O: Load configuration
- Ctrl+S: Save configuration
- Ctrl+Shift+S: Save configuration as
- Ctrl+Q: Quit application