ultralytics 8.3.140__py3-none-any.whl → 8.3.142__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_cuda.py +1 -1
- tests/test_solutions.py +3 -2
- ultralytics/__init__.py +1 -1
- ultralytics/cfg/__init__.py +6 -6
- ultralytics/cfg/datasets/open-images-v7.yaml +4 -7
- ultralytics/engine/model.py +6 -3
- ultralytics/engine/results.py +0 -1
- ultralytics/models/yolo/classify/predict.py +1 -1
- ultralytics/models/yolo/model.py +7 -1
- ultralytics/solutions/distance_calculation.py +2 -1
- ultralytics/solutions/object_counter.py +2 -4
- ultralytics/utils/autodevice.py +9 -7
- ultralytics/utils/loss.py +1 -2
- ultralytics/utils/plotting.py +14 -16
- ultralytics/utils/tal.py +3 -6
- ultralytics/utils/torch_utils.py +1 -1
- {ultralytics-8.3.140.dist-info → ultralytics-8.3.142.dist-info}/METADATA +1 -1
- {ultralytics-8.3.140.dist-info → ultralytics-8.3.142.dist-info}/RECORD +22 -22
- {ultralytics-8.3.140.dist-info → ultralytics-8.3.142.dist-info}/WHEEL +1 -1
- {ultralytics-8.3.140.dist-info → ultralytics-8.3.142.dist-info}/entry_points.txt +0 -0
- {ultralytics-8.3.140.dist-info → ultralytics-8.3.142.dist-info}/licenses/LICENSE +0 -0
- {ultralytics-8.3.140.dist-info → ultralytics-8.3.142.dist-info}/top_level.txt +0 -0
tests/test_cuda.py
CHANGED
@@ -22,7 +22,7 @@ if CUDA_IS_AVAILABLE:
|
|
22
22
|
else:
|
23
23
|
gpu_info = GPUInfo()
|
24
24
|
gpu_info.print_status()
|
25
|
-
idle_gpus = gpu_info.select_idle_gpu(count=2,
|
25
|
+
idle_gpus = gpu_info.select_idle_gpu(count=2, min_memory_fraction=0.2)
|
26
26
|
if idle_gpus:
|
27
27
|
DEVICES = idle_gpus
|
28
28
|
|
tests/test_solutions.py
CHANGED
@@ -205,12 +205,12 @@ def test_solution(name, solution_class, needs_frame_count, video, kwargs):
|
|
205
205
|
)
|
206
206
|
|
207
207
|
|
208
|
-
@pytest.mark.slow
|
209
208
|
@pytest.mark.skipif(checks.IS_PYTHON_3_8, reason="Disabled due to unsupported CLIP dependencies.")
|
210
209
|
@pytest.mark.skipif(IS_RASPBERRYPI, reason="Disabled due to slow performance on Raspberry Pi.")
|
211
210
|
def test_similarity_search():
|
212
211
|
"""Test similarity search solution."""
|
213
|
-
|
212
|
+
safe_download(f"{ASSETS_URL}/4-imgs-similaritysearch.zip", dir=TMP) # 4 dog images for testing in a zip file.
|
213
|
+
searcher = solutions.VisualAISearch(data=str(TMP / "4-imgs-similaritysearch"))
|
214
214
|
_ = searcher("a dog sitting on a bench") # Returns the results in format "- img name | similarity score"
|
215
215
|
|
216
216
|
|
@@ -297,6 +297,7 @@ def test_streamlit_handle_video_upload_creates_file():
|
|
297
297
|
os.remove("ultralytics.mp4")
|
298
298
|
|
299
299
|
|
300
|
+
@pytest.mark.skipif(checks.IS_PYTHON_3_8, reason="Disabled due to unsupported CLIP dependencies.")
|
300
301
|
@pytest.mark.skipif(IS_RASPBERRYPI, reason="Disabled due to slow performance on Raspberry Pi.")
|
301
302
|
def test_similarity_search_app_init():
|
302
303
|
"""Test SearchApp initializes with required attributes."""
|
ultralytics/__init__.py
CHANGED
ultralytics/cfg/__init__.py
CHANGED
@@ -108,8 +108,8 @@ CLI_HELP_MSG = f"""
|
|
108
108
|
|
109
109
|
yolo TASK MODE ARGS
|
110
110
|
|
111
|
-
Where TASK (optional) is one of {TASKS}
|
112
|
-
MODE (required) is one of {MODES}
|
111
|
+
Where TASK (optional) is one of {list(TASKS)}
|
112
|
+
MODE (required) is one of {list(MODES)}
|
113
113
|
ARGS (optional) are any number of custom 'arg=value' pairs like 'imgsz=320' that override defaults.
|
114
114
|
See all ARGS at https://docs.ultralytics.com/usage/cfg or with 'yolo cfg'
|
115
115
|
|
@@ -909,9 +909,9 @@ def entrypoint(debug: str = "") -> None:
|
|
909
909
|
mode = overrides.get("mode")
|
910
910
|
if mode is None:
|
911
911
|
mode = DEFAULT_CFG.mode or "predict"
|
912
|
-
LOGGER.warning(f"'mode' argument is missing. Valid modes are {MODES}. Using default 'mode={mode}'.")
|
912
|
+
LOGGER.warning(f"'mode' argument is missing. Valid modes are {list(MODES)}. Using default 'mode={mode}'.")
|
913
913
|
elif mode not in MODES:
|
914
|
-
raise ValueError(f"Invalid 'mode={mode}'. Valid modes are {MODES}.\n{CLI_HELP_MSG}")
|
914
|
+
raise ValueError(f"Invalid 'mode={mode}'. Valid modes are {list(MODES)}.\n{CLI_HELP_MSG}")
|
915
915
|
|
916
916
|
# Task
|
917
917
|
task = overrides.pop("task", None)
|
@@ -919,11 +919,11 @@ def entrypoint(debug: str = "") -> None:
|
|
919
919
|
if task not in TASKS:
|
920
920
|
if task == "track":
|
921
921
|
LOGGER.warning(
|
922
|
-
f"invalid 'task=track', setting 'task=detect' and 'mode=track'. Valid tasks are {TASKS}.\n{CLI_HELP_MSG}."
|
922
|
+
f"invalid 'task=track', setting 'task=detect' and 'mode=track'. Valid tasks are {list(TASKS)}.\n{CLI_HELP_MSG}."
|
923
923
|
)
|
924
924
|
task, mode = "detect", "track"
|
925
925
|
else:
|
926
|
-
raise ValueError(f"Invalid 'task={task}'. Valid tasks are {TASKS}.\n{CLI_HELP_MSG}")
|
926
|
+
raise ValueError(f"Invalid 'task={task}'. Valid tasks are {list(TASKS)}.\n{CLI_HELP_MSG}")
|
927
927
|
if "model" not in overrides:
|
928
928
|
overrides["model"] = TASK2MODEL[task]
|
929
929
|
|
@@ -622,21 +622,18 @@ names:
|
|
622
622
|
download: |
|
623
623
|
import warnings
|
624
624
|
|
625
|
-
from ultralytics.utils import LOGGER, SETTINGS, Path
|
626
|
-
from ultralytics.utils.checks import check_requirements
|
625
|
+
from ultralytics.utils import LOGGER, SETTINGS, Path
|
626
|
+
from ultralytics.utils.checks import check_requirements
|
627
627
|
|
628
628
|
check_requirements("fiftyone")
|
629
|
-
|
630
|
-
# Ubuntu>=22.04 patch https://github.com/voxel51/fiftyone/issues/2961#issuecomment-1666519347
|
631
|
-
check_requirements("fiftyone-db-ubuntu2204")
|
632
|
-
|
629
|
+
|
633
630
|
import fiftyone as fo
|
634
631
|
import fiftyone.zoo as foz
|
635
632
|
|
636
633
|
name = "open-images-v7"
|
637
634
|
fo.config.dataset_zoo_dir = Path(SETTINGS["datasets_dir"]) / "fiftyone" / name
|
638
635
|
fraction = 1.0 # fraction of full dataset to use
|
639
|
-
LOGGER.warning("
|
636
|
+
LOGGER.warning("Open Images V7 dataset requires at least **561 GB of free space. Starting download...")
|
640
637
|
for split in "train", "validation": # 1743042 train, 41620 val images
|
641
638
|
train = split == "train"
|
642
639
|
|
ultralytics/engine/model.py
CHANGED
@@ -79,7 +79,7 @@ class Model(torch.nn.Module):
|
|
79
79
|
|
80
80
|
def __init__(
|
81
81
|
self,
|
82
|
-
model: Union[str, Path] = "yolo11n.pt",
|
82
|
+
model: Union[str, Path, "Model"] = "yolo11n.pt",
|
83
83
|
task: str = None,
|
84
84
|
verbose: bool = False,
|
85
85
|
) -> None:
|
@@ -92,8 +92,8 @@ class Model(torch.nn.Module):
|
|
92
92
|
prediction, or export.
|
93
93
|
|
94
94
|
Args:
|
95
|
-
model (str | Path): Path or name of the model to load or create. Can be a local file path, a
|
96
|
-
model name from Ultralytics HUB,
|
95
|
+
model (str | Path | Model): Path or name of the model to load or create. Can be a local file path, a
|
96
|
+
model name from Ultralytics HUB, a Triton Server model, or an already initialized Model instance.
|
97
97
|
task (str | None): The task type associated with the YOLO model, specifying its application domain.
|
98
98
|
verbose (bool): If True, enables verbose output during the model's initialization and subsequent
|
99
99
|
operations.
|
@@ -108,6 +108,9 @@ class Model(torch.nn.Module):
|
|
108
108
|
>>> model = Model("path/to/model.yaml", task="detect")
|
109
109
|
>>> model = Model("hub_model", verbose=True)
|
110
110
|
"""
|
111
|
+
if isinstance(model, Model):
|
112
|
+
self.__dict__ = model.__dict__ # accepts an already initialized Model
|
113
|
+
return
|
111
114
|
super().__init__()
|
112
115
|
self.callbacks = callbacks.get_default_callbacks()
|
113
116
|
self.predictor = None # reuse predictor
|
ultralytics/engine/results.py
CHANGED
@@ -57,7 +57,7 @@ class ClassificationPredictor(BasePredictor):
|
|
57
57
|
super().setup_source(source)
|
58
58
|
updated = (
|
59
59
|
self.model.model.transforms.transforms[0].size != max(self.imgsz)
|
60
|
-
if hasattr(self.model.model, "transforms")
|
60
|
+
if hasattr(self.model.model, "transforms") and hasattr(self.model.model.transforms.transforms[0], "size")
|
61
61
|
else True
|
62
62
|
)
|
63
63
|
self.transforms = self.model.model.transforms if not updated else classify_transforms(self.imgsz)
|
ultralytics/models/yolo/model.py
CHANGED
@@ -39,7 +39,7 @@ class YOLO(Model):
|
|
39
39
|
>>> model = YOLO("yolo11n.pt") # load a pretrained YOLOv11n detection model
|
40
40
|
>>> model = YOLO("yolo11n-seg.pt") # load a pretrained YOLO11n segmentation model
|
41
41
|
"""
|
42
|
-
path = Path(model)
|
42
|
+
path = Path(model if isinstance(model, (str, Path)) else "")
|
43
43
|
if "-world" in path.stem and path.suffix in {".pt", ".yaml", ".yml"}: # if YOLOWorld PyTorch model
|
44
44
|
new_instance = YOLOWorld(path, verbose=verbose)
|
45
45
|
self.__class__ = type(new_instance)
|
@@ -51,6 +51,12 @@ class YOLO(Model):
|
|
51
51
|
else:
|
52
52
|
# Continue with default YOLO initialization
|
53
53
|
super().__init__(model=model, task=task, verbose=verbose)
|
54
|
+
if hasattr(self.model, "model") and "RTDETR" in self.model.model[-1]._get_name(): # if RTDETR head
|
55
|
+
from ultralytics import RTDETR
|
56
|
+
|
57
|
+
new_instance = RTDETR(self)
|
58
|
+
self.__class__ = type(new_instance)
|
59
|
+
self.__dict__ = new_instance.__dict__
|
54
60
|
|
55
61
|
@property
|
56
62
|
def task_map(self):
|
@@ -118,7 +118,8 @@ class DistanceCalculation(BaseSolution):
|
|
118
118
|
self.centroids = [] # Reset centroids for next frame
|
119
119
|
plot_im = annotator.result()
|
120
120
|
self.display_output(plot_im) # Display output with base class function
|
121
|
-
|
121
|
+
if self.CFG.get("show") and self.env_check:
|
122
|
+
cv2.setMouseCallback("Ultralytics Solutions", self.mouse_event_for_distance)
|
122
123
|
|
123
124
|
# Return SolutionResults with processed image and calculated metrics
|
124
125
|
return SolutionResults(plot_im=plot_im, pixels_distance=pixels_distance, total_tracks=len(self.track_ids))
|
@@ -160,7 +160,7 @@ class ObjectCounter(BaseSolution):
|
|
160
160
|
self.annotator = SolutionAnnotator(im0, line_width=self.line_width) # Initialize annotator
|
161
161
|
|
162
162
|
is_obb = getattr(self.tracks[0], "obb", None) is not None # True if OBB results exist
|
163
|
-
if is_obb:
|
163
|
+
if is_obb and self.track_data and self.track_data.id is not None:
|
164
164
|
self.boxes = self.track_data.xyxyxyxy.reshape(-1, 4, 2).cpu()
|
165
165
|
|
166
166
|
self.annotator.draw_region(
|
@@ -170,9 +170,7 @@ class ObjectCounter(BaseSolution):
|
|
170
170
|
# Iterate over bounding boxes, track ids and classes index
|
171
171
|
for box, track_id, cls, conf in zip(self.boxes, self.track_ids, self.clss, self.confs):
|
172
172
|
# Draw bounding box and counting region
|
173
|
-
self.annotator.box_label(
|
174
|
-
box, label=self.adjust_box_label(cls, conf, track_id), color=colors(cls, True), rotated=is_obb
|
175
|
-
)
|
173
|
+
self.annotator.box_label(box, label=self.adjust_box_label(cls, conf, track_id), color=colors(cls, True))
|
176
174
|
self.store_tracking_history(track_id, box, is_obb=is_obb) # Store track history
|
177
175
|
|
178
176
|
# Store previous position of track for object counting
|
ultralytics/utils/autodevice.py
CHANGED
@@ -116,13 +116,13 @@ class GPUInfo:
|
|
116
116
|
|
117
117
|
LOGGER.info(f"{'-' * len(hdr)}\n")
|
118
118
|
|
119
|
-
def select_idle_gpu(self, count=1,
|
119
|
+
def select_idle_gpu(self, count=1, min_memory_fraction=0):
|
120
120
|
"""
|
121
121
|
Selects the 'count' most idle GPUs based on utilization and free memory.
|
122
122
|
|
123
123
|
Args:
|
124
124
|
count (int): The number of idle GPUs to select. Defaults to 1.
|
125
|
-
|
125
|
+
min_memory_fraction (float): Minimum free memory required (fraction). Defaults to 0.
|
126
126
|
|
127
127
|
Returns:
|
128
128
|
(list[int]): Indices of the selected GPUs, sorted by idleness.
|
@@ -131,7 +131,8 @@ class GPUInfo:
|
|
131
131
|
Returns fewer than 'count' if not enough qualify or exist.
|
132
132
|
Returns basic CUDA indices if NVML fails. Empty list if no GPUs found.
|
133
133
|
"""
|
134
|
-
|
134
|
+
assert min_memory_fraction <= 1.0, f"min_memory_fraction must be <= 1.0, got {min_memory_fraction}"
|
135
|
+
LOGGER.info(f"Searching for {count} idle GPUs with >= {min_memory_fraction * 100:.1f}% free memory...")
|
135
136
|
|
136
137
|
if count <= 0:
|
137
138
|
return []
|
@@ -145,7 +146,8 @@ class GPUInfo:
|
|
145
146
|
eligible_gpus = [
|
146
147
|
gpu
|
147
148
|
for gpu in self.gpu_stats
|
148
|
-
if gpu.get("memory_free",
|
149
|
+
if gpu.get("memory_free", 0) / gpu.get("memory_total", 1) >= min_memory_fraction
|
150
|
+
and gpu.get("utilization", -1) != -1
|
149
151
|
]
|
150
152
|
eligible_gpus.sort(key=lambda x: (x.get("utilization", 101), -x.get("memory_free", 0)))
|
151
153
|
|
@@ -155,19 +157,19 @@ class GPUInfo:
|
|
155
157
|
if selected:
|
156
158
|
LOGGER.info(f"Selected idle CUDA devices {selected}")
|
157
159
|
else:
|
158
|
-
LOGGER.warning(f"No GPUs met criteria (Util != -1, Free Mem >= {
|
160
|
+
LOGGER.warning(f"No GPUs met criteria (Util != -1, Free Mem >= {min_memory_fraction * 100:.1f}%).")
|
159
161
|
|
160
162
|
return selected
|
161
163
|
|
162
164
|
|
163
165
|
if __name__ == "__main__":
|
164
|
-
|
166
|
+
required_free_mem_fraction = 0.2 # Require 20% free VRAM
|
165
167
|
num_gpus_to_select = 1
|
166
168
|
|
167
169
|
gpu_info = GPUInfo()
|
168
170
|
gpu_info.print_status()
|
169
171
|
|
170
|
-
selected = gpu_info.select_idle_gpu(count=num_gpus_to_select,
|
172
|
+
selected = gpu_info.select_idle_gpu(count=num_gpus_to_select, min_memory_fraction=required_free_mem_fraction)
|
171
173
|
if selected:
|
172
174
|
print(f"\n==> Using selected GPU indices: {selected}")
|
173
175
|
devices = [f"cuda:{idx}" for idx in selected]
|
ultralytics/utils/loss.py
CHANGED
@@ -613,8 +613,7 @@ class v8ClassificationLoss:
|
|
613
613
|
"""Compute the classification loss between predictions and true labels."""
|
614
614
|
preds = preds[1] if isinstance(preds, (list, tuple)) else preds
|
615
615
|
loss = F.cross_entropy(preds, batch["cls"], reduction="mean")
|
616
|
-
|
617
|
-
return loss, loss_items
|
616
|
+
return loss, loss.detach()
|
618
617
|
|
619
618
|
|
620
619
|
class v8OBBLoss(v8DetectionLoss):
|
ultralytics/utils/plotting.py
CHANGED
@@ -278,7 +278,7 @@ class Annotator:
|
|
278
278
|
else:
|
279
279
|
return txt_color
|
280
280
|
|
281
|
-
def box_label(self, box, label="", color=(128, 128, 128), txt_color=(255, 255, 255)
|
281
|
+
def box_label(self, box, label="", color=(128, 128, 128), txt_color=(255, 255, 255)):
|
282
282
|
"""
|
283
283
|
Draw a bounding box on an image with a given label.
|
284
284
|
|
@@ -287,7 +287,6 @@ class Annotator:
|
|
287
287
|
label (str, optional): The text label to be displayed.
|
288
288
|
color (tuple, optional): The background color of the rectangle (B, G, R).
|
289
289
|
txt_color (tuple, optional): The color of the text (R, G, B).
|
290
|
-
rotated (bool, optional): Whether the task is oriented bounding box detection.
|
291
290
|
|
292
291
|
Examples:
|
293
292
|
>>> from ultralytics.utils.plotting import Annotator
|
@@ -298,13 +297,13 @@ class Annotator:
|
|
298
297
|
txt_color = self.get_txt_color(color, txt_color)
|
299
298
|
if isinstance(box, torch.Tensor):
|
300
299
|
box = box.tolist()
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
300
|
+
|
301
|
+
multi_points = isinstance(box[0], list) # multiple points with shape (n, 2)
|
302
|
+
p1 = [int(b) for b in box[0]] if multi_points else (int(box[0]), int(box[1]))
|
303
|
+
if self.pil:
|
304
|
+
self.draw.polygon(
|
305
|
+
[tuple(b) for b in box], width=self.lw, outline=color
|
306
|
+
) if multi_points else self.draw.rectangle(box, width=self.lw, outline=color)
|
308
307
|
if label:
|
309
308
|
w, h = self.font.getsize(label) # text width, height
|
310
309
|
outside = p1[1] >= h # label fits outside box
|
@@ -317,12 +316,11 @@ class Annotator:
|
|
317
316
|
# self.draw.text([box[0], box[1]], label, fill=txt_color, font=self.font, anchor='ls') # for PIL>8.0
|
318
317
|
self.draw.text((p1[0], p1[1] - h if outside else p1[1]), label, fill=txt_color, font=self.font)
|
319
318
|
else: # cv2
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
cv2.rectangle(self.im, p1, p2, color, thickness=self.lw, lineType=cv2.LINE_AA)
|
319
|
+
cv2.polylines(
|
320
|
+
self.im, [np.asarray(box, dtype=int)], True, color, self.lw
|
321
|
+
) if multi_points else cv2.rectangle(
|
322
|
+
self.im, p1, (int(box[2]), int(box[3])), color, thickness=self.lw, lineType=cv2.LINE_AA
|
323
|
+
)
|
326
324
|
if label:
|
327
325
|
w, h = cv2.getTextSize(label, 0, fontScale=self.sf, thickness=self.tf)[0] # text width, height
|
328
326
|
h += 3 # add pixels to pad text
|
@@ -750,7 +748,7 @@ def plot_images(
|
|
750
748
|
c = names.get(c, c) if names else c
|
751
749
|
if labels or conf[j] > conf_thres:
|
752
750
|
label = f"{c}" if labels else f"{c} {conf[j]:.1f}"
|
753
|
-
annotator.box_label(box, label, color=color
|
751
|
+
annotator.box_label(box, label, color=color)
|
754
752
|
|
755
753
|
elif len(classes):
|
756
754
|
for c in classes:
|
ultralytics/utils/tal.py
CHANGED
@@ -21,7 +21,6 @@ class TaskAlignedAssigner(nn.Module):
|
|
21
21
|
Attributes:
|
22
22
|
topk (int): The number of top candidates to consider.
|
23
23
|
num_classes (int): The number of object classes.
|
24
|
-
bg_idx (int): Background class index.
|
25
24
|
alpha (float): The alpha parameter for the classification component of the task-aligned metric.
|
26
25
|
beta (float): The beta parameter for the localization component of the task-aligned metric.
|
27
26
|
eps (float): A small value to prevent division by zero.
|
@@ -32,7 +31,6 @@ class TaskAlignedAssigner(nn.Module):
|
|
32
31
|
super().__init__()
|
33
32
|
self.topk = topk
|
34
33
|
self.num_classes = num_classes
|
35
|
-
self.bg_idx = num_classes
|
36
34
|
self.alpha = alpha
|
37
35
|
self.beta = beta
|
38
36
|
self.eps = eps
|
@@ -66,7 +64,7 @@ class TaskAlignedAssigner(nn.Module):
|
|
66
64
|
|
67
65
|
if self.n_max_boxes == 0:
|
68
66
|
return (
|
69
|
-
torch.full_like(pd_scores[..., 0], self.
|
67
|
+
torch.full_like(pd_scores[..., 0], self.num_classes),
|
70
68
|
torch.zeros_like(pd_bboxes),
|
71
69
|
torch.zeros_like(pd_scores),
|
72
70
|
torch.zeros_like(pd_scores[..., 0]),
|
@@ -193,7 +191,7 @@ class TaskAlignedAssigner(nn.Module):
|
|
193
191
|
"""
|
194
192
|
return bbox_iou(gt_bboxes, pd_bboxes, xywh=False, CIoU=True).squeeze(-1).clamp_(0)
|
195
193
|
|
196
|
-
def select_topk_candidates(self, metrics,
|
194
|
+
def select_topk_candidates(self, metrics, topk_mask=None):
|
197
195
|
"""
|
198
196
|
Select the top-k candidates based on the given metrics.
|
199
197
|
|
@@ -201,7 +199,6 @@ class TaskAlignedAssigner(nn.Module):
|
|
201
199
|
metrics (torch.Tensor): A tensor of shape (b, max_num_obj, h*w), where b is the batch size,
|
202
200
|
max_num_obj is the maximum number of objects, and h*w represents the
|
203
201
|
total number of anchor points.
|
204
|
-
largest (bool): If True, select the largest values; otherwise, select the smallest values.
|
205
202
|
topk_mask (torch.Tensor): An optional boolean tensor of shape (b, max_num_obj, topk), where
|
206
203
|
topk is the number of top candidates to consider. If not provided,
|
207
204
|
the top-k values are automatically computed based on the given metrics.
|
@@ -210,7 +207,7 @@ class TaskAlignedAssigner(nn.Module):
|
|
210
207
|
(torch.Tensor): A tensor of shape (b, max_num_obj, h*w) containing the selected top-k candidates.
|
211
208
|
"""
|
212
209
|
# (b, max_num_obj, topk)
|
213
|
-
topk_metrics, topk_idxs = torch.topk(metrics, self.topk, dim=-1, largest=
|
210
|
+
topk_metrics, topk_idxs = torch.topk(metrics, self.topk, dim=-1, largest=True)
|
214
211
|
if topk_mask is None:
|
215
212
|
topk_mask = (topk_metrics.max(-1, keepdim=True)[0] > self.eps).expand_as(topk_idxs)
|
216
213
|
# (b, max_num_obj, topk)
|
ultralytics/utils/torch_utils.py
CHANGED
@@ -174,7 +174,7 @@ def select_device(device="", batch=0, newline=False, verbose=True):
|
|
174
174
|
|
175
175
|
# Replace each -1 with a selected GPU or remove it
|
176
176
|
parts = device.split(",")
|
177
|
-
selected = GPUInfo().select_idle_gpu(count=parts.count("-1"),
|
177
|
+
selected = GPUInfo().select_idle_gpu(count=parts.count("-1"), min_memory_fraction=0.2)
|
178
178
|
for i in range(len(parts)):
|
179
179
|
if parts[i] == "-1":
|
180
180
|
parts[i] = str(selected.pop(0)) if selected else ""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ultralytics
|
3
|
-
Version: 8.3.
|
3
|
+
Version: 8.3.142
|
4
4
|
Summary: Ultralytics YOLO 🚀 for SOTA object detection, multi-object tracking, instance segmentation, pose estimation and image classification.
|
5
5
|
Author-email: Glenn Jocher <glenn.jocher@ultralytics.com>, Jing Qiu <jing.qiu@ultralytics.com>
|
6
6
|
Maintainer-email: Ultralytics <hello@ultralytics.com>
|
@@ -1,16 +1,16 @@
|
|
1
1
|
tests/__init__.py,sha256=xnMhv3O_DF1YrW4zk__ZywQzAaoTDjPKPoiI1Ktss1w,670
|
2
2
|
tests/conftest.py,sha256=rsIAipRKfrVNoTaJ1LdpYue8AbcJ_fr3d3WIlM_6uXY,2982
|
3
3
|
tests/test_cli.py,sha256=vXUC_EK0fa87JRhHsCOZf7AJQ5_Jm1sL8u-yhmsaQh0,5851
|
4
|
-
tests/test_cuda.py,sha256=
|
4
|
+
tests/test_cuda.py,sha256=bT_IzqxKQW3u2E06_Gcox2tZfmadMEv0W66OUrPF0P4,7917
|
5
5
|
tests/test_engine.py,sha256=aGqZ8P7QO5C_nOa1b4FOyk92Ysdk5WiP-ST310Vyxys,4962
|
6
6
|
tests/test_exports.py,sha256=dhZn86LdbapW15RthQF870LGxDjC1MUZhlGdBgPmgIQ,9716
|
7
7
|
tests/test_integrations.py,sha256=dQteeRsRVuT_p5-T88-7jqT65Zm9iAXkyKg-KQ1_TQ8,6341
|
8
8
|
tests/test_python.py,sha256=Zx9OlPN11_D1WSLpi9nPFqORNHNz0lEn6mxVNL2ZHjE,25852
|
9
|
-
tests/test_solutions.py,sha256=
|
10
|
-
ultralytics/__init__.py,sha256=
|
9
|
+
tests/test_solutions.py,sha256=8qntPMu_k278R3ZTxaFXq1N7m9wLnvpXPdw33fobKSU,13045
|
10
|
+
ultralytics/__init__.py,sha256=T4ynXZmZYPUGqZx8ZNeiubG6VRJpCbJSj5EVAnFqGtg,730
|
11
11
|
ultralytics/assets/bus.jpg,sha256=wCAZxJecGR63Od3ZRERe9Aja1Weayrb9Ug751DS_vGM,137419
|
12
12
|
ultralytics/assets/zidane.jpg,sha256=Ftc4aeMmen1O0A3o6GCDO9FlfBslLpTAw0gnetx7bts,50427
|
13
|
-
ultralytics/cfg/__init__.py,sha256=
|
13
|
+
ultralytics/cfg/__init__.py,sha256=nDPCpYipxJ5XLjwwaoB5DNbovbOH-GM26_e2G5jDQ28,39580
|
14
14
|
ultralytics/cfg/default.yaml,sha256=oFG6llJO-Py5H-cR9qs-7FieJamroDLwpbrkhmfROOM,8307
|
15
15
|
ultralytics/cfg/datasets/Argoverse.yaml,sha256=_xlEDIJ9XkUo0v_iNL7FW079BoSeZtKSuLteKTtGbA8,3275
|
16
16
|
ultralytics/cfg/datasets/DOTAv1.5.yaml,sha256=SHND_CFkojxw5iQD5Mcgju2kCZIl0gW2ajuzv1cqoL0,1224
|
@@ -40,7 +40,7 @@ ultralytics/cfg/datasets/dota8.yaml,sha256=W43bp_6yUUVjs6vpogNrGI9vU7rLbEsSx6vyf
|
|
40
40
|
ultralytics/cfg/datasets/hand-keypoints.yaml,sha256=5vue4kvPrAdd6ZyB90rZgtGUUHvSi3s_ht7jBBqX7a4,989
|
41
41
|
ultralytics/cfg/datasets/lvis.yaml,sha256=jD-z6cny0l_Cl7xN6RqiFAc7a7odcVwr3E8_jmH-wzA,29716
|
42
42
|
ultralytics/cfg/datasets/medical-pills.yaml,sha256=3ho9VW8p5Hm1TuicguiL-akfC9dCZO5nwthO4sUR3k0,848
|
43
|
-
ultralytics/cfg/datasets/open-images-v7.yaml,sha256=
|
43
|
+
ultralytics/cfg/datasets/open-images-v7.yaml,sha256=uhsujByejzeysTB10QnSLfDNb9U_HqoES45QJrqMC7g,12132
|
44
44
|
ultralytics/cfg/datasets/package-seg.yaml,sha256=uechtCYfX8OrJrO5zV1-uGwbr69lUSuon1oXguEkLGg,864
|
45
45
|
ultralytics/cfg/datasets/signature.yaml,sha256=eABYny9n4w3RleR3RQmb505DiBll8R5cvcjWj8wkuf0,789
|
46
46
|
ultralytics/cfg/datasets/tiger-pose.yaml,sha256=gCQc1AX04Xfhnms4czm7R_XnT2XFL2u-t3M8Yya20ds,925
|
@@ -119,9 +119,9 @@ ultralytics/data/scripts/get_coco128.sh,sha256=qmRQl_hOKrsdHrTrnyQuFIH01oDz3lfaz
|
|
119
119
|
ultralytics/data/scripts/get_imagenet.sh,sha256=hr42H16bM47iT27rgS7MpEo-GeOZAYUQXgr0B2cwn48,1705
|
120
120
|
ultralytics/engine/__init__.py,sha256=lm6MckFYCPTbqIoX7w0s_daxdjNeBeKW6DXppv1-QUM,70
|
121
121
|
ultralytics/engine/exporter.py,sha256=BZWa7Mnl1BPvbPiD-RJs6M5Bca4sm3_MQgjoHesvXEs,70949
|
122
|
-
ultralytics/engine/model.py,sha256=
|
122
|
+
ultralytics/engine/model.py,sha256=6AhrrcuLOQk_JuOAPQt3uNktAhEBWcBBh_AP2DGEbAs,53147
|
123
123
|
ultralytics/engine/predictor.py,sha256=rZ5mIPeejkxUerpTfUf_1rSAklOR3THqoejlil4C04w,21651
|
124
|
-
ultralytics/engine/results.py,sha256=
|
124
|
+
ultralytics/engine/results.py,sha256=BOpn7RihPt8OUpdklWs1iL3LCxVXOiynPGpaR_MPToQ,70036
|
125
125
|
ultralytics/engine/trainer.py,sha256=xdgNAgq6umJ6915tiCK3U22NeY7w1HnvmAhXlwS_hYI,38955
|
126
126
|
ultralytics/engine/tuner.py,sha256=zEW1UpLlZ6N4xbvS7MxICkshRlaFgLNfuADA0VfRpao,12629
|
127
127
|
ultralytics/engine/validator.py,sha256=f9UUv3QqQStLrO1nojrHkdS58qYQxKXaoIQQria6WyA,17054
|
@@ -163,9 +163,9 @@ ultralytics/models/utils/__init__.py,sha256=lm6MckFYCPTbqIoX7w0s_daxdjNeBeKW6DXp
|
|
163
163
|
ultralytics/models/utils/loss.py,sha256=FShJFvzFBk0HRepRhiSVNz9J-Cq08FxkSNXhLppycI0,19993
|
164
164
|
ultralytics/models/utils/ops.py,sha256=SuBnwwgUTqByNHpufobGLW72yO2cyfZFi14KAFWSjjw,13613
|
165
165
|
ultralytics/models/yolo/__init__.py,sha256=or0j5xvcM0usMlsFTYhNAOcQUri7reD0cD9JR5b7zDk,307
|
166
|
-
ultralytics/models/yolo/model.py,sha256=
|
166
|
+
ultralytics/models/yolo/model.py,sha256=Akq0TuthKAWDIa2l2gNs3QLWVV5Zpk520fdnNa7zxm0,14648
|
167
167
|
ultralytics/models/yolo/classify/__init__.py,sha256=9--HVaNOfI1K7rn_rRqclL8FUAnpfeBrRqEQIaQw2xM,383
|
168
|
-
ultralytics/models/yolo/classify/predict.py,sha256=
|
168
|
+
ultralytics/models/yolo/classify/predict.py,sha256=aSNANtN4pbuaiprGR9d3krIfqnAMcAGhnOM8KRh8wR0,4639
|
169
169
|
ultralytics/models/yolo/classify/train.py,sha256=rv2CJv9fzvtHf2q4l5g0RsjplWKeLpz637kKqjtrLNY,9737
|
170
170
|
ultralytics/models/yolo/classify/val.py,sha256=xk-YwSQdl_oqyCBV0OOAOcXFL6CchebFOc36AkRSyjE,9992
|
171
171
|
ultralytics/models/yolo/detect/__init__.py,sha256=GIRsLYR-kT4JJx7lh4ZZAFGBZj0aebokuU0A7JbjDVA,257
|
@@ -207,11 +207,11 @@ ultralytics/solutions/__init__.py,sha256=ZoeAQavTLp8aClnhZ9tbl6lxy86GxofyGvZWTx2
|
|
207
207
|
ultralytics/solutions/ai_gym.py,sha256=QRTFwuD0g9KJgAjqdww4OeitXm-hsyXL1pJlrAhTyqA,5347
|
208
208
|
ultralytics/solutions/analytics.py,sha256=u-khRAViGupjq9mkuAFCl9G3yE8hXfXASfKZd_SQZ-8,12111
|
209
209
|
ultralytics/solutions/config.py,sha256=TLxQuZjqW-vhbS2OFmTT188-31ukHg1XP7l-BeOmqbU,5427
|
210
|
-
ultralytics/solutions/distance_calculation.py,sha256=
|
210
|
+
ultralytics/solutions/distance_calculation.py,sha256=JyB1KC1WihwGLFX2R2kk4QEvo8Qm0f3CD8fYqchzmfU,5807
|
211
211
|
ultralytics/solutions/heatmap.py,sha256=0Hw2Vhg4heglpnbNkM-RiGrQOkvgYbPRf4x8x4-zTjg,5418
|
212
212
|
ultralytics/solutions/instance_segmentation.py,sha256=IuAxxEkKrbTPHmD0jV3VEjNWpBc78o8exg00nE0ldeQ,3558
|
213
213
|
ultralytics/solutions/object_blurrer.py,sha256=-wXOdqqZisVhxLutZz7JvZmdgVGmsN7Ymary0JHc2qo,3946
|
214
|
-
ultralytics/solutions/object_counter.py,sha256=
|
214
|
+
ultralytics/solutions/object_counter.py,sha256=iNy4D1VUNYZ1JzMa8RUqQq5RBPcpSIuG60Qe3hsfZiw,9534
|
215
215
|
ultralytics/solutions/object_cropper.py,sha256=L6QZC5as_cUT42TMzeyXmkHa7vBi2UpNFf_-Jc7C1G0,3316
|
216
216
|
ultralytics/solutions/parking_management.py,sha256=BV-2lpSfgmK7fib3DnPSZ5rtLdy11c8pBQm-72iTetc,13289
|
217
217
|
ultralytics/solutions/queue_management.py,sha256=p1-cuI_rs4ygtlBryXjE65NYG2bnZXhp3ylggFnWcRs,4344
|
@@ -235,7 +235,7 @@ ultralytics/trackers/utils/kalman_filter.py,sha256=A0CqOnnaKH6kr0XwuHzyHmIU6aJAj
|
|
235
235
|
ultralytics/trackers/utils/matching.py,sha256=7eIufSdeN7cXuFMjvcfvz0Ldq84m4YKZl5IGxBR8IIo,7169
|
236
236
|
ultralytics/utils/__init__.py,sha256=7VT2VSCIgDPInuNKO0sy2_3-qUwuCafLG0wF4wAyjBg,59059
|
237
237
|
ultralytics/utils/autobatch.py,sha256=kg05q2qKg74y_Uq2vvr01i3KhLfpVR7sT0IXBt3_kyI,4921
|
238
|
-
ultralytics/utils/autodevice.py,sha256=
|
238
|
+
ultralytics/utils/autodevice.py,sha256=gSai9YvsDTYj5Kj18n4XGtf0oXXVPbjanKrO1C1w0C4,7454
|
239
239
|
ultralytics/utils/benchmarks.py,sha256=iqjxD29srcCpimtAhbSidpsjnUlMhNR5S6QGPZyz16I,30287
|
240
240
|
ultralytics/utils/checks.py,sha256=SinI5gY-znVbQ-JXk1JaHIlSp2kuBv92Rv99NWFzOFg,33763
|
241
241
|
ultralytics/utils/dist.py,sha256=aytW0JEkcA5ZTZucV92ot7Bn-apiej8aLk3QNWicjAc,4103
|
@@ -244,13 +244,13 @@ ultralytics/utils/errors.py,sha256=vY9h2evFSrHnZdHJVVrmm8Zzw4qVDLyo9DeYW5g0dFk,1
|
|
244
244
|
ultralytics/utils/export.py,sha256=Rr5R3GdJBapJJt1XHkH6VQwYN52-L_7wGiRDCgnb7BY,8817
|
245
245
|
ultralytics/utils/files.py,sha256=0K4O1cgqRiXaDw7EQK13TqA5SME_RrvfDVQSPetNr5w,8042
|
246
246
|
ultralytics/utils/instance.py,sha256=UOEsXR9V-bXNRk6BTonASBEgeMqvzzAk4S7VdXZJUAM,18090
|
247
|
-
ultralytics/utils/loss.py,sha256=
|
247
|
+
ultralytics/utils/loss.py,sha256=KMug5vHESghC3B3V5Vi-fhGVDdTjG9nGkGJmgO_WnPI,37575
|
248
248
|
ultralytics/utils/metrics.py,sha256=8x4S7y-rBKRkM47f_o7jfMHA1Bz8SDq3t-R1FXlQNEM,59267
|
249
249
|
ultralytics/utils/ops.py,sha256=YFwPrKlPcgEmgAWqnJVR0Ccx5NQgp5e3P-YYHwVSP0k,34779
|
250
250
|
ultralytics/utils/patches.py,sha256=_dhIU_eDklQE-aWIjpyjPHl_wOwZoGuIUQnXgdSwk_A,5020
|
251
|
-
ultralytics/utils/plotting.py,sha256=
|
252
|
-
ultralytics/utils/tal.py,sha256=
|
253
|
-
ultralytics/utils/torch_utils.py,sha256=
|
251
|
+
ultralytics/utils/plotting.py,sha256=WAWTGQAsM-cWy08QmcYOXrzFMHd24i8deYTed_u4kbg,47027
|
252
|
+
ultralytics/utils/tal.py,sha256=fkOdogPqPBUN07ThixpI8X7hea-oEfTIaaBLc26_O2s,20610
|
253
|
+
ultralytics/utils/torch_utils.py,sha256=WGNxGocstHD6ljhvujSCWjsYd4xWjNIXk_pq53zcKCc,39675
|
254
254
|
ultralytics/utils/triton.py,sha256=9P2rlQcGCTMFVKLA5S5mTYzU9cKbR5HF9ruVkPpVBE8,5307
|
255
255
|
ultralytics/utils/tuner.py,sha256=0Bp7l5dWZe1RzdvAIa11wQoX6eoAaoNRcA-EAnpofbk,6755
|
256
256
|
ultralytics/utils/callbacks/__init__.py,sha256=hzL63Rce6VkZhP4Lcim9LKjadixaQG86nKqPhk7IkS0,242
|
@@ -264,9 +264,9 @@ ultralytics/utils/callbacks/neptune.py,sha256=yYUgEgSv6L39sSev6vjwhAWU3DlPDsbSDV
|
|
264
264
|
ultralytics/utils/callbacks/raytune.py,sha256=A8amUGpux7dYES-L1iSeMoMXBySGWCD1aUqT7vcG-pU,1284
|
265
265
|
ultralytics/utils/callbacks/tensorboard.py,sha256=jgYnym3cUQFAgN1GzTyO7l3jINtfAh8zhrllDvnLuVQ,5339
|
266
266
|
ultralytics/utils/callbacks/wb.py,sha256=iDRFXI4IIDm8R5OI89DMTmjs8aHLo1HRCLkOFKdaMG4,7507
|
267
|
-
ultralytics-8.3.
|
268
|
-
ultralytics-8.3.
|
269
|
-
ultralytics-8.3.
|
270
|
-
ultralytics-8.3.
|
271
|
-
ultralytics-8.3.
|
272
|
-
ultralytics-8.3.
|
267
|
+
ultralytics-8.3.142.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
268
|
+
ultralytics-8.3.142.dist-info/METADATA,sha256=7W-oMpyVcu-nwCAur5sQWeVc38sKhvf3T0gpZw_WOwE,37200
|
269
|
+
ultralytics-8.3.142.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
270
|
+
ultralytics-8.3.142.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
|
271
|
+
ultralytics-8.3.142.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
|
272
|
+
ultralytics-8.3.142.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|