ultralytics 8.3.51__py3-none-any.whl → 8.3.52__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/solutions/default.yaml +16 -16
- ultralytics/utils/ops.py +7 -2
- ultralytics/utils/torch_utils.py +47 -17
- {ultralytics-8.3.51.dist-info → ultralytics-8.3.52.dist-info}/METADATA +1 -1
- {ultralytics-8.3.51.dist-info → ultralytics-8.3.52.dist-info}/RECORD +10 -10
- {ultralytics-8.3.51.dist-info → ultralytics-8.3.52.dist-info}/LICENSE +0 -0
- {ultralytics-8.3.51.dist-info → ultralytics-8.3.52.dist-info}/WHEEL +0 -0
- {ultralytics-8.3.51.dist-info → ultralytics-8.3.52.dist-info}/entry_points.txt +0 -0
- {ultralytics-8.3.51.dist-info → ultralytics-8.3.52.dist-info}/top_level.txt +0 -0
ultralytics/__init__.py
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
2
|
-
# Configuration for Ultralytics Solutions
|
2
|
+
# Configuration for Ultralytics Solutions: https://docs.ultralytics.com/solutions/
|
3
3
|
|
4
|
-
# Object counting settings
|
5
|
-
region: #
|
6
|
-
show_in: True #
|
7
|
-
show_out: True #
|
4
|
+
# Object counting settings --------------------------------------------------------------------------------------------
|
5
|
+
region: # list[tuple[int, int]] object counting, queue or speed estimation region points.
|
6
|
+
show_in: True # (bool) flag to display objects moving *into* the defined region
|
7
|
+
show_out: True # (bool) flag to display objects moving *out of* the defined region
|
8
8
|
|
9
|
-
# Heatmaps settings
|
10
|
-
colormap: #
|
9
|
+
# Heatmaps settings ----------------------------------------------------------------------------------------------------
|
10
|
+
colormap: # (int | str) colormap for heatmap, Only OPENCV supported colormaps can be used.
|
11
11
|
|
12
|
-
# Workouts monitoring settings
|
13
|
-
up_angle: 145.0 # Workouts up_angle for counts, 145.0 is default value.
|
14
|
-
down_angle: 90 # Workouts down_angle for counts, 90 is default value.
|
15
|
-
kpts: [6, 8, 10] #
|
12
|
+
# Workouts monitoring settings -----------------------------------------------------------------------------------------
|
13
|
+
up_angle: 145.0 # (float) Workouts up_angle for counts, 145.0 is default value.
|
14
|
+
down_angle: 90 # (float) Workouts down_angle for counts, 90 is default value. Y
|
15
|
+
kpts: [6, 8, 10] # (list[int]) keypoints for workouts monitoring, i.e. for pushups kpts have values of [6, 8, 10].
|
16
16
|
|
17
|
-
# Analytics settings
|
18
|
-
analytics_type: "line" #
|
19
|
-
json_file: # parking system regions file path.
|
17
|
+
# Analytics settings ---------------------------------------------------------------------------------------------------
|
18
|
+
analytics_type: "line" # (str) analytics type i.e "line", "pie", "bar" or "area" charts.
|
19
|
+
json_file: # (str) parking system regions file path.
|
20
20
|
|
21
|
-
# Security alarm system
|
22
|
-
records: 5 # Total detections count to send an email about security
|
21
|
+
# Security alarm system settings ---------------------------------------------------------------------------------------
|
22
|
+
records: 5 # (int) Total detections count to send an email about security
|
ultralytics/utils/ops.py
CHANGED
@@ -75,8 +75,13 @@ def segment2box(segment, width=640, height=640):
|
|
75
75
|
(np.ndarray): the minimum and maximum x and y values of the segment.
|
76
76
|
"""
|
77
77
|
x, y = segment.T # segment xy
|
78
|
-
|
79
|
-
|
78
|
+
# any 3 out of 4 sides are outside the image, clip coordinates first, https://github.com/ultralytics/ultralytics/pull/18294
|
79
|
+
if np.array([x.min() < 0, y.min() < 0, x.max() > width, y.max() > height]).sum() >= 3:
|
80
|
+
x = x.clip(0, width)
|
81
|
+
y = y.clip(0, height)
|
82
|
+
inside = (x >= 0) & (y >= 0) & (x <= width) & (y <= height)
|
83
|
+
x = x[inside]
|
84
|
+
y = y[inside]
|
80
85
|
return (
|
81
86
|
np.array([x.min(), y.min(), x.max(), y.max()], dtype=segment.dtype)
|
82
87
|
if any(x)
|
ultralytics/utils/torch_utils.py
CHANGED
@@ -617,6 +617,32 @@ def convert_optimizer_state_dict_to_fp16(state_dict):
|
|
617
617
|
return state_dict
|
618
618
|
|
619
619
|
|
620
|
+
@contextmanager
|
621
|
+
def cuda_memory_usage(device=None):
|
622
|
+
"""
|
623
|
+
Monitor and manage CUDA memory usage.
|
624
|
+
|
625
|
+
This function checks if CUDA is available and, if so, empties the CUDA cache to free up unused memory.
|
626
|
+
It then yields a dictionary containing memory usage information, which can be updated by the caller.
|
627
|
+
Finally, it updates the dictionary with the amount of memory reserved by CUDA on the specified device.
|
628
|
+
|
629
|
+
Args:
|
630
|
+
device (torch.device, optional): The CUDA device to query memory usage for. Defaults to None.
|
631
|
+
|
632
|
+
Yields:
|
633
|
+
(dict): A dictionary with a key 'memory' initialized to 0, which will be updated with the reserved memory.
|
634
|
+
"""
|
635
|
+
cuda_info = dict(memory=0)
|
636
|
+
if torch.cuda.is_available():
|
637
|
+
torch.cuda.empty_cache()
|
638
|
+
try:
|
639
|
+
yield cuda_info
|
640
|
+
finally:
|
641
|
+
cuda_info["memory"] = torch.cuda.memory_reserved(device)
|
642
|
+
else:
|
643
|
+
yield cuda_info
|
644
|
+
|
645
|
+
|
620
646
|
def profile(input, ops, n=10, device=None, max_num_obj=0):
|
621
647
|
"""
|
622
648
|
Ultralytics speed, memory and FLOPs profiler.
|
@@ -653,27 +679,31 @@ def profile(input, ops, n=10, device=None, max_num_obj=0):
|
|
653
679
|
flops = 0
|
654
680
|
|
655
681
|
try:
|
682
|
+
mem = 0
|
656
683
|
for _ in range(n):
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
684
|
+
with cuda_memory_usage(device) as cuda_info:
|
685
|
+
t[0] = time_sync()
|
686
|
+
y = m(x)
|
687
|
+
t[1] = time_sync()
|
688
|
+
try:
|
689
|
+
(sum(yi.sum() for yi in y) if isinstance(y, list) else y).sum().backward()
|
690
|
+
t[2] = time_sync()
|
691
|
+
except Exception: # no backward method
|
692
|
+
# print(e) # for debug
|
693
|
+
t[2] = float("nan")
|
694
|
+
mem += cuda_info["memory"] / 1e9 # (GB)
|
666
695
|
tf += (t[1] - t[0]) * 1000 / n # ms per op forward
|
667
696
|
tb += (t[2] - t[1]) * 1000 / n # ms per op backward
|
668
697
|
if max_num_obj: # simulate training with predictions per image grid (for AutoBatch)
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
698
|
+
with cuda_memory_usage(device) as cuda_info:
|
699
|
+
torch.randn(
|
700
|
+
x.shape[0],
|
701
|
+
max_num_obj,
|
702
|
+
int(sum((x.shape[-1] / s) * (x.shape[-2] / s) for s in m.stride.tolist())),
|
703
|
+
device=device,
|
704
|
+
dtype=torch.float32,
|
705
|
+
)
|
706
|
+
mem += cuda_info["memory"] / 1e9 # (GB)
|
677
707
|
s_in, s_out = (tuple(x.shape) if isinstance(x, torch.Tensor) else "list" for x in (x, y)) # shapes
|
678
708
|
p = sum(x.numel() for x in m.parameters()) if isinstance(m, nn.Module) else 0 # parameters
|
679
709
|
LOGGER.info(f"{p:12}{flops:12.4g}{mem:>14.3f}{tf:14.4g}{tb:14.4g}{str(s_in):>24s}{str(s_out):>24s}")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ultralytics
|
3
|
-
Version: 8.3.
|
3
|
+
Version: 8.3.52
|
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>
|
@@ -7,7 +7,7 @@ tests/test_exports.py,sha256=1MvhcQ2qHdbJImHII-bFarcaIcm-kPlEK-OdFLxnj7o,8769
|
|
7
7
|
tests/test_integrations.py,sha256=f5-QCUk1SU_-qn4mBCZwS3GN3tXEBIIXo4z2EhExbHw,6126
|
8
8
|
tests/test_python.py,sha256=IfHAXqilpYxWNmIE6rAWWUSeIYS6SBO9AkXGHDGZTvA,23182
|
9
9
|
tests/test_solutions.py,sha256=HlDe-XOgBX0k1cLhRTAhhawMHk6p-5dg5xl2AIRjfdk,3790
|
10
|
-
ultralytics/__init__.py,sha256=
|
10
|
+
ultralytics/__init__.py,sha256=9xVAPKMeVftp5ChRMlvZq2qpKp10c_gHCn79ueAb94k,681
|
11
11
|
ultralytics/assets/bus.jpg,sha256=wCAZxJecGR63Od3ZRERe9Aja1Weayrb9Ug751DS_vGM,137419
|
12
12
|
ultralytics/assets/zidane.jpg,sha256=Ftc4aeMmen1O0A3o6GCDO9FlfBslLpTAw0gnetx7bts,50427
|
13
13
|
ultralytics/cfg/__init__.py,sha256=etGrRb8t9r6R-n-00qFAmOZHXNriXEUe0zvEzCPi5oc,38921
|
@@ -86,7 +86,7 @@ ultralytics/cfg/models/v9/yolov9e.yaml,sha256=dhaR47WxuLOrZWDCceS4bQG00sQdrMc8FQ
|
|
86
86
|
ultralytics/cfg/models/v9/yolov9m.yaml,sha256=l6CmivzNu44sRVmkQXk4-tXflbV1nWnk5MSc8su2vhs,1311
|
87
87
|
ultralytics/cfg/models/v9/yolov9s.yaml,sha256=lPWcu-6ub1kCBD6zIDFwthYZ3RvdJfODWKy3vEQWRjo,1291
|
88
88
|
ultralytics/cfg/models/v9/yolov9t.yaml,sha256=qL__kr6GoefpQWP4jV0jdzwTp46bdFUcqtPRnfDbkY8,1275
|
89
|
-
ultralytics/cfg/solutions/default.yaml,sha256=
|
89
|
+
ultralytics/cfg/solutions/default.yaml,sha256=fPZqt9hYLEmFrjlujsNI3IPKcl5YJk-R2mQPHRkqfyQ,1571
|
90
90
|
ultralytics/cfg/trackers/botsort.yaml,sha256=FDIrZ3hAhRtMfDl654pt1HIexmPqlFQK-3lQ4D0tF84,918
|
91
91
|
ultralytics/cfg/trackers/bytetrack.yaml,sha256=rBWY4RjjX6PTO2o6TUJFYHVgXNZHCN5TuBuzwuPYVjA,723
|
92
92
|
ultralytics/data/__init__.py,sha256=VGe-ATG7j35F4A4r8Jmzffjlhve4JAJPgRa5ahKTU18,616
|
@@ -213,11 +213,11 @@ ultralytics/utils/files.py,sha256=uiXQSVABJRoI5ImnM6ndEBIFbECfksmWNEldBg8GnSo,82
|
|
213
213
|
ultralytics/utils/instance.py,sha256=NuTLa_XoqgmWNhxQ2JuflT22UAmEmv0UWd5BZXCjSNM,16841
|
214
214
|
ultralytics/utils/loss.py,sha256=_d2L4lIemaeAHrGHqf9q-KI7yTgHKCbIcYAF7Y-farI,34185
|
215
215
|
ultralytics/utils/metrics.py,sha256=toJlyA0W-xtChqAtIDiHISolxc_30NP33ezxWQ1rnPc,53804
|
216
|
-
ultralytics/utils/ops.py,sha256=
|
216
|
+
ultralytics/utils/ops.py,sha256=d5sLAvgqP36Pq_dMQE1DZFYhmIGUMrlrxh1czcuUfC4,33546
|
217
217
|
ultralytics/utils/patches.py,sha256=J-iOwIRbfUs-inBZerhnXby5tUKjYcOIyvhLTS352JE,3270
|
218
218
|
ultralytics/utils/plotting.py,sha256=GmBkN7e1skJK2cZ2hzKBXQCb1gayWTrA9TLHw0q07UM,62948
|
219
219
|
ultralytics/utils/tal.py,sha256=thD_AEhVmhaZqmS5szZMvpKO-RKOeZwfX1BYAhdnA0o,18470
|
220
|
-
ultralytics/utils/torch_utils.py,sha256=
|
220
|
+
ultralytics/utils/torch_utils.py,sha256=7qP0YhF5d8qCUD2XiOwXjCTOw8pje6HvX42J8oL3Ldw,33263
|
221
221
|
ultralytics/utils/triton.py,sha256=HL_gjIwMoi-WD8gJLTmemBehIto8eRz3HdK8fcROLk0,4043
|
222
222
|
ultralytics/utils/tuner.py,sha256=K09-z5k1E4ZriSKoWdwQrJ2PJ2fY1ez3-b2R6aKPTqM,6198
|
223
223
|
ultralytics/utils/callbacks/__init__.py,sha256=YrWqC3BVVaTLob4iCPR6I36mUxIUOpPJW7B_LjT78Qw,214
|
@@ -231,9 +231,9 @@ ultralytics/utils/callbacks/neptune.py,sha256=IbGQfEltamUKXJt93uSLQFn8c2rYh3DMTg
|
|
231
231
|
ultralytics/utils/callbacks/raytune.py,sha256=Ck_yFzg7UZXiDWrLHaltjQybzVWSFDfzpdrx9ZYTRfI,700
|
232
232
|
ultralytics/utils/callbacks/tensorboard.py,sha256=SHlE58Fb-sg-uZKtgy-ybIO3SAIfK55aj8kTYGA0Cyg,4167
|
233
233
|
ultralytics/utils/callbacks/wb.py,sha256=sizfTa-xI9k2pnDSP_Q9pHZEFwcl__gSFM0AcneuRpY,7058
|
234
|
-
ultralytics-8.3.
|
235
|
-
ultralytics-8.3.
|
236
|
-
ultralytics-8.3.
|
237
|
-
ultralytics-8.3.
|
238
|
-
ultralytics-8.3.
|
239
|
-
ultralytics-8.3.
|
234
|
+
ultralytics-8.3.52.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
235
|
+
ultralytics-8.3.52.dist-info/METADATA,sha256=GPMy_ZHGlZ6GSbN5zrW6QbJKiX_purHRkwNvc0T00-k,35332
|
236
|
+
ultralytics-8.3.52.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
237
|
+
ultralytics-8.3.52.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
|
238
|
+
ultralytics-8.3.52.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
|
239
|
+
ultralytics-8.3.52.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|