mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-22 09:26:36 +00:00
[AZ-171] Update export tests: restore full coverage for ONNX and CoreML
Made-with: Cursor
This commit is contained in:
+3
-10
@@ -1,4 +1,3 @@
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
import cv2
|
||||
@@ -17,29 +16,23 @@ _DATASET_IMAGES = _TESTS_DIR / "root" / "data" / "images"
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def exported_models(tmp_path_factory):
|
||||
# Arrange
|
||||
tmp = tmp_path_factory.mktemp("export")
|
||||
model_dir = tmp / "models"
|
||||
model_dir.mkdir()
|
||||
|
||||
# Arrange
|
||||
pt_path = str(model_dir / "test.pt")
|
||||
model = YOLO("yolo11n.pt")
|
||||
model.save(pt_path)
|
||||
YOLO("yolo11n.pt").save(pt_path)
|
||||
|
||||
old_config = c.config
|
||||
c.config = c.Config.from_yaml(str(_CONFIG_TEST), root=str(tmp))
|
||||
|
||||
onnx_out = model_dir / "test.onnx"
|
||||
coreml_out = model_dir / "test.mlpackage"
|
||||
|
||||
# Act
|
||||
exports_mod.export_onnx(pt_path)
|
||||
exports_mod.export_coreml(pt_path)
|
||||
|
||||
yield {
|
||||
"pt": pt_path,
|
||||
"onnx": str(onnx_out) if onnx_out.exists() else str(next(model_dir.glob("*.onnx"))),
|
||||
"coreml": str(coreml_out) if coreml_out.exists() else str(next(model_dir.glob("*.mlpackage"), "")),
|
||||
"onnx": str(next(model_dir.glob("*.onnx"))),
|
||||
"model_dir": model_dir,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user