Python optimize [Multi-coop multi-floor discovery, Auto .engine compilation, API, mortality webapp trigger, parallel processing/tensor batching/hybrid, etc.] #3

Merged
zakaria merged 39 commits from andrew/chicken-counting-sukawarna-det:python-optimize into python-optimize 2026-08-20 11:00:31 +07:00
Contributor

too many stuff to mention

too many stuff to mention
andrew added 39 commits 2026-08-20 10:58:21 +07:00
Reviewed-on: #1
- Remove shared DetectionTracker across cameras to prevent state leakage
- Add task="detect" to YOLO constructor to suppress warning
- Add export_engine.py script for .pt to .engine conversion
- Regenerate ONNX and TensorRT engine with latest settings
- Return early when tracks list is empty
- Fast-reject centroid by bounding rect before pointPolygonTest
- Purge stale tracks every 30 frames instead of every frame
- Skip deque append when trail_length == 0
- Auto-detect active camera by polling frame_index
- Show All Cameras Total accumulation in sidebar
- Show per-camera totals in camera list
- Add run_date to stats.json and display in dashboard
- Pipeline: thread run_date through build/run/batch
- batch_runner: _store_to_db after each camera (not just at end)
- dashboard: Flask app with templates/index.html
- Single-camera full-screen live stream with auto-switch
- DB history panel in sidebar
- store_results.py: standalone script for existing reports
- api/db/summary — overall totals
- api/db/history — per-date rows
- api/db/date/<date> — single date detail with per-camera breakdown
- api/db/camera/<id> — all runs for a specific camera
- api/db/location/<name> — per-location summary + history
- API.md — full endpoint documentation with schema
Wipe chicken_counter_* directories on batch start so dashboard
starts clean and populates as each camera runs.
- Suppress Flask request logs (werkzeug ERROR only)
- Cache SQLite connection with WAL + 8MB cache
- Increase poll_ms 500->1000, history refresh 30s->60s
- Show 'waiting for pipeline...' when /dev/shm empty
- Add chicken-dashboard.service for systemd auto-start
_init_db() creates the schema at startup so /api/db/*
endpoints work immediately without needing a batch run first.
- Add configs/cycle7_batch_optimized.yaml with tuned thresholds
- Update BatchConfig: add location and db_path fields
- Remove .pt/.onnx/.engine files from tracking (too large for git)
- Clean untracked test artifacts
- Switch Flask dev server -> waitress (8 threads, production WSGI)
- Only refresh frame.jpg when frame_index changes, not every second
- Safety try/except on send_file for edge-case file conflicts
- Fix test_run.sh: export PYTHONPATH, use venv python
- Update service file to use venv python
- Add engine_utils for TensorRT compatibility verification, auto-recompilation from .pt models, and YAML auto-updates
- Add mortality detection pipeline (mortality.py, test_run_mortality.sh, mortality_config.yaml)
- Add multi-execution batch modes (parallel_processes, tensor_batching, hybrid) in batch_runner.py
- Add daily test run automation scripts and video processing runners
- Add dashboard REST API, live stream endpoints, and web UI templates
- Clean up git tracking by ignoring __pycache__, .pyc, and build artifacts
zakaria merged commit d07e310593 into python-optimize 2026-08-20 11:00:31 +07:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: zakaria/chicken-counting-sukawarna-det#3