dgenerate-ultralytics-headless 8.3.214__py3-none-any.whl → 8.4.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dgenerate_ultralytics_headless-8.3.214.dist-info → dgenerate_ultralytics_headless-8.4.7.dist-info}/METADATA +64 -74
- dgenerate_ultralytics_headless-8.4.7.dist-info/RECORD +311 -0
- {dgenerate_ultralytics_headless-8.3.214.dist-info → dgenerate_ultralytics_headless-8.4.7.dist-info}/WHEEL +1 -1
- tests/__init__.py +7 -9
- tests/conftest.py +8 -15
- tests/test_cli.py +1 -1
- tests/test_cuda.py +13 -10
- tests/test_engine.py +9 -9
- tests/test_exports.py +65 -13
- tests/test_integrations.py +13 -13
- tests/test_python.py +125 -69
- tests/test_solutions.py +161 -152
- ultralytics/__init__.py +1 -1
- ultralytics/cfg/__init__.py +86 -92
- ultralytics/cfg/datasets/Argoverse.yaml +7 -6
- ultralytics/cfg/datasets/DOTAv1.5.yaml +1 -1
- ultralytics/cfg/datasets/DOTAv1.yaml +1 -1
- ultralytics/cfg/datasets/ImageNet.yaml +1 -1
- ultralytics/cfg/datasets/TT100K.yaml +346 -0
- ultralytics/cfg/datasets/VOC.yaml +15 -16
- ultralytics/cfg/datasets/african-wildlife.yaml +1 -1
- ultralytics/cfg/datasets/coco-pose.yaml +21 -0
- ultralytics/cfg/datasets/coco12-formats.yaml +101 -0
- ultralytics/cfg/datasets/coco128-seg.yaml +1 -1
- ultralytics/cfg/datasets/coco8-pose.yaml +21 -0
- ultralytics/cfg/datasets/dog-pose.yaml +28 -0
- ultralytics/cfg/datasets/dota8-multispectral.yaml +1 -1
- ultralytics/cfg/datasets/dota8.yaml +2 -2
- ultralytics/cfg/datasets/hand-keypoints.yaml +26 -2
- ultralytics/cfg/datasets/kitti.yaml +27 -0
- ultralytics/cfg/datasets/lvis.yaml +5 -5
- ultralytics/cfg/datasets/open-images-v7.yaml +1 -1
- ultralytics/cfg/datasets/tiger-pose.yaml +16 -0
- ultralytics/cfg/datasets/xView.yaml +16 -16
- ultralytics/cfg/default.yaml +4 -2
- ultralytics/cfg/models/11/yolo11-pose.yaml +1 -1
- ultralytics/cfg/models/11/yoloe-11-seg.yaml +2 -2
- ultralytics/cfg/models/11/yoloe-11.yaml +2 -2
- ultralytics/cfg/models/26/yolo26-cls.yaml +33 -0
- ultralytics/cfg/models/26/yolo26-obb.yaml +52 -0
- ultralytics/cfg/models/26/yolo26-p2.yaml +60 -0
- ultralytics/cfg/models/26/yolo26-p6.yaml +62 -0
- ultralytics/cfg/models/26/yolo26-pose.yaml +53 -0
- ultralytics/cfg/models/26/yolo26-seg.yaml +52 -0
- ultralytics/cfg/models/26/yolo26.yaml +52 -0
- ultralytics/cfg/models/26/yoloe-26-seg.yaml +53 -0
- ultralytics/cfg/models/26/yoloe-26.yaml +53 -0
- ultralytics/cfg/models/rt-detr/rtdetr-l.yaml +1 -1
- ultralytics/cfg/models/rt-detr/rtdetr-resnet101.yaml +1 -1
- ultralytics/cfg/models/rt-detr/rtdetr-resnet50.yaml +1 -1
- ultralytics/cfg/models/rt-detr/rtdetr-x.yaml +1 -1
- ultralytics/cfg/models/v10/yolov10b.yaml +2 -2
- ultralytics/cfg/models/v10/yolov10l.yaml +2 -2
- ultralytics/cfg/models/v10/yolov10m.yaml +2 -2
- ultralytics/cfg/models/v10/yolov10n.yaml +2 -2
- ultralytics/cfg/models/v10/yolov10s.yaml +2 -2
- ultralytics/cfg/models/v10/yolov10x.yaml +2 -2
- ultralytics/cfg/models/v3/yolov3-tiny.yaml +1 -1
- ultralytics/cfg/models/v6/yolov6.yaml +1 -1
- ultralytics/cfg/models/v8/yoloe-v8-seg.yaml +9 -6
- ultralytics/cfg/models/v8/yoloe-v8.yaml +9 -6
- ultralytics/cfg/models/v8/yolov8-cls-resnet101.yaml +1 -1
- ultralytics/cfg/models/v8/yolov8-cls-resnet50.yaml +1 -1
- ultralytics/cfg/models/v8/yolov8-ghost-p2.yaml +2 -2
- ultralytics/cfg/models/v8/yolov8-ghost-p6.yaml +2 -2
- ultralytics/cfg/models/v8/yolov8-ghost.yaml +2 -2
- ultralytics/cfg/models/v8/yolov8-obb.yaml +1 -1
- ultralytics/cfg/models/v8/yolov8-p2.yaml +1 -1
- ultralytics/cfg/models/v8/yolov8-pose-p6.yaml +1 -1
- ultralytics/cfg/models/v8/yolov8-rtdetr.yaml +1 -1
- ultralytics/cfg/models/v8/yolov8-seg-p6.yaml +1 -1
- ultralytics/cfg/models/v8/yolov8-world.yaml +1 -1
- ultralytics/cfg/models/v8/yolov8-worldv2.yaml +6 -6
- ultralytics/cfg/models/v9/yolov9s.yaml +1 -1
- ultralytics/data/__init__.py +4 -4
- ultralytics/data/annotator.py +5 -6
- ultralytics/data/augment.py +300 -475
- ultralytics/data/base.py +18 -26
- ultralytics/data/build.py +147 -25
- ultralytics/data/converter.py +108 -87
- ultralytics/data/dataset.py +47 -75
- ultralytics/data/loaders.py +42 -49
- ultralytics/data/split.py +5 -6
- ultralytics/data/split_dota.py +8 -15
- ultralytics/data/utils.py +36 -45
- ultralytics/engine/exporter.py +351 -263
- ultralytics/engine/model.py +186 -225
- ultralytics/engine/predictor.py +45 -54
- ultralytics/engine/results.py +198 -325
- ultralytics/engine/trainer.py +165 -106
- ultralytics/engine/tuner.py +41 -43
- ultralytics/engine/validator.py +55 -38
- ultralytics/hub/__init__.py +16 -19
- ultralytics/hub/auth.py +6 -12
- ultralytics/hub/google/__init__.py +7 -10
- ultralytics/hub/session.py +15 -25
- ultralytics/hub/utils.py +5 -8
- ultralytics/models/__init__.py +1 -1
- ultralytics/models/fastsam/__init__.py +1 -1
- ultralytics/models/fastsam/model.py +8 -10
- ultralytics/models/fastsam/predict.py +18 -30
- ultralytics/models/fastsam/utils.py +1 -2
- ultralytics/models/fastsam/val.py +5 -7
- ultralytics/models/nas/__init__.py +1 -1
- ultralytics/models/nas/model.py +5 -8
- ultralytics/models/nas/predict.py +7 -9
- ultralytics/models/nas/val.py +1 -2
- ultralytics/models/rtdetr/__init__.py +1 -1
- ultralytics/models/rtdetr/model.py +5 -8
- ultralytics/models/rtdetr/predict.py +15 -19
- ultralytics/models/rtdetr/train.py +10 -13
- ultralytics/models/rtdetr/val.py +21 -23
- ultralytics/models/sam/__init__.py +15 -2
- ultralytics/models/sam/amg.py +14 -20
- ultralytics/models/sam/build.py +26 -19
- ultralytics/models/sam/build_sam3.py +377 -0
- ultralytics/models/sam/model.py +29 -32
- ultralytics/models/sam/modules/blocks.py +83 -144
- ultralytics/models/sam/modules/decoders.py +19 -37
- ultralytics/models/sam/modules/encoders.py +44 -101
- ultralytics/models/sam/modules/memory_attention.py +16 -30
- ultralytics/models/sam/modules/sam.py +200 -73
- ultralytics/models/sam/modules/tiny_encoder.py +64 -83
- ultralytics/models/sam/modules/transformer.py +18 -28
- ultralytics/models/sam/modules/utils.py +174 -50
- ultralytics/models/sam/predict.py +2248 -350
- ultralytics/models/sam/sam3/__init__.py +3 -0
- ultralytics/models/sam/sam3/decoder.py +546 -0
- ultralytics/models/sam/sam3/encoder.py +529 -0
- ultralytics/models/sam/sam3/geometry_encoders.py +415 -0
- ultralytics/models/sam/sam3/maskformer_segmentation.py +286 -0
- ultralytics/models/sam/sam3/model_misc.py +199 -0
- ultralytics/models/sam/sam3/necks.py +129 -0
- ultralytics/models/sam/sam3/sam3_image.py +339 -0
- ultralytics/models/sam/sam3/text_encoder_ve.py +307 -0
- ultralytics/models/sam/sam3/vitdet.py +547 -0
- ultralytics/models/sam/sam3/vl_combiner.py +160 -0
- ultralytics/models/utils/loss.py +14 -26
- ultralytics/models/utils/ops.py +13 -17
- ultralytics/models/yolo/__init__.py +1 -1
- ultralytics/models/yolo/classify/predict.py +10 -13
- ultralytics/models/yolo/classify/train.py +12 -33
- ultralytics/models/yolo/classify/val.py +30 -29
- ultralytics/models/yolo/detect/predict.py +9 -12
- ultralytics/models/yolo/detect/train.py +17 -23
- ultralytics/models/yolo/detect/val.py +77 -59
- ultralytics/models/yolo/model.py +43 -60
- ultralytics/models/yolo/obb/predict.py +7 -16
- ultralytics/models/yolo/obb/train.py +14 -17
- ultralytics/models/yolo/obb/val.py +40 -37
- ultralytics/models/yolo/pose/__init__.py +1 -1
- ultralytics/models/yolo/pose/predict.py +7 -22
- ultralytics/models/yolo/pose/train.py +13 -16
- ultralytics/models/yolo/pose/val.py +39 -58
- ultralytics/models/yolo/segment/predict.py +17 -21
- ultralytics/models/yolo/segment/train.py +7 -10
- ultralytics/models/yolo/segment/val.py +95 -47
- ultralytics/models/yolo/world/train.py +8 -14
- ultralytics/models/yolo/world/train_world.py +11 -34
- ultralytics/models/yolo/yoloe/__init__.py +7 -7
- ultralytics/models/yolo/yoloe/predict.py +16 -23
- ultralytics/models/yolo/yoloe/train.py +36 -44
- ultralytics/models/yolo/yoloe/train_seg.py +11 -11
- ultralytics/models/yolo/yoloe/val.py +15 -20
- ultralytics/nn/__init__.py +7 -7
- ultralytics/nn/autobackend.py +159 -85
- ultralytics/nn/modules/__init__.py +68 -60
- ultralytics/nn/modules/activation.py +4 -6
- ultralytics/nn/modules/block.py +260 -224
- ultralytics/nn/modules/conv.py +52 -97
- ultralytics/nn/modules/head.py +831 -299
- ultralytics/nn/modules/transformer.py +76 -88
- ultralytics/nn/modules/utils.py +16 -21
- ultralytics/nn/tasks.py +180 -195
- ultralytics/nn/text_model.py +45 -69
- ultralytics/optim/__init__.py +5 -0
- ultralytics/optim/muon.py +338 -0
- ultralytics/solutions/__init__.py +12 -12
- ultralytics/solutions/ai_gym.py +13 -19
- ultralytics/solutions/analytics.py +15 -16
- ultralytics/solutions/config.py +6 -7
- ultralytics/solutions/distance_calculation.py +10 -13
- ultralytics/solutions/heatmap.py +8 -14
- ultralytics/solutions/instance_segmentation.py +6 -9
- ultralytics/solutions/object_blurrer.py +7 -10
- ultralytics/solutions/object_counter.py +12 -19
- ultralytics/solutions/object_cropper.py +8 -14
- ultralytics/solutions/parking_management.py +34 -32
- ultralytics/solutions/queue_management.py +10 -12
- ultralytics/solutions/region_counter.py +9 -12
- ultralytics/solutions/security_alarm.py +15 -20
- ultralytics/solutions/similarity_search.py +10 -15
- ultralytics/solutions/solutions.py +77 -76
- ultralytics/solutions/speed_estimation.py +7 -10
- ultralytics/solutions/streamlit_inference.py +2 -4
- ultralytics/solutions/templates/similarity-search.html +7 -18
- ultralytics/solutions/trackzone.py +7 -10
- ultralytics/solutions/vision_eye.py +5 -8
- ultralytics/trackers/__init__.py +1 -1
- ultralytics/trackers/basetrack.py +3 -5
- ultralytics/trackers/bot_sort.py +10 -27
- ultralytics/trackers/byte_tracker.py +21 -37
- ultralytics/trackers/track.py +4 -7
- ultralytics/trackers/utils/gmc.py +11 -22
- ultralytics/trackers/utils/kalman_filter.py +37 -48
- ultralytics/trackers/utils/matching.py +12 -15
- ultralytics/utils/__init__.py +124 -124
- ultralytics/utils/autobatch.py +2 -4
- ultralytics/utils/autodevice.py +17 -18
- ultralytics/utils/benchmarks.py +57 -71
- ultralytics/utils/callbacks/base.py +8 -10
- ultralytics/utils/callbacks/clearml.py +5 -13
- ultralytics/utils/callbacks/comet.py +32 -46
- ultralytics/utils/callbacks/dvc.py +13 -18
- ultralytics/utils/callbacks/mlflow.py +4 -5
- ultralytics/utils/callbacks/neptune.py +7 -15
- ultralytics/utils/callbacks/platform.py +423 -38
- ultralytics/utils/callbacks/raytune.py +3 -4
- ultralytics/utils/callbacks/tensorboard.py +25 -31
- ultralytics/utils/callbacks/wb.py +16 -14
- ultralytics/utils/checks.py +127 -85
- ultralytics/utils/cpu.py +3 -8
- ultralytics/utils/dist.py +9 -12
- ultralytics/utils/downloads.py +25 -33
- ultralytics/utils/errors.py +6 -14
- ultralytics/utils/events.py +2 -4
- ultralytics/utils/export/__init__.py +4 -236
- ultralytics/utils/export/engine.py +246 -0
- ultralytics/utils/export/imx.py +117 -63
- ultralytics/utils/export/tensorflow.py +231 -0
- ultralytics/utils/files.py +26 -30
- ultralytics/utils/git.py +9 -11
- ultralytics/utils/instance.py +30 -51
- ultralytics/utils/logger.py +212 -114
- ultralytics/utils/loss.py +601 -215
- ultralytics/utils/metrics.py +128 -156
- ultralytics/utils/nms.py +13 -16
- ultralytics/utils/ops.py +117 -166
- ultralytics/utils/patches.py +75 -21
- ultralytics/utils/plotting.py +75 -80
- ultralytics/utils/tal.py +125 -59
- ultralytics/utils/torch_utils.py +53 -79
- ultralytics/utils/tqdm.py +24 -21
- ultralytics/utils/triton.py +13 -19
- ultralytics/utils/tuner.py +19 -10
- dgenerate_ultralytics_headless-8.3.214.dist-info/RECORD +0 -283
- {dgenerate_ultralytics_headless-8.3.214.dist-info → dgenerate_ultralytics_headless-8.4.7.dist-info}/entry_points.txt +0 -0
- {dgenerate_ultralytics_headless-8.3.214.dist-info → dgenerate_ultralytics_headless-8.4.7.dist-info}/licenses/LICENSE +0 -0
- {dgenerate_ultralytics_headless-8.3.214.dist-info → dgenerate_ultralytics_headless-8.4.7.dist-info}/top_level.txt +0 -0
tests/test_exports.py
CHANGED
|
@@ -12,15 +12,8 @@ import pytest
|
|
|
12
12
|
from tests import MODEL, SOURCE
|
|
13
13
|
from ultralytics import YOLO
|
|
14
14
|
from ultralytics.cfg import TASK2DATA, TASK2MODEL, TASKS
|
|
15
|
-
from ultralytics.utils import
|
|
16
|
-
|
|
17
|
-
IS_RASPBERRYPI,
|
|
18
|
-
LINUX,
|
|
19
|
-
MACOS,
|
|
20
|
-
WINDOWS,
|
|
21
|
-
checks,
|
|
22
|
-
)
|
|
23
|
-
from ultralytics.utils.torch_utils import TORCH_1_11, TORCH_1_13, TORCH_2_1
|
|
15
|
+
from ultralytics.utils import ARM64, IS_RASPBERRYPI, LINUX, MACOS, MACOS_VERSION, WINDOWS, checks
|
|
16
|
+
from ultralytics.utils.torch_utils import TORCH_1_10, TORCH_1_11, TORCH_1_13, TORCH_2_0, TORCH_2_1, TORCH_2_8, TORCH_2_9
|
|
24
17
|
|
|
25
18
|
|
|
26
19
|
def test_export_torchscript():
|
|
@@ -119,6 +112,9 @@ def test_export_torchscript_matrix(task, dynamic, int8, half, batch, nms):
|
|
|
119
112
|
@pytest.mark.skipif(not MACOS, reason="CoreML inference only supported on macOS")
|
|
120
113
|
@pytest.mark.skipif(not TORCH_1_11, reason="CoreML export requires torch>=1.11")
|
|
121
114
|
@pytest.mark.skipif(checks.IS_PYTHON_3_13, reason="CoreML not supported in Python 3.13")
|
|
115
|
+
@pytest.mark.skipif(
|
|
116
|
+
MACOS and MACOS_VERSION and MACOS_VERSION >= "15", reason="CoreML YOLO26 matrix test crashes on macOS 15+"
|
|
117
|
+
)
|
|
122
118
|
@pytest.mark.parametrize(
|
|
123
119
|
"task, dynamic, int8, half, nms, batch",
|
|
124
120
|
[ # generate all combinations except for exclusion cases
|
|
@@ -148,7 +144,9 @@ def test_export_coreml_matrix(task, dynamic, int8, half, nms, batch):
|
|
|
148
144
|
|
|
149
145
|
|
|
150
146
|
@pytest.mark.slow
|
|
151
|
-
@pytest.mark.skipif(
|
|
147
|
+
@pytest.mark.skipif(
|
|
148
|
+
not checks.IS_PYTHON_MINIMUM_3_10 or not TORCH_1_13, reason="TFLite export requires Python>=3.10 and torch>=1.13"
|
|
149
|
+
)
|
|
152
150
|
@pytest.mark.skipif(
|
|
153
151
|
not LINUX or IS_RASPBERRYPI,
|
|
154
152
|
reason="Test disabled as TF suffers from install conflicts on Windows, macOS and Raspberry Pi",
|
|
@@ -217,6 +215,7 @@ def test_export_paddle():
|
|
|
217
215
|
|
|
218
216
|
|
|
219
217
|
@pytest.mark.slow
|
|
218
|
+
@pytest.mark.skipif(not TORCH_1_10, reason="MNN export requires torch>=1.10")
|
|
220
219
|
def test_export_mnn():
|
|
221
220
|
"""Test YOLO export to MNN format (WARNING: MNN test must precede NCNN test or CI error on Windows)."""
|
|
222
221
|
file = YOLO(MODEL).export(format="mnn", imgsz=32)
|
|
@@ -224,6 +223,7 @@ def test_export_mnn():
|
|
|
224
223
|
|
|
225
224
|
|
|
226
225
|
@pytest.mark.slow
|
|
226
|
+
@pytest.mark.skipif(not TORCH_1_10, reason="MNN export requires torch>=1.10")
|
|
227
227
|
@pytest.mark.parametrize(
|
|
228
228
|
"task, int8, half, batch",
|
|
229
229
|
[ # generate all combinations except for exclusion cases
|
|
@@ -240,6 +240,7 @@ def test_export_mnn_matrix(task, int8, half, batch):
|
|
|
240
240
|
|
|
241
241
|
|
|
242
242
|
@pytest.mark.slow
|
|
243
|
+
@pytest.mark.skipif(not TORCH_2_0, reason="NCNN inference causes segfault on PyTorch<2.0")
|
|
243
244
|
def test_export_ncnn():
|
|
244
245
|
"""Test YOLO export to NCNN format."""
|
|
245
246
|
file = YOLO(MODEL).export(format="ncnn", imgsz=32)
|
|
@@ -247,6 +248,7 @@ def test_export_ncnn():
|
|
|
247
248
|
|
|
248
249
|
|
|
249
250
|
@pytest.mark.slow
|
|
251
|
+
@pytest.mark.skipif(not TORCH_2_0, reason="NCNN inference causes segfault on PyTorch<2.0")
|
|
250
252
|
@pytest.mark.parametrize("task, half, batch", list(product(TASKS, [True, False], [1])))
|
|
251
253
|
def test_export_ncnn_matrix(task, half, batch):
|
|
252
254
|
"""Test YOLO export to NCNN format considering various export configurations."""
|
|
@@ -255,10 +257,60 @@ def test_export_ncnn_matrix(task, half, batch):
|
|
|
255
257
|
shutil.rmtree(file, ignore_errors=True) # retry in case of potential lingering multi-threaded file usage errors
|
|
256
258
|
|
|
257
259
|
|
|
258
|
-
@pytest.mark.skipif(
|
|
259
|
-
@pytest.mark.skipif(not
|
|
260
|
+
@pytest.mark.skipif(not TORCH_2_9, reason="IMX export requires torch>=2.9.0")
|
|
261
|
+
@pytest.mark.skipif(not checks.IS_PYTHON_MINIMUM_3_9, reason="Requires Python>=3.9")
|
|
262
|
+
@pytest.mark.skipif(WINDOWS or MACOS, reason="Skipping test on Windows and Macos")
|
|
263
|
+
@pytest.mark.skipif(ARM64, reason="IMX export is not supported on ARM64 architectures.")
|
|
260
264
|
def test_export_imx():
|
|
261
265
|
"""Test YOLO export to IMX format."""
|
|
262
|
-
model = YOLO("
|
|
266
|
+
model = YOLO("yolo11n.pt") # IMX export only supports YOLO11
|
|
263
267
|
file = model.export(format="imx", imgsz=32)
|
|
264
268
|
YOLO(file)(SOURCE, imgsz=32)
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
@pytest.mark.slow
|
|
272
|
+
@pytest.mark.skipif(not TORCH_2_8, reason="Axelera export requires torch>=2.8.0")
|
|
273
|
+
@pytest.mark.skipif(not LINUX, reason="Axelera export only supported on Linux")
|
|
274
|
+
@pytest.mark.skipif(not checks.IS_PYTHON_3_10, reason="Axelera export requires Python 3.10")
|
|
275
|
+
def test_export_axelera():
|
|
276
|
+
"""Test YOLO export to Axelera format."""
|
|
277
|
+
# For faster testing, use a smaller calibration dataset (32 image size crashes axelera export, so 64 is used)
|
|
278
|
+
file = YOLO(MODEL).export(format="axelera", imgsz=64, data="coco8.yaml")
|
|
279
|
+
assert Path(file).exists(), f"Axelera export failed, directory not found: {file}"
|
|
280
|
+
shutil.rmtree(file, ignore_errors=True) # cleanup
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
# @pytest.mark.skipif(True, reason="Disabled for debugging ruamel.yaml installation required by executorch")
|
|
284
|
+
@pytest.mark.skipif(not checks.IS_PYTHON_MINIMUM_3_10 or not TORCH_2_9, reason="Requires Python>=3.10 and Torch>=2.9.0")
|
|
285
|
+
@pytest.mark.skipif(WINDOWS, reason="Skipping test on Windows")
|
|
286
|
+
def test_export_executorch():
|
|
287
|
+
"""Test YOLO model export to ExecuTorch format."""
|
|
288
|
+
file = YOLO(MODEL).export(format="executorch", imgsz=32)
|
|
289
|
+
assert Path(file).exists(), f"ExecuTorch export failed, directory not found: {file}"
|
|
290
|
+
# Check that .pte file exists in the exported directory
|
|
291
|
+
pte_file = Path(file) / Path(MODEL).with_suffix(".pte").name
|
|
292
|
+
assert pte_file.exists(), f"ExecuTorch .pte file not found: {pte_file}"
|
|
293
|
+
# Check that metadata.yaml exists
|
|
294
|
+
metadata_file = Path(file) / "metadata.yaml"
|
|
295
|
+
assert metadata_file.exists(), f"ExecuTorch metadata.yaml not found: {metadata_file}"
|
|
296
|
+
# Note: Inference testing skipped as ExecuTorch requires special runtime setup
|
|
297
|
+
shutil.rmtree(file, ignore_errors=True) # cleanup
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
@pytest.mark.slow
|
|
301
|
+
@pytest.mark.skipif(not checks.IS_PYTHON_MINIMUM_3_10 or not TORCH_2_9, reason="Requires Python>=3.10 and Torch>=2.9.0")
|
|
302
|
+
@pytest.mark.skipif(WINDOWS, reason="Skipping test on Windows")
|
|
303
|
+
@pytest.mark.parametrize("task", TASKS)
|
|
304
|
+
def test_export_executorch_matrix(task):
|
|
305
|
+
"""Test YOLO export to ExecuTorch format for various task types."""
|
|
306
|
+
file = YOLO(TASK2MODEL[task]).export(format="executorch", imgsz=32)
|
|
307
|
+
assert Path(file).exists(), f"ExecuTorch export failed for task '{task}', directory not found: {file}"
|
|
308
|
+
# Check that .pte file exists in the exported directory
|
|
309
|
+
model_name = Path(TASK2MODEL[task]).with_suffix(".pte").name
|
|
310
|
+
pte_file = Path(file) / model_name
|
|
311
|
+
assert pte_file.exists(), f"ExecuTorch .pte file not found for task '{task}': {pte_file}"
|
|
312
|
+
# Check that metadata.yaml exists
|
|
313
|
+
metadata_file = Path(file) / "metadata.yaml"
|
|
314
|
+
assert metadata_file.exists(), f"ExecuTorch metadata.yaml not found for task '{task}': {metadata_file}"
|
|
315
|
+
# Note: Inference testing skipped as ExecuTorch requires special runtime setup
|
|
316
|
+
shutil.rmtree(file, ignore_errors=True) # cleanup
|
tests/test_integrations.py
CHANGED
|
@@ -8,7 +8,7 @@ from pathlib import Path
|
|
|
8
8
|
|
|
9
9
|
import pytest
|
|
10
10
|
|
|
11
|
-
from tests import MODEL, SOURCE
|
|
11
|
+
from tests import MODEL, SOURCE
|
|
12
12
|
from ultralytics import YOLO, download
|
|
13
13
|
from ultralytics.utils import ASSETS_URL, DATASETS_DIR, SETTINGS
|
|
14
14
|
from ultralytics.utils.checks import check_requirements
|
|
@@ -18,14 +18,14 @@ from ultralytics.utils.checks import check_requirements
|
|
|
18
18
|
def test_tensorboard():
|
|
19
19
|
"""Test training with TensorBoard logging enabled."""
|
|
20
20
|
SETTINGS["tensorboard"] = True
|
|
21
|
-
YOLO("
|
|
21
|
+
YOLO("yolo26n-cls.yaml").train(data="imagenet10", imgsz=32, epochs=3, plots=False, device="cpu")
|
|
22
22
|
SETTINGS["tensorboard"] = False
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
@pytest.mark.skipif(not check_requirements("ray", install=False), reason="ray[tune] not installed")
|
|
26
26
|
def test_model_ray_tune():
|
|
27
27
|
"""Tune YOLO model using Ray for hyperparameter optimization."""
|
|
28
|
-
YOLO("
|
|
28
|
+
YOLO("yolo26n-cls.yaml").tune(
|
|
29
29
|
use_ray=True, data="imagenet10", grace_period=1, iterations=1, imgsz=32, epochs=1, plots=False, device="cpu"
|
|
30
30
|
)
|
|
31
31
|
|
|
@@ -34,7 +34,7 @@ def test_model_ray_tune():
|
|
|
34
34
|
def test_mlflow():
|
|
35
35
|
"""Test training with MLflow tracking enabled."""
|
|
36
36
|
SETTINGS["mlflow"] = True
|
|
37
|
-
YOLO("
|
|
37
|
+
YOLO("yolo26n-cls.yaml").train(data="imagenet10", imgsz=32, epochs=3, plots=False, device="cpu")
|
|
38
38
|
SETTINGS["mlflow"] = False
|
|
39
39
|
|
|
40
40
|
|
|
@@ -50,7 +50,7 @@ def test_mlflow_keep_run_active():
|
|
|
50
50
|
|
|
51
51
|
# Test with MLFLOW_KEEP_RUN_ACTIVE=True
|
|
52
52
|
os.environ["MLFLOW_KEEP_RUN_ACTIVE"] = "True"
|
|
53
|
-
YOLO("
|
|
53
|
+
YOLO("yolo26n-cls.yaml").train(data="imagenet10", imgsz=32, epochs=1, plots=False, device="cpu")
|
|
54
54
|
status = mlflow.active_run().info.status
|
|
55
55
|
assert status == "RUNNING", "MLflow run should be active when MLFLOW_KEEP_RUN_ACTIVE=True"
|
|
56
56
|
|
|
@@ -58,27 +58,27 @@ def test_mlflow_keep_run_active():
|
|
|
58
58
|
|
|
59
59
|
# Test with MLFLOW_KEEP_RUN_ACTIVE=False
|
|
60
60
|
os.environ["MLFLOW_KEEP_RUN_ACTIVE"] = "False"
|
|
61
|
-
YOLO("
|
|
61
|
+
YOLO("yolo26n-cls.yaml").train(data="imagenet10", imgsz=32, epochs=1, plots=False, device="cpu")
|
|
62
62
|
status = mlflow.get_run(run_id=run_id).info.status
|
|
63
63
|
assert status == "FINISHED", "MLflow run should be ended when MLFLOW_KEEP_RUN_ACTIVE=False"
|
|
64
64
|
|
|
65
65
|
# Test with MLFLOW_KEEP_RUN_ACTIVE not set
|
|
66
66
|
os.environ.pop("MLFLOW_KEEP_RUN_ACTIVE", None)
|
|
67
|
-
YOLO("
|
|
67
|
+
YOLO("yolo26n-cls.yaml").train(data="imagenet10", imgsz=32, epochs=1, plots=False, device="cpu")
|
|
68
68
|
status = mlflow.get_run(run_id=run_id).info.status
|
|
69
69
|
assert status == "FINISHED", "MLflow run should be ended by default when MLFLOW_KEEP_RUN_ACTIVE is not set"
|
|
70
70
|
SETTINGS["mlflow"] = False
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
@pytest.mark.skipif(not check_requirements("tritonclient", install=False), reason="tritonclient[all] not installed")
|
|
74
|
-
def test_triton():
|
|
74
|
+
def test_triton(tmp_path):
|
|
75
75
|
"""Test NVIDIA Triton Server functionalities with YOLO model."""
|
|
76
76
|
check_requirements("tritonclient[all]")
|
|
77
|
-
from tritonclient.http import InferenceServerClient
|
|
77
|
+
from tritonclient.http import InferenceServerClient
|
|
78
78
|
|
|
79
79
|
# Create variables
|
|
80
80
|
model_name = "yolo"
|
|
81
|
-
triton_repo =
|
|
81
|
+
triton_repo = tmp_path / "triton_repo" # Triton repo path
|
|
82
82
|
triton_model = triton_repo / model_name # Triton model path
|
|
83
83
|
|
|
84
84
|
# Export model to ONNX
|
|
@@ -129,21 +129,21 @@ def test_faster_coco_eval():
|
|
|
129
129
|
from ultralytics.models.yolo.pose import PoseValidator
|
|
130
130
|
from ultralytics.models.yolo.segment import SegmentationValidator
|
|
131
131
|
|
|
132
|
-
args = {"model": "
|
|
132
|
+
args = {"model": "yolo26n.pt", "data": "coco8.yaml", "save_json": True, "imgsz": 64}
|
|
133
133
|
validator = DetectionValidator(args=args)
|
|
134
134
|
validator()
|
|
135
135
|
validator.is_coco = True
|
|
136
136
|
download(f"{ASSETS_URL}/instances_val2017.json", dir=DATASETS_DIR / "coco8/annotations")
|
|
137
137
|
_ = validator.eval_json(validator.stats)
|
|
138
138
|
|
|
139
|
-
args = {"model": "
|
|
139
|
+
args = {"model": "yolo26n-seg.pt", "data": "coco8-seg.yaml", "save_json": True, "imgsz": 64}
|
|
140
140
|
validator = SegmentationValidator(args=args)
|
|
141
141
|
validator()
|
|
142
142
|
validator.is_coco = True
|
|
143
143
|
download(f"{ASSETS_URL}/instances_val2017.json", dir=DATASETS_DIR / "coco8-seg/annotations")
|
|
144
144
|
_ = validator.eval_json(validator.stats)
|
|
145
145
|
|
|
146
|
-
args = {"model": "
|
|
146
|
+
args = {"model": "yolo26n-pose.pt", "data": "coco8-pose.yaml", "save_json": True, "imgsz": 64}
|
|
147
147
|
validator = PoseValidator(args=args)
|
|
148
148
|
validator()
|
|
149
149
|
validator.is_coco = True
|