|
|
@ -18,7 +18,7 @@ from ultralytics.utils import ( |
|
|
|
checks, |
|
|
|
checks, |
|
|
|
) |
|
|
|
) |
|
|
|
from ultralytics.utils.torch_utils import TORCH_1_9, TORCH_1_13 |
|
|
|
from ultralytics.utils.torch_utils import TORCH_1_9, TORCH_1_13 |
|
|
|
|
|
|
|
import importlib |
|
|
|
|
|
|
|
|
|
|
|
def test_export_torchscript(): |
|
|
|
def test_export_torchscript(): |
|
|
|
"""Test YOLO model exporting to TorchScript format for compatibility and correctness.""" |
|
|
|
"""Test YOLO model exporting to TorchScript format for compatibility and correctness.""" |
|
|
@ -32,15 +32,6 @@ def test_export_onnx(): |
|
|
|
YOLO(file)(SOURCE, imgsz=32) # exported model inference |
|
|
|
YOLO(file)(SOURCE, imgsz=32) # exported model inference |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.slow |
|
|
|
|
|
|
|
@pytest.mark.skipif(IS_RASPBERRYPI or not LINUX or MACOS, reason="Skipping test on Raspberry Pi and Windows") |
|
|
|
|
|
|
|
def test_export_imx500_gptq(): |
|
|
|
|
|
|
|
"""Test YOLOv8n exports to imx500 format with gptq.""" |
|
|
|
|
|
|
|
model = YOLO("yolov8n.pt") |
|
|
|
|
|
|
|
file = model.export(format="imx500", imgsz=32, gptq=True) |
|
|
|
|
|
|
|
YOLO(file)(SOURCE, imgsz=32) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.skipif(not TORCH_1_13, reason="OpenVINO requires torch>=1.13") |
|
|
|
@pytest.mark.skipif(not TORCH_1_13, reason="OpenVINO requires torch>=1.13") |
|
|
|
def test_export_openvino(): |
|
|
|
def test_export_openvino(): |
|
|
|
"""Test YOLO exports to OpenVINO format for model inference compatibility.""" |
|
|
|
"""Test YOLO exports to OpenVINO format for model inference compatibility.""" |
|
|
@ -214,3 +205,11 @@ def test_export_ncnn(): |
|
|
|
"""Test YOLO exports to NCNN format.""" |
|
|
|
"""Test YOLO exports to NCNN format.""" |
|
|
|
file = YOLO(MODEL).export(format="ncnn", imgsz=32) |
|
|
|
file = YOLO(MODEL).export(format="ncnn", imgsz=32) |
|
|
|
YOLO(file)(SOURCE, imgsz=32) # exported model inference |
|
|
|
YOLO(file)(SOURCE, imgsz=32) # exported model inference |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.skipif(not LINUX or MACOS, reason="Skipping test on Windows and Macos") |
|
|
|
|
|
|
|
def test_export_imx500_ptq(): |
|
|
|
|
|
|
|
"""Test YOLOv8n exports to imx500 format.""" |
|
|
|
|
|
|
|
model = YOLO("yolov8n.pt") |
|
|
|
|
|
|
|
file = model.export(format="imx500", imgsz=32, gptq=False) |
|
|
|
|
|
|
|
YOLO(file)(SOURCE, imgsz=32) |