mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-22 22:36:36 +00:00
Update configuration and test structure for improved clarity and functionality
- Modified `.gitignore` to include test fixture data while excluding test results. - Updated `config.yaml` to change the model from 'yolo11m.yaml' to 'yolo26m.pt'. - Enhanced `.cursor/rules/coderule.mdc` with additional guidelines for test environment consistency and infrastructure handling. - Revised autopilot state management in `_docs/_autopilot_state.md` to reflect current progress and tasks. - Removed outdated augmentation tests and adjusted dataset formation tests to align with the new structure. These changes streamline the configuration and testing processes, ensuring better organization and clarity in the project.
This commit is contained in:
+11
-27
@@ -9,33 +9,18 @@ import constants as c
|
||||
import train as train_mod
|
||||
import exports as exports_mod
|
||||
|
||||
_PROJECT_ROOT = Path(__file__).resolve().parent.parent
|
||||
_DATASET_IMAGES = _PROJECT_ROOT / "_docs/00_problem/input_data/dataset/images"
|
||||
_DATASET_LABELS = _PROJECT_ROOT / "_docs/00_problem/input_data/dataset/labels"
|
||||
_CONFIG_TEST = _PROJECT_ROOT / "config.test.yaml"
|
||||
_TESTS_DIR = Path(__file__).resolve().parent
|
||||
_TEST_ROOT = _TESTS_DIR / "root"
|
||||
_DATASET_IMAGES = _TEST_ROOT / "data" / "images"
|
||||
_CONFIG_TEST = _TESTS_DIR.parent / "config.test.yaml"
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def e2e_result(tmp_path_factory):
|
||||
base = tmp_path_factory.mktemp("e2e")
|
||||
|
||||
def e2e_result():
|
||||
old_config = c.config
|
||||
c.config = c.Config.from_yaml(str(_CONFIG_TEST), root=str(base / "azaion"))
|
||||
c.config = c.Config.from_yaml(str(_CONFIG_TEST), root=str(_TEST_ROOT))
|
||||
|
||||
data_img = Path(c.config.data_images_dir)
|
||||
data_lbl = Path(c.config.data_labels_dir)
|
||||
data_img.mkdir(parents=True)
|
||||
data_lbl.mkdir(parents=True)
|
||||
Path(c.config.models_dir).mkdir(parents=True)
|
||||
|
||||
for img in sorted(_DATASET_IMAGES.glob("*.jpg")):
|
||||
shutil.copy2(img, data_img / img.name)
|
||||
lbl = _DATASET_LABELS / f"{img.stem}.txt"
|
||||
if lbl.exists():
|
||||
shutil.copy2(lbl, data_lbl / lbl.name)
|
||||
|
||||
from augmentation import Augmentator
|
||||
Augmentator().augment_annotations()
|
||||
Path(c.config.models_dir).mkdir(parents=True, exist_ok=True)
|
||||
|
||||
train_mod.train_dataset()
|
||||
|
||||
@@ -48,15 +33,14 @@ def e2e_result(tmp_path_factory):
|
||||
"today_dataset": today_ds,
|
||||
}
|
||||
|
||||
shutil.rmtree(c.config.datasets_dir, ignore_errors=True)
|
||||
shutil.rmtree(c.config.models_dir, ignore_errors=True)
|
||||
shutil.rmtree(c.config.corrupted_dir, ignore_errors=True)
|
||||
c.config = old_config
|
||||
|
||||
|
||||
@pytest.mark.e2e
|
||||
class TestTrainingPipeline:
|
||||
def test_augmentation_produced_output(self, e2e_result):
|
||||
proc = Path(c.config.processed_images_dir)
|
||||
assert len(list(proc.glob("*.jpg"))) == 800
|
||||
|
||||
def test_dataset_formed(self, e2e_result):
|
||||
base = Path(e2e_result["today_dataset"])
|
||||
for split in ("train", "valid", "test"):
|
||||
@@ -66,7 +50,7 @@ class TestTrainingPipeline:
|
||||
len(list((base / s / "images").glob("*.jpg")))
|
||||
for s in ("train", "valid", "test")
|
||||
)
|
||||
assert total == 800
|
||||
assert total == 20
|
||||
|
||||
def test_data_yaml_created(self, e2e_result):
|
||||
yaml_path = Path(e2e_result["today_dataset"]) / "data.yaml"
|
||||
|
||||
Reference in New Issue
Block a user