46 lines
1.2 KiB
Python
46 lines
1.2 KiB
Python
from scripts.audit_yolo_label_outliers import classify_box
|
|
from scripts.audit_yolo_label_relationships import Box
|
|
|
|
|
|
DEFAULTS = {
|
|
"tile_size": 640,
|
|
"min_dimension_pixels": 4.0,
|
|
"extreme_aspect_ratio": 8.0,
|
|
"edge_tolerance_pixels": 0.5,
|
|
}
|
|
|
|
|
|
def test_classify_box_reports_independent_geometric_risks() -> None:
|
|
box = Box(0, 0.5, 0.003, 0.2, 0.006)
|
|
|
|
assert classify_box(box, **DEFAULTS) == [
|
|
{
|
|
"category": "small_dimension",
|
|
"width_px": 128.0,
|
|
"height_px": 3.84,
|
|
"area_px2": 491.52,
|
|
"aspect_ratio": 33.333333,
|
|
},
|
|
{
|
|
"category": "extreme_aspect_ratio",
|
|
"width_px": 128.0,
|
|
"height_px": 3.84,
|
|
"area_px2": 491.52,
|
|
"aspect_ratio": 33.333333,
|
|
},
|
|
{
|
|
"category": "tile_edge",
|
|
"edge_sides": ["top"],
|
|
"width_px": 128.0,
|
|
"height_px": 3.84,
|
|
"area_px2": 491.52,
|
|
"aspect_ratio": 33.333333,
|
|
},
|
|
]
|
|
|
|
|
|
def test_classify_box_ignores_ordinary_interior_box() -> None:
|
|
box = Box(0, 0.5, 0.5, 0.1, 0.08)
|
|
|
|
assert classify_box(box, **DEFAULTS) == []
|