This commit is contained in:
nq
2026-05-03 21:58:47 +03:00
parent fd44235ff4
commit e45d1cb6b4
18 changed files with 1259 additions and 0 deletions

49
scripts/run_pilot.sh Normal file
View File

@@ -0,0 +1,49 @@
#!/usr/bin/env bash
set -euo pipefail
# Run from repository root.
# First run downloads two sheets only. Increase --limit after confirming overlays look sane.
python -m bgtopo_poc.cli inventory \
--config configs/blue_detector.yaml \
--out data/manifest.csv \
--limit 2
python -m bgtopo_poc.cli download \
--manifest data/manifest.csv \
--out-dir data/raw \
--out-manifest data/manifest_downloaded.csv \
--limit 2
python - <<'PY'
import pandas as pd
from pathlib import Path
m = pd.read_csv('data/manifest_downloaded.csv')
for _, r in m.iterrows():
sid = r['sheet_id']
Path('data/interim/candidates').mkdir(parents=True, exist_ok=True)
print(f"Scanning {sid}")
PY
while IFS=, read -r sheet_id map_url tif_url map_path tif_path; do
if [[ "$sheet_id" == "sheet_id" ]]; then continue; fi
python -m bgtopo_poc.cli detect \
--config configs/blue_detector.yaml \
--sheet-id "$sheet_id" \
--map "$map_path" \
--tif "$tif_path" \
--out-dir data/interim/candidates
python -m bgtopo_poc.cli overlay \
--tif "$tif_path" \
--candidates "data/interim/candidates/${sheet_id}_candidates.csv" \
--out "reports/overlays/${sheet_id}_overlay.png"
done < data/manifest_downloaded.csv
python -m bgtopo_poc.cli report \
--candidates data/interim/candidates/*_candidates.csv \
--overlays reports/overlays/*_overlay.png \
--out reports/poc_report.html
echo "Open reports/poc_report.html"

View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -euo pipefail
# Pick one downloaded sheet/candidate file first.
SHEET_ID="${1:-K-34-009-2}"
TIF="data/raw/${SHEET_ID}/${SHEET_ID}.tif"
CAND="data/interim/candidates/${SHEET_ID}_candidates.csv"
OUT="data/yolo/${SHEET_ID}"
python -m bgtopo_poc.cli export-yolo \
--config configs/blue_detector.yaml \
--sheet-id "$SHEET_ID" \
--tif "$TIF" \
--candidates "$CAND" \
--out-dir "$OUT" \
--tile-size 1024 \
--overlap 128
# RTX 3080 FE 10 GB: start batch 2-4 at imgsz=1024. Raise only if VRAM allows it.
python -m bgtopo_poc.cli train-yolo \
--data-yaml "$OUT/data.yaml" \
--model yolov8s.pt \
--imgsz 1024 \
--epochs 80 \
--batch 4 \
--device 0