ultralytics 8.3.112__py3-none-any.whl → 8.3.114__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.
- ultralytics/__init__.py +1 -1
- ultralytics/cfg/datasets/dota8-multispectral.yaml +38 -0
- ultralytics/cfg/trackers/botsort.yaml +4 -3
- ultralytics/data/augment.py +1 -1
- ultralytics/data/converter.py +3 -1
- ultralytics/data/loaders.py +1 -1
- ultralytics/engine/exporter.py +1 -1
- ultralytics/engine/predictor.py +3 -1
- ultralytics/models/yolo/detect/predict.py +25 -1
- ultralytics/nn/autobackend.py +10 -3
- ultralytics/solutions/region_counter.py +3 -2
- ultralytics/trackers/bot_sort.py +32 -8
- ultralytics/trackers/byte_tracker.py +3 -3
- ultralytics/trackers/track.py +20 -1
- ultralytics/utils/ops.py +16 -6
- ultralytics/utils/torch_utils.py +1 -1
- {ultralytics-8.3.112.dist-info → ultralytics-8.3.114.dist-info}/METADATA +1 -1
- {ultralytics-8.3.112.dist-info → ultralytics-8.3.114.dist-info}/RECORD +22 -21
- {ultralytics-8.3.112.dist-info → ultralytics-8.3.114.dist-info}/WHEEL +0 -0
- {ultralytics-8.3.112.dist-info → ultralytics-8.3.114.dist-info}/entry_points.txt +0 -0
- {ultralytics-8.3.112.dist-info → ultralytics-8.3.114.dist-info}/licenses/LICENSE +0 -0
- {ultralytics-8.3.112.dist-info → ultralytics-8.3.114.dist-info}/top_level.txt +0 -0
ultralytics/__init__.py
CHANGED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
2
|
+
|
3
|
+
# DOTA8-Multispectral dataset (DOTA8 interpolated across 10 channels in the visual spectrum) by Ultralytics
|
4
|
+
# Documentation: https://docs.ultralytics.com/datasets/obb/dota8/
|
5
|
+
# Example usage: yolo train model=yolov8n-obb.pt data=dota8-multispectral.yaml
|
6
|
+
# parent
|
7
|
+
# ├── ultralytics
|
8
|
+
# └── datasets
|
9
|
+
# └── dota8-multispectral ← downloads here (37.3MB)
|
10
|
+
|
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: ../datasets/dota8-multispectral # dataset root dir
|
13
|
+
train: images/train # train images (relative to 'path') 4 images
|
14
|
+
val: images/val # val images (relative to 'path') 4 images
|
15
|
+
|
16
|
+
# Number of multispectral image channels
|
17
|
+
channels: 10
|
18
|
+
|
19
|
+
# Classes for DOTA 1.0
|
20
|
+
names:
|
21
|
+
0: plane
|
22
|
+
1: ship
|
23
|
+
2: storage tank
|
24
|
+
3: baseball diamond
|
25
|
+
4: tennis court
|
26
|
+
5: basketball court
|
27
|
+
6: ground track field
|
28
|
+
7: harbor
|
29
|
+
8: bridge
|
30
|
+
9: large vehicle
|
31
|
+
10: small vehicle
|
32
|
+
11: helicopter
|
33
|
+
12: roundabout
|
34
|
+
13: soccer ball field
|
35
|
+
14: swimming pool
|
36
|
+
|
37
|
+
# Download script/URL (optional)
|
38
|
+
download: https://github.com/ultralytics/assets/releases/download/v0.0.0/dota8-multispectral.zip
|
@@ -15,7 +15,8 @@ fuse_score: True # Whether to fuse confidence scores with the iou distances befo
|
|
15
15
|
|
16
16
|
# BoT-SORT settings
|
17
17
|
gmc_method: sparseOptFlow # method of global motion compensation
|
18
|
-
# ReID model related thresh
|
19
|
-
proximity_thresh: 0.5
|
20
|
-
appearance_thresh: 0.25
|
18
|
+
# ReID model related thresh
|
19
|
+
proximity_thresh: 0.5 # minimum IoU for valid match with ReID
|
20
|
+
appearance_thresh: 0.25 # minimum appearance similarity for ReID
|
21
21
|
with_reid: False
|
22
|
+
model: auto # uses native features if detector is YOLO else yolo11n-cls.pt
|
ultralytics/data/augment.py
CHANGED
@@ -2117,7 +2117,7 @@ class Format:
|
|
2117
2117
|
if len(img.shape) < 3:
|
2118
2118
|
img = np.expand_dims(img, -1)
|
2119
2119
|
img = img.transpose(2, 0, 1)
|
2120
|
-
img = np.ascontiguousarray(img[::-1] if random.uniform(0, 1) > self.bgr else img)
|
2120
|
+
img = np.ascontiguousarray(img[::-1] if random.uniform(0, 1) > self.bgr and img.shape[0] == 3 else img)
|
2121
2121
|
img = torch.from_numpy(img)
|
2122
2122
|
return img
|
2123
2123
|
|
ultralytics/data/converter.py
CHANGED
@@ -718,7 +718,9 @@ def convert_to_multispectral(path, n_channels=10, replace=False, zip=False):
|
|
718
718
|
|
719
719
|
Examples:
|
720
720
|
>>> # Convert a single image
|
721
|
-
>>> convert_to_multispectral("path/to/image.jpg", n_channels=
|
721
|
+
>>> convert_to_multispectral("path/to/image.jpg", n_channels=10)
|
722
|
+
>>> # Convert a dataset
|
723
|
+
>>> convert_to_multispectral("../datasets/coco8", n_channels=10)
|
722
724
|
"""
|
723
725
|
from scipy.interpolate import interp1d
|
724
726
|
|
ultralytics/data/loaders.py
CHANGED
@@ -492,7 +492,7 @@ class LoadPilAndNumpy:
|
|
492
492
|
if isinstance(im, Image.Image):
|
493
493
|
if im.mode != "RGB":
|
494
494
|
im = im.convert("RGB")
|
495
|
-
im = np.asarray(im)[:, :, ::-1]
|
495
|
+
im = np.asarray(im)[:, :, ::-1] # RGB to BGR
|
496
496
|
im = np.ascontiguousarray(im) # contiguous
|
497
497
|
return im
|
498
498
|
|
ultralytics/engine/exporter.py
CHANGED
@@ -351,7 +351,7 @@ class Exporter:
|
|
351
351
|
if self.args.int8 and not self.args.data:
|
352
352
|
self.args.data = DEFAULT_CFG.data or TASK2DATA[getattr(model, "task", "detect")] # assign default data
|
353
353
|
LOGGER.warning(
|
354
|
-
"INT8 export requires a missing 'data' arg for calibration. Using default 'data={self.args.data}'."
|
354
|
+
f"INT8 export requires a missing 'data' arg for calibration. Using default 'data={self.args.data}'."
|
355
355
|
)
|
356
356
|
if tfjs and (ARM64 and LINUX):
|
357
357
|
raise SystemError("TF.js exports are not currently supported on ARM64 Linux")
|
ultralytics/engine/predictor.py
CHANGED
@@ -151,7 +151,9 @@ class BasePredictor:
|
|
151
151
|
not_tensor = not isinstance(im, torch.Tensor)
|
152
152
|
if not_tensor:
|
153
153
|
im = np.stack(self.pre_transform(im))
|
154
|
-
|
154
|
+
if im.shape[-1] == 3:
|
155
|
+
im = im[..., ::-1] # BGR to RGB
|
156
|
+
im = im.transpose((0, 3, 1, 2)) # BHWC to BCHW, (n, 3, h, w)
|
155
157
|
im = np.ascontiguousarray(im) # contiguous
|
156
158
|
im = torch.from_numpy(im)
|
157
159
|
|
@@ -51,6 +51,7 @@ class DetectionPredictor(BasePredictor):
|
|
51
51
|
>>> results = predictor.predict("path/to/image.jpg")
|
52
52
|
>>> processed_results = predictor.postprocess(preds, img, orig_imgs)
|
53
53
|
"""
|
54
|
+
save_feats = getattr(self, "save_feats", False)
|
54
55
|
preds = ops.non_max_suppression(
|
55
56
|
preds,
|
56
57
|
self.args.conf,
|
@@ -61,12 +62,35 @@ class DetectionPredictor(BasePredictor):
|
|
61
62
|
nc=len(self.model.names),
|
62
63
|
end2end=getattr(self.model, "end2end", False),
|
63
64
|
rotated=self.args.task == "obb",
|
65
|
+
return_idxs=save_feats,
|
64
66
|
)
|
65
67
|
|
66
68
|
if not isinstance(orig_imgs, list): # input images are a torch.Tensor, not a list
|
67
69
|
orig_imgs = ops.convert_torch2numpy_batch(orig_imgs)
|
68
70
|
|
69
|
-
|
71
|
+
if save_feats:
|
72
|
+
obj_feats = self.get_obj_feats(self._feats, preds[1])
|
73
|
+
preds = preds[0]
|
74
|
+
|
75
|
+
results = self.construct_results(preds, img, orig_imgs, **kwargs)
|
76
|
+
|
77
|
+
if save_feats:
|
78
|
+
for r, f in zip(results, obj_feats):
|
79
|
+
r.feats = f # add object features to results
|
80
|
+
|
81
|
+
return results
|
82
|
+
|
83
|
+
def get_obj_feats(self, feat_maps, idxs):
|
84
|
+
"""Extract object features from the feature maps."""
|
85
|
+
from math import gcd
|
86
|
+
|
87
|
+
import torch
|
88
|
+
|
89
|
+
s = gcd(*[x.shape[1] for x in feat_maps]) # find smallest vector length
|
90
|
+
obj_feats = torch.cat(
|
91
|
+
[x.permute(0, 2, 3, 1).reshape(x.shape[0], -1, s, x.shape[1] // s).mean(dim=-1) for x in feat_maps], dim=1
|
92
|
+
) # mean reduce all vectors to same length
|
93
|
+
return [feats[idx] for feats, idx in zip(obj_feats, idxs)] # for each image in batch, indexed separately
|
70
94
|
|
71
95
|
def construct_results(self, preds, img, orig_imgs):
|
72
96
|
"""
|
ultralytics/nn/autobackend.py
CHANGED
@@ -148,7 +148,7 @@ class AutoBackend(nn.Module):
|
|
148
148
|
model, metadata, task = None, None, None
|
149
149
|
|
150
150
|
# Set device
|
151
|
-
cuda = torch.cuda.is_available() and device.type != "cpu" # use CUDA
|
151
|
+
cuda = isinstance(device, torch.device) and torch.cuda.is_available() and device.type != "cpu" # use CUDA
|
152
152
|
if cuda and not any([nn_module, pt, jit, engine, onnx, paddle]): # GPU dataloader formats
|
153
153
|
device = torch.device("cpu")
|
154
154
|
cuda = False
|
@@ -264,6 +264,13 @@ class AutoBackend(nn.Module):
|
|
264
264
|
import openvino as ov
|
265
265
|
|
266
266
|
core = ov.Core()
|
267
|
+
device_name = "AUTO"
|
268
|
+
if isinstance(device, str) and device.startswith("intel"):
|
269
|
+
device_name = device.split(":")[1].upper() # Intel OpenVINO device
|
270
|
+
device = torch.device("cpu")
|
271
|
+
if device_name not in core.available_devices:
|
272
|
+
LOGGER.warning(f"OpenVINO device '{device_name}' not available. Using 'AUTO' instead.")
|
273
|
+
device_name = "AUTO"
|
267
274
|
w = Path(w)
|
268
275
|
if not w.is_file(): # if not *.xml
|
269
276
|
w = next(w.glob("*.xml")) # get *.xml file from *_openvino_model dir
|
@@ -276,7 +283,7 @@ class AutoBackend(nn.Module):
|
|
276
283
|
LOGGER.info(f"Using OpenVINO {inference_mode} mode for batch={batch} inference...")
|
277
284
|
ov_compiled_model = core.compile_model(
|
278
285
|
ov_model,
|
279
|
-
device_name=
|
286
|
+
device_name=device_name,
|
280
287
|
config={"PERFORMANCE_HINT": inference_mode},
|
281
288
|
)
|
282
289
|
input_name = ov_compiled_model.input().get_any_name()
|
@@ -531,7 +538,7 @@ class AutoBackend(nn.Module):
|
|
531
538
|
metadata = yaml_load(metadata)
|
532
539
|
if metadata and isinstance(metadata, dict):
|
533
540
|
for k, v in metadata.items():
|
534
|
-
if k in {"stride", "batch"}:
|
541
|
+
if k in {"stride", "batch", "channels"}:
|
535
542
|
metadata[k] = int(v)
|
536
543
|
elif k in {"imgsz", "names", "kpt_shape", "args"} and isinstance(v, str):
|
537
544
|
metadata[k] = eval(v)
|
@@ -96,8 +96,8 @@ class RegionCounter(BaseSolution):
|
|
96
96
|
|
97
97
|
# Process bounding boxes & check containment
|
98
98
|
if points:
|
99
|
-
for
|
100
|
-
annotator.box_label(box, label=self.names[cls], color=colors(
|
99
|
+
for point, cls, track_id, box in zip(points, self.clss, self.track_ids, self.boxes):
|
100
|
+
annotator.box_label(box, label=self.names[cls], color=colors(track_id, True))
|
101
101
|
|
102
102
|
for region in self.counting_regions:
|
103
103
|
if region["prepared_polygon"].contains(point):
|
@@ -111,6 +111,7 @@ class RegionCounter(BaseSolution):
|
|
111
111
|
label=str(region["counts"]),
|
112
112
|
color=region["region_color"],
|
113
113
|
txt_color=region["text_color"],
|
114
|
+
margin=self.line_width * 4,
|
114
115
|
)
|
115
116
|
region["counts"] = 0 # Reset for next frame
|
116
117
|
plot_im = annotator.result()
|
ultralytics/trackers/bot_sort.py
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
from collections import deque
|
4
4
|
|
5
5
|
import numpy as np
|
6
|
+
import torch
|
7
|
+
|
8
|
+
from ultralytics.utils.ops import xywh2xyxy
|
9
|
+
from ultralytics.utils.plotting import save_one_box
|
6
10
|
|
7
11
|
from .basetrack import TrackState
|
8
12
|
from .byte_tracker import BYTETracker, STrack
|
@@ -186,14 +190,18 @@ class BOTSORT(BYTETracker):
|
|
186
190
|
>>> bot_sort = BOTSORT(args, frame_rate=30)
|
187
191
|
"""
|
188
192
|
super().__init__(args, frame_rate)
|
193
|
+
self.gmc = GMC(method=args.gmc_method)
|
194
|
+
|
189
195
|
# ReID module
|
190
196
|
self.proximity_thresh = args.proximity_thresh
|
191
197
|
self.appearance_thresh = args.appearance_thresh
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
198
|
+
self.encoder = (
|
199
|
+
(lambda feats, s: [f.cpu().numpy() for f in feats]) # native features do not require any model
|
200
|
+
if self.args.model == "auto"
|
201
|
+
else ReID(args.model)
|
202
|
+
if args.with_reid
|
203
|
+
else None
|
204
|
+
)
|
197
205
|
|
198
206
|
def get_kalmanfilter(self):
|
199
207
|
"""Return an instance of KalmanFilterXYWH for predicting and updating object states in the tracking process."""
|
@@ -204,7 +212,7 @@ class BOTSORT(BYTETracker):
|
|
204
212
|
if len(dets) == 0:
|
205
213
|
return []
|
206
214
|
if self.args.with_reid and self.encoder is not None:
|
207
|
-
features_keep = self.encoder
|
215
|
+
features_keep = self.encoder(img, dets)
|
208
216
|
return [BOTrack(xyxy, s, c, f) for (xyxy, s, c, f) in zip(dets, scores, cls, features_keep)] # detections
|
209
217
|
else:
|
210
218
|
return [BOTrack(xyxy, s, c) for (xyxy, s, c) in zip(dets, scores, cls)] # detections
|
@@ -212,14 +220,14 @@ class BOTSORT(BYTETracker):
|
|
212
220
|
def get_dists(self, tracks, detections):
|
213
221
|
"""Calculate distances between tracks and detections using IoU and optionally ReID embeddings."""
|
214
222
|
dists = matching.iou_distance(tracks, detections)
|
215
|
-
dists_mask = dists > self.proximity_thresh
|
223
|
+
dists_mask = dists > (1 - self.proximity_thresh)
|
216
224
|
|
217
225
|
if self.args.fuse_score:
|
218
226
|
dists = matching.fuse_score(dists, detections)
|
219
227
|
|
220
228
|
if self.args.with_reid and self.encoder is not None:
|
221
229
|
emb_dists = matching.embedding_distance(tracks, detections) / 2.0
|
222
|
-
emb_dists[emb_dists > self.appearance_thresh] = 1.0
|
230
|
+
emb_dists[emb_dists > (1 - self.appearance_thresh)] = 1.0
|
223
231
|
emb_dists[dists_mask] = 1.0
|
224
232
|
dists = np.minimum(dists, emb_dists)
|
225
233
|
return dists
|
@@ -232,3 +240,19 @@ class BOTSORT(BYTETracker):
|
|
232
240
|
"""Reset the BOTSORT tracker to its initial state, clearing all tracked objects and internal states."""
|
233
241
|
super().reset()
|
234
242
|
self.gmc.reset_params()
|
243
|
+
|
244
|
+
|
245
|
+
class ReID:
|
246
|
+
"""YOLO model as encoder for re-identification."""
|
247
|
+
|
248
|
+
def __init__(self, model):
|
249
|
+
"""Initialize encoder for re-identification."""
|
250
|
+
from ultralytics import YOLO
|
251
|
+
|
252
|
+
self.model = YOLO(model)
|
253
|
+
self.model(embed=[len(self.model.model.model) - 2 if ".pt" in model else -1], verbose=False) # initialize
|
254
|
+
|
255
|
+
def __call__(self, img, dets):
|
256
|
+
"""Extract embeddings for detected objects."""
|
257
|
+
feats = self.model([save_one_box(det, img, save=False) for det in xywh2xyxy(torch.from_numpy(dets[:, :4]))])
|
258
|
+
return [f.cpu().numpy() for f in feats]
|
@@ -290,7 +290,7 @@ class BYTETracker:
|
|
290
290
|
self.kalman_filter = self.get_kalmanfilter()
|
291
291
|
self.reset_id()
|
292
292
|
|
293
|
-
def update(self, results, img=None):
|
293
|
+
def update(self, results, img=None, feats=None):
|
294
294
|
"""Updates the tracker with new detections and returns the current list of tracked objects."""
|
295
295
|
self.frame_id += 1
|
296
296
|
activated_stracks = []
|
@@ -316,7 +316,7 @@ class BYTETracker:
|
|
316
316
|
cls_keep = cls[remain_inds]
|
317
317
|
cls_second = cls[inds_second]
|
318
318
|
|
319
|
-
detections = self.init_track(dets, scores_keep, cls_keep, img)
|
319
|
+
detections = self.init_track(dets, scores_keep, cls_keep, img if feats is None else feats)
|
320
320
|
# Add newly detected tracklets to tracked_stracks
|
321
321
|
unconfirmed = []
|
322
322
|
tracked_stracks = [] # type: list[STrack]
|
@@ -347,7 +347,7 @@ class BYTETracker:
|
|
347
347
|
track.re_activate(det, self.frame_id, new_id=False)
|
348
348
|
refind_stracks.append(track)
|
349
349
|
# Step 3: Second association, with low score detection boxes association the untrack to the low score detections
|
350
|
-
detections_second = self.init_track(dets_second, scores_second, cls_second, img)
|
350
|
+
detections_second = self.init_track(dets_second, scores_second, cls_second, img if feats is None else feats)
|
351
351
|
r_tracked_stracks = [strack_pool[i] for i in u_track if strack_pool[i].state == TrackState.Tracked]
|
352
352
|
# TODO
|
353
353
|
dists = matching.iou_distance(r_tracked_stracks, detections_second)
|
ultralytics/trackers/track.py
CHANGED
@@ -44,6 +44,25 @@ def on_predict_start(predictor: object, persist: bool = False) -> None:
|
|
44
44
|
if cfg.tracker_type not in {"bytetrack", "botsort"}:
|
45
45
|
raise AssertionError(f"Only 'bytetrack' and 'botsort' are supported for now, but got '{cfg.tracker_type}'")
|
46
46
|
|
47
|
+
if cfg.tracker_type == "botsort" and cfg.with_reid and cfg.model == "auto":
|
48
|
+
from ultralytics.nn.modules.head import Detect
|
49
|
+
|
50
|
+
if not (
|
51
|
+
isinstance(predictor.model.model, torch.nn.Module)
|
52
|
+
and isinstance(predictor.model.model.model[-1], Detect)
|
53
|
+
and not predictor.model.model.model[-1].end2end
|
54
|
+
):
|
55
|
+
cfg.model = "yolo11n-cls.pt"
|
56
|
+
else:
|
57
|
+
predictor.save_feats = True
|
58
|
+
predictor._feats = None
|
59
|
+
|
60
|
+
# Register hook to extract input of Detect layer
|
61
|
+
def capture_io(module, input, output):
|
62
|
+
predictor._feats = input[0]
|
63
|
+
|
64
|
+
predictor.model.model.model[-1].register_forward_hook(capture_io)
|
65
|
+
|
47
66
|
trackers = []
|
48
67
|
for _ in range(predictor.dataset.bs):
|
49
68
|
tracker = TRACKER_MAP[cfg.tracker_type](args=cfg, frame_rate=30)
|
@@ -79,7 +98,7 @@ def on_predict_postprocess_end(predictor: object, persist: bool = False) -> None
|
|
79
98
|
det = (result.obb if is_obb else result.boxes).cpu().numpy()
|
80
99
|
if len(det) == 0:
|
81
100
|
continue
|
82
|
-
tracks = tracker.update(det, result.orig_img)
|
101
|
+
tracks = tracker.update(det, result.orig_img, getattr(result, "feats", None))
|
83
102
|
if len(tracks) == 0:
|
84
103
|
continue
|
85
104
|
idx = tracks[:, -1].astype(int)
|
ultralytics/utils/ops.py
CHANGED
@@ -194,6 +194,7 @@ def non_max_suppression(
|
|
194
194
|
in_place=True,
|
195
195
|
rotated=False,
|
196
196
|
end2end=False,
|
197
|
+
return_idxs=False,
|
197
198
|
):
|
198
199
|
"""
|
199
200
|
Perform non-maximum suppression (NMS) on a set of boxes, with support for masks and multiple labels per box.
|
@@ -221,6 +222,7 @@ def non_max_suppression(
|
|
221
222
|
in_place (bool): If True, the input prediction tensor will be modified in place.
|
222
223
|
rotated (bool): If Oriented Bounding Boxes (OBB) are being passed for NMS.
|
223
224
|
end2end (bool): If the model doesn't require NMS.
|
225
|
+
return_idxs (bool): Return the indices of the detections that were kept.
|
224
226
|
|
225
227
|
Returns:
|
226
228
|
(List[torch.Tensor]): A list of length batch_size, where each element is a tensor of
|
@@ -248,6 +250,7 @@ def non_max_suppression(
|
|
248
250
|
nm = prediction.shape[1] - nc - 4 # number of masks
|
249
251
|
mi = 4 + nc # mask start index
|
250
252
|
xc = prediction[:, 4:mi].amax(1) > conf_thres # candidates
|
253
|
+
xinds = torch.stack([torch.arange(len(i), device=prediction.device) for i in xc])[..., None] # to track idxs
|
251
254
|
|
252
255
|
# Settings
|
253
256
|
# min_wh = 2 # (pixels) minimum box width and height
|
@@ -263,10 +266,12 @@ def non_max_suppression(
|
|
263
266
|
|
264
267
|
t = time.time()
|
265
268
|
output = [torch.zeros((0, 6 + nm), device=prediction.device)] * bs
|
266
|
-
|
269
|
+
keepi = [torch.zeros((0, 1), device=prediction.device)] * bs # to store the kept idxs
|
270
|
+
for xi, (x, xk) in enumerate(zip(prediction, xinds)): # image index, (preds, preds indices)
|
267
271
|
# Apply constraints
|
268
272
|
# x[((x[:, 2:4] < min_wh) | (x[:, 2:4] > max_wh)).any(1), 4] = 0 # width-height
|
269
|
-
|
273
|
+
filt = xc[xi] # confidence
|
274
|
+
x, xk = x[filt], xk[filt]
|
270
275
|
|
271
276
|
# Cat apriori labels if autolabelling
|
272
277
|
if labels and len(labels[xi]) and not rotated:
|
@@ -286,20 +291,25 @@ def non_max_suppression(
|
|
286
291
|
if multi_label:
|
287
292
|
i, j = torch.where(cls > conf_thres)
|
288
293
|
x = torch.cat((box[i], x[i, 4 + j, None], j[:, None].float(), mask[i]), 1)
|
294
|
+
xk = xk[i]
|
289
295
|
else: # best class only
|
290
296
|
conf, j = cls.max(1, keepdim=True)
|
291
|
-
|
297
|
+
filt = conf.view(-1) > conf_thres
|
298
|
+
x = torch.cat((box, conf, j.float(), mask), 1)[filt]
|
299
|
+
xk = xk[filt]
|
292
300
|
|
293
301
|
# Filter by class
|
294
302
|
if classes is not None:
|
295
303
|
x = x[(x[:, 5:6] == classes).any(1)]
|
304
|
+
x, xk = x[filt], xk[filt]
|
296
305
|
|
297
306
|
# Check shape
|
298
307
|
n = x.shape[0] # number of boxes
|
299
308
|
if not n: # no boxes
|
300
309
|
continue
|
301
310
|
if n > max_nms: # excess boxes
|
302
|
-
|
311
|
+
filt = x[:, 4].argsort(descending=True)[:max_nms] # sort by confidence and remove excess boxes
|
312
|
+
x, xk = x[filt], xk[filt]
|
303
313
|
|
304
314
|
# Batched NMS
|
305
315
|
c = x[:, 5:6] * (0 if agnostic else max_wh) # classes
|
@@ -324,12 +334,12 @@ def non_max_suppression(
|
|
324
334
|
# if redundant:
|
325
335
|
# i = i[iou.sum(1) > 1] # require redundancy
|
326
336
|
|
327
|
-
output[xi] = x[i]
|
337
|
+
output[xi], keepi[xi] = x[i], xk[i].reshape(-1)
|
328
338
|
if (time.time() - t) > time_limit:
|
329
339
|
LOGGER.warning(f"NMS time limit {time_limit:.3f}s exceeded")
|
330
340
|
break # time limit exceeded
|
331
341
|
|
332
|
-
return output
|
342
|
+
return (output, keepi) if return_idxs else output
|
333
343
|
|
334
344
|
|
335
345
|
def clip_boxes(boxes, shape):
|
ultralytics/utils/torch_utils.py
CHANGED
@@ -161,7 +161,7 @@ def select_device(device="", batch=0, newline=False, verbose=True):
|
|
161
161
|
Note:
|
162
162
|
Sets the 'CUDA_VISIBLE_DEVICES' environment variable for specifying which GPUs to use.
|
163
163
|
"""
|
164
|
-
if isinstance(device, torch.device) or str(device).startswith("tpu"):
|
164
|
+
if isinstance(device, torch.device) or str(device).startswith("tpu") or str(device).startswith("intel"):
|
165
165
|
return device
|
166
166
|
|
167
167
|
s = f"Ultralytics {__version__} 🚀 Python-{PYTHON_VERSION} torch-{torch.__version__} "
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ultralytics
|
3
|
-
Version: 8.3.
|
3
|
+
Version: 8.3.114
|
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,4 +1,4 @@
|
|
1
|
-
ultralytics/__init__.py,sha256=
|
1
|
+
ultralytics/__init__.py,sha256=WBfQJaKm6-2YTizBGkwFR26SwOipY7Xf-o89_L_k6GE,730
|
2
2
|
ultralytics/assets/bus.jpg,sha256=wCAZxJecGR63Od3ZRERe9Aja1Weayrb9Ug751DS_vGM,137419
|
3
3
|
ultralytics/assets/zidane.jpg,sha256=Ftc4aeMmen1O0A3o6GCDO9FlfBslLpTAw0gnetx7bts,50427
|
4
4
|
ultralytics/cfg/__init__.py,sha256=-66Vtli1XqcRUJ9F_gYyEoKTO3gDMmOrDDnUEa5G84s,39646
|
@@ -25,6 +25,7 @@ ultralytics/cfg/datasets/coco8-seg.yaml,sha256=wpfFI-GfL5asbLtFyaHLE6593jdka7waE
|
|
25
25
|
ultralytics/cfg/datasets/coco8.yaml,sha256=qJX2TSM7nMV-PpCMXCX4702yp3a-ZF1ubLatlGN5XOE,1901
|
26
26
|
ultralytics/cfg/datasets/crack-seg.yaml,sha256=QEnxOouOKQ3TM6Cl8pBnX5QLPWdChZEBA28jaLkzxA4,852
|
27
27
|
ultralytics/cfg/datasets/dog-pose.yaml,sha256=Cr-J7dPhHmNfW9TKH48L22WPYmJFtWH-lbOAxLHnjKU,907
|
28
|
+
ultralytics/cfg/datasets/dota8-multispectral.yaml,sha256=F_GBGsFyuJwaWItCOn27CBDgCdsVyI9e0IcXKbZc7t0,1229
|
28
29
|
ultralytics/cfg/datasets/dota8.yaml,sha256=W43bp_6yUUVjs6vpogNrGI9vU7rLbEsSx6vyfIkDyj8,1073
|
29
30
|
ultralytics/cfg/datasets/hand-keypoints.yaml,sha256=5vue4kvPrAdd6ZyB90rZgtGUUHvSi3s_ht7jBBqX7a4,989
|
30
31
|
ultralytics/cfg/datasets/lvis.yaml,sha256=jD-z6cny0l_Cl7xN6RqiFAc7a7odcVwr3E8_jmH-wzA,29716
|
@@ -90,16 +91,16 @@ ultralytics/cfg/models/v9/yolov9m.yaml,sha256=WcKQ3xRsC1JMgA42Hx4xzr4FZmtE6B3wKv
|
|
90
91
|
ultralytics/cfg/models/v9/yolov9s.yaml,sha256=j_v3JWaPtiuM8aKJt15Z_4HPRCoHWn_G6Z07t8CZyjk,1391
|
91
92
|
ultralytics/cfg/models/v9/yolov9t.yaml,sha256=Q8GpSXE7fumhuJiQg4a2SkuS_UmnXqp-eoZxW_C0vEo,1375
|
92
93
|
ultralytics/cfg/solutions/default.yaml,sha256=c-9thwI7y7VmIoIM6AW70Z0r825SToH2h7gSCsUoAak,1664
|
93
|
-
ultralytics/cfg/trackers/botsort.yaml,sha256=
|
94
|
+
ultralytics/cfg/trackers/botsort.yaml,sha256=8fM3y4TXKKT_5aWsqmQw5JEgwNlBGlRaf8LXpJQSmYs,1216
|
94
95
|
ultralytics/cfg/trackers/bytetrack.yaml,sha256=6u-tiZlk16EqEwkNXaMrza6PAQmWj_ypgv26LGCtPDg,886
|
95
96
|
ultralytics/data/__init__.py,sha256=nAXaL1puCc7z_NjzQNlJnhbVhT9Fla2u7Dsqo7q1dAc,644
|
96
97
|
ultralytics/data/annotator.py,sha256=VEwb11FsEZm75qlEp8XDHFGKW0_rGsEaFDaBVd771Kw,2902
|
97
|
-
ultralytics/data/augment.py,sha256=
|
98
|
+
ultralytics/data/augment.py,sha256=WBVuxXW1Mzu7V-LaSopoFEiu8S2r0kM5zMpFVyzcWF0,125280
|
98
99
|
ultralytics/data/base.py,sha256=efummc7-4ha3O2J-ZoUOK9-HO-8Glh3h0W2oEwh4WBg,18503
|
99
100
|
ultralytics/data/build.py,sha256=56pavLie6PDFEVYChMxnGQGtGsxozYZRpFqC70DRGls,9650
|
100
|
-
ultralytics/data/converter.py,sha256=
|
101
|
+
ultralytics/data/converter.py,sha256=znXH2XTdo0Q4NDHMny1ydVBvrxKn2kbbwI-X5bn1MlQ,26890
|
101
102
|
ultralytics/data/dataset.py,sha256=3hcnCBBb5C_m4l5E1m2uf_2hQFhMv31FmvTfvWed8ek,34760
|
102
|
-
ultralytics/data/loaders.py,sha256=
|
103
|
+
ultralytics/data/loaders.py,sha256=kl3gHkcIcNHqLKuQ5fyAlDo9WYBsCPjLcnFbRpk6KVw,28494
|
103
104
|
ultralytics/data/split.py,sha256=6LHB1z8woXurWjXfM-Zm2thRr1KXvzR18CFJA-SDUvE,4677
|
104
105
|
ultralytics/data/split_dota.py,sha256=p8eVGht9tABSVbf9vwvxA_AQYEva3IGHePKlMeNrn64,11872
|
105
106
|
ultralytics/data/utils.py,sha256=yzYHZor0E1JU5RjC5dKYSqQx1uYHorDtzZK_Qi2dz6E,35124
|
@@ -108,9 +109,9 @@ ultralytics/data/scripts/get_coco.sh,sha256=UuJpJeo3qQpTHVINeOpmP0NYmg8PhEFE3A8J
|
|
108
109
|
ultralytics/data/scripts/get_coco128.sh,sha256=qmRQl_hOKrsdHrTrnyQuFIH01oDz3lfaz138OgGfLt8,650
|
109
110
|
ultralytics/data/scripts/get_imagenet.sh,sha256=hr42H16bM47iT27rgS7MpEo-GeOZAYUQXgr0B2cwn48,1705
|
110
111
|
ultralytics/engine/__init__.py,sha256=lm6MckFYCPTbqIoX7w0s_daxdjNeBeKW6DXppv1-QUM,70
|
111
|
-
ultralytics/engine/exporter.py,sha256=
|
112
|
+
ultralytics/engine/exporter.py,sha256=KeOF8LH0sgQdPd4jSny5ggATMf1AOebcTGdibLvS0AA,73663
|
112
113
|
ultralytics/engine/model.py,sha256=wS1cwgv0iyhsslMAZYMGlYDWitDIRW96d7MxwW-Sw5o,52817
|
113
|
-
ultralytics/engine/predictor.py,sha256=
|
114
|
+
ultralytics/engine/predictor.py,sha256=YJ5l-0qIpr6JAJxowswtZ0IqmXBqVTvAA9vR40v0sCM,21752
|
114
115
|
ultralytics/engine/results.py,sha256=C3j-kyjoMxn7bb8tK_kaYrOWB8-7qDYZ-_hSh1LPWMA,79742
|
115
116
|
ultralytics/engine/trainer.py,sha256=O6Cl-27Wd8w7WJGfG3rIx7LDgF-_qb9gF_j8oBeUV24,38839
|
116
117
|
ultralytics/engine/tuner.py,sha256=oyjnbAExddGTBN-sm7tXFtxSgjZOZ5M81EIJSzpmqno,12581
|
@@ -159,7 +160,7 @@ ultralytics/models/yolo/classify/predict.py,sha256=JV9szginTQ9Lpob0FozhKMiEIu1vV
|
|
159
160
|
ultralytics/models/yolo/classify/train.py,sha256=rv2CJv9fzvtHf2q4l5g0RsjplWKeLpz637kKqjtrLNY,9737
|
160
161
|
ultralytics/models/yolo/classify/val.py,sha256=xk-YwSQdl_oqyCBV0OOAOcXFL6CchebFOc36AkRSyjE,9992
|
161
162
|
ultralytics/models/yolo/detect/__init__.py,sha256=GIRsLYR-kT4JJx7lh4ZZAFGBZj0aebokuU0A7JbjDVA,257
|
162
|
-
ultralytics/models/yolo/detect/predict.py,sha256=
|
163
|
+
ultralytics/models/yolo/detect/predict.py,sha256=7s9j-JaFNO0ATxlQZCav3PjAGe9qx5jrs2CGJ5_h7aM,5306
|
163
164
|
ultralytics/models/yolo/detect/train.py,sha256=YOEmUZkfJBq6hNbB_P10k-uy4_2fUgdPfVWzO4y8Egs,9538
|
164
165
|
ultralytics/models/yolo/detect/val.py,sha256=_gpsMoMzo_7Rv_vQDyvCeztp6NbuoPNQBNvDWH_R-L4,18434
|
165
166
|
ultralytics/models/yolo/obb/__init__.py,sha256=tQmpG8wVHsajWkZdmD6cjGohJ4ki64iSXQT8JY_dydo,221
|
@@ -183,7 +184,7 @@ ultralytics/models/yolo/yoloe/train.py,sha256=JF_QxJUU3_w8yhmTfKFTpI7rVRJL1g7z7w
|
|
183
184
|
ultralytics/models/yolo/yoloe/train_seg.py,sha256=6nN9DbP-AJKlJ3nIlvNn8VXFwFLQEVjSOgdN5aA817M,5309
|
184
185
|
ultralytics/models/yolo/yoloe/val.py,sha256=utdt8wZvvW9OPxO5rx8KsFlkLG0FXj0YMD7Jhyk54D8,8440
|
185
186
|
ultralytics/nn/__init__.py,sha256=rjociYD9lo_K-d-1s6TbdWklPLjTcEHk7OIlRDJstIE,615
|
186
|
-
ultralytics/nn/autobackend.py,sha256=
|
187
|
+
ultralytics/nn/autobackend.py,sha256=5FAYp7VktiOKxY0ta1BSewaXf_eH-EENvjnvazPotwQ,39214
|
187
188
|
ultralytics/nn/tasks.py,sha256=EwRC70qA3eP8Xp-gGP8OuN-q8LCGDrq1iRue7ncRSV4,62916
|
188
189
|
ultralytics/nn/text_model.py,sha256=H6OiLe0FOyZY4pd7-ixRTxaBgx3lOc2GmGTmrFnoJd0,10136
|
189
190
|
ultralytics/nn/modules/__init__.py,sha256=dXLtIk9rt944WfsTdpgEdWOg3HQEHdwQztuZ6WNJygs,3144
|
@@ -204,7 +205,7 @@ ultralytics/solutions/object_counter.py,sha256=QXBRBEv_a0uiOYYzsNdu0VAH62rg97v1E
|
|
204
205
|
ultralytics/solutions/object_cropper.py,sha256=RNk_v_XRXm9Ye2TsKG5CPd3TDsRaiODWpy8MvYqkSLs,3382
|
205
206
|
ultralytics/solutions/parking_management.py,sha256=SiVxRl44OxxYUXIzNOxOBqtaFJSRRpD_gTsNyvB1n5o,13277
|
206
207
|
ultralytics/solutions/queue_management.py,sha256=cUzAMMeWijowkdiuaSUZRr0S3I5MTHkCQOLjOqS0JN0,4299
|
207
|
-
ultralytics/solutions/region_counter.py,sha256=
|
208
|
+
ultralytics/solutions/region_counter.py,sha256=5CFtrWxQC8a-6puaxjYXaJAmYE9vTFUxNSd-XYeiRkU,5373
|
208
209
|
ultralytics/solutions/security_alarm.py,sha256=mbUtqoLgjAWz9k3pjMoEZY_PR-lhjiic1NK90FhEJkw,6250
|
209
210
|
ultralytics/solutions/solutions.py,sha256=UaDZN_wAmV-XeRh57ca9TuqX-7sZUU-TmrpL1BqYuEc,31522
|
210
211
|
ultralytics/solutions/speed_estimation.py,sha256=3UFtGXKNUy1jt6GS4wg4hvkQoQ4KkOHXjzMpmSHodx0,5126
|
@@ -213,9 +214,9 @@ ultralytics/solutions/trackzone.py,sha256=05XVTQVCGHFAuFNPzyv0VXKQSJKiyWkU6zkXVo
|
|
213
214
|
ultralytics/solutions/vision_eye.py,sha256=cFjex7mau20Ww4Cuq9lbaAidVTByXk7nhZ0KVHqUzBY,2924
|
214
215
|
ultralytics/trackers/__init__.py,sha256=Zlu_Ig5osn7hqch_g5Be_e4pwZUkeeTQiesJCi0pFGI,255
|
215
216
|
ultralytics/trackers/basetrack.py,sha256=LYvWB5d7Woyrz_RlxaopjV07RQKH3sff_lZJfMcMxcA,4450
|
216
|
-
ultralytics/trackers/bot_sort.py,sha256=
|
217
|
-
ultralytics/trackers/byte_tracker.py,sha256=
|
218
|
-
ultralytics/trackers/track.py,sha256=
|
217
|
+
ultralytics/trackers/bot_sort.py,sha256=vu3gtJnaVZ3O_Z-YBHypY2IxOZgMf63tucRGPgcf5Es,11296
|
218
|
+
ultralytics/trackers/byte_tracker.py,sha256=D7JQ_6V8OUMQryxTrAr010UXMSaboQnI7T1xppzHXYg,20921
|
219
|
+
ultralytics/trackers/track.py,sha256=mu6L9RWAW8Nq0vJanX-hTTUST-OmLq49d8VV96-J9u8,4817
|
219
220
|
ultralytics/trackers/utils/__init__.py,sha256=lm6MckFYCPTbqIoX7w0s_daxdjNeBeKW6DXppv1-QUM,70
|
220
221
|
ultralytics/trackers/utils/gmc.py,sha256=dz3I5LbIv7h1__Xg7rGHecQFE32VFTe54tUnxb8F0Z8,14466
|
221
222
|
ultralytics/trackers/utils/kalman_filter.py,sha256=A0CqOnnaKH6kr0XwuHzyHmIU6aJAjJYxF9jVlNBKZHo,21326
|
@@ -232,11 +233,11 @@ ultralytics/utils/files.py,sha256=0K4O1cgqRiXaDw7EQK13TqA5SME_RrvfDVQSPetNr5w,80
|
|
232
233
|
ultralytics/utils/instance.py,sha256=UOEsXR9V-bXNRk6BTonASBEgeMqvzzAk4S7VdXZJUAM,18090
|
233
234
|
ultralytics/utils/loss.py,sha256=us3lwmSlIwEzoMztNjpet7Kb1r1-sMGyESykqgYPDVo,36945
|
234
235
|
ultralytics/utils/metrics.py,sha256=uv5O-2Ft8wYfTvDedFxiUqMZ6Nr2CL6I9ybGZiK3e2s,53773
|
235
|
-
ultralytics/utils/ops.py,sha256=
|
236
|
+
ultralytics/utils/ops.py,sha256=Fkbd91djIdf8npXRTLzUQMWsNak3aQKANFTTnOxl77Y,34783
|
236
237
|
ultralytics/utils/patches.py,sha256=qArRoYscf7jph-OwIYJAAkOB5bAM6pcktgXKc76A8HE,4860
|
237
238
|
ultralytics/utils/plotting.py,sha256=5QPK1y-gm4T1mK3sjfRZhIUJAyP05D1cJ7h9wHPTifU,46616
|
238
239
|
ultralytics/utils/tal.py,sha256=P5nPoR9qNnFuDIda0fsn8WP6m1V8r7EbvXUuhNRFFTA,20805
|
239
|
-
ultralytics/utils/torch_utils.py,sha256=
|
240
|
+
ultralytics/utils/torch_utils.py,sha256=OqH2yNSghs0JSq16Br_PDBnVed5ZRs0C58zDZDk_bqA,38888
|
240
241
|
ultralytics/utils/triton.py,sha256=xK9Db_ZUVDnIK1u76S2G-6ulIBsLfj9HN_YOaSrnMuU,5304
|
241
242
|
ultralytics/utils/tuner.py,sha256=R_TVIfsTA8qxEPiqHBCZgh1rzqAAOwQ1gImw-0IR13g,6682
|
242
243
|
ultralytics/utils/callbacks/__init__.py,sha256=hzL63Rce6VkZhP4Lcim9LKjadixaQG86nKqPhk7IkS0,242
|
@@ -250,9 +251,9 @@ ultralytics/utils/callbacks/neptune.py,sha256=JaI95Cj2kIjUhlEEOiDN0-Drc-fDelLhNI
|
|
250
251
|
ultralytics/utils/callbacks/raytune.py,sha256=A8amUGpux7dYES-L1iSeMoMXBySGWCD1aUqT7vcG-pU,1284
|
251
252
|
ultralytics/utils/callbacks/tensorboard.py,sha256=jgYnym3cUQFAgN1GzTyO7l3jINtfAh8zhrllDvnLuVQ,5339
|
252
253
|
ultralytics/utils/callbacks/wb.py,sha256=iDRFXI4IIDm8R5OI89DMTmjs8aHLo1HRCLkOFKdaMG4,7507
|
253
|
-
ultralytics-8.3.
|
254
|
-
ultralytics-8.3.
|
255
|
-
ultralytics-8.3.
|
256
|
-
ultralytics-8.3.
|
257
|
-
ultralytics-8.3.
|
258
|
-
ultralytics-8.3.
|
254
|
+
ultralytics-8.3.114.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
255
|
+
ultralytics-8.3.114.dist-info/METADATA,sha256=tMAyCuNauy-ZB4hDNUQT3FJ453ZeCRGXTc5G2MddF3Y,37354
|
256
|
+
ultralytics-8.3.114.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
257
|
+
ultralytics-8.3.114.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
|
258
|
+
ultralytics-8.3.114.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
|
259
|
+
ultralytics-8.3.114.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|