[AZ-153] [AZ-155] [AZ-156] [AZ-158] Add augmentation, dataset formation, label validation, model split tests

Made-with: Cursor
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-03-26 23:18:17 +02:00
parent 66fe1cc918
commit 41552c5699
7 changed files with 690 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
import sys
import types
for _name in ("ultralytics", "boto3", "netron", "requests"):
if _name not in sys.modules:
sys.modules[_name] = types.ModuleType(_name)
sys.modules["ultralytics"].YOLO = type("YOLO", (), {})
sys.modules["boto3"].client = lambda *a, **k: None
from train import check_label
def test_bt_lbl_01_valid_label_returns_true(tmp_path):
p = tmp_path / "a.txt"
p.write_text("0 0.5 0.5 0.1 0.1", encoding="utf-8")
assert check_label(str(p)) is True
def test_bt_lbl_02_x_gt_one_returns_false(tmp_path):
p = tmp_path / "a.txt"
p.write_text("0 1.5 0.5 0.1 0.1", encoding="utf-8")
assert check_label(str(p)) is False
def test_bt_lbl_03_height_gt_one_returns_false(tmp_path):
p = tmp_path / "a.txt"
p.write_text("0 0.5 0.5 0.1 1.2", encoding="utf-8")
assert check_label(str(p)) is False
def test_bt_lbl_04_missing_file_returns_false(tmp_path):
p = tmp_path / "missing.txt"
assert check_label(str(p)) is False
def test_bt_lbl_05_multiline_one_corrupted_returns_false(tmp_path):
p = tmp_path / "a.txt"
p.write_text("0 0.5 0.5 0.1 0.1\n3 0.5 0.5 0.1 1.5", encoding="utf-8")
assert check_label(str(p)) is False