From 27d012256e9429634e1858f1beb1647d4dd0521b Mon Sep 17 00:00:00 2001 From: malvm Date: Fri, 24 Jul 2026 09:31:39 +0400 Subject: [PATCH] fix Rand augment off --- .agents/PROJECT_CONTEXT.md | 4 ++-- src/yolo_webui/config.py | 5 +++-- src/yolo_webui/static/index.html | 1 + tests/frontend_smoke.js | 4 +++- tests/test_config.py | 22 ++++++++++++++++++++++ 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/.agents/PROJECT_CONTEXT.md b/.agents/PROJECT_CONTEXT.md index 62ae0e5..954a8fc 100755 --- a/.agents/PROJECT_CONTEXT.md +++ b/.agents/PROJECT_CONTEXT.md @@ -352,8 +352,8 @@ auto_augment=randaugment Вероятности и доли валидируются в диапазоне `0…1`; `degrees`, `shear` и `close_mosaic` не могут быть отрицательными. Режимы copy-paste: `flip`, `mixup`. -Политики AutoAugment: `randaugment`, `autoaugment`, `augmix`. Если augmentation -выключена, эти kwargs вообще не передаются в Ultralytics. +Политики AutoAugment: `none` (отключено), `randaugment`, `autoaugment`, `augmix`. Если augmentation +выключена, эти kwargs вообще не передаются в Ultralytics. При `auto_augment="none"` параметр транслируется в `None` для Ultralytics. ## 10. Работа с датасетами diff --git a/src/yolo_webui/config.py b/src/yolo_webui/config.py index 4feb00c..30173bf 100755 --- a/src/yolo_webui/config.py +++ b/src/yolo_webui/config.py @@ -8,7 +8,7 @@ from typing import Any, Literal YoloTask = Literal["detect", "segment", "classify", "pose", "obb"] -AutoAugmentPolicy = Literal["randaugment", "autoaugment", "augmix"] +AutoAugmentPolicy = Literal["none", "randaugment", "autoaugment", "augmix"] CopyPasteMode = Literal["flip", "mixup"] SUPPORTED_TASKS: tuple[YoloTask, ...] = ( "detect", @@ -18,6 +18,7 @@ SUPPORTED_TASKS: tuple[YoloTask, ...] = ( "obb", ) SUPPORTED_AUTO_AUGMENT_POLICIES: tuple[AutoAugmentPolicy, ...] = ( + "none", "randaugment", "autoaugment", "augmix", @@ -161,7 +162,7 @@ class AugmentationConfig: "cutmix": self.cutmix, "copy_paste": self.copy_paste, "copy_paste_mode": self.copy_paste_mode, - "auto_augment": self.auto_augment, + "auto_augment": None if self.auto_augment == "none" else self.auto_augment, "erasing": self.erasing, "close_mosaic": self.close_mosaic, } diff --git a/src/yolo_webui/static/index.html b/src/yolo_webui/static/index.html index 58c69e6..f856920 100755 --- a/src/yolo_webui/static/index.html +++ b/src/yolo_webui/static/index.html @@ -296,6 +296,7 @@