From 2c9002785ef04dbf72315028761e9c8878382f36 Mon Sep 17 00:00:00 2001 From: Codex Date: Tue, 7 Jul 2026 05:21:54 +0200 Subject: [PATCH] Harden operator YOLO training runtime --- backend/README.md | 3 ++- docs/AI_PIPELINES.md | 3 ++- docs/CODEX_EXECUTION_LOG.md | 1 + scripts/README.md | 3 ++- scripts/train_operator_yolo_detector.sh | 5 ++++- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/backend/README.md b/backend/README.md index c4ad8f9a..072dca3d 100644 --- a/backend/README.md +++ b/backend/README.md @@ -283,7 +283,7 @@ candidates are too weak for the target imagery. It is not a browser feature and does not change API contracts: ```bash -docker exec -it geointel python /app/scripts/export_operator_yolo_dataset.py \ +docker exec -it geointel python3 /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 \ @@ -302,6 +302,7 @@ docker exec \ -e TRAIN_BATCH=2 \ -e TRAIN_WORKERS=0 \ -e TRAIN_DEVICE=cpu \ + -e PYTHON_BIN=python3 \ geointel bash /app/scripts/train_operator_yolo_detector.sh ``` diff --git a/docs/AI_PIPELINES.md b/docs/AI_PIPELINES.md index 32a51a88..212ba7aa 100644 --- a/docs/AI_PIPELINES.md +++ b/docs/AI_PIPELINES.md @@ -233,7 +233,7 @@ 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 \ +docker exec -it geointel python3 /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 \ @@ -258,6 +258,7 @@ docker exec \ -e TRAIN_BATCH=2 \ -e TRAIN_WORKERS=0 \ -e TRAIN_DEVICE=cpu \ + -e PYTHON_BIN=python3 \ geointel bash /app/scripts/train_operator_yolo_detector.sh ``` diff --git a/docs/CODEX_EXECUTION_LOG.md b/docs/CODEX_EXECUTION_LOG.md index 89ededce..4294342a 100644 --- a/docs/CODEX_EXECUTION_LOG.md +++ b/docs/CODEX_EXECUTION_LOG.md @@ -9,6 +9,7 @@ Changed: - requires `OPERATOR_YOLO_DATASET_DIR` - requires an existing `YOLO_BASE_MODEL_PATH` - writes a local `TRAIN_MODEL_OUTPUT_PATH` + - uses `PYTHON_BIN=python3` by default for the all-in-one container - 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`. diff --git a/scripts/README.md b/scripts/README.md index fbda2b12..62c15fab 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -265,7 +265,7 @@ Export the same operator samples to a local YOLO detection dataset when the public model candidates are not strong enough for the target imagery: ```bash -docker exec -it geointel python /app/scripts/export_operator_yolo_dataset.py \ +docker exec -it geointel python3 /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 \ @@ -291,6 +291,7 @@ docker exec \ -e TRAIN_BATCH=2 \ -e TRAIN_WORKERS=0 \ -e TRAIN_DEVICE=cpu \ + -e PYTHON_BIN=python3 \ geointel bash /app/scripts/train_operator_yolo_detector.sh ``` diff --git a/scripts/train_operator_yolo_detector.sh b/scripts/train_operator_yolo_detector.sh index 409fe035..068c7a5c 100644 --- a/scripts/train_operator_yolo_detector.sh +++ b/scripts/train_operator_yolo_detector.sh @@ -21,6 +21,7 @@ Environment variables: TRAIN_BATCH Batch size. Default: 2 TRAIN_WORKERS Data-loader workers. Default: 0 TRAIN_DEVICE Device passed to Ultralytics. Default: cpu + PYTHON_BIN Python executable. Default: python3 This helper is an operator/runtime smoke wrapper. It requires an existing local base model and an existing local dataset.yaml. It does not create app features. @@ -42,6 +43,7 @@ TRAIN_IMGSZ="${TRAIN_IMGSZ:-512}" TRAIN_BATCH="${TRAIN_BATCH:-2}" TRAIN_WORKERS="${TRAIN_WORKERS:-0}" TRAIN_DEVICE="${TRAIN_DEVICE:-cpu}" +PYTHON_BIN="${PYTHON_BIN:-python3}" DATASET_YAML="${OPERATOR_YOLO_DATASET_DIR%/}/dataset.yaml" SUMMARY_PATH="${TRAIN_OUTPUT_DIR%/}/${TRAIN_RUN_NAME}/training_summary.json" @@ -55,6 +57,7 @@ export TRAIN_IMGSZ export TRAIN_BATCH export TRAIN_WORKERS export TRAIN_DEVICE +export PYTHON_BIN export SUMMARY_PATH if [[ ! -f "${DATASET_YAML}" ]]; then @@ -69,7 +72,7 @@ fi mkdir -p "${TRAIN_OUTPUT_DIR}" "$(dirname "${TRAIN_MODEL_OUTPUT_PATH}")" -python - <<'PY' +"${PYTHON_BIN}" - <<'PY' from __future__ import annotations import json