139 lines
4.2 KiB
Bash
139 lines
4.2 KiB
Bash
# =============================================================================
|
||
# DEPRECATED — use env.example instead.
|
||
#
|
||
# cp env.example .env && nano .env
|
||
#
|
||
# This file is kept for backward compatibility only. All new deployments should
|
||
# use env.example as the single canonical template. See DEPLOY.md.
|
||
# =============================================================================
|
||
|
||
# --- Core paths ---
|
||
OUTPUT_DIR=/opt/zenai-kpc-counter
|
||
DB_PATH=/opt/zenai-kpc-counter/counter.db
|
||
STATE_FILE=/opt/zenai-kpc-counter/current_counter.json
|
||
|
||
# --- Input source ---
|
||
SOURCE=rtsp://user:pass@192.168.0.100:554/stream1
|
||
OPENCV_FFMPEG_CAPTURE_OPTIONS=rtsp_transport;tcp|fflags;nobuffer|flags;low_delay
|
||
|
||
# --- RKNN model ---
|
||
MODEL_PATH=/opt/models/your_model.rknn
|
||
IMGSZ=320
|
||
HALF=false
|
||
CORE_MASK=1
|
||
DEVICE=0
|
||
|
||
# --- YOLO decoder ---
|
||
NUM_CLASSES=4
|
||
SCORE_SIGMOID=false
|
||
|
||
# --- Detection ---
|
||
# Confidence threshold – detections below this are discarded before NMS
|
||
CONF=0.3
|
||
# NMS IoU threshold (0-1): boxes overlapping the top box by more than this are
|
||
# suppressed. RAISE it (e.g. 0.6-0.7) if two close/overlapping objects are being
|
||
# merged into one and their separate boxes get suppressed. Lower = more aggressive
|
||
# merging. Default 0.45.
|
||
NMS_IOU=0.45
|
||
|
||
# --- ByteTrack tracking ---
|
||
TRACK_HIGH_THRESH=0.5
|
||
TRACK_LOW_THRESH=0.3
|
||
TRACK_MATCH_THRESH=0.7
|
||
TRACK_BUFFER=60
|
||
TRACK_MIN_HITS=3
|
||
|
||
# --- ID-switch counting guards ---
|
||
DEDUP_FRAMES=15
|
||
DEDUP_PX=60
|
||
INHERIT_SEC=1.0
|
||
INHERIT_PX=60
|
||
|
||
# --- Display ---
|
||
SITE_NAME=ZenAi
|
||
|
||
# --- Object class names ---
|
||
CAMERA_NAME=ZenAi
|
||
OBJECT_LABEL=karung
|
||
CLASS_OBJECT=karung
|
||
OBJECT_CLASS_ID=0
|
||
|
||
# --- Line crossing ---
|
||
LINE_Y1=
|
||
LINE_Y1_FRAC=0.70
|
||
LINE_Y2=
|
||
LINE_Y2_FRAC=0.30
|
||
|
||
# --- Counting day management ---
|
||
DAILY_CUTOFF_TIME=20:00
|
||
CUTOFF_TIME=20:00
|
||
|
||
# --- CSV export ---
|
||
EXPORT_CSV=false
|
||
CROSS_CSV=/opt/zenai-kpc-counter/crossings.csv
|
||
|
||
# --- Crossing snapshots ---
|
||
SAVE_CROSS_SNAPSHOT=true
|
||
SAVE_DETECT_SNAPSHOT=false
|
||
CROSS_SNAPSHOT_DIR=/opt/zenai-kpc-counter/snapshots
|
||
CROSS_SNAPSHOT_QUALITY=85
|
||
CROSS_SNAPSHOT_MAX_FILES=1000
|
||
CROSS_SNAPSHOT_MAX_AGE_DAYS=3
|
||
CROSS_SNAPSHOT_CLEANUP_SEC=3600
|
||
|
||
# --- Rate / performance ---
|
||
MOTION_DETECTION_ENABLED=true
|
||
MOTION_PIXEL_DELTA=25
|
||
MOTION_MIN_AREA_FRAC=0.002
|
||
MOTION_HEARTBEAT_FRAMES=15
|
||
MOTION_THRESHOLD=5.0
|
||
|
||
# --- Runtime control (start/stop counting on the fly) ---
|
||
# When true, the counter watches a JSON control file and pauses/resumes object
|
||
# detection & counting based on its "counting" flag. The dashboard shows a
|
||
# COUNTING ON/OFF toggle button that writes this file. When false, the counter
|
||
# always counts and the dashboard hides the toggle. (true/false, default: false)
|
||
CONTROL_ENABLED=false
|
||
# Path to the shared control file. MUST be identical for the counter and the
|
||
# dashboard so the toggle takes effect. Contents: {"counting": true|false}
|
||
CONTROL_FILE=/opt/bytetrack-counter/control.json
|
||
# Counting state to assume on startup / when the control file does not exist yet.
|
||
CONTROL_DEFAULT_COUNTING=true
|
||
# How often (seconds) the counter re-reads the control file. Default 1.0.
|
||
CONTROL_POLL_SEC=1.0
|
||
# Optional TCP control socket (requires CONTROL_ENABLED=true). Lets you toggle
|
||
# counting over the network with line commands. It updates the same control file,
|
||
# so changes apply within CONTROL_POLL_SEC. (true/false, default: false)
|
||
# Commands (newline-terminated): START|RESUME|ON, STOP|PAUSE|OFF, TOGGLE, STATUS
|
||
# e.g. printf 'STOP\n' | nc 127.0.0.1 5090
|
||
CONTROL_SOCKET_ENABLED=false
|
||
# Bind address for the control socket. Use 127.0.0.1 for local-only, 0.0.0.0 to
|
||
# allow remote clients (no auth — protect with firewall / trusted network).
|
||
CONTROL_SOCKET_HOST=127.0.0.1
|
||
# Control socket TCP port.
|
||
CONTROL_SOCKET_PORT=5090
|
||
|
||
# Sliding window in seconds for computing the crossing rate (objects/minute)
|
||
RATE_WINDOW_SEC=60
|
||
WARMUP_FRAMES=30
|
||
RECONNECT_DELAY_SEC=3
|
||
MAX_RECONNECT_ATTEMPTS=0
|
||
TRACKED_PRUNE_SEC=300
|
||
|
||
# --- Video recording ---
|
||
RECORD_VIDEO=false
|
||
VIDEO_SEGMENT_SEC=3600
|
||
OUTPUT_FPS=15
|
||
|
||
# --- Live stream snapshot ---
|
||
LIVE_STREAM_ENABLED=true
|
||
LIVE_STREAM_FRAME_PATH=/dev/shm/zenai-kpc-counter/live_frame.jpg
|
||
LIVE_STREAM_QUALITY=75
|
||
LIVE_STREAM_EVERY_N=2
|
||
|
||
# --- Dashboard (counter_dashboard.py) ---
|
||
SECRET_KEY=change-me-in-production
|
||
DASHBOARD_HOST=0.0.0.0
|
||
DASHBOARD_PORT=5000
|
||
FLASK_DEBUG=false
|