A Flask-based monitoring and camera-management web app that uses a YOLO segmentation/tracking model to detect and label people (customers / workers / unknown) in video feeds, store camera configurations in a MySQL database, and optionally send LINE notifications.
Key files
- server.py — main Flask app and video pipeline. See
server.is_box_partially_in_regionandserver.generate_frames. - user_management.py — CLI to add/delete/list login users. See
user_management.cli_menu. - utils/login_utils.py — login helpers and password hashing. See
utils.login_utils.validate_login,utils.login_utils.add_userandutils.login_utils.hash_password. - utils/sql_cmd.py — DB connection and helper functions. See
utils.sql_cmd.connect_V89DB. - utils/create_cameraTable.py — camera_config table creation and CSV import.
- utils/create_login_database.py — creates the login table.
- static/main.js — client JS (WebRTC / UI helpers). See
createOfferin static/main.js. - botsort.yaml — tracker configuration used by the model.
- segment_V89_small_openvino_model/metadata.yaml — model metadata.
- Templates: templates/index.html, templates/dashboard.html, templates/login.html, templates/config.html
Requirements
- Python 3.8+
- MySQL server accessible to the app
- Packages (install with pip): flask, ultralytics, opencv-python, aiortc, shapely, mysql-connector-python, requests, pandas
Quick setup
-
Creating conda environment:
conda env create -f environment.yaml conda activate V89_monitoring
Updating environment:
conda env update --file environment.yaml --prune
-
Configure DB access (the code uses
connect_V89DB()defaults in utils/sql_cmd.py). Update credentials there or wrap via environment vars. -
Create DB tables:
- Run utils/create_cameraTable.py to create
camera_configand importform_data.csv. - Run utils/create_login_database.py to create the
logintable.
- Run utils/create_cameraTable.py to create
-
Add a user with the CLI:
python user_management.py
This uses [user_management.cli_menu] which calls [utils.login_utils.add_user].
Run the app
python server.py