Report blank YOLO label QA tiles
This commit is contained in:
@@ -68,6 +68,18 @@ def test_all_in_one_dockerfile_copies_operator_scripts_for_runtime_use() -> None
|
||||
assert "COPY scripts/train_operator_yolo_detector.sh /app/scripts/train_operator_yolo_detector.sh" in dockerfile
|
||||
|
||||
|
||||
def test_all_in_one_dockerfile_copies_operator_scripts_after_dependency_install() -> None:
|
||||
dockerfile = (ROOT / "deploy" / "unraid" / "Dockerfile.all-in-one").read_text(encoding="utf-8")
|
||||
|
||||
dependency_install_index = dockerfile.index('RUN /usr/bin/python3.11 -m venv /opt/geointel/venv \\')
|
||||
operator_copy_index = dockerfile.index(
|
||||
"COPY scripts/render_operator_yolo_label_qa_contact_sheets.py "
|
||||
"/app/scripts/render_operator_yolo_label_qa_contact_sheets.py"
|
||||
)
|
||||
|
||||
assert operator_copy_index > dependency_install_index
|
||||
|
||||
|
||||
def test_compose_does_not_require_missing_root_env_file() -> None:
|
||||
compose = (ROOT / "docker-compose.yml").read_text(encoding="utf-8")
|
||||
|
||||
|
||||
@@ -5,12 +5,20 @@ import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from PIL import Image
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
|
||||
|
||||
def write_patterned_image(path: Path, color: tuple[int, int, int]) -> None:
|
||||
image = Image.new("RGB", (64, 64), color=color)
|
||||
draw = ImageDraw.Draw(image)
|
||||
draw.rectangle((8, 8, 38, 30), fill=(220, 220, 210))
|
||||
draw.line((0, 48, 64, 24), fill=(30, 40, 50), width=4)
|
||||
image.save(path)
|
||||
|
||||
|
||||
def test_operator_yolo_label_qa_contact_sheets_render_visual_artifacts(tmp_path: Path) -> None:
|
||||
script_path = ROOT / "scripts" / "render_operator_yolo_label_qa_contact_sheets.py"
|
||||
assert script_path.exists()
|
||||
@@ -29,9 +37,9 @@ def test_operator_yolo_label_qa_contact_sheets_render_visual_artifacts(tmp_path:
|
||||
(image_train / "dense_000.png", (120, 130, 140)),
|
||||
(image_train / "invalid_000.png", (80, 100, 120)),
|
||||
(image_val / "missing_000.png", (90, 120, 90)),
|
||||
(image_val / "negative_000.png", (50, 50, 55)),
|
||||
):
|
||||
Image.new("RGB", (64, 64), color=color).save(path)
|
||||
write_patterned_image(path, color)
|
||||
Image.new("RGB", (64, 64), color=(255, 255, 255)).save(image_val / "negative_000.png")
|
||||
|
||||
(labels_train / "dense_000.txt").write_text(
|
||||
"0 0.500000 0.500000 0.500000 0.500000\n"
|
||||
@@ -141,12 +149,16 @@ def test_operator_yolo_label_qa_contact_sheets_render_visual_artifacts(tmp_path:
|
||||
assert report["rendered_tile_count"] == 4
|
||||
assert report["missing_label_file_count"] == 1
|
||||
assert report["invalid_label_count"] == 1
|
||||
assert report["low_visual_variance_tile_count"] == 1
|
||||
assert [tile["sample_slug"] for tile in report["selected_tiles"]] == [
|
||||
"dense",
|
||||
"invalid",
|
||||
"missing",
|
||||
"negative",
|
||||
]
|
||||
tile_by_slug = {tile["sample_slug"]: tile for tile in report["selected_tiles"]}
|
||||
assert tile_by_slug["negative"]["low_visual_variance"] is True
|
||||
assert tile_by_slug["dense"]["low_visual_variance"] is False
|
||||
|
||||
sheet_path = output_dir / report["contact_sheets"][0]["path"]
|
||||
assert sheet_path.exists()
|
||||
@@ -159,4 +171,5 @@ def test_operator_yolo_label_qa_contact_sheets_render_visual_artifacts(tmp_path:
|
||||
assert "Operator YOLO Label QA Contact Sheets" in markdown
|
||||
assert "missing label files: 1" in markdown
|
||||
assert "invalid label rows: 1" in markdown
|
||||
assert "low-variance rendered tiles: 1" in markdown
|
||||
assert "contact_sheet_001.png" in markdown
|
||||
|
||||
Reference in New Issue
Block a user