mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-22 09:16:36 +00:00
[AZ-171] Add CoreML inference test
Made-with: Cursor
This commit is contained in:
@@ -104,3 +104,19 @@ class TestCoremlExport:
|
||||
assert len(pkgs) >= 1
|
||||
model_file = pkgs[0] / "Data" / "com.apple.CoreML" / "model.mlmodel"
|
||||
assert model_file.exists()
|
||||
|
||||
def test_coreml_inference_produces_detections(self, exported_models):
|
||||
# Arrange
|
||||
pkgs = list(exported_models["model_dir"].glob("*.mlpackage"))
|
||||
assert len(pkgs) >= 1
|
||||
imgs = sorted(_DATASET_IMAGES.glob("*.jpg"))
|
||||
if not imgs:
|
||||
pytest.skip("no test images")
|
||||
model = YOLO(str(pkgs[0]))
|
||||
|
||||
# Act
|
||||
results = model.predict(source=str(imgs[0]), imgsz=c.config.export.onnx_imgsz, verbose=False)
|
||||
|
||||
# Assert
|
||||
assert len(results) == 1
|
||||
assert results[0].boxes is not None
|
||||
|
||||
Reference in New Issue
Block a user