Configuration¶
Settings live in settings.json in the data folder (./data, or --data-dir, or PPE_GUARD_DATA_DIR). The dashboard's Settings page edits the same file, and the server validates every change. An invalid file is moved aside to settings.invalid.json and defaults are used.
{
"general": {
"site_name": "My site"
},
"detection": {
"weights": "auto",
"confidence": 0.4,
"iou": 0.5,
"imgsz": 640,
"device": null,
"tracker": "bytetrack.yaml",
"max_fps": 15.0
},
"compliance": {
"required_ppe": {
"helmet": true,
"vest": true,
"mask": false
},
"violation_delay": 2.0,
"clear_after": 3.0,
"lost_timeout": 3.0,
"treat_unseen_as_missing": false,
"min_overlap": 0.5,
"snapshot_interval": 10.0,
"max_snapshots": 5
},
"alerts": {
"webhook_url": null,
"format": "generic",
"cooldown": 60.0,
"public_url": null
},
"recording": {
"clips": true,
"pre_seconds": 4.0,
"max_seconds": 20.0,
"fps": 8.0,
"max_width": 800
},
"storage": {
"retention_days": 0
},
"analysis": {
"max_upload_mb": 500,
"keep_jobs": 20
},
"cameras": [
{
"id": "webcam",
"name": "Webcam",
"source": "0",
"enabled": true,
"autostart": false,
"loop": true,
"zones": []
}
]
}
general¶
Site details.
| Key | Type | Default | Limits | Description |
|---|---|---|---|---|
general.site_name |
str | "My site" |
min length 1, max length 80 | Shown in the dashboard, reports and alerts. |
detection¶
How the model runs. weights needs a camera restart; the rest apply within a second.
| Key | Type | Default | Limits | Description |
|---|---|---|---|---|
detection.weights |
str | "auto" |
Path, model alias (see ppe-guard weights list) or 'auto'. |
|
detection.confidence |
float | 0.4 |
≥ 0.01, ≤ 1 | Minimum detection confidence. Lower finds more, with more false alarms. |
detection.iou |
float | 0.5 |
≥ 0.05, ≤ 1 | NMS overlap threshold (ignored by NMS-free models). |
detection.imgsz |
int | 640 |
≥ 160, ≤ 1920 | Inference image size in pixels. |
detection.device |
str or null | null |
'cpu', '0', 'cuda:0', 'mps'... null = GPU if available. | |
detection.tracker |
one of ['bytetrack.yaml', 'botsort.yaml'] | "bytetrack.yaml" |
Multi-object tracker that keeps worker IDs across frames. | |
detection.max_fps |
float | 15.0 |
≥ 1, ≤ 120 | Upper bound on processed frames per second. |
compliance¶
What counts as a violation. Applies to every camera; PPE zones can override required_ppe.
| Key | Type | Default | Limits | Description |
|---|---|---|---|---|
compliance.required_ppe |
RequiredPPE | (section) | Items every worker must wear. | |
compliance.violation_delay |
float | 2.0 |
≥ 0, ≤ 60 | Seconds an item must look missing before a violation opens. |
compliance.clear_after |
float | 3.0 |
≥ 0, ≤ 300 | Seconds of compliance before an open violation closes. |
compliance.lost_timeout |
float | 3.0 |
≥ 0.1, ≤ 300 | Seconds a worker may be out of view before being forgotten. |
compliance.treat_unseen_as_missing |
bool | false |
Strict mode: a required item that is not visible counts as missing. | |
compliance.min_overlap |
float | 0.5 |
> 0, ≤ 1 | Share of a PPE box that must lie inside a person box. |
compliance.snapshot_interval |
float | 10.0 |
≥ 1, ≤ 3600 | Seconds between snapshots of an ongoing violation. |
compliance.max_snapshots |
int | 5 |
≥ 1, ≤ 100 | Snapshots kept per violation. |
compliance.required_ppe:
| Key | Type | Default | Limits | Description |
|---|---|---|---|---|
compliance.required_ppe.helmet |
bool | true |
Hard hat required. | |
compliance.required_ppe.vest |
bool | true |
High-visibility safety vest required. | |
compliance.required_ppe.mask |
bool | false |
Face mask required. |
alerts¶
Webhook alerts for new violations.
| Key | Type | Default | Limits | Description |
|---|---|---|---|---|
alerts.webhook_url |
str or null | null |
URL that receives a POST for each new violation. | |
alerts.format |
one of ['generic', 'slack', 'discord'] | "generic" |
Payload shape: generic JSON, Slack or Discord. | |
alerts.cooldown |
float | 60.0 |
≥ 0, ≤ 86400 | Minimum seconds between alerts per camera. |
alerts.public_url |
str or null | null |
Dashboard address included in alert messages, e.g. https://ppe.example.com |
recording¶
Video clips saved with each violation.
| Key | Type | Default | Limits | Description |
|---|---|---|---|---|
recording.clips |
bool | true |
Save a short video clip with every violation. | |
recording.pre_seconds |
float | 4.0 |
≥ 0, ≤ 30 | Seconds of video kept from before a violation. |
recording.max_seconds |
float | 20.0 |
≥ 2, ≤ 120 | Longest clip, including the pre-roll. |
recording.fps |
float | 8.0 |
≥ 1, ≤ 30 | Frame rate of saved clips. |
recording.max_width |
int | 800 |
≥ 320, ≤ 1920 | Clips are scaled down to this width. |
storage¶
How long data is kept.
| Key | Type | Default | Limits | Description |
|---|---|---|---|---|
storage.retention_days |
int | 0 |
≥ 0, ≤ 3650 | Delete violations, snapshots and clips older than this. 0 keeps everything. |
analysis¶
Limits for the Analyze page.
| Key | Type | Default | Limits | Description |
|---|---|---|---|---|
analysis.max_upload_mb |
int | 500 |
≥ 1, ≤ 10000 | Largest file accepted by Analyze. |
analysis.keep_jobs |
int | 20 |
≥ 1, ≤ 500 | Finished analysis jobs to keep on disk. |
cameras¶
A list of cameras. Add them in Settings → Cameras or with the API.
| Key | Type | Default | Limits | Description |
|---|---|---|---|---|
cameras[].id |
str | required | Short slug, e.g. 'gate-north'. | |
cameras[].name |
str | required | min length 1, max length 80 | Display name. |
cameras[].source |
str | required | min length 1 | Webcam index ('0'), file path, or rtsp/http URL. |
cameras[].enabled |
bool | true |
Disabled cameras cannot be started. | |
cameras[].autostart |
bool | false |
Start this camera when the server starts. | |
cameras[].loop |
bool | true |
Restart video files when they end. | |
cameras[].zones |
list[Zone] | [] |
PPE and no-entry zones (see below). |
Zones¶
Each camera has a list of zones, drawn in the zone editor. Points are normalised to 0-1 (x to the right, y down).
| Key | Type | Default | Limits | Description |
|---|---|---|---|---|
cameras[].zones[].id |
str | required | Short slug, unique per camera. | |
cameras[].zones[].name |
str | required | min length 1, max length 60 | Shown on the video and in violations. |
cameras[].zones[].kind |
one of ['ppe', 'restricted'] | "ppe" |
'ppe': check PPE inside. 'restricted': nobody may enter. | |
cameras[].zones[].points |
list[tuple[float, float]] | required | min length 3, max length 64 | Polygon corners as [x, y] pairs in 0-1. |
cameras[].zones[].required_ppe |
RequiredPPE or null | null |
PPE zones only: items required inside this zone (default: global rule). | |
cameras[].zones[].enabled |
bool | true |
Disabled zones are kept but ignored. |
Environment variables¶
| Variable | Meaning |
|---|---|
PPE_GUARD_DATA_DIR |
Data folder (settings, database, snapshots, clips). Default ./data. |
PPE_GUARD_MODELS_DIR |
Where model weights are stored and downloaded. Default ./models. |
PPE_GUARD_PASSWORD |
Dashboard password. Set at every start, replacing one set in the UI. |