ultralytics 8.3.160__py3-none-any.whl → 8.3.162__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.
- tests/conftest.py +2 -2
- tests/test_python.py +4 -3
- ultralytics/__init__.py +1 -1
- ultralytics/cfg/datasets/Argoverse.yaml +1 -1
- ultralytics/cfg/datasets/DOTAv1.5.yaml +1 -1
- ultralytics/cfg/datasets/DOTAv1.yaml +1 -1
- ultralytics/cfg/datasets/GlobalWheat2020.yaml +1 -1
- ultralytics/cfg/datasets/HomeObjects-3K.yaml +1 -1
- ultralytics/cfg/datasets/ImageNet.yaml +1 -1
- ultralytics/cfg/datasets/Objects365.yaml +1 -1
- ultralytics/cfg/datasets/SKU-110K.yaml +1 -1
- ultralytics/cfg/datasets/VOC.yaml +1 -1
- ultralytics/cfg/datasets/VisDrone.yaml +6 -3
- ultralytics/cfg/datasets/african-wildlife.yaml +1 -1
- ultralytics/cfg/datasets/brain-tumor.yaml +1 -1
- ultralytics/cfg/datasets/carparts-seg.yaml +1 -1
- ultralytics/cfg/datasets/coco-pose.yaml +1 -1
- ultralytics/cfg/datasets/coco.yaml +1 -1
- ultralytics/cfg/datasets/coco128-seg.yaml +1 -1
- ultralytics/cfg/datasets/coco128.yaml +1 -1
- ultralytics/cfg/datasets/coco8-grayscale.yaml +1 -1
- ultralytics/cfg/datasets/coco8-multispectral.yaml +1 -1
- ultralytics/cfg/datasets/coco8-pose.yaml +1 -1
- ultralytics/cfg/datasets/coco8-seg.yaml +1 -1
- ultralytics/cfg/datasets/coco8.yaml +1 -1
- ultralytics/cfg/datasets/crack-seg.yaml +1 -1
- ultralytics/cfg/datasets/dog-pose.yaml +1 -1
- ultralytics/cfg/datasets/dota8-multispectral.yaml +1 -1
- ultralytics/cfg/datasets/dota8.yaml +1 -1
- ultralytics/cfg/datasets/hand-keypoints.yaml +1 -1
- ultralytics/cfg/datasets/lvis.yaml +1 -1
- ultralytics/cfg/datasets/medical-pills.yaml +1 -1
- ultralytics/cfg/datasets/open-images-v7.yaml +1 -1
- ultralytics/cfg/datasets/package-seg.yaml +1 -1
- ultralytics/cfg/datasets/signature.yaml +1 -1
- ultralytics/cfg/datasets/tiger-pose.yaml +1 -1
- ultralytics/cfg/datasets/xView.yaml +1 -1
- ultralytics/data/augment.py +2 -0
- ultralytics/data/converter.py +5 -7
- ultralytics/data/dataset.py +1 -1
- ultralytics/data/split.py +1 -1
- ultralytics/data/split_dota.py +1 -1
- ultralytics/engine/exporter.py +15 -5
- ultralytics/engine/results.py +1 -1
- ultralytics/engine/tuner.py +2 -2
- ultralytics/models/nas/model.py +2 -1
- ultralytics/models/sam/modules/tiny_encoder.py +1 -1
- ultralytics/models/yolo/detect/val.py +1 -1
- ultralytics/models/yolo/world/train.py +1 -1
- ultralytics/models/yolo/world/train_world.py +17 -9
- ultralytics/models/yolo/yoloe/train.py +1 -1
- ultralytics/nn/autobackend.py +7 -1
- ultralytics/nn/tasks.py +4 -3
- ultralytics/solutions/similarity_search.py +11 -12
- ultralytics/solutions/solutions.py +53 -54
- ultralytics/utils/__init__.py +1 -2
- ultralytics/utils/checks.py +21 -0
- ultralytics/utils/metrics.py +10 -9
- ultralytics/utils/patches.py +1 -2
- ultralytics/utils/plotting.py +2 -2
- ultralytics/utils/torch_utils.py +2 -1
- {ultralytics-8.3.160.dist-info → ultralytics-8.3.162.dist-info}/METADATA +9 -1
- {ultralytics-8.3.160.dist-info → ultralytics-8.3.162.dist-info}/RECORD +67 -67
- {ultralytics-8.3.160.dist-info → ultralytics-8.3.162.dist-info}/WHEEL +0 -0
- {ultralytics-8.3.160.dist-info → ultralytics-8.3.162.dist-info}/entry_points.txt +0 -0
- {ultralytics-8.3.160.dist-info → ultralytics-8.3.162.dist-info}/licenses/LICENSE +0 -0
- {ultralytics-8.3.160.dist-info → ultralytics-8.3.162.dist-info}/top_level.txt +0 -0
tests/conftest.py
CHANGED
@@ -56,11 +56,11 @@ def pytest_terminal_summary(terminalreporter, exitstatus, config):
|
|
56
56
|
from ultralytics.utils import WEIGHTS_DIR
|
57
57
|
|
58
58
|
# Remove files
|
59
|
-
models = [path for x in
|
59
|
+
models = [path for x in {"*.onnx", "*.torchscript"} for path in WEIGHTS_DIR.rglob(x)]
|
60
60
|
for file in ["decelera_portrait_min.mov", "bus.jpg", "yolo11n.onnx", "yolo11n.torchscript"] + models:
|
61
61
|
Path(file).unlink(missing_ok=True)
|
62
62
|
|
63
63
|
# Remove directories
|
64
|
-
models = [path for x in
|
64
|
+
models = [path for x in {"*.mlpackage", "*_openvino_model"} for path in WEIGHTS_DIR.rglob(x)]
|
65
65
|
for directory in [WEIGHTS_DIR / "path with spaces", TMP.parents[1] / ".pytest_cache", TMP] + models:
|
66
66
|
shutil.rmtree(directory, ignore_errors=True)
|
tests/test_python.py
CHANGED
@@ -16,6 +16,7 @@ from tests import CFG, MODEL, MODELS, SOURCE, SOURCES_LIST, TASK_MODEL_DATA, TMP
|
|
16
16
|
from ultralytics import RTDETR, YOLO
|
17
17
|
from ultralytics.cfg import TASK2DATA, TASKS
|
18
18
|
from ultralytics.data.build import load_inference_source
|
19
|
+
from ultralytics.data.utils import check_det_dataset
|
19
20
|
from ultralytics.utils import (
|
20
21
|
ARM64,
|
21
22
|
ASSETS,
|
@@ -203,7 +204,7 @@ def test_track_stream(model):
|
|
203
204
|
@pytest.mark.parametrize("task,model,data", TASK_MODEL_DATA)
|
204
205
|
def test_val(task: str, model: str, data: str) -> None:
|
205
206
|
"""Test the validation mode of the YOLO model."""
|
206
|
-
for plots in
|
207
|
+
for plots in {True, False}: # Test both cases i.e. plots=True and plots=False
|
207
208
|
metrics = YOLO(model).val(data=data, imgsz=32, plots=plots)
|
208
209
|
metrics.to_df()
|
209
210
|
metrics.to_csv()
|
@@ -389,7 +390,7 @@ def test_cfg_init():
|
|
389
390
|
check_dict_alignment({"a": 1}, {"b": 2})
|
390
391
|
copy_default_cfg()
|
391
392
|
(Path.cwd() / DEFAULT_CFG_PATH.name.replace(".yaml", "_copy.yaml")).unlink(missing_ok=False)
|
392
|
-
[smart_value(x) for x in
|
393
|
+
[smart_value(x) for x in {"none", "true", "false"}]
|
393
394
|
|
394
395
|
|
395
396
|
def test_utils_init():
|
@@ -720,7 +721,7 @@ def test_grayscale(task: str, model: str, data: str) -> None:
|
|
720
721
|
if task == "classify": # not support grayscale classification yet
|
721
722
|
return
|
722
723
|
grayscale_data = Path(TMP) / f"{Path(data).stem}-grayscale.yaml"
|
723
|
-
data =
|
724
|
+
data = check_det_dataset(data)
|
724
725
|
data["channels"] = 1 # add additional channels key for grayscale
|
725
726
|
YAML.save(grayscale_data, data)
|
726
727
|
# remove npy files in train/val splits if exists, might be created by previous tests
|
ultralytics/__init__.py
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── Argoverse ← downloads here (31.5 GB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: Argoverse # dataset root dir
|
13
13
|
train: Argoverse-1.1/images/train/ # train images (relative to 'path') 39384 images
|
14
14
|
val: Argoverse-1.1/images/val/ # val images (relative to 'path') 15062 images
|
15
15
|
test: Argoverse-1.1/images/test/ # test images (optional) https://eval.ai/web/challenges/challenge-page/800/overview
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── dota1.5 ← downloads here (2GB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: DOTAv1.5 # dataset root dir
|
13
13
|
train: images/train # train images (relative to 'path') 1411 images
|
14
14
|
val: images/val # val images (relative to 'path') 458 images
|
15
15
|
test: images/test # test images (optional) 937 images
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── dota1 ← downloads here (2GB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: DOTAv1 # dataset root dir
|
13
13
|
train: images/train # train images (relative to 'path') 1411 images
|
14
14
|
val: images/val # val images (relative to 'path') 458 images
|
15
15
|
test: images/test # test images (optional) 937 images
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── GlobalWheat2020 ← downloads here (7.0 GB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: GlobalWheat2020 # dataset root dir
|
13
13
|
train: # train images (relative to 'path') 3422 images
|
14
14
|
- images/arvalis_1
|
15
15
|
- images/arvalis_2
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── homeobjects-3K ← downloads here (390 MB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: homeobjects-3K # dataset root dir
|
13
13
|
train: train/images # train images (relative to 'path') 2285 images
|
14
14
|
val: valid/images # val images (relative to 'path') 404 images
|
15
15
|
test: # test images (relative to 'path')
|
@@ -10,7 +10,7 @@
|
|
10
10
|
# └── imagenet ← downloads here (144 GB)
|
11
11
|
|
12
12
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
13
|
-
path:
|
13
|
+
path: imagenet # dataset root dir
|
14
14
|
train: train # train images (relative to 'path') 1281167 images
|
15
15
|
val: val # val images (relative to 'path') 50000 images
|
16
16
|
test: # test images (optional)
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── Objects365 ← downloads here (712 GB = 367G data + 345G zips)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: Objects365 # dataset root dir
|
13
13
|
train: images/train # train images (relative to 'path') 1742289 images
|
14
14
|
val: images/val # val images (relative to 'path') 80000 images
|
15
15
|
test: # test images (optional)
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── SKU-110K ← downloads here (13.6 GB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: SKU-110K # dataset root dir
|
13
13
|
train: train.txt # train images (relative to 'path') 8219 images
|
14
14
|
val: val.txt # val images (relative to 'path') 588 images
|
15
15
|
test: test.txt # test images (optional) 2936 images
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── VOC ← downloads here (2.8 GB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: VOC
|
13
13
|
train: # train images (relative to 'path') 16551 images
|
14
14
|
- images/train2012
|
15
15
|
- images/train2007
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── VisDrone ← downloads here (2.3 GB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: VisDrone # dataset root dir
|
13
13
|
train: VisDrone2019-DET-train/images # train images (relative to 'path') 6471 images
|
14
14
|
val: VisDrone2019-DET-val/images # val images (relative to 'path') 548 images
|
15
15
|
test: VisDrone2019-DET-test-dev/images # test images (optional) 1610 images
|
@@ -58,8 +58,11 @@ download: |
|
|
58
58
|
cls = int(row[5]) - 1
|
59
59
|
box = convert_box(img_size, tuple(map(int, row[:4])))
|
60
60
|
lines.append(f"{cls} {' '.join(f'{x:.6f}' for x in box)}\n")
|
61
|
-
|
62
|
-
|
61
|
+
|
62
|
+
label_file = str(f).replace(f"{os.sep}annotations{os.sep}", f"{os.sep}labels{os.sep}")
|
63
|
+
with open(label_file, "w", encoding="utf-8") as fl:
|
64
|
+
fl.writelines(lines)
|
65
|
+
|
63
66
|
|
64
67
|
|
65
68
|
# Download
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── african-wildlife ← downloads here (100 MB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: african-wildlife # dataset root dir
|
13
13
|
train: train/images # train images (relative to 'path') 1052 images
|
14
14
|
val: valid/images # val images (relative to 'path') 225 images
|
15
15
|
test: test/images # test images (relative to 'path') 227 images
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── brain-tumor ← downloads here (4.05 MB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: brain-tumor # dataset root dir
|
13
13
|
train: train/images # train images (relative to 'path') 893 images
|
14
14
|
val: valid/images # val images (relative to 'path') 223 images
|
15
15
|
test: # test images (relative to 'path')
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── carparts-seg ← downloads here (132 MB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: carparts-seg # dataset root dir
|
13
13
|
train: train/images # train images (relative to 'path') 3516 images
|
14
14
|
val: valid/images # val images (relative to 'path') 276 images
|
15
15
|
test: test/images # test images (relative to 'path') 401 images
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── coco-pose ← downloads here (20.1 GB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: coco-pose # dataset root dir
|
13
13
|
train: train2017.txt # train images (relative to 'path') 56599 images
|
14
14
|
val: val2017.txt # val images (relative to 'path') 2346 images
|
15
15
|
test: test-dev2017.txt # 20288 of 40670 images, submit to https://codalab.lisn.upsaclay.fr/competitions/7403
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── coco ← downloads here (20.1 GB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: coco # dataset root dir
|
13
13
|
train: train2017.txt # train images (relative to 'path') 118287 images
|
14
14
|
val: val2017.txt # val images (relative to 'path') 5000 images
|
15
15
|
test: test-dev2017.txt # 20288 of 40670 images, submit to https://competitions.codalab.org/competitions/20794
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── coco128-seg ← downloads here (7 MB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: coco128-seg # dataset root dir
|
13
13
|
train: images/train2017 # train images (relative to 'path') 128 images
|
14
14
|
val: images/train2017 # val images (relative to 'path') 128 images
|
15
15
|
test: # test images (optional)
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── coco128 ← downloads here (7 MB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: coco128 # dataset root dir
|
13
13
|
train: images/train2017 # train images (relative to 'path') 128 images
|
14
14
|
val: images/train2017 # val images (relative to 'path') 128 images
|
15
15
|
test: # test images (optional)
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── coco8-grayscale ← downloads here (1 MB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: coco8-grayscale # dataset root dir
|
13
13
|
train: images/train # train images (relative to 'path') 4 images
|
14
14
|
val: images/val # val images (relative to 'path') 4 images
|
15
15
|
test: # test images (optional)
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── coco8-multispectral ← downloads here (20.2 MB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: coco8-multispectral # dataset root dir
|
13
13
|
train: images/train # train images (relative to 'path') 4 images
|
14
14
|
val: images/val # val images (relative to 'path') 4 images
|
15
15
|
test: # test images (optional)
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── coco8-pose ← downloads here (1 MB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: coco8-pose # dataset root dir
|
13
13
|
train: images/train # train images (relative to 'path') 4 images
|
14
14
|
val: images/val # val images (relative to 'path') 4 images
|
15
15
|
test: # test images (optional)
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── coco8-seg ← downloads here (1 MB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: coco8-seg # dataset root dir
|
13
13
|
train: images/train # train images (relative to 'path') 4 images
|
14
14
|
val: images/val # val images (relative to 'path') 4 images
|
15
15
|
test: # test images (optional)
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── coco8 ← downloads here (1 MB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: coco8 # dataset root dir
|
13
13
|
train: images/train # train images (relative to 'path') 4 images
|
14
14
|
val: images/val # val images (relative to 'path') 4 images
|
15
15
|
test: # test images (optional)
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── crack-seg ← downloads here (91.2 MB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: crack-seg # dataset root dir
|
13
13
|
train: train/images # train images (relative to 'path') 3717 images
|
14
14
|
val: valid/images # val images (relative to 'path') 112 images
|
15
15
|
test: test/images # test images (relative to 'path') 200 images
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── dog-pose ← downloads here (337 MB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: dog-pose # dataset root dir
|
13
13
|
train: train # train images (relative to 'path') 6773 images
|
14
14
|
val: val # val images (relative to 'path') 1703 images
|
15
15
|
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── dota8-multispectral ← downloads here (37.3MB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: dota8-multispectral # dataset root dir
|
13
13
|
train: images/train # train images (relative to 'path') 4 images
|
14
14
|
val: images/val # val images (relative to 'path') 4 images
|
15
15
|
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── dota8 ← downloads here (1MB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: dota8 # dataset root dir
|
13
13
|
train: images/train # train images (relative to 'path') 4 images
|
14
14
|
val: images/val # val images (relative to 'path') 4 images
|
15
15
|
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── hand-keypoints ← downloads here (369 MB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: hand-keypoints # dataset root dir
|
13
13
|
train: train # train images (relative to 'path') 18776 images
|
14
14
|
val: val # val images (relative to 'path') 7992 images
|
15
15
|
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── lvis ← downloads here (20.1 GB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: lvis # dataset root dir
|
13
13
|
train: train.txt # train images (relative to 'path') 100170 images
|
14
14
|
val: val.txt # val images (relative to 'path') 19809 images
|
15
15
|
minival: minival.txt # minival images (relative to 'path') 5000 images
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── medical-pills ← downloads here (8.19 MB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: medical-pills # dataset root dir
|
13
13
|
train: train/images # train images (relative to 'path') 92 images
|
14
14
|
val: valid/images # val images (relative to 'path') 23 images
|
15
15
|
test: # test images (relative to 'path')
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── open-images-v7 ← downloads here (561 GB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: open-images-v7 # dataset root dir
|
13
13
|
train: images/train # train images (relative to 'path') 1743042 images
|
14
14
|
val: images/val # val images (relative to 'path') 41620 images
|
15
15
|
test: # test images (optional)
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── package-seg ← downloads here (102 MB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: package-seg # dataset root dir
|
13
13
|
train: train/images # train images (relative to 'path') 1920 images
|
14
14
|
val: valid/images # val images (relative to 'path') 89 images
|
15
15
|
test: test/images # test images (relative to 'path') 188 images
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── signature ← downloads here (11.2 MB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: signature # dataset root dir
|
13
13
|
train: train/images # train images (relative to 'path') 143 images
|
14
14
|
val: valid/images # val images (relative to 'path') 35 images
|
15
15
|
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# └── tiger-pose ← downloads here (75.3 MB)
|
10
10
|
|
11
11
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
12
|
-
path:
|
12
|
+
path: tiger-pose # dataset root dir
|
13
13
|
train: train # train images (relative to 'path') 210 images
|
14
14
|
val: val # val images (relative to 'path') 53 images
|
15
15
|
|
@@ -10,7 +10,7 @@
|
|
10
10
|
# └── xView ← downloads here (20.7 GB)
|
11
11
|
|
12
12
|
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
13
|
-
path:
|
13
|
+
path: xView # dataset root dir
|
14
14
|
train: images/autosplit_train.txt # train images (relative to 'path') 90% of 847 train images
|
15
15
|
val: images/autosplit_val.txt # train images (relative to 'path') 10% of 847 train images
|
16
16
|
|
ultralytics/data/augment.py
CHANGED
@@ -1805,6 +1805,8 @@ class CopyPaste(BaseMixTransform):
|
|
1805
1805
|
def _transform(self, labels1, labels2={}):
|
1806
1806
|
"""Apply Copy-Paste augmentation to combine objects from another image into the current image."""
|
1807
1807
|
im = labels1["img"]
|
1808
|
+
if "mosaic_border" not in labels1:
|
1809
|
+
im = im.copy() # avoid modifying original non-mosaic image
|
1808
1810
|
cls = labels1["cls"]
|
1809
1811
|
h, w = im.shape[:2]
|
1810
1812
|
instances = labels1.pop("instances")
|
ultralytics/data/converter.py
CHANGED
@@ -248,12 +248,10 @@ def convert_coco(
|
|
248
248
|
>>> from ultralytics.data.converter import convert_coco
|
249
249
|
|
250
250
|
Convert COCO annotations to YOLO format
|
251
|
-
>>> convert_coco("
|
251
|
+
>>> convert_coco("coco/annotations/", use_segments=True, use_keypoints=False, cls91to80=False)
|
252
252
|
|
253
253
|
Convert LVIS annotations to YOLO format
|
254
|
-
>>> convert_coco(
|
255
|
-
... "../datasets/lvis/annotations/", use_segments=True, use_keypoints=False, cls91to80=False, lvis=True
|
256
|
-
... )
|
254
|
+
>>> convert_coco("lvis/annotations/", use_segments=True, use_keypoints=False, cls91to80=False, lvis=True)
|
257
255
|
"""
|
258
256
|
# Create dataset directory
|
259
257
|
save_dir = increment_path(save_dir) # increment if save directory already exists
|
@@ -498,7 +496,7 @@ def convert_dota_to_yolo_obb(dota_root_path: str):
|
|
498
496
|
formatted_coords = [f"{coord:.6g}" for coord in normalized_coords]
|
499
497
|
g.write(f"{class_idx} {' '.join(formatted_coords)}\n")
|
500
498
|
|
501
|
-
for phase in
|
499
|
+
for phase in {"train", "val"}:
|
502
500
|
image_dir = dota_root_path / "images" / phase
|
503
501
|
orig_label_dir = dota_root_path / "labels" / f"{phase}_original"
|
504
502
|
save_dir = dota_root_path / "labels" / phase
|
@@ -686,7 +684,7 @@ def create_synthetic_coco_dataset():
|
|
686
684
|
# Create synthetic images
|
687
685
|
shutil.rmtree(dir / "labels" / "test2017", ignore_errors=True) # Remove test2017 directory as not needed
|
688
686
|
with ThreadPoolExecutor(max_workers=NUM_THREADS) as executor:
|
689
|
-
for subset in
|
687
|
+
for subset in {"train2017", "val2017"}:
|
690
688
|
subset_dir = dir / "images" / subset
|
691
689
|
subset_dir.mkdir(parents=True, exist_ok=True)
|
692
690
|
|
@@ -724,7 +722,7 @@ def convert_to_multispectral(path: Union[str, Path], n_channels: int = 10, repla
|
|
724
722
|
>>> convert_to_multispectral("path/to/image.jpg", n_channels=10)
|
725
723
|
|
726
724
|
Convert a dataset
|
727
|
-
>>> convert_to_multispectral("
|
725
|
+
>>> convert_to_multispectral("coco8", n_channels=10)
|
728
726
|
"""
|
729
727
|
from scipy.interpolate import interp1d
|
730
728
|
|
ultralytics/data/dataset.py
CHANGED
@@ -482,7 +482,7 @@ class GroundingDataset(YOLODataset):
|
|
482
482
|
a warning is logged and verification is skipped.
|
483
483
|
"""
|
484
484
|
expected_counts = {
|
485
|
-
"final_mixed_train_no_coco_segm":
|
485
|
+
"final_mixed_train_no_coco_segm": 3662412,
|
486
486
|
"final_mixed_train_no_coco": 3681235,
|
487
487
|
"final_flickr_separateGT_train_segm": 638214,
|
488
488
|
"final_flickr_separateGT_train": 640704,
|
ultralytics/data/split.py
CHANGED
ultralytics/data/split_dota.py
CHANGED
@@ -295,7 +295,7 @@ def split_trainval(
|
|
295
295
|
for r in rates:
|
296
296
|
crop_sizes.append(int(crop_size / r))
|
297
297
|
gaps.append(int(gap / r))
|
298
|
-
for split in
|
298
|
+
for split in {"train", "val"}:
|
299
299
|
split_images_and_labels(data_root, save_dir, split, crop_sizes, gaps)
|
300
300
|
|
301
301
|
|
ultralytics/engine/exporter.py
CHANGED
@@ -100,6 +100,7 @@ from ultralytics.utils.checks import (
|
|
100
100
|
check_is_path_safe,
|
101
101
|
check_requirements,
|
102
102
|
check_version,
|
103
|
+
is_intel,
|
103
104
|
is_sudo_available,
|
104
105
|
)
|
105
106
|
from ultralytics.utils.downloads import attempt_download_asset, get_github_assets, safe_download
|
@@ -107,7 +108,7 @@ from ultralytics.utils.export import export_engine, export_onnx
|
|
107
108
|
from ultralytics.utils.files import file_size, spaces_in_path
|
108
109
|
from ultralytics.utils.ops import Profile, nms_rotated
|
109
110
|
from ultralytics.utils.patches import arange_patch
|
110
|
-
from ultralytics.utils.torch_utils import TORCH_1_13,
|
111
|
+
from ultralytics.utils.torch_utils import TORCH_1_13, get_latest_opset, select_device
|
111
112
|
|
112
113
|
|
113
114
|
def export_formats():
|
@@ -372,9 +373,9 @@ class Exporter:
|
|
372
373
|
raise SystemError("TF.js exports are not currently supported on ARM64 Linux")
|
373
374
|
# Recommend OpenVINO if export and Intel CPU
|
374
375
|
if SETTINGS.get("openvino_msg"):
|
375
|
-
if
|
376
|
+
if is_intel():
|
376
377
|
LOGGER.info(
|
377
|
-
"💡 ProTip: Export to OpenVINO format for best performance on Intel
|
378
|
+
"💡 ProTip: Export to OpenVINO format for best performance on Intel hardware."
|
378
379
|
" Learn more at https://docs.ultralytics.com/integrations/openvino/"
|
379
380
|
)
|
380
381
|
SETTINGS["openvino_msg"] = False
|
@@ -706,7 +707,16 @@ class Exporter:
|
|
706
707
|
def export_paddle(self, prefix=colorstr("PaddlePaddle:")):
|
707
708
|
"""Export YOLO model to PaddlePaddle format."""
|
708
709
|
assert not IS_JETSON, "Jetson Paddle exports not supported yet"
|
709
|
-
check_requirements(
|
710
|
+
check_requirements(
|
711
|
+
(
|
712
|
+
"paddlepaddle-gpu"
|
713
|
+
if torch.cuda.is_available()
|
714
|
+
else "paddlepaddle==3.0.0" # pin 3.0.0 for ARM64
|
715
|
+
if ARM64
|
716
|
+
else "paddlepaddle>=3.0.0",
|
717
|
+
"x2paddle",
|
718
|
+
)
|
719
|
+
)
|
710
720
|
import x2paddle # noqa
|
711
721
|
from x2paddle.convert import pytorch2paddle # noqa
|
712
722
|
|
@@ -939,7 +949,7 @@ class Exporter:
|
|
939
949
|
"tf_keras", # required by 'onnx2tf' package
|
940
950
|
"sng4onnx>=1.0.1", # required by 'onnx2tf' package
|
941
951
|
"onnx_graphsurgeon>=0.3.26", # required by 'onnx2tf' package
|
942
|
-
"ai-edge-litert>=1.2.0", # required by 'onnx2tf' package
|
952
|
+
"ai-edge-litert>=1.2.0,<1.4.0", # required by 'onnx2tf' package
|
943
953
|
"onnx>=1.12.0,<1.18.0",
|
944
954
|
"onnx2tf>=1.26.3",
|
945
955
|
"onnxslim>=0.1.56",
|
ultralytics/engine/results.py
CHANGED
@@ -800,7 +800,7 @@ class Results(SimpleClass, DataExportMixin):
|
|
800
800
|
decimals (int): Number of decimal places to round the output values to.
|
801
801
|
|
802
802
|
Returns:
|
803
|
-
(List[Dict]): A list of dictionaries, each containing summarized information for a single detection
|
803
|
+
(List[Dict[str, Any]]): A list of dictionaries, each containing summarized information for a single detection
|
804
804
|
or classification result. The structure of each dictionary varies based on the task type
|
805
805
|
(classification or detection) and available information (boxes, masks, keypoints).
|
806
806
|
|
ultralytics/engine/tuner.py
CHANGED
@@ -21,10 +21,10 @@ import time
|
|
21
21
|
from typing import Dict, List, Optional
|
22
22
|
|
23
23
|
import numpy as np
|
24
|
-
import torch
|
25
24
|
|
26
25
|
from ultralytics.cfg import get_cfg, get_save_dir
|
27
26
|
from ultralytics.utils import DEFAULT_CFG, LOGGER, YAML, callbacks, colorstr, remove_colorstr
|
27
|
+
from ultralytics.utils.patches import torch_load
|
28
28
|
from ultralytics.utils.plotting import plot_tune_results
|
29
29
|
|
30
30
|
|
@@ -198,7 +198,7 @@ class Tuner:
|
|
198
198
|
cmd = [*launch, "train", *(f"{k}={v}" for k, v in train_args.items())]
|
199
199
|
return_code = subprocess.run(cmd, check=True).returncode
|
200
200
|
ckpt_file = weights_dir / ("best.pt" if (weights_dir / "best.pt").exists() else "last.pt")
|
201
|
-
metrics =
|
201
|
+
metrics = torch_load(ckpt_file)["train_metrics"]
|
202
202
|
assert return_code == 0, "training failed"
|
203
203
|
|
204
204
|
except Exception as e:
|
ultralytics/models/nas/model.py
CHANGED
@@ -8,6 +8,7 @@ import torch
|
|
8
8
|
from ultralytics.engine.model import Model
|
9
9
|
from ultralytics.utils import DEFAULT_CFG_DICT
|
10
10
|
from ultralytics.utils.downloads import attempt_download_asset
|
11
|
+
from ultralytics.utils.patches import torch_load
|
11
12
|
from ultralytics.utils.torch_utils import model_info
|
12
13
|
|
13
14
|
from .predict import NASPredictor
|
@@ -56,7 +57,7 @@ class NAS(Model):
|
|
56
57
|
|
57
58
|
suffix = Path(weights).suffix
|
58
59
|
if suffix == ".pt":
|
59
|
-
self.model =
|
60
|
+
self.model = torch_load(attempt_download_asset(weights))
|
60
61
|
elif suffix == "":
|
61
62
|
self.model = super_gradients.training.models.get(weights, pretrained_weights="coco")
|
62
63
|
|
@@ -931,7 +931,7 @@ class TinyViT(nn.Module):
|
|
931
931
|
if layer.downsample is not None:
|
932
932
|
layer.downsample.apply(lambda x: _set_lr_scale(x, lr_scales[i - 1]))
|
933
933
|
assert i == depth
|
934
|
-
for m in
|
934
|
+
for m in {self.norm_head, self.head}:
|
935
935
|
m.apply(lambda x: _set_lr_scale(x, lr_scales[-1]))
|
936
936
|
|
937
937
|
for k, p in self.named_parameters():
|