Files
karung-counting-feedmill-se…/CHANGELOG.md
T

121 lines
6.6 KiB
Markdown

# Changelog
All notable changes to this project are documented here. Format follows
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) (dated entries; no
version tags are cut in this repo — POC stage, `main` is the release line).
## [Unreleased]
### Added
- **DO-gated manual batch mode** (`auto` default · `do_manual` · legacy `manual`):
smartphone photo capture → OCR draft → plate-grouped start gates → net
expected/counted on live panel → stop soft-warn + force → discard only when
**both** gross `count` and `box_loading` are 0.
- `config.yaml` `batch.default_mode` + `do:` block; `DoConfig` in
`src/config_loader.py`; runtime `$OUTPUT_DIR/do_settings.json`.
- `delivery_orders` table + additive `batches` columns (`plate`, `do_numbers`,
`expected_*`, `net_*`); photo tree `do_photos/YYYY-MM-DD/` (7-day retention).
- APIs: `POST /api/batch/stop-preview`, DO CRUD + `POST /api/do/upload`,
`GET|POST /api/do/settings` (all gated fields office-only:
require_plate/require_do/**ocr_engine**, 403 on operator), office-only
mode/model_mode POST (403 on operator; 409 when batch active).
- `src/do_batch.py` (pure gates/nets/units), `src/do_ocr.py`
(`extract_do_fields` rapid|tesseract|paddle|none).
- **RapidOCR default engine** (`rapidocr_onnxruntime`, bundled PP-OCR models);
tesseract + paddle kept as backups, explicit error if a dep is missing.
- Operator DO panel (no OCR toggle); monitoring 3-way mode switch + model mode +
OCR selector with labels `RapidOCR (Default, Light & Accurate)` /
`Tesseract (Backup, Light)` / `PaddleOCR (Accuracy, Heavy to run)` /
`None (Manual)` + require-plate controls; history/export plate, DO,
expected, net columns.
- `ERD.md` (Mermaid ERD, repo root; superseded `docs/do-erd.md`); tests `tests/test_do_batch.py`.
### Changed
- OCR engine default **`rapid`** (was `tesseract`) across `config.yaml`,
`DoConfig`, `empty_do_settings`, `extract_do_fields`; `ocr_engine` write
moved office-only (was both ports); OCR engine selector removed from
operator page.
- Default batch mode seed **`auto`** (was hard-coded `manual` when
`batch_mode.json` missing); `predict.py` accepts `do_manual` as operator-driven
and persists sack `unloading` for net-at-stop.
- Finalize discard rule (dashboard stop **and** `predict.py` `finalize_batch`):
keep row if **either** net ≠ 0 (box-only batches no longer dropped).
- Batch discard rule now gross-based: drop only when `count == 0` **and**
`box_loading == 0` (was both nets 0 — kept rows like `count=0, unloading=7`).
- Event log wording: `masuk`/`keluar` now match event direction (unloading no
longer logged as `masuk`, `TOTAL` line follows direction); wired the
existing-but-unused `src/logger.py` `CSVLogger` into `predict.py`
(`batch_summary.csv`, `sack_events.csv` under `output.dir`).
## 2026-09-18 — Config tuning: Sack confidence and batch timeout
### Changed
- `config.yaml`: Decreased `models.detection_params.sack.conf` from `0.35` to `0.30` for improved sack sensitivity.
- `config.yaml`: Decreased `batch.timeout_seconds` from `30.0` to `20.0` for faster batch cycle completion.
- `config.yaml`: Clarified deprecation note on `batch.merge_threshold_seconds`.
## 2026-09-17 — Unified `config.yaml` with extensible model presets
### Added
- `config.yaml` — single canonical config (stream, models, counting knobs,
batch, output paths, camera). Secrets/deployment-only values stay in `.env`.
- `src/config_loader.py` — stdlib-dataclasses + pyyaml loader, zero new
dependencies. Missing file falls back to `.env` + legacy defaults with a
`UserWarning`; `MODEL_MODE` env still honoured once with a `DeprecationWarning`.
- `tests/test_config_loader.py` — 8 smoke tests (load/validate, precedence,
atomic mode-switch round-trip, YAML-only mode-E extension, legacy warnings).
- Per-class `iou` and `min_bbox_area` in `models.detection_params`
(shared across modes; `iou` default `0.7` = Ultralytics default, no behaviour change).
- `--config` CLI flag on `predict.py` (default: `config.yaml` next to `predict.py`).
### Changed
- **Model modes are data**: `config.yaml → models.modes` holds engines
(path key + contributed classes) and class filters only. `predict.py`
derives tracker roles structurally — adding mode E/F/... needs no code change,
and the dashboard `/api/model-modes` lists new modes automatically.
- Dashboard `POST /api/batch/mode {"model_mode": "X"}` validates against
`config.yaml` and persists atomically (tmp+replace, comments preserved) to
`models.active_mode`. Manual `karung-counter` restart still required.
- `batch_mode.json` keeps only the manual/auto batch `mode`; its legacy
`model_mode` key is ignored (warned when it disagrees).
- `zones.json` keeps geometry only (polygons + left/right limits); legacy knob
keys there are ignored with a warning — `config.yaml counting.*` is canonical.
- `deploy_to_jetson.py` also syncs `config.yaml`.
- `src/tracking.py` / `src/detection.py` accept an `iou` parameter
(default `0.7`, v3 callers unaffected).
## 2026-09-15 — Default model mode B → C
- Production default is now **Mode C** (combined v4 sack+truck + yolo11n
box-only on a dedicated tracker) instead of Mode B (shared sack+box tracker).
Changed in `predict.py`, `counter_dashboard.py`, `.env.example`, and docs.
Sack path uses the proven v4 model; sack/box track-ID spaces no longer collide.
## 2026-09-14 — `models/modelREADME.md` rename
- `models/README.md` → `models/modelREADME.md` to avoid confusion with the
root README. No content change.
## 2026-09-11 — Model weights tracked, per-mode matrix
- `models/*.pt` + `*.onnx` are now git-tracked (clone-ready); `*.engine`
stays gitignored (rebuildable via `export_model.py` on the Jetson).
- All weights moved under `models/` with a per-mode detector/filter matrix
(`models/modelREADME.md`); `predict.py` paths, `deploy_to_jetson.py`, and
docs updated.
- Multi-model modes (A/B/C/D, default B at the time) + box counting +
manual-mode banner (`6e4af50`).
## 2026-09-10 — Single `predict.py` entrypoint, experiments archived
- Production + dev CLI unified in `predict.py` (runs as `karung-counter.service`
with zero args). Retired experiments moved to `archive/` via `git mv`
(`predict_new.py`, `rpo_iki/`, `simple_predict.py`, check/merge/test scripts).
- Docs guides added (`docs/architecture.md`, `models.md`, `configuration.md`,
`scripts.md`) plus DB/batch helper scripts; pytest smoke tests + CI.
## 2026-08-24 — Manual & auto batch modes, dual-port dashboards
- Manual/auto batch counting, operator (port 5000) + monitoring (port 5721)
dashboards, historical batch data views and corrections.