Detection Logging
Record and export object detection events with metadata
The logging stage records detection events with timestamps, locations, and confidence scores for analysis and reporting.
Every matched detection is logged with comprehensive metadata, enabling historical analysis, reporting, and integration with external systems.
| Field | Type | Description |
|---|
log_id | UUID | Unique entry identifier |
timestamp | TIMESTAMP | Detection time (UTC) |
class_id | INTEGER | Matched object class |
class_name | VARCHAR | Human-readable label |
confidence | FLOAT | Match confidence score |
camera_id | VARCHAR | Source camera identifier |
bbox | JSON | Bounding box coordinates |
frame_id | INTEGER | Source frame number |
| Step | Action | Output |
|---|
| 1 | Receive match result | Detection + class info |
| 2 | Enrich metadata | Add timestamp, camera, location |
| 3 | Duplicate check | Prevent rapid re-logging |
| 4 | Write to database | Persisted log entry |
| 5 | Trigger events | Webhooks, alerts |
Avoid logging the same object repeatedly:
| Parameter | Default | Description |
|---|
cooldown_seconds | 30 | Minimum time between same object logs |
iou_threshold | 0.7 | Spatial overlap threshold |
track_id | - | Object tracking ID (if available) |
| Backend | Use Case | Features |
|---|
| PostgreSQL | Production | ACID, queries, joins |
| SQLite | Development | Simple, embedded |
| CSV | Export | Human-readable, portable |
| JSON Lines | Streaming | Append-only, flexible |
CREATE TABLE detection_logs (
log_id UUID PRIMARY KEY,
timestamp TIMESTAMP NOT NULL,
class_id INTEGER REFERENCES object_classes(id),
class_name VARCHAR(100),
confidence FLOAT,
camera_id VARCHAR(50),
bbox JSONB,
frame_id INTEGER,
created_at TIMESTAMP DEFAULT NOW()
);
CREATE INDEX idx_logs_timestamp ON detection_logs(timestamp);
CREATE INDEX idx_logs_class ON detection_logs(class_id);
CREATE INDEX idx_logs_camera ON detection_logs(camera_id);
| Format | Extension | Use Case |
|---|
| CSV | .csv | Spreadsheet analysis |
| JSON | .json | API consumption |
| Parquet | .parquet | Big data pipelines |
| Excel | .xlsx | Business reports |
| Filter | Description |
|---|
| Today | Logs from current date |
| Last hour | Recent detections |
| Custom range | Start and end timestamps |
| Filter | Description |
|---|
| Single class | All logs for one object type |
| Multiple classes | Filter by list |
| Exclude classes | All except specified |
| Metric | Description |
|---|
| Count by class | Total detections per type |
| Count by hour | Hourly detection volume |
| Count by camera | Detections per source |
| Average confidence | Mean match confidence |
| Event | Trigger | Action |
|---|
| New detection | Any match logged | Webhook, database write |
| High-value object | Specific class detected | Alert notification |
| Anomaly | Unusual detection pattern | Escalation |
| Threshold exceeded | Count > limit | Warning |
| Strategy | Duration | Description |
|---|
| Keep all | Indefinite | Full history |
| Rolling window | 30/90 days | Delete older logs |
| Archive | 1 year | Move to cold storage |
| Aggregate only | After 30 days | Keep summaries |
| System | Method | Purpose |
|---|
| REST API | HTTP | External queries |
| Webhooks | POST | Real-time notifications |
| Message queue | Pub/sub | Event streaming |
| Dashboard | SQL | Visualization |