ultralytics 8.2.92__py3-none-any.whl → 8.2.94__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ultralytics might be problematic. Click here for more details.
- tests/test_cli.py +1 -1
- ultralytics/__init__.py +1 -1
- ultralytics/engine/exporter.py +1 -1
- ultralytics/engine/trainer.py +28 -14
- ultralytics/models/nas/val.py +1 -1
- ultralytics/models/sam/predict.py +7 -5
- ultralytics/models/yolo/obb/val.py +1 -1
- ultralytics/models/yolo/pose/val.py +1 -1
- ultralytics/models/yolo/segment/val.py +1 -1
- ultralytics/nn/tasks.py +51 -4
- ultralytics/solutions/queue_management.py +14 -52
- ultralytics/solutions/speed_estimation.py +54 -118
- ultralytics/utils/plotting.py +55 -1
- {ultralytics-8.2.92.dist-info → ultralytics-8.2.94.dist-info}/METADATA +10 -10
- {ultralytics-8.2.92.dist-info → ultralytics-8.2.94.dist-info}/RECORD +19 -19
- {ultralytics-8.2.92.dist-info → ultralytics-8.2.94.dist-info}/WHEEL +1 -1
- {ultralytics-8.2.92.dist-info → ultralytics-8.2.94.dist-info}/LICENSE +0 -0
- {ultralytics-8.2.92.dist-info → ultralytics-8.2.94.dist-info}/entry_points.txt +0 -0
- {ultralytics-8.2.92.dist-info → ultralytics-8.2.94.dist-info}/top_level.txt +0 -0
tests/test_cli.py
CHANGED
|
@@ -101,7 +101,7 @@ def test_mobilesam():
|
|
|
101
101
|
model.predict(source, points=[900, 370], labels=[1])
|
|
102
102
|
|
|
103
103
|
# Predict a segment based on a box prompt
|
|
104
|
-
model.predict(source, bboxes=[439, 437, 524, 709])
|
|
104
|
+
model.predict(source, bboxes=[439, 437, 524, 709], save=True)
|
|
105
105
|
|
|
106
106
|
# Predict all
|
|
107
107
|
# model(source)
|
ultralytics/__init__.py
CHANGED
ultralytics/engine/exporter.py
CHANGED
|
@@ -391,7 +391,7 @@ class Exporter:
|
|
|
391
391
|
"""YOLOv8 ONNX export."""
|
|
392
392
|
requirements = ["onnx>=1.12.0"]
|
|
393
393
|
if self.args.simplify:
|
|
394
|
-
requirements += ["onnxslim==0.1.
|
|
394
|
+
requirements += ["onnxslim==0.1.34", "onnxruntime" + ("-gpu" if torch.cuda.is_available() else "")]
|
|
395
395
|
check_requirements(requirements)
|
|
396
396
|
import onnx # noqa
|
|
397
397
|
|
ultralytics/engine/trainer.py
CHANGED
|
@@ -28,7 +28,6 @@ from ultralytics.utils import (
|
|
|
28
28
|
DEFAULT_CFG,
|
|
29
29
|
LOCAL_RANK,
|
|
30
30
|
LOGGER,
|
|
31
|
-
MACOS,
|
|
32
31
|
RANK,
|
|
33
32
|
TQDM,
|
|
34
33
|
__version__,
|
|
@@ -409,13 +408,17 @@ class BaseTrainer:
|
|
|
409
408
|
break
|
|
410
409
|
|
|
411
410
|
# Log
|
|
412
|
-
mem = f"{torch.cuda.memory_reserved() / 1E9 if torch.cuda.is_available() else 0:.3g}G" # (GB)
|
|
413
|
-
loss_len = self.tloss.shape[0] if len(self.tloss.shape) else 1
|
|
414
|
-
losses = self.tloss if loss_len > 1 else torch.unsqueeze(self.tloss, 0)
|
|
415
411
|
if RANK in {-1, 0}:
|
|
412
|
+
loss_length = self.tloss.shape[0] if len(self.tloss.shape) else 1
|
|
416
413
|
pbar.set_description(
|
|
417
|
-
("%11s" * 2 + "%11.4g" * (2 +
|
|
418
|
-
% (
|
|
414
|
+
("%11s" * 2 + "%11.4g" * (2 + loss_length))
|
|
415
|
+
% (
|
|
416
|
+
f"{epoch + 1}/{self.epochs}",
|
|
417
|
+
f"{self._get_memory():.3g}G", # (GB) GPU memory util
|
|
418
|
+
*(self.tloss if loss_length > 1 else torch.unsqueeze(self.tloss, 0)), # losses
|
|
419
|
+
batch["cls"].shape[0], # batch size, i.e. 8
|
|
420
|
+
batch["img"].shape[-1], # imgsz, i.e 640
|
|
421
|
+
)
|
|
419
422
|
)
|
|
420
423
|
self.run_callbacks("on_batch_end")
|
|
421
424
|
if self.args.plots and ni in self.plot_idx:
|
|
@@ -453,11 +456,7 @@ class BaseTrainer:
|
|
|
453
456
|
self.scheduler.last_epoch = self.epoch # do not move
|
|
454
457
|
self.stop |= epoch >= self.epochs # stop if exceeded epochs
|
|
455
458
|
self.run_callbacks("on_fit_epoch_end")
|
|
456
|
-
|
|
457
|
-
if MACOS:
|
|
458
|
-
torch.mps.empty_cache() # clear unified memory at end of epoch, may help MPS' management of 'unlimited' virtual memoy
|
|
459
|
-
else:
|
|
460
|
-
torch.cuda.empty_cache() # clear GPU memory at end of epoch, may help reduce CUDA out of memory errors
|
|
459
|
+
self._clear_memory()
|
|
461
460
|
|
|
462
461
|
# Early Stopping
|
|
463
462
|
if RANK != -1: # if DDP training
|
|
@@ -478,14 +477,29 @@ class BaseTrainer:
|
|
|
478
477
|
if self.args.plots:
|
|
479
478
|
self.plot_metrics()
|
|
480
479
|
self.run_callbacks("on_train_end")
|
|
480
|
+
self._clear_memory()
|
|
481
|
+
self.run_callbacks("teardown")
|
|
482
|
+
|
|
483
|
+
def _get_memory(self):
|
|
484
|
+
"""Get accelerator memory utilization in GB."""
|
|
485
|
+
if self.device.type == "mps":
|
|
486
|
+
memory = torch.mps.driver_allocated_memory()
|
|
487
|
+
elif self.device.type == "cpu":
|
|
488
|
+
memory = 0
|
|
489
|
+
else:
|
|
490
|
+
memory = torch.cuda.memory_reserved()
|
|
491
|
+
return memory / 1e9
|
|
492
|
+
|
|
493
|
+
def _clear_memory(self):
|
|
494
|
+
"""Clear accelerator memory on different platforms."""
|
|
481
495
|
gc.collect()
|
|
482
|
-
if
|
|
496
|
+
if self.device.type == "mps":
|
|
483
497
|
torch.mps.empty_cache()
|
|
498
|
+
elif self.device.type == "cpu":
|
|
499
|
+
return
|
|
484
500
|
else:
|
|
485
501
|
torch.cuda.empty_cache()
|
|
486
502
|
|
|
487
|
-
self.run_callbacks("teardown")
|
|
488
|
-
|
|
489
503
|
def read_results_csv(self):
|
|
490
504
|
"""Read results.csv into a dict using pandas."""
|
|
491
505
|
import pandas as pd # scope for faster 'import ultralytics'
|
ultralytics/models/nas/val.py
CHANGED
|
@@ -450,16 +450,18 @@ class Predictor(BasePredictor):
|
|
|
450
450
|
|
|
451
451
|
results = []
|
|
452
452
|
for masks, orig_img, img_path in zip([pred_masks], orig_imgs, self.batch[0]):
|
|
453
|
-
if pred_bboxes is not None:
|
|
454
|
-
pred_bboxes = ops.scale_boxes(img.shape[2:], pred_bboxes.float(), orig_img.shape, padding=False)
|
|
455
|
-
cls = torch.arange(len(pred_masks), dtype=torch.int32, device=pred_masks.device)
|
|
456
|
-
pred_bboxes = torch.cat([pred_bboxes, pred_scores[:, None], cls[:, None]], dim=-1)
|
|
457
|
-
|
|
458
453
|
if len(masks) == 0:
|
|
459
454
|
masks = None
|
|
460
455
|
else:
|
|
461
456
|
masks = ops.scale_masks(masks[None].float(), orig_img.shape[:2], padding=False)[0]
|
|
462
457
|
masks = masks > self.model.mask_threshold # to bool
|
|
458
|
+
if pred_bboxes is not None:
|
|
459
|
+
pred_bboxes = ops.scale_boxes(img.shape[2:], pred_bboxes.float(), orig_img.shape, padding=False)
|
|
460
|
+
else:
|
|
461
|
+
pred_bboxes = batched_mask_to_box(masks)
|
|
462
|
+
# NOTE: SAM models do not return cls info. This `cls` here is just a placeholder for consistency.
|
|
463
|
+
cls = torch.arange(len(pred_masks), dtype=torch.int32, device=pred_masks.device)
|
|
464
|
+
pred_bboxes = torch.cat([pred_bboxes, pred_scores[:, None], cls[:, None]], dim=-1)
|
|
463
465
|
results.append(Results(orig_img, path=img_path, names=names, masks=masks, boxes=pred_bboxes))
|
|
464
466
|
# Reset segment-all mode.
|
|
465
467
|
self.segment_all = False
|
ultralytics/nn/tasks.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
|
2
2
|
|
|
3
3
|
import contextlib
|
|
4
|
+
import pickle
|
|
5
|
+
import types
|
|
4
6
|
from copy import deepcopy
|
|
5
7
|
from pathlib import Path
|
|
6
8
|
|
|
@@ -750,7 +752,35 @@ def temporary_modules(modules=None, attributes=None):
|
|
|
750
752
|
del sys.modules[old]
|
|
751
753
|
|
|
752
754
|
|
|
753
|
-
|
|
755
|
+
class SafeClass:
|
|
756
|
+
"""A placeholder class to replace unknown classes during unpickling."""
|
|
757
|
+
|
|
758
|
+
def __init__(self, *args, **kwargs):
|
|
759
|
+
"""Initialize SafeClass instance, ignoring all arguments."""
|
|
760
|
+
pass
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
class SafeUnpickler(pickle.Unpickler):
|
|
764
|
+
"""Custom Unpickler that replaces unknown classes with SafeClass."""
|
|
765
|
+
|
|
766
|
+
def find_class(self, module, name):
|
|
767
|
+
"""Attempt to find a class, returning SafeClass if not among safe modules."""
|
|
768
|
+
safe_modules = (
|
|
769
|
+
"torch",
|
|
770
|
+
"collections",
|
|
771
|
+
"collections.abc",
|
|
772
|
+
"builtins",
|
|
773
|
+
"math",
|
|
774
|
+
"numpy",
|
|
775
|
+
# Add other modules considered safe
|
|
776
|
+
)
|
|
777
|
+
if module in safe_modules:
|
|
778
|
+
return super().find_class(module, name)
|
|
779
|
+
else:
|
|
780
|
+
return SafeClass
|
|
781
|
+
|
|
782
|
+
|
|
783
|
+
def torch_safe_load(weight, safe_only=False):
|
|
754
784
|
"""
|
|
755
785
|
Attempts to load a PyTorch model with the torch.load() function. If a ModuleNotFoundError is raised, it catches the
|
|
756
786
|
error, logs a warning message, and attempts to install the missing module via the check_requirements() function.
|
|
@@ -758,9 +788,18 @@ def torch_safe_load(weight):
|
|
|
758
788
|
|
|
759
789
|
Args:
|
|
760
790
|
weight (str): The file path of the PyTorch model.
|
|
791
|
+
safe_only (bool): If True, replace unknown classes with SafeClass during loading.
|
|
792
|
+
|
|
793
|
+
Example:
|
|
794
|
+
```python
|
|
795
|
+
from ultralytics.nn.tasks import torch_safe_load
|
|
796
|
+
|
|
797
|
+
ckpt, file = torch_safe_load("path/to/best.pt", safe_only=True)
|
|
798
|
+
```
|
|
761
799
|
|
|
762
800
|
Returns:
|
|
763
|
-
(dict): The loaded
|
|
801
|
+
ckpt (dict): The loaded model checkpoint.
|
|
802
|
+
file (str): The loaded filename
|
|
764
803
|
"""
|
|
765
804
|
from ultralytics.utils.downloads import attempt_download_asset
|
|
766
805
|
|
|
@@ -779,7 +818,15 @@ def torch_safe_load(weight):
|
|
|
779
818
|
"ultralytics.utils.loss.v10DetectLoss": "ultralytics.utils.loss.E2EDetectLoss", # YOLOv10
|
|
780
819
|
},
|
|
781
820
|
):
|
|
782
|
-
|
|
821
|
+
if safe_only:
|
|
822
|
+
# Load via custom pickle module
|
|
823
|
+
safe_pickle = types.ModuleType("safe_pickle")
|
|
824
|
+
safe_pickle.Unpickler = SafeUnpickler
|
|
825
|
+
safe_pickle.load = lambda file_obj: SafeUnpickler(file_obj).load()
|
|
826
|
+
with open(file, "rb") as f:
|
|
827
|
+
ckpt = torch.load(f, pickle_module=safe_pickle)
|
|
828
|
+
else:
|
|
829
|
+
ckpt = torch.load(file, map_location="cpu")
|
|
783
830
|
|
|
784
831
|
except ModuleNotFoundError as e: # e.name is missing module name
|
|
785
832
|
if e.name == "models":
|
|
@@ -809,7 +856,7 @@ def torch_safe_load(weight):
|
|
|
809
856
|
)
|
|
810
857
|
ckpt = {"model": ckpt.model}
|
|
811
858
|
|
|
812
|
-
return ckpt, file
|
|
859
|
+
return ckpt, file
|
|
813
860
|
|
|
814
861
|
|
|
815
862
|
def attempt_load_weights(weights, device=None, inplace=True, fuse=False):
|
|
@@ -20,15 +20,8 @@ class QueueManager:
|
|
|
20
20
|
names,
|
|
21
21
|
reg_pts=None,
|
|
22
22
|
line_thickness=2,
|
|
23
|
-
track_thickness=2,
|
|
24
23
|
view_img=False,
|
|
25
|
-
region_color=(255, 0, 255),
|
|
26
|
-
view_queue_counts=True,
|
|
27
24
|
draw_tracks=False,
|
|
28
|
-
count_txt_color=(255, 255, 255),
|
|
29
|
-
track_color=None,
|
|
30
|
-
region_thickness=5,
|
|
31
|
-
fontsize=0.7,
|
|
32
25
|
):
|
|
33
26
|
"""
|
|
34
27
|
Initializes the QueueManager with specified parameters for tracking and counting objects.
|
|
@@ -38,57 +31,35 @@ class QueueManager:
|
|
|
38
31
|
reg_pts (list of tuples, optional): Points defining the counting region polygon. Defaults to a predefined
|
|
39
32
|
rectangle.
|
|
40
33
|
line_thickness (int, optional): Thickness of the annotation lines. Defaults to 2.
|
|
41
|
-
track_thickness (int, optional): Thickness of the track lines. Defaults to 2.
|
|
42
34
|
view_img (bool, optional): Whether to display the image frames. Defaults to False.
|
|
43
|
-
region_color (tuple, optional): Color of the counting region lines (BGR). Defaults to (255, 0, 255).
|
|
44
|
-
view_queue_counts (bool, optional): Whether to display the queue counts. Defaults to True.
|
|
45
35
|
draw_tracks (bool, optional): Whether to draw tracks of the objects. Defaults to False.
|
|
46
|
-
count_txt_color (tuple, optional): Color of the count text (BGR). Defaults to (255, 255, 255).
|
|
47
|
-
track_color (tuple, optional): Color of the tracks. If None, different colors will be used for different
|
|
48
|
-
tracks. Defaults to None.
|
|
49
|
-
region_thickness (int, optional): Thickness of the counting region lines. Defaults to 5.
|
|
50
|
-
fontsize (float, optional): Font size for the text annotations. Defaults to 0.7.
|
|
51
36
|
"""
|
|
52
|
-
# Mouse events state
|
|
53
|
-
self.is_drawing = False
|
|
54
|
-
self.selected_point = None
|
|
55
|
-
|
|
56
37
|
# Region & Line Information
|
|
57
38
|
self.reg_pts = reg_pts if reg_pts is not None else [(20, 60), (20, 680), (1120, 680), (1120, 60)]
|
|
58
39
|
self.counting_region = (
|
|
59
40
|
Polygon(self.reg_pts) if len(self.reg_pts) >= 3 else Polygon([(20, 60), (20, 680), (1120, 680), (1120, 60)])
|
|
60
41
|
)
|
|
61
|
-
self.region_color = region_color
|
|
62
|
-
self.region_thickness = region_thickness
|
|
63
42
|
|
|
64
|
-
#
|
|
65
|
-
self.im0 = None
|
|
43
|
+
# annotation Information
|
|
66
44
|
self.tf = line_thickness
|
|
67
45
|
self.view_img = view_img
|
|
68
|
-
self.view_queue_counts = view_queue_counts
|
|
69
|
-
self.fontsize = fontsize
|
|
70
46
|
|
|
71
47
|
self.names = names # Class names
|
|
72
|
-
self.annotator = None # Annotator
|
|
73
|
-
self.window_name = "Ultralytics YOLOv8 Queue Manager"
|
|
74
48
|
|
|
75
49
|
# Object counting Information
|
|
76
50
|
self.counts = 0
|
|
77
|
-
self.count_txt_color = count_txt_color
|
|
78
51
|
|
|
79
52
|
# Tracks info
|
|
80
53
|
self.track_history = defaultdict(list)
|
|
81
|
-
self.track_thickness = track_thickness
|
|
82
54
|
self.draw_tracks = draw_tracks
|
|
83
|
-
self.track_color = track_color
|
|
84
55
|
|
|
85
56
|
# Check if environment supports imshow
|
|
86
57
|
self.env_check = check_imshow(warn=True)
|
|
87
58
|
|
|
88
|
-
def extract_and_process_tracks(self, tracks):
|
|
59
|
+
def extract_and_process_tracks(self, tracks, im0):
|
|
89
60
|
"""Extracts and processes tracks for queue management in a video stream."""
|
|
90
61
|
# Initialize annotator and draw the queue region
|
|
91
|
-
|
|
62
|
+
annotator = Annotator(im0, self.tf, self.names)
|
|
92
63
|
self.counts = 0 # Reset counts every frame
|
|
93
64
|
if tracks[0].boxes.id is not None:
|
|
94
65
|
boxes = tracks[0].boxes.xyxy.cpu()
|
|
@@ -98,7 +69,7 @@ class QueueManager:
|
|
|
98
69
|
# Extract tracks
|
|
99
70
|
for box, track_id, cls in zip(boxes, track_ids, clss):
|
|
100
71
|
# Draw bounding box
|
|
101
|
-
|
|
72
|
+
annotator.box_label(box, label=self.names[cls], color=colors(int(track_id), True))
|
|
102
73
|
|
|
103
74
|
# Update track history
|
|
104
75
|
track_line = self.track_history[track_id]
|
|
@@ -108,10 +79,10 @@ class QueueManager:
|
|
|
108
79
|
|
|
109
80
|
# Draw track trails if enabled
|
|
110
81
|
if self.draw_tracks:
|
|
111
|
-
|
|
82
|
+
annotator.draw_centroid_and_tracks(
|
|
112
83
|
track_line,
|
|
113
|
-
color=
|
|
114
|
-
track_thickness=self.
|
|
84
|
+
color=colors(int(track_id), True),
|
|
85
|
+
track_thickness=self.line_thickness,
|
|
115
86
|
)
|
|
116
87
|
|
|
117
88
|
prev_position = self.track_history[track_id][-2] if len(self.track_history[track_id]) > 1 else None
|
|
@@ -125,21 +96,16 @@ class QueueManager:
|
|
|
125
96
|
# Display queue counts
|
|
126
97
|
label = f"Queue Counts : {str(self.counts)}"
|
|
127
98
|
if label is not None:
|
|
128
|
-
|
|
99
|
+
annotator.queue_counts_display(
|
|
129
100
|
label,
|
|
130
101
|
points=self.reg_pts,
|
|
131
|
-
region_color=
|
|
132
|
-
txt_color=
|
|
102
|
+
region_color=(255, 0, 255),
|
|
103
|
+
txt_color=(104, 31, 17),
|
|
133
104
|
)
|
|
134
105
|
|
|
135
|
-
self.display_frames()
|
|
136
|
-
|
|
137
|
-
def display_frames(self):
|
|
138
|
-
"""Displays the current frame with annotations."""
|
|
139
106
|
if self.env_check and self.view_img:
|
|
140
|
-
|
|
141
|
-
cv2.
|
|
142
|
-
cv2.imshow(self.window_name, self.im0)
|
|
107
|
+
annotator.draw_region(reg_pts=self.reg_pts, thickness=self.tf * 2, color=(255, 0, 255))
|
|
108
|
+
cv2.imshow("Ultralytics YOLOv8 Queue Manager", im0)
|
|
143
109
|
# Close window on 'q' key press
|
|
144
110
|
if cv2.waitKey(1) & 0xFF == ord("q"):
|
|
145
111
|
return
|
|
@@ -152,12 +118,8 @@ class QueueManager:
|
|
|
152
118
|
im0 (ndarray): Current frame from the video stream.
|
|
153
119
|
tracks (list): List of tracks obtained from the object tracking process.
|
|
154
120
|
"""
|
|
155
|
-
self.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if self.view_img:
|
|
159
|
-
self.display_frames() # Display the frame if enabled
|
|
160
|
-
return self.im0
|
|
121
|
+
self.extract_and_process_tracks(tracks, im0) # Extract and process tracks
|
|
122
|
+
return im0
|
|
161
123
|
|
|
162
124
|
|
|
163
125
|
if __name__ == "__main__":
|
|
@@ -13,7 +13,7 @@ from ultralytics.utils.plotting import Annotator, colors
|
|
|
13
13
|
class SpeedEstimator:
|
|
14
14
|
"""A class to estimate the speed of objects in a real-time video stream based on their tracks."""
|
|
15
15
|
|
|
16
|
-
def __init__(self, names, reg_pts=None, view_img=False, line_thickness=2,
|
|
16
|
+
def __init__(self, names, reg_pts=None, view_img=False, line_thickness=2, spdl_dist_thresh=10):
|
|
17
17
|
"""
|
|
18
18
|
Initializes the SpeedEstimator with the given parameters.
|
|
19
19
|
|
|
@@ -22,158 +22,94 @@ class SpeedEstimator:
|
|
|
22
22
|
reg_pts (list, optional): List of region points for speed estimation. Defaults to [(20, 400), (1260, 400)].
|
|
23
23
|
view_img (bool, optional): Whether to display the image with annotations. Defaults to False.
|
|
24
24
|
line_thickness (int, optional): Thickness of the lines for drawing boxes and tracks. Defaults to 2.
|
|
25
|
-
region_thickness (int, optional): Thickness of the region lines. Defaults to 5.
|
|
26
25
|
spdl_dist_thresh (int, optional): Distance threshold for speed calculation. Defaults to 10.
|
|
27
26
|
"""
|
|
28
|
-
# Visual & image information
|
|
29
|
-
self.im0 = None
|
|
30
|
-
self.annotator = None
|
|
31
|
-
self.view_img = view_img
|
|
32
|
-
|
|
33
27
|
# Region information
|
|
34
28
|
self.reg_pts = reg_pts if reg_pts is not None else [(20, 400), (1260, 400)]
|
|
35
|
-
|
|
29
|
+
|
|
30
|
+
self.names = names # Classes names
|
|
36
31
|
|
|
37
32
|
# Tracking information
|
|
38
|
-
self.clss = None
|
|
39
|
-
self.names = names
|
|
40
|
-
self.boxes = None
|
|
41
|
-
self.trk_ids = None
|
|
42
|
-
self.trk_pts = None
|
|
43
|
-
self.line_thickness = line_thickness
|
|
44
33
|
self.trk_history = defaultdict(list)
|
|
45
34
|
|
|
46
|
-
#
|
|
47
|
-
self.
|
|
48
|
-
self.
|
|
49
|
-
self.
|
|
50
|
-
self.
|
|
51
|
-
self.
|
|
52
|
-
self.
|
|
35
|
+
self.view_img = view_img # bool for displaying inference
|
|
36
|
+
self.tf = line_thickness # line thickness for annotator
|
|
37
|
+
self.spd = {} # set for speed data
|
|
38
|
+
self.trkd_ids = [] # list for already speed_estimated and tracked ID's
|
|
39
|
+
self.spdl = spdl_dist_thresh # Speed line distance threshold
|
|
40
|
+
self.trk_pt = {} # set for tracks previous time
|
|
41
|
+
self.trk_pp = {} # set for tracks previous point
|
|
53
42
|
|
|
54
43
|
# Check if the environment supports imshow
|
|
55
44
|
self.env_check = check_imshow(warn=True)
|
|
56
45
|
|
|
57
|
-
def
|
|
46
|
+
def estimate_speed(self, im0, tracks):
|
|
58
47
|
"""
|
|
59
|
-
|
|
48
|
+
Estimates the speed of objects based on tracking data.
|
|
60
49
|
|
|
61
50
|
Args:
|
|
51
|
+
im0 (ndarray): Image.
|
|
62
52
|
tracks (list): List of tracks obtained from the object tracking process.
|
|
63
|
-
"""
|
|
64
|
-
self.boxes = tracks[0].boxes.xyxy.cpu()
|
|
65
|
-
self.clss = tracks[0].boxes.cls.cpu().tolist()
|
|
66
|
-
self.trk_ids = tracks[0].boxes.id.int().cpu().tolist()
|
|
67
|
-
|
|
68
|
-
def store_track_info(self, track_id, box):
|
|
69
|
-
"""
|
|
70
|
-
Stores track data.
|
|
71
|
-
|
|
72
|
-
Args:
|
|
73
|
-
track_id (int): Object track id.
|
|
74
|
-
box (list): Object bounding box data.
|
|
75
53
|
|
|
76
54
|
Returns:
|
|
77
|
-
(
|
|
55
|
+
(ndarray): The image with annotated boxes and tracks.
|
|
78
56
|
"""
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
track.append(bbox_center)
|
|
57
|
+
if tracks[0].boxes.id is None:
|
|
58
|
+
return im0
|
|
82
59
|
|
|
83
|
-
|
|
84
|
-
|
|
60
|
+
boxes = tracks[0].boxes.xyxy.cpu()
|
|
61
|
+
clss = tracks[0].boxes.cls.cpu().tolist()
|
|
62
|
+
t_ids = tracks[0].boxes.id.int().cpu().tolist()
|
|
63
|
+
annotator = Annotator(im0, line_width=self.tf)
|
|
64
|
+
annotator.draw_region(reg_pts=self.reg_pts, color=(255, 0, 255), thickness=self.tf * 2)
|
|
85
65
|
|
|
86
|
-
|
|
87
|
-
|
|
66
|
+
for box, t_id, cls in zip(boxes, t_ids, clss):
|
|
67
|
+
track = self.trk_history[t_id]
|
|
68
|
+
bbox_center = (float((box[0] + box[2]) / 2), float((box[1] + box[3]) / 2))
|
|
69
|
+
track.append(bbox_center)
|
|
88
70
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
Plots track and bounding box.
|
|
71
|
+
if len(track) > 30:
|
|
72
|
+
track.pop(0)
|
|
92
73
|
|
|
93
|
-
|
|
94
|
-
track_id (int): Object track id.
|
|
95
|
-
box (list): Object bounding box data.
|
|
96
|
-
cls (str): Object class name.
|
|
97
|
-
track (list): Tracking history for drawing tracks path.
|
|
98
|
-
"""
|
|
99
|
-
speed_label = f"{int(self.dist_data[track_id])} km/h" if track_id in self.dist_data else self.names[int(cls)]
|
|
100
|
-
bbox_color = colors(int(track_id)) if track_id in self.dist_data else (255, 0, 255)
|
|
74
|
+
trk_pts = np.hstack(track).astype(np.int32).reshape((-1, 1, 2))
|
|
101
75
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
cv2.circle(self.im0, (int(track[-1][0]), int(track[-1][1])), 5, bbox_color, -1)
|
|
76
|
+
if t_id not in self.trk_pt:
|
|
77
|
+
self.trk_pt[t_id] = 0
|
|
105
78
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
Calculates the speed of an object.
|
|
79
|
+
speed_label = f"{int(self.spd[t_id])} km/h" if t_id in self.spd else self.names[int(cls)]
|
|
80
|
+
bbox_color = colors(int(t_id), True)
|
|
109
81
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
track (
|
|
113
|
-
"""
|
|
114
|
-
if not self.reg_pts[0][0] < track[-1][0] < self.reg_pts[1][0]:
|
|
115
|
-
return
|
|
116
|
-
if self.reg_pts[1][1] - self.spdl_dist_thresh < track[-1][1] < self.reg_pts[1][1] + self.spdl_dist_thresh:
|
|
117
|
-
direction = "known"
|
|
118
|
-
elif self.reg_pts[0][1] - self.spdl_dist_thresh < track[-1][1] < self.reg_pts[0][1] + self.spdl_dist_thresh:
|
|
119
|
-
direction = "known"
|
|
120
|
-
else:
|
|
121
|
-
direction = "unknown"
|
|
122
|
-
|
|
123
|
-
if self.trk_previous_times.get(trk_id) != 0 and direction != "unknown" and trk_id not in self.trk_idslist:
|
|
124
|
-
self.trk_idslist.append(trk_id)
|
|
125
|
-
|
|
126
|
-
time_difference = time() - self.trk_previous_times[trk_id]
|
|
127
|
-
if time_difference > 0:
|
|
128
|
-
dist_difference = np.abs(track[-1][1] - self.trk_previous_points[trk_id][1])
|
|
129
|
-
speed = dist_difference / time_difference
|
|
130
|
-
self.dist_data[trk_id] = speed
|
|
131
|
-
|
|
132
|
-
self.trk_previous_times[trk_id] = time()
|
|
133
|
-
self.trk_previous_points[trk_id] = track[-1]
|
|
134
|
-
|
|
135
|
-
def estimate_speed(self, im0, tracks, region_color=(255, 0, 0)):
|
|
136
|
-
"""
|
|
137
|
-
Estimates the speed of objects based on tracking data.
|
|
82
|
+
annotator.box_label(box, speed_label, bbox_color)
|
|
83
|
+
cv2.polylines(im0, [trk_pts], isClosed=False, color=bbox_color, thickness=self.tf)
|
|
84
|
+
cv2.circle(im0, (int(track[-1][0]), int(track[-1][1])), self.tf * 2, bbox_color, -1)
|
|
138
85
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
86
|
+
# Calculation of object speed
|
|
87
|
+
if not self.reg_pts[0][0] < track[-1][0] < self.reg_pts[1][0]:
|
|
88
|
+
return
|
|
89
|
+
if self.reg_pts[1][1] - self.spdl < track[-1][1] < self.reg_pts[1][1] + self.spdl:
|
|
90
|
+
direction = "known"
|
|
91
|
+
elif self.reg_pts[0][1] - self.spdl < track[-1][1] < self.reg_pts[0][1] + self.spdl:
|
|
92
|
+
direction = "known"
|
|
93
|
+
else:
|
|
94
|
+
direction = "unknown"
|
|
143
95
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
"""
|
|
147
|
-
self.im0 = im0
|
|
148
|
-
if tracks[0].boxes.id is None:
|
|
149
|
-
if self.view_img and self.env_check:
|
|
150
|
-
self.display_frames()
|
|
151
|
-
return im0
|
|
96
|
+
if self.trk_pt.get(t_id) != 0 and direction != "unknown" and t_id not in self.trkd_ids:
|
|
97
|
+
self.trkd_ids.append(t_id)
|
|
152
98
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
99
|
+
time_difference = time() - self.trk_pt[t_id]
|
|
100
|
+
if time_difference > 0:
|
|
101
|
+
self.spd[t_id] = np.abs(track[-1][1] - self.trk_pp[t_id][1]) / time_difference
|
|
156
102
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if trk_id not in self.trk_previous_times:
|
|
161
|
-
self.trk_previous_times[trk_id] = 0
|
|
162
|
-
|
|
163
|
-
self.plot_box_and_track(trk_id, box, cls, track)
|
|
164
|
-
self.calculate_speed(trk_id, track)
|
|
103
|
+
self.trk_pt[t_id] = time()
|
|
104
|
+
self.trk_pp[t_id] = track[-1]
|
|
165
105
|
|
|
166
106
|
if self.view_img and self.env_check:
|
|
167
|
-
|
|
107
|
+
cv2.imshow("Ultralytics Speed Estimation", im0)
|
|
108
|
+
if cv2.waitKey(1) & 0xFF == ord("q"):
|
|
109
|
+
return
|
|
168
110
|
|
|
169
111
|
return im0
|
|
170
112
|
|
|
171
|
-
def display_frames(self):
|
|
172
|
-
"""Displays the current frame."""
|
|
173
|
-
cv2.imshow("Ultralytics Speed Estimation", self.im0)
|
|
174
|
-
if cv2.waitKey(1) & 0xFF == ord("q"):
|
|
175
|
-
return
|
|
176
|
-
|
|
177
113
|
|
|
178
114
|
if __name__ == "__main__":
|
|
179
115
|
names = {0: "person", 1: "car"} # example class names
|
ultralytics/utils/plotting.py
CHANGED
|
@@ -20,7 +20,7 @@ from ultralytics.utils.files import increment_path
|
|
|
20
20
|
|
|
21
21
|
class Colors:
|
|
22
22
|
"""
|
|
23
|
-
Ultralytics
|
|
23
|
+
Ultralytics color palette https://docs.ultralytics.com/reference/utils/plotting/#ultralytics.utils.plotting.Colors.
|
|
24
24
|
|
|
25
25
|
This class provides methods to work with the Ultralytics color palette, including converting hex color codes to
|
|
26
26
|
RGB values.
|
|
@@ -29,6 +29,60 @@ class Colors:
|
|
|
29
29
|
palette (list of tuple): List of RGB color values.
|
|
30
30
|
n (int): The number of colors in the palette.
|
|
31
31
|
pose_palette (np.ndarray): A specific color palette array with dtype np.uint8.
|
|
32
|
+
|
|
33
|
+
## Ultralytics Color Palette
|
|
34
|
+
|
|
35
|
+
| Index | Color | HEX | RGB |
|
|
36
|
+
|-------|-------------------------------------------------------------------|-----------|-------------------|
|
|
37
|
+
| 0 | <i class="fa-solid fa-square fa-2xl" style="color: #042aff;"></i> | `#042aff` | (4, 42, 255) |
|
|
38
|
+
| 1 | <i class="fa-solid fa-square fa-2xl" style="color: #0bdbeb;"></i> | `#0bdbeb` | (11, 219, 235) |
|
|
39
|
+
| 2 | <i class="fa-solid fa-square fa-2xl" style="color: #f3f3f3;"></i> | `#f3f3f3` | (243, 243, 243) |
|
|
40
|
+
| 3 | <i class="fa-solid fa-square fa-2xl" style="color: #00dfb7;"></i> | `#00dfb7` | (0, 223, 183) |
|
|
41
|
+
| 4 | <i class="fa-solid fa-square fa-2xl" style="color: #111f68;"></i> | `#111f68` | (17, 31, 104) |
|
|
42
|
+
| 5 | <i class="fa-solid fa-square fa-2xl" style="color: #ff6fdd;"></i> | `#ff6fdd` | (255, 111, 221) |
|
|
43
|
+
| 6 | <i class="fa-solid fa-square fa-2xl" style="color: #ff444f;"></i> | `#ff444f` | (255, 68, 79) |
|
|
44
|
+
| 7 | <i class="fa-solid fa-square fa-2xl" style="color: #cced00;"></i> | `#cced00` | (204, 237, 0) |
|
|
45
|
+
| 8 | <i class="fa-solid fa-square fa-2xl" style="color: #00f344;"></i> | `#00f344` | (0, 243, 68) |
|
|
46
|
+
| 9 | <i class="fa-solid fa-square fa-2xl" style="color: #bd00ff;"></i> | `#bd00ff` | (189, 0, 255) |
|
|
47
|
+
| 10 | <i class="fa-solid fa-square fa-2xl" style="color: #00b4ff;"></i> | `#00b4ff` | (0, 180, 255) |
|
|
48
|
+
| 11 | <i class="fa-solid fa-square fa-2xl" style="color: #dd00ba;"></i> | `#dd00ba` | (221, 0, 186) |
|
|
49
|
+
| 12 | <i class="fa-solid fa-square fa-2xl" style="color: #00ffff;"></i> | `#00ffff` | (0, 255, 255) |
|
|
50
|
+
| 13 | <i class="fa-solid fa-square fa-2xl" style="color: #26c000;"></i> | `#26c000` | (38, 192, 0) |
|
|
51
|
+
| 14 | <i class="fa-solid fa-square fa-2xl" style="color: #01ffb3;"></i> | `#01ffb3` | (1, 255, 179) |
|
|
52
|
+
| 15 | <i class="fa-solid fa-square fa-2xl" style="color: #7d24ff;"></i> | `#7d24ff` | (125, 36, 255) |
|
|
53
|
+
| 16 | <i class="fa-solid fa-square fa-2xl" style="color: #7b0068;"></i> | `#7b0068` | (123, 0, 104) |
|
|
54
|
+
| 17 | <i class="fa-solid fa-square fa-2xl" style="color: #ff1b6c;"></i> | `#ff1b6c` | (255, 27, 108) |
|
|
55
|
+
| 18 | <i class="fa-solid fa-square fa-2xl" style="color: #fc6d2f;"></i> | `#fc6d2f` | (252, 109, 47) |
|
|
56
|
+
| 19 | <i class="fa-solid fa-square fa-2xl" style="color: #a2ff0b;"></i> | `#a2ff0b` | (162, 255, 11) |
|
|
57
|
+
|
|
58
|
+
## Pose Color Palette
|
|
59
|
+
|
|
60
|
+
| Index | Color | HEX | RGB |
|
|
61
|
+
|-------|-------------------------------------------------------------------|-----------|-------------------|
|
|
62
|
+
| 0 | <i class="fa-solid fa-square fa-2xl" style="color: #ff8000;"></i> | `#ff8000` | (255, 128, 0) |
|
|
63
|
+
| 1 | <i class="fa-solid fa-square fa-2xl" style="color: #ff9933;"></i> | `#ff9933` | (255, 153, 51) |
|
|
64
|
+
| 2 | <i class="fa-solid fa-square fa-2xl" style="color: #ffb266;"></i> | `#ffb266` | (255, 178, 102) |
|
|
65
|
+
| 3 | <i class="fa-solid fa-square fa-2xl" style="color: #e6e600;"></i> | `#e6e600` | (230, 230, 0) |
|
|
66
|
+
| 4 | <i class="fa-solid fa-square fa-2xl" style="color: #ff99ff;"></i> | `#ff99ff` | (255, 153, 255) |
|
|
67
|
+
| 5 | <i class="fa-solid fa-square fa-2xl" style="color: #99ccff;"></i> | `#99ccff` | (153, 204, 255) |
|
|
68
|
+
| 6 | <i class="fa-solid fa-square fa-2xl" style="color: #ff66ff;"></i> | `#ff66ff` | (255, 102, 255) |
|
|
69
|
+
| 7 | <i class="fa-solid fa-square fa-2xl" style="color: #ff33ff;"></i> | `#ff33ff` | (255, 51, 255) |
|
|
70
|
+
| 8 | <i class="fa-solid fa-square fa-2xl" style="color: #66b2ff;"></i> | `#66b2ff` | (102, 178, 255) |
|
|
71
|
+
| 9 | <i class="fa-solid fa-square fa-2xl" style="color: #3399ff;"></i> | `#3399ff` | (51, 153, 255) |
|
|
72
|
+
| 10 | <i class="fa-solid fa-square fa-2xl" style="color: #ff9999;"></i> | `#ff9999` | (255, 153, 153) |
|
|
73
|
+
| 11 | <i class="fa-solid fa-square fa-2xl" style="color: #ff6666;"></i> | `#ff6666` | (255, 102, 102) |
|
|
74
|
+
| 12 | <i class="fa-solid fa-square fa-2xl" style="color: #ff3333;"></i> | `#ff3333` | (255, 51, 51) |
|
|
75
|
+
| 13 | <i class="fa-solid fa-square fa-2xl" style="color: #99ff99;"></i> | `#99ff99` | (153, 255, 153) |
|
|
76
|
+
| 14 | <i class="fa-solid fa-square fa-2xl" style="color: #66ff66;"></i> | `#66ff66` | (102, 255, 102) |
|
|
77
|
+
| 15 | <i class="fa-solid fa-square fa-2xl" style="color: #33ff33;"></i> | `#33ff33` | (51, 255, 51) |
|
|
78
|
+
| 16 | <i class="fa-solid fa-square fa-2xl" style="color: #00ff00;"></i> | `#00ff00` | (0, 255, 0) |
|
|
79
|
+
| 17 | <i class="fa-solid fa-square fa-2xl" style="color: #0000ff;"></i> | `#0000ff` | (0, 0, 255) |
|
|
80
|
+
| 18 | <i class="fa-solid fa-square fa-2xl" style="color: #ff0000;"></i> | `#ff0000` | (255, 0, 0) |
|
|
81
|
+
| 19 | <i class="fa-solid fa-square fa-2xl" style="color: #ffffff;"></i> | `#ffffff` | (255, 255, 255) |
|
|
82
|
+
|
|
83
|
+
!!! note "Ultralytics Brand Colors"
|
|
84
|
+
|
|
85
|
+
For Ultralytics brand colors see [https://www.ultralytics.com/brand](https://www.ultralytics.com/brand). Please use the official Ultralytics colors for all marketing materials.
|
|
32
86
|
"""
|
|
33
87
|
|
|
34
88
|
def __init__(self):
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ultralytics
|
|
3
|
-
Version: 8.2.
|
|
4
|
-
Summary: Ultralytics
|
|
3
|
+
Version: 8.2.94
|
|
4
|
+
Summary: Ultralytics YOLO for SOTA object detection, multi-object tracking, instance segmentation, pose estimation and image classification.
|
|
5
5
|
Author: Glenn Jocher, Ayush Chaurasia, Jing Qiu
|
|
6
6
|
Maintainer: Glenn Jocher, Ayush Chaurasia, Jing Qiu
|
|
7
7
|
License: AGPL-3.0
|
|
8
8
|
Project-URL: Bug Reports, https://github.com/ultralytics/ultralytics/issues
|
|
9
9
|
Project-URL: Funding, https://ultralytics.com
|
|
10
10
|
Project-URL: Source, https://github.com/ultralytics/ultralytics/
|
|
11
|
-
Keywords: machine-learning,deep-learning,computer-vision,ML,DL,AI,YOLO,YOLOv3,YOLOv5,YOLOv8,HUB,Ultralytics
|
|
11
|
+
Keywords: machine-learning,deep-learning,computer-vision,ML,DL,AI,YOLO,YOLOv3,YOLOv5,YOLOv8,YOLOv9,YOLOv10,HUB,Ultralytics
|
|
12
12
|
Classifier: Development Status :: 4 - Beta
|
|
13
13
|
Classifier: Intended Audience :: Developers
|
|
14
14
|
Classifier: Intended Audience :: Education
|
|
@@ -132,7 +132,7 @@ To request an Enterprise License please complete the form at [Ultralytics Licens
|
|
|
132
132
|
|
|
133
133
|
## <div align="center">Documentation</div>
|
|
134
134
|
|
|
135
|
-
See below for a quickstart installation and usage example, and see the [YOLOv8 Docs](https://docs.ultralytics.com) for full documentation on training, validation, prediction and deployment.
|
|
135
|
+
See below for a quickstart installation and usage example, and see the [YOLOv8 Docs](https://docs.ultralytics.com/) for full documentation on training, validation, prediction and deployment.
|
|
136
136
|
|
|
137
137
|
<details open>
|
|
138
138
|
<summary>Install</summary>
|
|
@@ -145,7 +145,7 @@ Pip install the ultralytics package including all [requirements](https://github.
|
|
|
145
145
|
pip install ultralytics
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
For alternative installation methods including [Conda](https://anaconda.org/conda-forge/ultralytics), [Docker](https://hub.docker.com/r/ultralytics/ultralytics), and Git, please refer to the [Quickstart Guide](https://docs.ultralytics.com/quickstart).
|
|
148
|
+
For alternative installation methods including [Conda](https://anaconda.org/conda-forge/ultralytics), [Docker](https://hub.docker.com/r/ultralytics/ultralytics), and Git, please refer to the [Quickstart Guide](https://docs.ultralytics.com/quickstart/).
|
|
149
149
|
|
|
150
150
|
[](https://anaconda.org/conda-forge/ultralytics) [](https://hub.docker.com/r/ultralytics/ultralytics)
|
|
151
151
|
|
|
@@ -162,7 +162,7 @@ YOLOv8 may be used directly in the Command Line Interface (CLI) with a `yolo` co
|
|
|
162
162
|
yolo predict model=yolov8n.pt source='https://ultralytics.com/images/bus.jpg'
|
|
163
163
|
```
|
|
164
164
|
|
|
165
|
-
`yolo` can be used for a variety of tasks and modes and accepts additional arguments, i.e. `imgsz=640`. See the YOLOv8 [CLI Docs](https://docs.ultralytics.com/usage/cli) for examples.
|
|
165
|
+
`yolo` can be used for a variety of tasks and modes and accepts additional arguments, i.e. `imgsz=640`. See the YOLOv8 [CLI Docs](https://docs.ultralytics.com/usage/cli/) for examples.
|
|
166
166
|
|
|
167
167
|
### Python
|
|
168
168
|
|
|
@@ -182,7 +182,7 @@ results = model("https://ultralytics.com/images/bus.jpg") # predict on an image
|
|
|
182
182
|
path = model.export(format="onnx") # export the model to ONNX format
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
-
See YOLOv8 [Python Docs](https://docs.ultralytics.com/usage/python) for more examples.
|
|
185
|
+
See YOLOv8 [Python Docs](https://docs.ultralytics.com/usage/python/) for more examples.
|
|
186
186
|
|
|
187
187
|
</details>
|
|
188
188
|
|
|
@@ -201,7 +201,7 @@ Ultralytics provides interactive notebooks for YOLOv8, covering training, valida
|
|
|
201
201
|
|
|
202
202
|
## <div align="center">Models</div>
|
|
203
203
|
|
|
204
|
-
YOLOv8 [Detect](https://docs.ultralytics.com/tasks/detect), [Segment](https://docs.ultralytics.com/tasks/segment) and [Pose](https://docs.ultralytics.com/tasks/pose) models pretrained on the [COCO](https://docs.ultralytics.com/datasets/detect/coco) dataset are available here, as well as YOLOv8 [Classify](https://docs.ultralytics.com/tasks/classify) models pretrained on the [ImageNet](https://docs.ultralytics.com/datasets/classify/imagenet) dataset. [Track](https://docs.ultralytics.com/modes/track) mode is available for all Detect, Segment and Pose models.
|
|
204
|
+
YOLOv8 [Detect](https://docs.ultralytics.com/tasks/detect/), [Segment](https://docs.ultralytics.com/tasks/segment/) and [Pose](https://docs.ultralytics.com/tasks/pose/) models pretrained on the [COCO](https://docs.ultralytics.com/datasets/detect/coco/) dataset are available here, as well as YOLOv8 [Classify](https://docs.ultralytics.com/tasks/classify/) models pretrained on the [ImageNet](https://docs.ultralytics.com/datasets/classify/imagenet/) dataset. [Track](https://docs.ultralytics.com/modes/track/) mode is available for all Detect, Segment and Pose models.
|
|
205
205
|
|
|
206
206
|
<img width="1024" src="https://raw.githubusercontent.com/ultralytics/assets/main/im/banner-tasks.png" alt="Ultralytics YOLO supported tasks">
|
|
207
207
|
|
|
@@ -312,7 +312,7 @@ See [Classification Docs](https://docs.ultralytics.com/tasks/classify/) for usag
|
|
|
312
312
|
|
|
313
313
|
## <div align="center">Integrations</div>
|
|
314
314
|
|
|
315
|
-
Our key integrations with leading AI platforms extend the functionality of Ultralytics' offerings, enhancing tasks like dataset labeling, training, visualization, and model management. Discover how Ultralytics, in collaboration with [Roboflow](https://roboflow.com/?ref=ultralytics), ClearML, [Comet](https://bit.ly/yolov8-readme-comet), Neural Magic and [OpenVINO](https://docs.ultralytics.com/integrations/openvino), can optimize your AI workflow.
|
|
315
|
+
Our key integrations with leading AI platforms extend the functionality of Ultralytics' offerings, enhancing tasks like dataset labeling, training, visualization, and model management. Discover how Ultralytics, in collaboration with [Roboflow](https://roboflow.com/?ref=ultralytics), ClearML, [Comet](https://bit.ly/yolov8-readme-comet), Neural Magic and [OpenVINO](https://docs.ultralytics.com/integrations/openvino/), can optimize your AI workflow.
|
|
316
316
|
|
|
317
317
|
<br>
|
|
318
318
|
<a href="https://ultralytics.com/hub" target="_blank">
|
|
@@ -347,7 +347,7 @@ Experience seamless AI with [Ultralytics HUB](https://www.ultralytics.com/hub)
|
|
|
347
347
|
|
|
348
348
|
## <div align="center">Contribute</div>
|
|
349
349
|
|
|
350
|
-
We love your input! YOLOv5 and YOLOv8 would not be possible without help from our community. Please see our [Contributing Guide](https://docs.ultralytics.com/help/contributing) to get started, and fill out our [Survey](https://www.ultralytics.com/survey?utm_source=github&utm_medium=social&utm_campaign=Survey) to send us feedback on your experience. Thank you 🙏 to all our contributors!
|
|
350
|
+
We love your input! YOLOv5 and YOLOv8 would not be possible without help from our community. Please see our [Contributing Guide](https://docs.ultralytics.com/help/contributing/) to get started, and fill out our [Survey](https://www.ultralytics.com/survey?utm_source=github&utm_medium=social&utm_campaign=Survey) to send us feedback on your experience. Thank you 🙏 to all our contributors!
|
|
351
351
|
|
|
352
352
|
<!-- SVG image from https://opencollective.com/ultralytics/contributors.svg?width=990 -->
|
|
353
353
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
tests/__init__.py,sha256=9evx3lOdKZeY1iWXvH-FkMkgf8jLucWICoabzeD6aYg,626
|
|
2
2
|
tests/conftest.py,sha256=3ZtD4VlMKK5jVJwIPCrNAcG63vywJzdLq7U2AfYR2VI,2919
|
|
3
|
-
tests/test_cli.py,sha256=
|
|
3
|
+
tests/test_cli.py,sha256=E4lMt49TGo12Lb5CgQfpk1bwyFUZuFxF0V9j_ykV7xM,4821
|
|
4
4
|
tests/test_cuda.py,sha256=uD-ddNEcBMFQmQ9iE4fIGh0EIcGwEoDEUNVCEHicaWE,5133
|
|
5
5
|
tests/test_engine.py,sha256=xW-UT9_9xZp-7-hSnbJgMw_ezTk6NqTOIiA59XZDmxA,4934
|
|
6
6
|
tests/test_explorer.py,sha256=IMFvZ9uMoEXVC5FwdaVh0821wBgs7muVF6aw1F-auAI,2572
|
|
@@ -8,7 +8,7 @@ tests/test_exports.py,sha256=Uezf3OatpPHlo5qoPw-2kqkZxuMCF9L4XF2riD4vmII,8225
|
|
|
8
8
|
tests/test_integrations.py,sha256=xglcfMPjfVh346PV8WTpk6tBxraCXEFJEQyyJMr5tyU,6064
|
|
9
9
|
tests/test_python.py,sha256=08fg47DuJflumuUBto480-9VCqtEGAhQjNnQdcHs9_c,22242
|
|
10
10
|
tests/test_solutions.py,sha256=p_2edhl96Ty3jwzSf02Q2m2mTu9skc0Z-eMcUuuXfLg,3300
|
|
11
|
-
ultralytics/__init__.py,sha256=
|
|
11
|
+
ultralytics/__init__.py,sha256=O6sPQ_8fCEfwvfDZLx6eIevrmM_KAbE4h0FlV6oM2lg,695
|
|
12
12
|
ultralytics/assets/bus.jpg,sha256=wCAZxJecGR63Od3ZRERe9Aja1Weayrb9Ug751DS_vGM,137419
|
|
13
13
|
ultralytics/assets/zidane.jpg,sha256=Ftc4aeMmen1O0A3o6GCDO9FlfBslLpTAw0gnetx7bts,50427
|
|
14
14
|
ultralytics/cfg/__init__.py,sha256=pkB7wk0pHOA3xzKzMbS-hA0iJoPOWVNnwZJh0LuWh-w,33089
|
|
@@ -98,11 +98,11 @@ ultralytics/data/explorer/utils.py,sha256=EvvukQiQUTBrsZznmMnyEX2EqTuwZo_Geyc8yf
|
|
|
98
98
|
ultralytics/data/explorer/gui/__init__.py,sha256=mHtJuK4hwF8cuV-VHDc7tp6u6D1gHz2Z7JI8grmQDTs,42
|
|
99
99
|
ultralytics/data/explorer/gui/dash.py,sha256=vZ476NaUH4FKU08rAJ1K9WNyKtg0soMyJJxqg176yWc,10498
|
|
100
100
|
ultralytics/engine/__init__.py,sha256=mHtJuK4hwF8cuV-VHDc7tp6u6D1gHz2Z7JI8grmQDTs,42
|
|
101
|
-
ultralytics/engine/exporter.py,sha256=
|
|
101
|
+
ultralytics/engine/exporter.py,sha256=MtBFbJp3ifhn9sQXuQb7vxxOmtS_SOw7lnQhrq4H42c,57078
|
|
102
102
|
ultralytics/engine/model.py,sha256=AB9tu7kJW-QiTAp0F_J8KQJ4FijsHXcYBTaVHb7aMrg,52281
|
|
103
103
|
ultralytics/engine/predictor.py,sha256=MgMWHUJdRcVCaVmOyvdy2Gjk_EyRHv-ar0SSGxQe8F4,17471
|
|
104
104
|
ultralytics/engine/results.py,sha256=x5Ptr5uGjEz63_N1DnfDg2ktNhLqT93oPyIPruuWp6w,70986
|
|
105
|
-
ultralytics/engine/trainer.py,sha256=
|
|
105
|
+
ultralytics/engine/trainer.py,sha256=GtuAXRElX7CJ-XAQy_XqmvzzsD25SrRlViRGADKec2c,36681
|
|
106
106
|
ultralytics/engine/tuner.py,sha256=gPqDTHH7vRB2O3YyH26m1BjVKbXxuA2XAlPRzTKFZsc,11838
|
|
107
107
|
ultralytics/engine/validator.py,sha256=yaUMb5efBvgFg8M24IFlmv3J-acbbSgtqLCk-mM07Wo,14623
|
|
108
108
|
ultralytics/hub/__init__.py,sha256=AM_twjV9ouUmyxh3opoPgTqDpMOd8xIOHsAKdWS2L18,5663
|
|
@@ -119,7 +119,7 @@ ultralytics/models/fastsam/val.py,sha256=ILKmw3U8FYmmQsO9wk9-bJ9Pyp_ZthJM36b61L7
|
|
|
119
119
|
ultralytics/models/nas/__init__.py,sha256=d6-WTrYLXvbPs58ebA0-583ODi-VyzXc-t4aGIDQK6M,179
|
|
120
120
|
ultralytics/models/nas/model.py,sha256=CF1xUOrriI8lsrkrscW-XD7E0YIRn54snL_jm2EP0vk,3234
|
|
121
121
|
ultralytics/models/nas/predict.py,sha256=4KDytjWzaDMSc_jr3W3s6z6En6mwKfGP70SQXx_F2wM,2096
|
|
122
|
-
ultralytics/models/nas/val.py,sha256=
|
|
122
|
+
ultralytics/models/nas/val.py,sha256=6lt1wf8JCYO-rc0G0DjYUVDggvTAXks2eu5QnwL08S4,1695
|
|
123
123
|
ultralytics/models/rtdetr/__init__.py,sha256=AZga1C3qlGTtgpAupDW4doijq5aZlQeF8e55_DP2Uas,197
|
|
124
124
|
ultralytics/models/rtdetr/model.py,sha256=2VkppF1_581XmQ0UI7lo8fX7MqhAJPXVMr2jyMHXtbk,1988
|
|
125
125
|
ultralytics/models/rtdetr/predict.py,sha256=cxULdJAzL9RM11Y24tIguKcNJZXwynNsrWRCW-jUYEQ,3568
|
|
@@ -129,7 +129,7 @@ ultralytics/models/sam/__init__.py,sha256=o4_D6y8YJlOXIK7Lwo9RHnIJJ9xoFNi4zK99QS
|
|
|
129
129
|
ultralytics/models/sam/amg.py,sha256=GrmO_8YfIDt_QkPEMF_WFjPZkhwhf7iwx7ig8JgOUnE,8709
|
|
130
130
|
ultralytics/models/sam/build.py,sha256=zNQbrgSHUgz1gyXQwLKGTpa6CSEjeaevcP3w1Z1l3mo,12233
|
|
131
131
|
ultralytics/models/sam/model.py,sha256=2KFUp8SHiqOgwUjkdqdau0oduJwKQxm4N9GHWjdhUFo,7382
|
|
132
|
-
ultralytics/models/sam/predict.py,sha256=
|
|
132
|
+
ultralytics/models/sam/predict.py,sha256=unsoNrEx6pexKD28-HTpALa02PtNtE4e2ERdzs9qbYw,38556
|
|
133
133
|
ultralytics/models/sam/modules/__init__.py,sha256=mHtJuK4hwF8cuV-VHDc7tp6u6D1gHz2Z7JI8grmQDTs,42
|
|
134
134
|
ultralytics/models/sam/modules/blocks.py,sha256=Q-KwhFbdyZhl1tjG_kP2LcQkZbzoNt618i-NRrKNx2Y,45919
|
|
135
135
|
ultralytics/models/sam/modules/decoders.py,sha256=mODsqnTN_CjE3H0Sh9cd8PfTnHANPjGB1bjqHxfezSg,25830
|
|
@@ -155,21 +155,21 @@ ultralytics/models/yolo/detect/val.py,sha256=Na1y94GLfF72-9Jj6uNtPk_CCpLpNPmoMVg
|
|
|
155
155
|
ultralytics/models/yolo/obb/__init__.py,sha256=txWbPGLY1_M7ZwlLQjrwGjTBOlsv9P3yk5ZEgysTinU,193
|
|
156
156
|
ultralytics/models/yolo/obb/predict.py,sha256=VxpKCKV5dWnOr0GyV1rJGH5SzzRouCYW_8T26xJ8MU8,2037
|
|
157
157
|
ultralytics/models/yolo/obb/train.py,sha256=_FVYCvHJ5ECi2aN8k7AmVLxRUuun7acSqwWtCBRuL6Q,1473
|
|
158
|
-
ultralytics/models/yolo/obb/val.py,sha256=
|
|
158
|
+
ultralytics/models/yolo/obb/val.py,sha256=dgKJnGKfdBpYMXsM1_MN2chONd2O6E3hEnITuTXw82U,9329
|
|
159
159
|
ultralytics/models/yolo/pose/__init__.py,sha256=OGvxN3LqJot2h8GX1csJ1KErsHnDKsm33Ce6ZBU9Lr4,199
|
|
160
160
|
ultralytics/models/yolo/pose/predict.py,sha256=cpTe4vTI3etnGCgyMcvxbF0cMNetiWXUwhsipEFX-KQ,2365
|
|
161
161
|
ultralytics/models/yolo/pose/train.py,sha256=mUC1GaYmRBTvXQsL-uNdcdANoIXdeGGBRdgOKkqRIRI,2926
|
|
162
|
-
ultralytics/models/yolo/pose/val.py,sha256=
|
|
162
|
+
ultralytics/models/yolo/pose/val.py,sha256=4SIfHioPZL2QVhhvFEibir0bAzvIhykswKc1Kl5GbwA,12390
|
|
163
163
|
ultralytics/models/yolo/segment/__init__.py,sha256=mSbKOE8BnHL7PL2nCOVG7dRM7CI6hJezFPPwZFjEmy8,247
|
|
164
164
|
ultralytics/models/yolo/segment/predict.py,sha256=UAzSIc7xlZKr9PVMWS63X4ySUg9QmMh8tHtdfd7D-nk,2468
|
|
165
165
|
ultralytics/models/yolo/segment/train.py,sha256=UTGGSInq_yuQuNm0wdrVruyiGe04fAZv5v1WMqQl9Ys,2298
|
|
166
|
-
ultralytics/models/yolo/segment/val.py,sha256=
|
|
166
|
+
ultralytics/models/yolo/segment/val.py,sha256=qqvhdFEjoj5uXW8Mz3FTDpxO7vkrTsTRH7doGMNuGK8,14060
|
|
167
167
|
ultralytics/models/yolo/world/__init__.py,sha256=3VTH0q4NOt2EWRom15yCymvmvm0Etp2bmETJUhsVTBI,103
|
|
168
168
|
ultralytics/models/yolo/world/train.py,sha256=gaDrAmLJpg9qDtmL5evA5HsV2yb4RTRSfk2EDYrHdRg,3686
|
|
169
169
|
ultralytics/models/yolo/world/train_world.py,sha256=IsnCEVt6DcM9lUskCKmIN-M8MM79xLpwTRqRoAHUnZ4,4857
|
|
170
170
|
ultralytics/nn/__init__.py,sha256=4BPLHY89xEM_al5uK0aOmFgiML6CMGEZbezxOvTjOEs,587
|
|
171
171
|
ultralytics/nn/autobackend.py,sha256=DZTIHsp2PLs8H2-oQR9LqA-uPj8DARGonCXzRv2Pkdc,31546
|
|
172
|
-
ultralytics/nn/tasks.py,sha256=
|
|
172
|
+
ultralytics/nn/tasks.py,sha256=GbRUqOmLS6wTB2U6Z3IojXE96jCrs33vrCwVGxmD_34,47777
|
|
173
173
|
ultralytics/nn/modules/__init__.py,sha256=m8x-XRHVLWMECPeysVlv1TQenV-n8oAbK1gxnoXzLpk,2553
|
|
174
174
|
ultralytics/nn/modules/activation.py,sha256=chhn469wnRHEs5BMGNBYXwPYZc_7-urspTT8fnBd-xA,895
|
|
175
175
|
ultralytics/nn/modules/block.py,sha256=n6Xhevz8_n05UCt_vmZ7eVRiDbA_zV_TvWNBbpZe-qA,34352
|
|
@@ -184,8 +184,8 @@ ultralytics/solutions/distance_calculation.py,sha256=o_DAHk4JX8n2Vt7E68MX67mREOB
|
|
|
184
184
|
ultralytics/solutions/heatmap.py,sha256=oEVivA4KAK6z0wA5Ca_a2qTckQN8tCt9MCpsPREeNnk,10375
|
|
185
185
|
ultralytics/solutions/object_counter.py,sha256=QXSg2a5IBW70lirIKml8xNgPDyzUy7dLt2gUn59_18A,9941
|
|
186
186
|
ultralytics/solutions/parking_management.py,sha256=z0-g2nehh4aA1nO71foT8Rw5pQTxKnEdcKJb1Arrd0Q,10134
|
|
187
|
-
ultralytics/solutions/queue_management.py,sha256=
|
|
188
|
-
ultralytics/solutions/speed_estimation.py,sha256=
|
|
187
|
+
ultralytics/solutions/queue_management.py,sha256=yKPGc2-fN-lMpNddkxjN7xYGIJwMdoU-VIDRxQ1KPow,4869
|
|
188
|
+
ultralytics/solutions/speed_estimation.py,sha256=c9OPGpDU9x6Dj4SobNc-sO90EZTPTGeKkW5u6C6Zj7g,4623
|
|
189
189
|
ultralytics/solutions/streamlit_inference.py,sha256=MKf5P3O5oJwIKu2h_URvzaQjMWoSEMDMBwordplfRxo,5703
|
|
190
190
|
ultralytics/trackers/__init__.py,sha256=j72IgH2dZHQArMPK4YwcV5ieIw94fYvlGdQjB9cOQKw,227
|
|
191
191
|
ultralytics/trackers/basetrack.py,sha256=dXnXW3cxxd7lPm20JJCNO2voCIrQ4vhbNI1g4YEgn-Y,4423
|
|
@@ -209,7 +209,7 @@ ultralytics/utils/loss.py,sha256=mDHGmF-gjggAUVhI1dkCm7TtfZHCwz25XKm4M2xJKLs,339
|
|
|
209
209
|
ultralytics/utils/metrics.py,sha256=UgLGudWp57uXDMlMUJy4gsz6cfVjcq7tYmHeto3TqvM,53927
|
|
210
210
|
ultralytics/utils/ops.py,sha256=dsXNdyrYx_p6io6zezig9p84dxS7U-10vceHNVu2IL0,32888
|
|
211
211
|
ultralytics/utils/patches.py,sha256=Oo3DkP7MbXnNGvPfoFSocAkVvaPh9kwMT_9RQUfjVhI,3594
|
|
212
|
-
ultralytics/utils/plotting.py,sha256=
|
|
212
|
+
ultralytics/utils/plotting.py,sha256=bud5mAvFxQ2JD29dReaO4c7Z00k6jIaPJJCznIoyy2w,61543
|
|
213
213
|
ultralytics/utils/tal.py,sha256=ECsu95xEqOItmxMDN4YTD3FsUiIsQNWy0pZC3TfvFfk,16877
|
|
214
214
|
ultralytics/utils/torch_utils.py,sha256=NgZtDgjQkAVCAqCdFrFMSU9Fl_x3pYqaYa1mhAvOb_8,29312
|
|
215
215
|
ultralytics/utils/triton.py,sha256=gg1finxno_tY2Ge9PMhmu7PI9wvoFZoiicdT4Bhqv3w,3936
|
|
@@ -225,9 +225,9 @@ ultralytics/utils/callbacks/neptune.py,sha256=5Z3ua5YBTUS56FH8VQKQG1aaIo9fH8GEyz
|
|
|
225
225
|
ultralytics/utils/callbacks/raytune.py,sha256=ODVYzy-CoM4Uge0zjkh3Hnh9nF2M0vhDrSenXnvcizw,705
|
|
226
226
|
ultralytics/utils/callbacks/tensorboard.py,sha256=0kn4IR10no99UCIheojWRujgybmUHSx5fPI6Vsq6l_g,4135
|
|
227
227
|
ultralytics/utils/callbacks/wb.py,sha256=9-fjQIdLjr3b73DTE3rHO171KvbH1VweJ-bmbv-rqTw,6747
|
|
228
|
-
ultralytics-8.2.
|
|
229
|
-
ultralytics-8.2.
|
|
230
|
-
ultralytics-8.2.
|
|
231
|
-
ultralytics-8.2.
|
|
232
|
-
ultralytics-8.2.
|
|
233
|
-
ultralytics-8.2.
|
|
228
|
+
ultralytics-8.2.94.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
|
229
|
+
ultralytics-8.2.94.dist-info/METADATA,sha256=tqncGrC7zri313tqgv5vjcUWYKeUYHhlWpPCXMtxIO0,41897
|
|
230
|
+
ultralytics-8.2.94.dist-info/WHEEL,sha256=5Mi1sN9lKoFv_gxcPtisEVrJZihrm_beibeg5R6xb4I,91
|
|
231
|
+
ultralytics-8.2.94.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
|
|
232
|
+
ultralytics-8.2.94.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
|
|
233
|
+
ultralytics-8.2.94.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|