Expand regional corpus and aerial finetuning controls
GeoIntel release gates / Compile, test, contracts and builds (push) Canceled after 0s
GeoIntel release gates / Python and npm vulnerability policy (push) Canceled after 0s
GeoIntel release gates / GIS image, SBOM and container scan (push) Canceled after 0s

This commit is contained in:
Jens
2026-07-27 06:19:11 +02:00
parent 8a4a995659
commit 2316ff28f5
6 changed files with 105 additions and 2 deletions
+11 -1
View File
@@ -52,6 +52,14 @@ def metrics(tp: int, fp: int, fn: int) -> dict[str, float | int]:
}
def scale_box(box: tuple[float, float, float, float], factor: float) -> tuple[float, float, float, float]:
"""Scale a detector box around its center for calibration-only geometry correction."""
x1, y1, x2, y2 = box
cx, cy = (x1 + x2) / 2, (y1 + y2) / 2
half_width, half_height = (x2 - x1) * factor / 2, (y2 - y1) * factor / 2
return cx - half_width, cy - half_height, cx + half_width, cy + half_height
def read_references(path: Path, width: int, height: int) -> list[tuple[float, float, float, float]]:
boxes = []
for line in path.read_text(encoding="utf-8").splitlines() if path.is_file() else []:
@@ -88,6 +96,7 @@ def main() -> int:
default=1000,
help="Maximum detections retained per tile; dense Belgian urban tiles exceed YOLO's default 300.",
)
parser.add_argument("--box-scale", type=float, default=1.0)
args = parser.parse_args()
from ultralytics import YOLO
@@ -119,7 +128,7 @@ def main() -> int:
for tile, result in zip(tiles, results, strict=True):
height, width = result.orig_shape
predictions = [
(tuple(map(float, box)), float(score))
(scale_box(tuple(map(float, box)), args.box_scale), float(score))
for box, score in zip(result.boxes.xyxy.cpu().tolist(), result.boxes.conf.cpu().tolist(), strict=True)
]
observations.append(
@@ -163,6 +172,7 @@ def main() -> int:
"test_time_augmentation": args.augment,
"inference_imgsz": args.imgsz,
"max_detections_per_tile": args.max_det,
"box_scale": args.box_scale,
"tile_count": len(tiles),
"sweeps": sweeps,
}