forked from dsutanto/zenai-kpc-python
merging to main
This commit is contained in:
1 parent
d9c04d36c0
commit
6071d56dc3
5 files changed
+196
-146
No files matched your search
+59
-50
@@ -1,32 +1,27 @@
|
||||
# =============================================================================
|
||||
# ZenAI KPC edge counter + dashboard
|
||||
# Shared config for: counter_live_rknn.py + counter_dashboard.py
|
||||
#
|
||||
# On device:
|
||||
# cp env.example .env && nano .env
|
||||
#
|
||||
# Install path (systemd): /opt/zenai-kpc-python
|
||||
# Data path: /opt/zenai-kpc-counter
|
||||
# See DEPLOY.md for full setup instructions.
|
||||
# =============================================================================
|
||||
# Edge RK3588 production counter + dashboard
|
||||
# Shared config for: counter_live_rknn_bytetrack.py + counter_dashboard.py
|
||||
# Copy to .env on device: cp config.env.example .env && nano .env
|
||||
# =============================================================================
|
||||
|
||||
# --- Core paths ---
|
||||
# Root output directory (video segments, default snapshot/CSV paths)
|
||||
OUTPUT_DIR=/opt/zenai-kpc-counter
|
||||
# SQLite database path for daily counter records
|
||||
DB_PATH=/opt/zenai-kpc-counter/counter.db
|
||||
# JSON file for the active counting-day state (counter writes, dashboard reads)
|
||||
STATE_FILE=/opt/zenai-kpc-counter/current_counter.json
|
||||
# Root output directory (logs, DB, video, CSV)
|
||||
OUTPUT_DIR=/opt/zenai-kpc-bt-counter
|
||||
# SQLite database path for daily counter records & crossing logs
|
||||
DB_PATH=/tmp/counter.db
|
||||
# JSON file persisting the current active counting day state
|
||||
STATE_FILE=/tmp/current_counter.json
|
||||
|
||||
# --- Input source ---
|
||||
# RTSP / HTTP live stream, or a local video file path
|
||||
SOURCE=rtsp://user:pass@192.168.0.100:554/stream1
|
||||
#SOURCE=rtsp://user:pass@192.168.0.100:554/stream1
|
||||
SOURCE=rtsp://10.38.30.64:8554/my_stream
|
||||
# FFmpeg capture options passed to cv2.VideoCapture (RTSP low-latency flags)
|
||||
OPENCV_FFMPEG_CAPTURE_OPTIONS=rtsp_transport;tcp|fflags;nobuffer|flags;low_delay
|
||||
|
||||
# --- RKNN model ---
|
||||
# Path to exported .rknn model (YOLO format)
|
||||
MODEL_PATH=/opt/models/your_model.rknn
|
||||
# Path to exported .rknn model (YOLO format, e.g. yolo11n.rknn)
|
||||
MODEL_PATH=/opt/models/zenai_kac_sukawarna_20260702.rknn
|
||||
# Input image size for the model (square, e.g. 320 → 320×320)
|
||||
IMGSZ=320
|
||||
# Use FP16 inference on NPU (true/false); currently unused in ByteTrack variant
|
||||
@@ -58,24 +53,14 @@ TRACK_BUFFER=60
|
||||
# Minimum consecutive (or total) hits needed before a track is considered confirmed
|
||||
TRACK_MIN_HITS=3
|
||||
|
||||
# --- ID-switch counting guards ---
|
||||
# Dedup guard: ignore a second crossing in the same direction within DEDUP_FRAMES
|
||||
# frames and DEDUP_PX horizontal pixels (set DEDUP_PX=-1 to disable).
|
||||
DEDUP_FRAMES=15
|
||||
DEDUP_PX=60
|
||||
# Inheritance guard: new tracks inherit position from a recently-seen nearby track
|
||||
# (set INHERIT_PX=-1 to disable).
|
||||
INHERIT_SEC=1.0
|
||||
INHERIT_PX=60
|
||||
|
||||
# --- Display ---
|
||||
# Site name shown on the dashboard header
|
||||
# Site name shown on the dashboard header (top-right)
|
||||
SITE_NAME=ZenAi
|
||||
|
||||
# --- Object class names ---
|
||||
# Camera / location identifier shown in HUD and stored in DB
|
||||
CAMERA_NAME=ZenAi
|
||||
# Label used for grouping in the database
|
||||
# Label used for batch grouping in the database
|
||||
OBJECT_LABEL=karung
|
||||
# Class name for the counted object (must match model class order)
|
||||
CLASS_OBJECT=karung
|
||||
@@ -83,59 +68,83 @@ CLASS_OBJECT=karung
|
||||
OBJECT_CLASS_ID=0
|
||||
|
||||
# --- Line crossing ---
|
||||
# Line 1 (~upper): counts top-to-down (IN). Line 2 (~lower): bottom-to-up (OUT).
|
||||
# Fixed y-coordinate overrides the fraction if set.
|
||||
# Two horizontal counting lines:
|
||||
# Line 1 (default ~33%): counts top-to-down (IN)
|
||||
# Line 2 (default ~66%): counts bottom-to-up (OUT)
|
||||
# Fixed y-coordinate for line 1/IN (overrides LINE_Y1_FRAC if set)
|
||||
LINE_Y1=
|
||||
# Fraction of frame height for line 1 (default 0.33)
|
||||
LINE_Y1_FRAC=0.70
|
||||
# Fixed y-coordinate for line 2 (overrides LINE_Y2_FRAC if set)
|
||||
LINE_Y2=
|
||||
# Fraction of frame height for line 2 (default 0.66)
|
||||
LINE_Y2_FRAC=0.30
|
||||
|
||||
# --- Counting day management ---
|
||||
# New counting day starts after this time (HH:MM).
|
||||
# Daily cutoff time (HH:MM) – a new counting day starts after this time and the
|
||||
# previous day's counter_in / counter_out totals are finalized in the database.
|
||||
# CUTOFF_TIME is an alias used by the dashboard; DAILY_CUTOFF_TIME takes priority in counter_live_rknn.py.
|
||||
DAILY_CUTOFF_TIME=20:00
|
||||
CUTOFF_TIME=20:00
|
||||
|
||||
# --- CSV export ---
|
||||
# Write per-crossing events to a CSV file (true/false)
|
||||
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
|
||||
# Path where the crossing CSV is written
|
||||
CROSS_CSV=/tmp/crossings.csv
|
||||
|
||||
# --- Rate / performance ---
|
||||
# Enable motion detection pre-filter: skip inference on frames with no movement
|
||||
# (true/false, default: false). When enabled, frames below MOTION_THRESHOLD are
|
||||
# skipped, saving NPU/CPU load.
|
||||
MOTION_DETECTION_ENABLED=true
|
||||
MOTION_PIXEL_DELTA=25
|
||||
MOTION_MIN_AREA_FRAC=0.002
|
||||
MOTION_HEARTBEAT_FRAMES=15
|
||||
# Mean absolute pixel difference threshold (0–255) to consider a frame as having
|
||||
# motion. Lower = more sensitive. Default 5.0.
|
||||
MOTION_THRESHOLD=5.0
|
||||
# Sliding window in seconds for computing the crossing rate (objects/minute)
|
||||
RATE_WINDOW_SEC=60
|
||||
# Number of frames to discard at startup to let the stream buffer stabilise
|
||||
WARMUP_FRAMES=30
|
||||
# Delay in seconds between stream reconnection attempts
|
||||
RECONNECT_DELAY_SEC=3
|
||||
# Maximum reconnection attempts (0 = infinite)
|
||||
MAX_RECONNECT_ATTEMPTS=0
|
||||
# Seconds after which a tracked but unseen object is pruned from the active set
|
||||
TRACKED_PRUNE_SEC=300
|
||||
|
||||
# --- Video recording ---
|
||||
# Save annotated frames to segmented MP4 files (true/false)
|
||||
RECORD_VIDEO=false
|
||||
# Duration in seconds of each video segment file
|
||||
VIDEO_SEGMENT_SEC=3600
|
||||
# Output video FPS (fallback if source FPS is unknown or ≤ 1)
|
||||
OUTPUT_FPS=15
|
||||
|
||||
# --- Live stream snapshot ---
|
||||
# Periodically write the latest annotated frame as JPEG for an external web server
|
||||
LIVE_STREAM_ENABLED=true
|
||||
LIVE_STREAM_FRAME_PATH=/dev/shm/zenai-kpc-counter/live_frame.jpg
|
||||
# Path to the shared-memory snapshot file (served by nginx / lighttpd)
|
||||
LIVE_STREAM_FRAME_PATH=/dev/shm/byetrack-counter/live_frame.jpg
|
||||
# JPEG quality (1–100)
|
||||
LIVE_STREAM_QUALITY=75
|
||||
# Write the snapshot every N frames (lower = more frequent updates)
|
||||
LIVE_STREAM_EVERY_N=2
|
||||
|
||||
# --- Dashboard (counter_dashboard.py) ---
|
||||
# Flask secret key for session/cookie signing — change in production!
|
||||
SECRET_KEY=change-me-in-production
|
||||
# Bind address for the Flask web server
|
||||
DASHBOARD_HOST=0.0.0.0
|
||||
# Listen port for the dashboard web UI
|
||||
DASHBOARD_PORT=5000
|
||||
# Enable Flask debug mode (true/false) — auto-reloads on code changes; disable in production
|
||||
FLASK_DEBUG=false
|
||||
# Fallback name for the active counting-day JSON state file used by the dashboard
|
||||
CURRENT_COUNTER_PATH=/tmp/bytetrack_current_counter.json
|
||||
|
||||
# Debug: set DEBUG_TRACKING=true to log per-frame tracking details to stdout
|
||||
# DEBUG_TRACKING=false
|
||||
SAVE_CROSS_SNAPSHOT=true
|
||||
CROSS_SNAPSHOT_DIR=/opt/zenai-kpc-snaps/snapshots
|
||||
CROSS_SNAPSHOT_CLEANUP_SEC=3600
|
||||
CROSS_SNAPSHOT_MAX_AGE_DAYS=3
|
||||
|
||||
DEDUP_PX=-1
|
||||
Reference in new issue
Block a user