fixed tests

test-quan
Francesco Mattioli 3 weeks ago
parent 16d3208018
commit 0b9f31e073
  1. 1
      docker/Dockerfile-runner
  2. 19
      tests/test_exports.py
  3. 5
      ultralytics/engine/exporter.py

@ -27,6 +27,7 @@ RUN pip install pytest-cov
RUN ./bin/installdependencies.sh && \
apt-get -y install libicu-dev
# Install Java 17 for imx500 export tests
RUN apt update && apt install -y openjdk-17-jdk openjdk-17-jre
# Inline ENTRYPOINT command to configure and start runner with default TOKEN and NAME

@ -18,7 +18,7 @@ from ultralytics.utils import (
checks,
)
from ultralytics.utils.torch_utils import TORCH_1_9, TORCH_1_13
import importlib
def test_export_torchscript():
"""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
@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")
def test_export_openvino():
"""Test YOLO exports to OpenVINO format for model inference compatibility."""
@ -214,3 +205,11 @@ def test_export_ncnn():
"""Test YOLO exports to NCNN format."""
file = YOLO(MODEL).export(format="ncnn", imgsz=32)
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)

@ -1113,11 +1113,10 @@ class Exporter:
raise ValueError("IMX500 export is not supported for end2end models.")
if "C2f" not in self.model.__str__():
raise ValueError("IMX500 export is only supported for YOLOv8 detection models")
check_requirements(("model-compression-toolkit==2.1.1", "sony-custom-layers==0.2.0", "tensorflow==2.12.0"))
check_requirements(("imx500-converter[pt]==3.14.3", "keras<3.0")) # Separate requirements for imx500-converter
check_requirements(("model-compression-toolkit==2.1.1", "sony-custom-layers==0.2.0"))
check_requirements(("imx500-converter[pt]==3.14.3")) # Separate requirements for imx500-converter
import subprocess
import model_compression_toolkit as mct
import onnx
from sony_custom_layers.pytorch.object_detection.nms import multiclass_nms

Loading…
Cancel
Save