ultralytics 8.3.159__py3-none-any.whl → 8.3.161__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/test_python.py +2 -1
- ultralytics/__init__.py +1 -1
- ultralytics/cfg/__init__.py +0 -2
- 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 +8 -8
- ultralytics/data/converter.py +3 -5
- ultralytics/data/dataset.py +1 -1
- ultralytics/data/split.py +1 -1
- ultralytics/engine/exporter.py +11 -2
- ultralytics/engine/model.py +2 -0
- ultralytics/engine/results.py +1 -6
- ultralytics/models/yolo/model.py +25 -24
- ultralytics/models/yolo/world/train.py +1 -1
- ultralytics/models/yolo/world/train_world.py +6 -6
- ultralytics/models/yolo/yoloe/train.py +1 -1
- ultralytics/nn/autobackend.py +7 -1
- ultralytics/solutions/heatmap.py +1 -1
- ultralytics/solutions/object_counter.py +9 -9
- ultralytics/solutions/similarity_search.py +11 -12
- ultralytics/solutions/solutions.py +55 -56
- ultralytics/utils/__init__.py +1 -4
- ultralytics/utils/instance.py +2 -0
- ultralytics/utils/metrics.py +24 -36
- {ultralytics-8.3.159.dist-info → ultralytics-8.3.161.dist-info}/METADATA +1 -1
- {ultralytics-8.3.159.dist-info → ultralytics-8.3.161.dist-info}/RECORD +62 -62
- {ultralytics-8.3.159.dist-info → ultralytics-8.3.161.dist-info}/WHEEL +0 -0
- {ultralytics-8.3.159.dist-info → ultralytics-8.3.161.dist-info}/entry_points.txt +0 -0
- {ultralytics-8.3.159.dist-info → ultralytics-8.3.161.dist-info}/licenses/LICENSE +0 -0
- {ultralytics-8.3.159.dist-info → ultralytics-8.3.161.dist-info}/top_level.txt +0 -0
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,
|
@@ -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
ultralytics/cfg/__init__.py
CHANGED
@@ -954,8 +954,6 @@ def entrypoint(debug: str = "") -> None:
|
|
954
954
|
from ultralytics import YOLO
|
955
955
|
|
956
956
|
model = YOLO(model, task=task)
|
957
|
-
if isinstance(overrides.get("pretrained"), str):
|
958
|
-
model.load(overrides["pretrained"])
|
959
957
|
|
960
958
|
# Task Update
|
961
959
|
if task != model.task:
|
@@ -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
@@ -251,8 +251,7 @@ class Compose:
|
|
251
251
|
>>> multiple_transforms = compose[0:2] # Returns a Compose object with RandomFlip and RandomPerspective
|
252
252
|
"""
|
253
253
|
assert isinstance(index, (int, list)), f"The indices should be either list or int type but got {type(index)}"
|
254
|
-
|
255
|
-
return Compose([self.transforms[i] for i in index])
|
254
|
+
return Compose([self.transforms[i] for i in index]) if isinstance(index, list) else self.transforms[index]
|
256
255
|
|
257
256
|
def __setitem__(self, index: Union[list, int], value: Union[list, int]) -> None:
|
258
257
|
"""
|
@@ -1560,14 +1559,15 @@ class RandomFlip:
|
|
1560
1559
|
h = 1 if instances.normalized else h
|
1561
1560
|
w = 1 if instances.normalized else w
|
1562
1561
|
|
1563
|
-
#
|
1562
|
+
# WARNING: two separate if and calls to random.random() intentional for reproducibility with older versions
|
1564
1563
|
if self.direction == "vertical" and random.random() < self.p:
|
1565
1564
|
img = np.flipud(img)
|
1566
1565
|
instances.flipud(h)
|
1566
|
+
if self.flip_idx is not None and instances.keypoints is not None:
|
1567
|
+
instances.keypoints = np.ascontiguousarray(instances.keypoints[:, self.flip_idx, :])
|
1567
1568
|
if self.direction == "horizontal" and random.random() < self.p:
|
1568
1569
|
img = np.fliplr(img)
|
1569
1570
|
instances.fliplr(w)
|
1570
|
-
# For keypoints
|
1571
1571
|
if self.flip_idx is not None and instances.keypoints is not None:
|
1572
1572
|
instances.keypoints = np.ascontiguousarray(instances.keypoints[:, self.flip_idx, :])
|
1573
1573
|
labels["img"] = np.ascontiguousarray(img)
|
@@ -2533,9 +2533,9 @@ def v8_transforms(dataset, imgsz, hyp, stretch=False):
|
|
2533
2533
|
flip_idx = dataset.data.get("flip_idx", []) # for keypoints augmentation
|
2534
2534
|
if dataset.use_keypoints:
|
2535
2535
|
kpt_shape = dataset.data.get("kpt_shape", None)
|
2536
|
-
if len(flip_idx) == 0 and hyp.fliplr > 0.0:
|
2537
|
-
hyp.fliplr = 0.0
|
2538
|
-
LOGGER.warning("No 'flip_idx' array defined in data.yaml,
|
2536
|
+
if len(flip_idx) == 0 and (hyp.fliplr > 0.0 or hyp.flipud > 0.0):
|
2537
|
+
hyp.fliplr = hyp.flipud = 0.0 # both fliplr and flipud require flip_idx
|
2538
|
+
LOGGER.warning("No 'flip_idx' array defined in data.yaml, disabling 'fliplr' and 'flipud' augmentations.")
|
2539
2539
|
elif flip_idx and (len(flip_idx) != kpt_shape[0]):
|
2540
2540
|
raise ValueError(f"data.yaml flip_idx={flip_idx} length must be equal to kpt_shape[0]={kpt_shape[0]}")
|
2541
2541
|
|
@@ -2546,7 +2546,7 @@ def v8_transforms(dataset, imgsz, hyp, stretch=False):
|
|
2546
2546
|
CutMix(dataset, pre_transform=pre_transform, p=hyp.cutmix),
|
2547
2547
|
Albumentations(p=1.0),
|
2548
2548
|
RandomHSV(hgain=hyp.hsv_h, sgain=hyp.hsv_s, vgain=hyp.hsv_v),
|
2549
|
-
RandomFlip(direction="vertical", p=hyp.flipud),
|
2549
|
+
RandomFlip(direction="vertical", p=hyp.flipud, flip_idx=flip_idx),
|
2550
2550
|
RandomFlip(direction="horizontal", p=hyp.fliplr, flip_idx=flip_idx),
|
2551
2551
|
]
|
2552
2552
|
) # transforms
|
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
|
@@ -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/engine/exporter.py
CHANGED
@@ -706,7 +706,16 @@ class Exporter:
|
|
706
706
|
def export_paddle(self, prefix=colorstr("PaddlePaddle:")):
|
707
707
|
"""Export YOLO model to PaddlePaddle format."""
|
708
708
|
assert not IS_JETSON, "Jetson Paddle exports not supported yet"
|
709
|
-
check_requirements(
|
709
|
+
check_requirements(
|
710
|
+
(
|
711
|
+
"paddlepaddle-gpu"
|
712
|
+
if torch.cuda.is_available()
|
713
|
+
else "paddlepaddle==3.0.0" # pin 3.0.0 for ARM64
|
714
|
+
if ARM64
|
715
|
+
else "paddlepaddle>=3.0.0",
|
716
|
+
"x2paddle",
|
717
|
+
)
|
718
|
+
)
|
710
719
|
import x2paddle # noqa
|
711
720
|
from x2paddle.convert import pytorch2paddle # noqa
|
712
721
|
|
@@ -1495,7 +1504,7 @@ class NMSModel(torch.nn.Module):
|
|
1495
1504
|
scores, classes = scores.max(dim=-1)
|
1496
1505
|
self.args.max_det = min(pred.shape[1], self.args.max_det) # in case num_anchors < max_det
|
1497
1506
|
# (N, max_det, 4 coords + 1 class score + 1 class label + extra_shape).
|
1498
|
-
out = torch.zeros(
|
1507
|
+
out = torch.zeros(pred.shape[0], self.args.max_det, boxes.shape[-1] + 2 + extra_shape, **kwargs)
|
1499
1508
|
for i in range(bs):
|
1500
1509
|
box, cls, score, extra = boxes[i], classes[i], scores[i], extras[i]
|
1501
1510
|
mask = score > self.args.conf
|
ultralytics/engine/model.py
CHANGED
@@ -777,6 +777,8 @@ class Model(torch.nn.Module):
|
|
777
777
|
|
778
778
|
checks.check_pip_update_available()
|
779
779
|
|
780
|
+
if isinstance(kwargs.get("pretrained", None), (str, Path)):
|
781
|
+
self.load(kwargs["pretrained"]) # load pretrained weights if provided
|
780
782
|
overrides = YAML.load(checks.check_yaml(kwargs["cfg"])) if kwargs.get("cfg") else self.overrides
|
781
783
|
custom = {
|
782
784
|
# NOTE: handle the case when 'cfg' includes 'data'.
|
ultralytics/engine/results.py
CHANGED
@@ -16,7 +16,6 @@ import torch
|
|
16
16
|
from ultralytics.data.augment import LetterBox
|
17
17
|
from ultralytics.utils import LOGGER, DataExportMixin, SimpleClass, ops
|
18
18
|
from ultralytics.utils.plotting import Annotator, colors, save_one_box
|
19
|
-
from ultralytics.utils.torch_utils import smart_inference_mode
|
20
19
|
|
21
20
|
|
22
21
|
class BaseTensor(SimpleClass):
|
@@ -801,7 +800,7 @@ class Results(SimpleClass, DataExportMixin):
|
|
801
800
|
decimals (int): Number of decimal places to round the output values to.
|
802
801
|
|
803
802
|
Returns:
|
804
|
-
(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
|
805
804
|
or classification result. The structure of each dictionary varies based on the task type
|
806
805
|
(classification or detection) and available information (boxes, masks, keypoints).
|
807
806
|
|
@@ -1204,7 +1203,6 @@ class Keypoints(BaseTensor):
|
|
1204
1203
|
>>> keypoints_cpu = keypoints.cpu() # Move keypoints to CPU
|
1205
1204
|
"""
|
1206
1205
|
|
1207
|
-
@smart_inference_mode() # avoid keypoints < conf in-place error
|
1208
1206
|
def __init__(self, keypoints: Union[torch.Tensor, np.ndarray], orig_shape: Tuple[int, int]) -> None:
|
1209
1207
|
"""
|
1210
1208
|
Initialize the Keypoints object with detection keypoints and original image dimensions.
|
@@ -1225,9 +1223,6 @@ class Keypoints(BaseTensor):
|
|
1225
1223
|
"""
|
1226
1224
|
if keypoints.ndim == 2:
|
1227
1225
|
keypoints = keypoints[None, :]
|
1228
|
-
if keypoints.shape[2] == 3: # x, y, conf
|
1229
|
-
mask = keypoints[..., 2] < 0.5 # points with conf < 0.5 (not visible)
|
1230
|
-
keypoints[..., :2][mask] = 0
|
1231
1226
|
super().__init__(keypoints, orig_shape)
|
1232
1227
|
self.has_visible = self.data.shape[-1] == 3
|
1233
1228
|
|