ultralytics 8.2.48__py3-none-any.whl → 8.2.50__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.
Potentially problematic release.
This version of ultralytics might be problematic. Click here for more details.
- tests/conftest.py +17 -5
- tests/test_cli.py +8 -8
- tests/test_cuda.py +5 -5
- tests/test_engine.py +5 -5
- tests/test_explorer.py +4 -4
- tests/test_exports.py +12 -24
- tests/test_integrations.py +9 -5
- tests/test_python.py +35 -39
- ultralytics/__init__.py +1 -1
- ultralytics/cfg/__init__.py +156 -39
- ultralytics/data/augment.py +3 -3
- ultralytics/data/explorer/explorer.py +3 -0
- ultralytics/engine/model.py +1 -1
- ultralytics/engine/results.py +160 -68
- ultralytics/hub/session.py +2 -0
- ultralytics/models/fastsam/prompt.py +1 -1
- ultralytics/models/sam/amg.py +1 -1
- ultralytics/models/sam/modules/tiny_encoder.py +1 -1
- ultralytics/models/yolo/classify/train.py +7 -16
- ultralytics/models/yolo/world/train_world.py +2 -2
- ultralytics/nn/modules/block.py +1 -0
- ultralytics/nn/tasks.py +1 -1
- ultralytics/solutions/__init__.py +1 -0
- ultralytics/solutions/ai_gym.py +3 -3
- ultralytics/solutions/streamlit_inference.py +154 -0
- ultralytics/utils/__init__.py +0 -1
- ultralytics/utils/metrics.py +1 -2
- ultralytics/utils/plotting.py +3 -3
- ultralytics/utils/torch_utils.py +22 -8
- {ultralytics-8.2.48.dist-info → ultralytics-8.2.50.dist-info}/METADATA +3 -3
- {ultralytics-8.2.48.dist-info → ultralytics-8.2.50.dist-info}/RECORD +35 -34
- {ultralytics-8.2.48.dist-info → ultralytics-8.2.50.dist-info}/WHEEL +1 -1
- {ultralytics-8.2.48.dist-info → ultralytics-8.2.50.dist-info}/LICENSE +0 -0
- {ultralytics-8.2.48.dist-info → ultralytics-8.2.50.dist-info}/entry_points.txt +0 -0
- {ultralytics-8.2.48.dist-info → ultralytics-8.2.50.dist-info}/top_level.txt +0 -0
tests/conftest.py
CHANGED
|
@@ -11,18 +11,24 @@ def pytest_addoption(parser):
|
|
|
11
11
|
Add custom command-line options to pytest.
|
|
12
12
|
|
|
13
13
|
Args:
|
|
14
|
-
parser (pytest.config.Parser): The pytest parser object.
|
|
14
|
+
parser (pytest.config.Parser): The pytest parser object for adding custom command-line options.
|
|
15
|
+
|
|
16
|
+
Returns:
|
|
17
|
+
(None)
|
|
15
18
|
"""
|
|
16
19
|
parser.addoption("--slow", action="store_true", default=False, help="Run slow tests")
|
|
17
20
|
|
|
18
21
|
|
|
19
22
|
def pytest_collection_modifyitems(config, items):
|
|
20
23
|
"""
|
|
21
|
-
Modify the list of test items to
|
|
24
|
+
Modify the list of test items to exclude tests marked as slow if the --slow option is not specified.
|
|
22
25
|
|
|
23
26
|
Args:
|
|
24
|
-
config (pytest.config.Config): The pytest
|
|
25
|
-
items (list):
|
|
27
|
+
config (pytest.config.Config): The pytest configuration object that provides access to command-line options.
|
|
28
|
+
items (list): The list of collected pytest item objects to be modified based on the presence of --slow option.
|
|
29
|
+
|
|
30
|
+
Returns:
|
|
31
|
+
(None) The function modifies the 'items' list in place, and does not return a value.
|
|
26
32
|
"""
|
|
27
33
|
if not config.getoption("--slow"):
|
|
28
34
|
# Remove the item entirely from the list of test items if it's marked as 'slow'
|
|
@@ -38,6 +44,9 @@ def pytest_sessionstart(session):
|
|
|
38
44
|
|
|
39
45
|
Args:
|
|
40
46
|
session (pytest.Session): The pytest session object.
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
(None)
|
|
41
50
|
"""
|
|
42
51
|
from ultralytics.utils.torch_utils import init_seeds
|
|
43
52
|
|
|
@@ -54,9 +63,12 @@ def pytest_terminal_summary(terminalreporter, exitstatus, config):
|
|
|
54
63
|
and directories used during testing.
|
|
55
64
|
|
|
56
65
|
Args:
|
|
57
|
-
terminalreporter (pytest.terminal.TerminalReporter): The terminal reporter object.
|
|
66
|
+
terminalreporter (pytest.terminal.TerminalReporter): The terminal reporter object used for terminal output.
|
|
58
67
|
exitstatus (int): The exit status of the test run.
|
|
59
68
|
config (pytest.config.Config): The pytest config object.
|
|
69
|
+
|
|
70
|
+
Returns:
|
|
71
|
+
(None)
|
|
60
72
|
"""
|
|
61
73
|
from ultralytics.utils import WEIGHTS_DIR
|
|
62
74
|
|
tests/test_cli.py
CHANGED
|
@@ -20,7 +20,7 @@ def run(cmd):
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
def test_special_modes():
|
|
23
|
-
"""Test various special command modes
|
|
23
|
+
"""Test various special command-line modes for YOLO functionality."""
|
|
24
24
|
run("yolo help")
|
|
25
25
|
run("yolo checks")
|
|
26
26
|
run("yolo version")
|
|
@@ -30,30 +30,30 @@ def test_special_modes():
|
|
|
30
30
|
|
|
31
31
|
@pytest.mark.parametrize("task,model,data", TASK_MODEL_DATA)
|
|
32
32
|
def test_train(task, model, data):
|
|
33
|
-
"""Test YOLO training for
|
|
33
|
+
"""Test YOLO training for different tasks, models, and datasets."""
|
|
34
34
|
run(f"yolo train {task} model={model} data={data} imgsz=32 epochs=1 cache=disk")
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
@pytest.mark.parametrize("task,model,data", TASK_MODEL_DATA)
|
|
38
38
|
def test_val(task, model, data):
|
|
39
|
-
"""Test YOLO validation for
|
|
39
|
+
"""Test YOLO validation process for specified task, model, and data using a shell command."""
|
|
40
40
|
run(f"yolo val {task} model={model} data={data} imgsz=32 save_txt save_json")
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
@pytest.mark.parametrize("task,model,data", TASK_MODEL_DATA)
|
|
44
44
|
def test_predict(task, model, data):
|
|
45
|
-
"""Test YOLO prediction on sample assets for
|
|
45
|
+
"""Test YOLO prediction on provided sample assets for specified task and model."""
|
|
46
46
|
run(f"yolo predict model={model} source={ASSETS} imgsz=32 save save_crop save_txt")
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
@pytest.mark.parametrize("model", MODELS)
|
|
50
50
|
def test_export(model):
|
|
51
|
-
"""Test exporting a YOLO model to
|
|
51
|
+
"""Test exporting a YOLO model to TorchScript format."""
|
|
52
52
|
run(f"yolo export model={model} format=torchscript imgsz=32")
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
def test_rtdetr(task="detect", model="yolov8n-rtdetr.yaml", data="coco8.yaml"):
|
|
56
|
-
"""Test the RTDETR functionality
|
|
56
|
+
"""Test the RTDETR functionality within Ultralytics for detection tasks using specified model and data."""
|
|
57
57
|
# Warning: must use imgsz=640 (note also add coma, spaces, fraction=0.25 args to test single-image training)
|
|
58
58
|
run(f"yolo train {task} model={model} data={data} --imgsz= 160 epochs =1, cache = disk fraction=0.25")
|
|
59
59
|
run(f"yolo predict {task} model={model} source={ASSETS / 'bus.jpg'} imgsz=160 save save_crop save_txt")
|
|
@@ -61,7 +61,7 @@ def test_rtdetr(task="detect", model="yolov8n-rtdetr.yaml", data="coco8.yaml"):
|
|
|
61
61
|
|
|
62
62
|
@pytest.mark.skipif(checks.IS_PYTHON_3_12, reason="MobileSAM with CLIP is not supported in Python 3.12")
|
|
63
63
|
def test_fastsam(task="segment", model=WEIGHTS_DIR / "FastSAM-s.pt", data="coco8-seg.yaml"):
|
|
64
|
-
"""Test FastSAM
|
|
64
|
+
"""Test FastSAM model for segmenting objects in images using various prompts within Ultralytics."""
|
|
65
65
|
source = ASSETS / "bus.jpg"
|
|
66
66
|
|
|
67
67
|
run(f"yolo segment val {task} model={model} data={data} imgsz=32")
|
|
@@ -99,7 +99,7 @@ def test_fastsam(task="segment", model=WEIGHTS_DIR / "FastSAM-s.pt", data="coco8
|
|
|
99
99
|
|
|
100
100
|
|
|
101
101
|
def test_mobilesam():
|
|
102
|
-
"""Test MobileSAM segmentation
|
|
102
|
+
"""Test MobileSAM segmentation with point prompts using Ultralytics."""
|
|
103
103
|
from ultralytics import SAM
|
|
104
104
|
|
|
105
105
|
# Load the model
|
tests/test_cuda.py
CHANGED
|
@@ -32,7 +32,7 @@ def test_checks():
|
|
|
32
32
|
],
|
|
33
33
|
)
|
|
34
34
|
def test_export_engine_matrix(task, dynamic, int8, half, batch):
|
|
35
|
-
"""Test YOLO
|
|
35
|
+
"""Test YOLO model export to TensorRT format for various configurations and run inference."""
|
|
36
36
|
file = YOLO(TASK2MODEL[task]).export(
|
|
37
37
|
format="engine",
|
|
38
38
|
imgsz=32,
|
|
@@ -51,7 +51,7 @@ def test_export_engine_matrix(task, dynamic, int8, half, batch):
|
|
|
51
51
|
|
|
52
52
|
@pytest.mark.skipif(not CUDA_IS_AVAILABLE, reason="CUDA is not available")
|
|
53
53
|
def test_train():
|
|
54
|
-
"""Test model training on a minimal dataset."""
|
|
54
|
+
"""Test model training on a minimal dataset using available CUDA devices."""
|
|
55
55
|
device = 0 if CUDA_DEVICE_COUNT == 1 else [0, 1]
|
|
56
56
|
YOLO(MODEL).train(data="coco8.yaml", imgsz=64, epochs=1, device=device) # requires imgsz>=64
|
|
57
57
|
|
|
@@ -59,7 +59,7 @@ def test_train():
|
|
|
59
59
|
@pytest.mark.slow
|
|
60
60
|
@pytest.mark.skipif(not CUDA_IS_AVAILABLE, reason="CUDA is not available")
|
|
61
61
|
def test_predict_multiple_devices():
|
|
62
|
-
"""Validate model prediction
|
|
62
|
+
"""Validate model prediction consistency across CPU and CUDA devices."""
|
|
63
63
|
model = YOLO("yolov8n.pt")
|
|
64
64
|
model = model.cpu()
|
|
65
65
|
assert str(model.device) == "cpu"
|
|
@@ -84,7 +84,7 @@ def test_predict_multiple_devices():
|
|
|
84
84
|
|
|
85
85
|
@pytest.mark.skipif(not CUDA_IS_AVAILABLE, reason="CUDA is not available")
|
|
86
86
|
def test_autobatch():
|
|
87
|
-
"""Check batch size for YOLO model using autobatch."""
|
|
87
|
+
"""Check optimal batch size for YOLO model training using autobatch utility."""
|
|
88
88
|
from ultralytics.utils.autobatch import check_train_batch_size
|
|
89
89
|
|
|
90
90
|
check_train_batch_size(YOLO(MODEL).model.cuda(), imgsz=128, amp=True)
|
|
@@ -103,7 +103,7 @@ def test_utils_benchmarks():
|
|
|
103
103
|
|
|
104
104
|
@pytest.mark.skipif(not CUDA_IS_AVAILABLE, reason="CUDA is not available")
|
|
105
105
|
def test_predict_sam():
|
|
106
|
-
"""Test SAM model
|
|
106
|
+
"""Test SAM model predictions using different prompts, including bounding boxes and point annotations."""
|
|
107
107
|
from ultralytics import SAM
|
|
108
108
|
from ultralytics.models.sam import Predictor as SAMPredictor
|
|
109
109
|
|
tests/test_engine.py
CHANGED
|
@@ -12,12 +12,12 @@ from ultralytics.utils import ASSETS, DEFAULT_CFG, WEIGHTS_DIR
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
def test_func(*args): # noqa
|
|
15
|
-
"""Test function callback."""
|
|
15
|
+
"""Test function callback for evaluating YOLO model performance metrics."""
|
|
16
16
|
print("callback test passed")
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
def test_export():
|
|
20
|
-
"""
|
|
20
|
+
"""Tests the model exporting function by adding a callback and asserting its execution."""
|
|
21
21
|
exporter = Exporter()
|
|
22
22
|
exporter.add_callback("on_export_start", test_func)
|
|
23
23
|
assert test_func in exporter.callbacks["on_export_start"], "callback test failed"
|
|
@@ -26,7 +26,7 @@ def test_export():
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def test_detect():
|
|
29
|
-
"""Test object detection functionality."""
|
|
29
|
+
"""Test YOLO object detection training, validation, and prediction functionality."""
|
|
30
30
|
overrides = {"data": "coco8.yaml", "model": "yolov8n.yaml", "imgsz": 32, "epochs": 1, "save": False}
|
|
31
31
|
cfg = get_cfg(DEFAULT_CFG)
|
|
32
32
|
cfg.data = "coco8.yaml"
|
|
@@ -65,7 +65,7 @@ def test_detect():
|
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
def test_segment():
|
|
68
|
-
"""
|
|
68
|
+
"""Tests image segmentation training, validation, and prediction pipelines using YOLO models."""
|
|
69
69
|
overrides = {"data": "coco8-seg.yaml", "model": "yolov8n-seg.yaml", "imgsz": 32, "epochs": 1, "save": False}
|
|
70
70
|
cfg = get_cfg(DEFAULT_CFG)
|
|
71
71
|
cfg.data = "coco8-seg.yaml"
|
|
@@ -104,7 +104,7 @@ def test_segment():
|
|
|
104
104
|
|
|
105
105
|
|
|
106
106
|
def test_classify():
|
|
107
|
-
"""Test image classification
|
|
107
|
+
"""Test image classification including training, validation, and prediction phases."""
|
|
108
108
|
overrides = {"data": "imagenet10", "model": "yolov8n-cls.yaml", "imgsz": 32, "epochs": 1, "save": False}
|
|
109
109
|
cfg = get_cfg(DEFAULT_CFG)
|
|
110
110
|
cfg.data = "imagenet10"
|
tests/test_explorer.py
CHANGED
|
@@ -9,7 +9,7 @@ from ultralytics.utils import ASSETS
|
|
|
9
9
|
|
|
10
10
|
@pytest.mark.slow
|
|
11
11
|
def test_similarity():
|
|
12
|
-
"""Test similarity calculations and SQL queries
|
|
12
|
+
"""Test the correctness and response length of similarity calculations and SQL queries in the Explorer."""
|
|
13
13
|
exp = Explorer(data="coco8.yaml")
|
|
14
14
|
exp.create_embeddings_table()
|
|
15
15
|
similar = exp.get_similar(idx=1)
|
|
@@ -26,7 +26,7 @@ def test_similarity():
|
|
|
26
26
|
|
|
27
27
|
@pytest.mark.slow
|
|
28
28
|
def test_det():
|
|
29
|
-
"""Test detection functionalities and
|
|
29
|
+
"""Test detection functionalities and verify embedding table includes bounding boxes."""
|
|
30
30
|
exp = Explorer(data="coco8.yaml", model="yolov8n.pt")
|
|
31
31
|
exp.create_embeddings_table(force=True)
|
|
32
32
|
assert len(exp.table.head()["bboxes"]) > 0
|
|
@@ -39,7 +39,7 @@ def test_det():
|
|
|
39
39
|
|
|
40
40
|
@pytest.mark.slow
|
|
41
41
|
def test_seg():
|
|
42
|
-
"""Test segmentation functionalities and
|
|
42
|
+
"""Test segmentation functionalities and ensure the embedding table includes segmentation masks."""
|
|
43
43
|
exp = Explorer(data="coco8-seg.yaml", model="yolov8n-seg.pt")
|
|
44
44
|
exp.create_embeddings_table(force=True)
|
|
45
45
|
assert len(exp.table.head()["masks"]) > 0
|
|
@@ -51,7 +51,7 @@ def test_seg():
|
|
|
51
51
|
|
|
52
52
|
@pytest.mark.slow
|
|
53
53
|
def test_pose():
|
|
54
|
-
"""Test pose estimation
|
|
54
|
+
"""Test pose estimation functionality and verify the embedding table includes keypoints."""
|
|
55
55
|
exp = Explorer(data="coco8-pose.yaml", model="yolov8n-pose.pt")
|
|
56
56
|
exp.create_embeddings_table(force=True)
|
|
57
57
|
assert len(exp.table.head()["keypoints"]) > 0
|
tests/test_exports.py
CHANGED
|
@@ -21,13 +21,13 @@ from ultralytics.utils.torch_utils import TORCH_1_9, TORCH_1_13
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
def test_export_torchscript():
|
|
24
|
-
"""Test YOLO
|
|
24
|
+
"""Test YOLO model exporting to TorchScript format for compatibility and correctness."""
|
|
25
25
|
file = YOLO(MODEL).export(format="torchscript", optimize=False, imgsz=32)
|
|
26
26
|
YOLO(file)(SOURCE, imgsz=32) # exported model inference
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
def test_export_onnx():
|
|
30
|
-
"""Test YOLO
|
|
30
|
+
"""Test YOLO model export to ONNX format with dynamic axes."""
|
|
31
31
|
file = YOLO(MODEL).export(format="onnx", dynamic=True, imgsz=32)
|
|
32
32
|
YOLO(file)(SOURCE, imgsz=32) # exported model inference
|
|
33
33
|
|
|
@@ -35,7 +35,7 @@ def test_export_onnx():
|
|
|
35
35
|
@pytest.mark.skipif(checks.IS_PYTHON_3_12, reason="OpenVINO not supported in Python 3.12")
|
|
36
36
|
@pytest.mark.skipif(not TORCH_1_13, reason="OpenVINO requires torch>=1.13")
|
|
37
37
|
def test_export_openvino():
|
|
38
|
-
"""Test YOLO exports to OpenVINO format."""
|
|
38
|
+
"""Test YOLO exports to OpenVINO format for model inference compatibility."""
|
|
39
39
|
file = YOLO(MODEL).export(format="openvino", imgsz=32)
|
|
40
40
|
YOLO(file)(SOURCE, imgsz=32) # exported model inference
|
|
41
41
|
|
|
@@ -52,7 +52,7 @@ def test_export_openvino():
|
|
|
52
52
|
],
|
|
53
53
|
)
|
|
54
54
|
def test_export_openvino_matrix(task, dynamic, int8, half, batch):
|
|
55
|
-
"""Test YOLO exports to OpenVINO
|
|
55
|
+
"""Test YOLO model exports to OpenVINO under various configuration matrix conditions."""
|
|
56
56
|
file = YOLO(TASK2MODEL[task]).export(
|
|
57
57
|
format="openvino",
|
|
58
58
|
imgsz=32,
|
|
@@ -76,7 +76,7 @@ def test_export_openvino_matrix(task, dynamic, int8, half, batch):
|
|
|
76
76
|
"task, dynamic, int8, half, batch, simplify", product(TASKS, [True, False], [False], [False], [1, 2], [True, False])
|
|
77
77
|
)
|
|
78
78
|
def test_export_onnx_matrix(task, dynamic, int8, half, batch, simplify):
|
|
79
|
-
"""Test YOLO exports to ONNX format."""
|
|
79
|
+
"""Test YOLO exports to ONNX format with various configurations and parameters."""
|
|
80
80
|
file = YOLO(TASK2MODEL[task]).export(
|
|
81
81
|
format="onnx",
|
|
82
82
|
imgsz=32,
|
|
@@ -93,7 +93,7 @@ def test_export_onnx_matrix(task, dynamic, int8, half, batch, simplify):
|
|
|
93
93
|
@pytest.mark.slow
|
|
94
94
|
@pytest.mark.parametrize("task, dynamic, int8, half, batch", product(TASKS, [False], [False], [False], [1, 2]))
|
|
95
95
|
def test_export_torchscript_matrix(task, dynamic, int8, half, batch):
|
|
96
|
-
"""
|
|
96
|
+
"""Tests YOLO model exports to TorchScript format under varied configurations."""
|
|
97
97
|
file = YOLO(TASK2MODEL[task]).export(
|
|
98
98
|
format="torchscript",
|
|
99
99
|
imgsz=32,
|
|
@@ -119,7 +119,7 @@ def test_export_torchscript_matrix(task, dynamic, int8, half, batch):
|
|
|
119
119
|
],
|
|
120
120
|
)
|
|
121
121
|
def test_export_coreml_matrix(task, dynamic, int8, half, batch):
|
|
122
|
-
"""Test YOLO exports to CoreML format."""
|
|
122
|
+
"""Test YOLO exports to CoreML format with various parameter configurations."""
|
|
123
123
|
file = YOLO(TASK2MODEL[task]).export(
|
|
124
124
|
format="coreml",
|
|
125
125
|
imgsz=32,
|
|
@@ -144,7 +144,7 @@ def test_export_coreml_matrix(task, dynamic, int8, half, batch):
|
|
|
144
144
|
],
|
|
145
145
|
)
|
|
146
146
|
def test_export_tflite_matrix(task, dynamic, int8, half, batch):
|
|
147
|
-
"""Test YOLO exports to TFLite format."""
|
|
147
|
+
"""Test YOLO exports to TFLite format considering various export configurations."""
|
|
148
148
|
file = YOLO(TASK2MODEL[task]).export(
|
|
149
149
|
format="tflite",
|
|
150
150
|
imgsz=32,
|
|
@@ -162,7 +162,7 @@ def test_export_tflite_matrix(task, dynamic, int8, half, batch):
|
|
|
162
162
|
@pytest.mark.skipif(IS_RASPBERRYPI, reason="CoreML not supported on Raspberry Pi")
|
|
163
163
|
@pytest.mark.skipif(checks.IS_PYTHON_3_12, reason="CoreML not supported in Python 3.12")
|
|
164
164
|
def test_export_coreml():
|
|
165
|
-
"""Test YOLO exports to CoreML format."""
|
|
165
|
+
"""Test YOLO exports to CoreML format, optimized for macOS only."""
|
|
166
166
|
if MACOS:
|
|
167
167
|
file = YOLO(MODEL).export(format="coreml", imgsz=32)
|
|
168
168
|
YOLO(file)(SOURCE, imgsz=32) # model prediction only supported on macOS for nms=False models
|
|
@@ -173,11 +173,7 @@ def test_export_coreml():
|
|
|
173
173
|
@pytest.mark.skipif(not checks.IS_PYTHON_MINIMUM_3_10, reason="TFLite export requires Python>=3.10")
|
|
174
174
|
@pytest.mark.skipif(not LINUX, reason="Test disabled as TF suffers from install conflicts on Windows and macOS")
|
|
175
175
|
def test_export_tflite():
|
|
176
|
-
"""
|
|
177
|
-
Test YOLO exports to TFLite format.
|
|
178
|
-
|
|
179
|
-
Note TF suffers from install conflicts on Windows and macOS.
|
|
180
|
-
"""
|
|
176
|
+
"""Test YOLO exports to TFLite format under specific OS and Python version conditions."""
|
|
181
177
|
model = YOLO(MODEL)
|
|
182
178
|
file = model.export(format="tflite", imgsz=32)
|
|
183
179
|
YOLO(file)(SOURCE, imgsz=32)
|
|
@@ -186,11 +182,7 @@ def test_export_tflite():
|
|
|
186
182
|
@pytest.mark.skipif(True, reason="Test disabled")
|
|
187
183
|
@pytest.mark.skipif(not LINUX, reason="TF suffers from install conflicts on Windows and macOS")
|
|
188
184
|
def test_export_pb():
|
|
189
|
-
"""
|
|
190
|
-
Test YOLO exports to *.pb format.
|
|
191
|
-
|
|
192
|
-
Note TF suffers from install conflicts on Windows and macOS.
|
|
193
|
-
"""
|
|
185
|
+
"""Test YOLO exports to TensorFlow's Protobuf (*.pb) format."""
|
|
194
186
|
model = YOLO(MODEL)
|
|
195
187
|
file = model.export(format="pb", imgsz=32)
|
|
196
188
|
YOLO(file)(SOURCE, imgsz=32)
|
|
@@ -198,11 +190,7 @@ def test_export_pb():
|
|
|
198
190
|
|
|
199
191
|
@pytest.mark.skipif(True, reason="Test disabled as Paddle protobuf and ONNX protobuf requirementsk conflict.")
|
|
200
192
|
def test_export_paddle():
|
|
201
|
-
"""
|
|
202
|
-
Test YOLO exports to Paddle format.
|
|
203
|
-
|
|
204
|
-
Note Paddle protobuf requirements conflicting with onnx protobuf requirements.
|
|
205
|
-
"""
|
|
193
|
+
"""Test YOLO exports to Paddle format, noting protobuf conflicts with ONNX."""
|
|
206
194
|
YOLO(MODEL).export(format="paddle", imgsz=32)
|
|
207
195
|
|
|
208
196
|
|
tests/test_integrations.py
CHANGED
|
@@ -16,7 +16,7 @@ from ultralytics.utils.checks import check_requirements
|
|
|
16
16
|
|
|
17
17
|
@pytest.mark.skipif(not check_requirements("ray", install=False), reason="ray[tune] not installed")
|
|
18
18
|
def test_model_ray_tune():
|
|
19
|
-
"""Tune YOLO model
|
|
19
|
+
"""Tune YOLO model using Ray for hyperparameter optimization."""
|
|
20
20
|
YOLO("yolov8n-cls.yaml").tune(
|
|
21
21
|
use_ray=True, data="imagenet10", grace_period=1, iterations=1, imgsz=32, epochs=1, plots=False, device="cpu"
|
|
22
22
|
)
|
|
@@ -24,7 +24,7 @@ def test_model_ray_tune():
|
|
|
24
24
|
|
|
25
25
|
@pytest.mark.skipif(not check_requirements("mlflow", install=False), reason="mlflow not installed")
|
|
26
26
|
def test_mlflow():
|
|
27
|
-
"""Test training with MLflow tracking enabled."""
|
|
27
|
+
"""Test training with MLflow tracking enabled (see https://mlflow.org/ for details)."""
|
|
28
28
|
SETTINGS["mlflow"] = True
|
|
29
29
|
YOLO("yolov8n-cls.yaml").train(data="imagenet10", imgsz=32, epochs=3, plots=False, device="cpu")
|
|
30
30
|
|
|
@@ -32,9 +32,9 @@ def test_mlflow():
|
|
|
32
32
|
@pytest.mark.skipif(True, reason="Test failing in scheduled CI https://github.com/ultralytics/ultralytics/pull/8868")
|
|
33
33
|
@pytest.mark.skipif(not check_requirements("mlflow", install=False), reason="mlflow not installed")
|
|
34
34
|
def test_mlflow_keep_run_active():
|
|
35
|
+
"""Ensure MLflow run status matches MLFLOW_KEEP_RUN_ACTIVE environment variable settings."""
|
|
35
36
|
import mlflow
|
|
36
37
|
|
|
37
|
-
"""Test training with MLflow tracking enabled."""
|
|
38
38
|
SETTINGS["mlflow"] = True
|
|
39
39
|
run_name = "Test Run"
|
|
40
40
|
os.environ["MLFLOW_RUN"] = run_name
|
|
@@ -62,7 +62,11 @@ def test_mlflow_keep_run_active():
|
|
|
62
62
|
|
|
63
63
|
@pytest.mark.skipif(not check_requirements("tritonclient", install=False), reason="tritonclient[all] not installed")
|
|
64
64
|
def test_triton():
|
|
65
|
-
"""
|
|
65
|
+
"""
|
|
66
|
+
Test NVIDIA Triton Server functionalities with YOLO model.
|
|
67
|
+
|
|
68
|
+
See https://catalog.ngc.nvidia.com/orgs/nvidia/containers/tritonserver.
|
|
69
|
+
"""
|
|
66
70
|
check_requirements("tritonclient[all]")
|
|
67
71
|
from tritonclient.http import InferenceServerClient # noqa
|
|
68
72
|
|
|
@@ -114,7 +118,7 @@ def test_triton():
|
|
|
114
118
|
|
|
115
119
|
@pytest.mark.skipif(not check_requirements("pycocotools", install=False), reason="pycocotools not installed")
|
|
116
120
|
def test_pycocotools():
|
|
117
|
-
"""Validate model predictions using pycocotools."""
|
|
121
|
+
"""Validate YOLO model predictions on COCO dataset using pycocotools."""
|
|
118
122
|
from ultralytics.models.yolo.detect import DetectionValidator
|
|
119
123
|
from ultralytics.models.yolo.pose import PoseValidator
|
|
120
124
|
from ultralytics.models.yolo.segment import SegmentationValidator
|