- services: separate 08:00 counting and 06:00 weighing systemd units/timers,
run_daily_counting.sh / run_daily_weighing.sh, install_service.sh update
- dashboard: guard /api/weight/coops against rows without weight data
- sim/day-0: CYCLE_START_DATE 2026-10-01 (day 0 = DOC arrival, counts only);
consolidation skips cycle_day 0 artifacts (storage.py guard)
- weight: predict_chicken_weight(use_gbm=False) default. Retrained joblib
(LGBM, 14:26) predicts a step function of cycle_day only (108.1 g days 1-5,
140.1 g days 6-8, zero sensitivity to camera area); fallback Gompertz +
allometric blend restored, varies per camera/day (37.2-115.7 g over days 1-7).
Re-enable only after model retrained on early-day morphometry with
features_dict/volumetric wired (see ponytail comment in growth_model.py).
Covered by new tests/test_growth_model_gbm.py
- models/scripts: retraining tooling (train_weight_model.py,
train_c23_focused_model.py), retrained joblib, historical_weights_avg.csv
- configs/template/requirements: cycle7 batch yamls, index.html, deps
- data: db/chicken_counts.db + reports refreshed from 2026-10-01..08 rerun
Tests: PYTHONPATH=src python3 -m unittest discover -s tests -p "test_*.py"
-> Ran 51, 49 pass. 2 pre-existing failures unchanged from baseline
(61ca7c2): fusion n_valid_samples 59!=98, consolidate fixture (day-0 date
conflicts with day-0 skip).
59 lines
2.2 KiB
Bash
Executable File
59 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# Daily 1-floor full-cycle simulation.
|
|
# Maps today's date onto source videos from FULL_Cycle_Kandang_Atas_Test
|
|
# (2026-05-22 .. 2026-07-09, 49 days, loops back after end date).
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
cd "$SCRIPT_DIR"
|
|
|
|
SRC_ROOT="$SCRIPT_DIR/../VIDEOS/cycle7/FULL_Cycle_Kandang_Atas_Test"
|
|
SIM_ROOT="$SCRIPT_DIR/../VIDEOS/cycle7/FULL_CYCLE_1_FLOOR_SIM"
|
|
SIM_EPOCH="2026-10-01" # sim day 1 maps to SRC_START
|
|
SRC_START="2026-05-22"
|
|
CYCLE_DAYS=49 # 2026-05-22 .. 2026-07-09 inclusive
|
|
CYCLE_START_DATE="2026-10-01" # 2026-10-01 = Cycle Day 0 (DOC arrival, no weight); weight from day 1 (2026-10-02)
|
|
|
|
TODAY="$(date +%F)"
|
|
offset=$(( ( $(date -d "$TODAY" +%s) - $(date -d "$SIM_EPOCH" +%s) ) / 86400 ))
|
|
idx=$(( (offset % CYCLE_DAYS + CYCLE_DAYS) % CYCLE_DAYS ))
|
|
SRC_DATE="$(date -d "$SRC_START + $idx days" +%F)"
|
|
|
|
SRC_DIR="$SRC_ROOT/$SRC_DATE"
|
|
DEST_DIR="$SIM_ROOT/$TODAY"
|
|
|
|
mapfile -t VIDEOS < <(ls -1 "$SRC_DIR"/*.mp4 2>/dev/null || true)
|
|
if [ "${#VIDEOS[@]}" -eq 0 ]; then
|
|
echo "[sim] no source videos in $SRC_DIR — skipping $TODAY" >&2
|
|
exit 0
|
|
fi
|
|
|
|
# Skip loudly when another job is holding VRAM (needs ~6 GB for 4 workers).
|
|
free_mb="$(nvidia-smi --query-gpu=memory.free --format=csv,noheader,nounits 2>/dev/null | head -1)"
|
|
if [ -z "$free_mb" ] || [ "$free_mb" -lt 6000 ]; then
|
|
echo "[sim] SKIP: ${free_mb:-driver-lost} MiB free (need 6000) — GPU busy" >&2
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "$DEST_DIR"
|
|
for f in "${VIDEOS[@]}"; do
|
|
ln -sf "$(realpath "$f")" "$DEST_DIR/"
|
|
done
|
|
|
|
echo "[sim] $TODAY <- $SRC_DATE (${#VIDEOS[@]} videos)"
|
|
|
|
PYTHONPATH="$SCRIPT_DIR/src" python3 -m chicken_counter.cli batch \
|
|
--config configs/floor_config/K1-L1.yaml \
|
|
--root-dir "$(realpath "$SIM_ROOT")" \
|
|
--date "$TODAY" \
|
|
--cycle-start-date "$CYCLE_START_DATE" \
|
|
--doc-weight 32.0 \
|
|
--no-video
|
|
|
|
|
|
# Refresh cycle_weight_parquet_data/ (parquet only) from every date folder.
|
|
# Never fails the day: daily rows are already stored in SQLite by this point.
|
|
PYTHONPATH="$SCRIPT_DIR/src" python3 -m chicken_counter.cli consolidate-parquets \
|
|
--root-dir "$(realpath "$SIM_ROOT")" \
|
|
|| echo "[sim] WARN consolidation failed — daily data intact" >&2
|