GeoIntel release gates / Compile, test, contracts and builds (push) Successful in 1m49s
GeoIntel release gates / Python and npm vulnerability policy (push) Successful in 21s
GeoIntel release gates / Production AI image, SBOM and container scan (push) Successful in 5m39s
GeoIntel release gates / Deploy exact gated revision to Unraid (push) Failing after 58m43s
51 lines
1.3 KiB
Python
51 lines
1.3 KiB
Python
import pytest
|
|
|
|
from scripts.audit_yolo_cross_tile_repetition import (
|
|
interior_global_key,
|
|
tile_offsets,
|
|
)
|
|
from scripts.audit_yolo_label_relationships import Box
|
|
|
|
|
|
def test_tile_offsets_parse_exporter_filename() -> None:
|
|
assert tile_offsets("/data/geel_0005_r256_c512.png") == (256, 512)
|
|
with pytest.raises(ValueError, match="no row/column offsets"):
|
|
tile_offsets("/data/not-a-tile.png")
|
|
|
|
|
|
def test_interior_global_key_reconstructs_same_object_across_tiles() -> None:
|
|
first = Box(0, 0.75, 0.5, 0.1, 0.1)
|
|
second = Box(0, 0.25, 0.5, 0.1, 0.1)
|
|
|
|
first_key = interior_global_key(
|
|
first,
|
|
row_offset=0,
|
|
column_offset=0,
|
|
tile_size=512,
|
|
edge_tolerance_pixels=0.5,
|
|
)
|
|
second_key = interior_global_key(
|
|
second,
|
|
row_offset=0,
|
|
column_offset=256,
|
|
tile_size=512,
|
|
edge_tolerance_pixels=0.5,
|
|
)
|
|
|
|
assert first_key == second_key == (358.4, 230.4, 409.6, 281.6)
|
|
|
|
|
|
def test_interior_global_key_rejects_edge_clipped_box() -> None:
|
|
edge_box = Box(0, 0.05, 0.5, 0.1, 0.1)
|
|
|
|
assert (
|
|
interior_global_key(
|
|
edge_box,
|
|
row_offset=0,
|
|
column_offset=256,
|
|
tile_size=512,
|
|
edge_tolerance_pixels=0.5,
|
|
)
|
|
is None
|
|
)
|