Add operator YOLO training dataset tooling
GeoIntel CI / docs-smoke (push) Has been cancelled
GeoIntel CI / contract-smoke (push) Has been cancelled

This commit is contained in:
Codex
2026-07-07 05:19:16 +02:00
parent 306fcd1b24
commit 31a2aa6138
10 changed files with 607 additions and 0 deletions
+36
View File
@@ -229,6 +229,42 @@ The multi-sample summary exposes `best_overall_by_score`,
model-quality decisions are based on repeated persisted QA/QC evidence rather
than one AOI.
When repeated public model benchmarks remain too weak, the operator can convert
the prepared real-data samples into a local YOLO training dataset:
```bash
docker exec -it geointel python /app/scripts/export_operator_yolo_dataset.py \
--manifest-path /app/storage/operator-data/operator_samples_manifest.json \
--output-dir /app/storage/operator-data/yolo-building-dataset \
--val-samples turnhout \
--force
```
The exporter creates a standard YOLO detection layout with `dataset.yaml`,
`images/train`, `labels/train`, `images/val` and `labels/val`. It converts GRB
building reference geometries to pixel-space bounding boxes for the matching
orthophoto sample and records `yolo_dataset_summary.json`.
A minimal local training smoke can then be run explicitly in an AI-enabled
runtime:
```bash
docker exec \
-e OPERATOR_YOLO_DATASET_DIR=/app/storage/operator-data/yolo-building-dataset \
-e YOLO_BASE_MODEL_PATH=/app/models/yolov8n.pt \
-e TRAIN_MODEL_OUTPUT_PATH=/app/models/geointel-building-detector.pt \
-e TRAIN_EPOCHS=8 \
-e TRAIN_IMGSZ=512 \
-e TRAIN_BATCH=2 \
-e TRAIN_WORKERS=0 \
-e TRAIN_DEVICE=cpu \
geointel bash /app/scripts/train_operator_yolo_detector.sh
```
This remains operator tooling only. GeoIntel does not expose Training Studio in
V1, does not generate labels from predictions and does not treat the trained
artifact as useful until it passes the same real-data Detection + QA matrix.
For visual error inspection, export the persisted QA evidence from a calibration
summary:
+32
View File
@@ -1,3 +1,35 @@
## Sprint 129 Operator YOLO training dataset tooling (2026-07-07)
Changed:
- Added `scripts/export_operator_yolo_dataset.py` to export prepared operator samples into a local YOLO detection dataset:
- input manifest: `operator_samples_manifest.json`
- output: `dataset.yaml`, `images/train`, `labels/train`, `images/val`, `labels/val`, `yolo_dataset_summary.json`
- labels are derived from GRB building references with `source_name=grb` and `reference_layer_name=buildings`.
- Added `scripts/train_operator_yolo_detector.sh` as an explicit operator/runtime wrapper around a local Ultralytics training smoke:
- requires `OPERATOR_YOLO_DATASET_DIR`
- requires an existing `YOLO_BASE_MODEL_PATH`
- writes a local `TRAIN_MODEL_OUTPUT_PATH`
- writes `training_summary.json`.
- Added readiness coverage for exporter compile and train-wrapper shell syntax.
- Added regression coverage in `backend/tests/test_sprint129_operator_yolo_training_dataset.py`.
- Updated `scripts/README.md`, `backend/README.md`, `docs/AI_PIPELINES.md`, `docs/TODO.md` and `CHANGELOG.md`.
Tested:
- RED: `python -m pytest backend\tests\test_sprint129_operator_yolo_training_dataset.py -q` failed while the exporter and training wrapper contracts were incomplete.
- `python -m pytest backend\tests\test_sprint129_operator_yolo_training_dataset.py -q` passed.
- `python scripts\export_operator_yolo_dataset.py --help` passed without requiring local GIS dependencies.
- `python -m py_compile scripts\export_operator_yolo_dataset.py` passed.
- `bash -n scripts/train_operator_yolo_detector.sh` passed.
Open:
- Run the exporter and training smoke inside the AI-enabled Tower runtime, then benchmark the trained artifact through the existing multi-sample Detection + QA matrix.
Limitations:
- This is operator tooling only. It does not add Training Studio, browser training controls, provider fetching, fake detections, model auto-provisioning or API contract changes.
Next recommended pass:
- Generate the local YOLO dataset from the current Geel/Mol/Turnhout samples, train a small local model smoke from `yolov8n.pt`, and compare it against the current `yolov8s-building-segmentation-pt` benchmark.
## Sprint 128 Stronger building model runtime benchmark (2026-07-07)
Changed:
+2
View File
@@ -404,3 +404,5 @@ This file now starts with the current implementation status. Older preparation/b
- [x] Render persisted QA/QC feature-level evidence as Map workspace overlays.
- [x] Add safe local YOLO model env configuration helper for Unraid/Tower runtime activation.
- [x] Harden configured YOLO inference for single-band raster tiles and wrapped runtime errors.
- [x] Add operator-only YOLO dataset export and local training-smoke wrapper for real sample calibration.
- [ ] Train/evaluate a local GeoIntel building detector from the operator samples and only activate it after QA/QC matrix improvement.