ultralytics 8.3.32__py3-none-any.whl → 8.3.33__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/engine/exporter.py +0 -3
- ultralytics/solutions/object_counter.py +48 -28
- ultralytics/utils/benchmarks.py +0 -2
- {ultralytics-8.3.32.dist-info → ultralytics-8.3.33.dist-info}/METADATA +1 -1
- {ultralytics-8.3.32.dist-info → ultralytics-8.3.33.dist-info}/RECORD +10 -10
- {ultralytics-8.3.32.dist-info → ultralytics-8.3.33.dist-info}/LICENSE +0 -0
- {ultralytics-8.3.32.dist-info → ultralytics-8.3.33.dist-info}/WHEEL +0 -0
- {ultralytics-8.3.32.dist-info → ultralytics-8.3.33.dist-info}/entry_points.txt +0 -0
- {ultralytics-8.3.32.dist-info → ultralytics-8.3.33.dist-info}/top_level.txt +0 -0
ultralytics/__init__.py
CHANGED
ultralytics/engine/exporter.py
CHANGED
@@ -79,7 +79,6 @@ from ultralytics.utils import (
|
|
79
79
|
ARM64,
|
80
80
|
DEFAULT_CFG,
|
81
81
|
IS_JETSON,
|
82
|
-
IS_RASPBERRYPI,
|
83
82
|
LINUX,
|
84
83
|
LOGGER,
|
85
84
|
MACOS,
|
@@ -265,8 +264,6 @@ class Exporter:
|
|
265
264
|
"WARNING ⚠️ INT8 export requires a missing 'data' arg for calibration. "
|
266
265
|
f"Using default 'data={self.args.data}'."
|
267
266
|
)
|
268
|
-
if mnn and (IS_RASPBERRYPI or IS_JETSON):
|
269
|
-
raise SystemError("MNN export not supported on Raspberry Pi and NVIDIA Jetson")
|
270
267
|
|
271
268
|
# Input
|
272
269
|
im = torch.zeros(self.args.batch, 3, *self.imgsz).to(self.device)
|
@@ -46,13 +46,12 @@ class ObjectCounter(BaseSolution):
|
|
46
46
|
self.show_in = self.CFG["show_in"]
|
47
47
|
self.show_out = self.CFG["show_out"]
|
48
48
|
|
49
|
-
def count_objects(self,
|
49
|
+
def count_objects(self, current_centroid, track_id, prev_position, cls):
|
50
50
|
"""
|
51
51
|
Counts objects within a polygonal or linear region based on their tracks.
|
52
52
|
|
53
53
|
Args:
|
54
|
-
|
55
|
-
box (List[float]): Bounding box coordinates [x1, y1, x2, y2] for the specific track in the current frame.
|
54
|
+
current_centroid (Tuple[float, float]): Current centroid values in the current frame.
|
56
55
|
track_id (int): Unique identifier for the tracked object.
|
57
56
|
prev_position (Tuple[float, float]): Last frame position coordinates (x, y) of the track.
|
58
57
|
cls (int): Class index for classwise count updates.
|
@@ -69,29 +68,50 @@ class ObjectCounter(BaseSolution):
|
|
69
68
|
if prev_position is None or track_id in self.counted_ids:
|
70
69
|
return
|
71
70
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
71
|
+
if len(self.region) == 2: # Linear region (defined as a line segment)
|
72
|
+
line = self.LineString(self.region) # Check if the line intersects the trajectory of the object
|
73
|
+
if line.intersects(self.LineString([prev_position, current_centroid])):
|
74
|
+
# Determine orientation of the region (vertical or horizontal)
|
75
|
+
if abs(self.region[0][0] - self.region[1][0]) < abs(self.region[0][1] - self.region[1][1]):
|
76
|
+
# Vertical region: Compare x-coordinates to determine direction
|
77
|
+
if current_centroid[0] > prev_position[0]: # Moving right
|
78
|
+
self.in_count += 1
|
79
|
+
self.classwise_counts[self.names[cls]]["IN"] += 1
|
80
|
+
else: # Moving left
|
81
|
+
self.out_count += 1
|
82
|
+
self.classwise_counts[self.names[cls]]["OUT"] += 1
|
83
|
+
else:
|
84
|
+
# Horizontal region: Compare y-coordinates to determine direction
|
85
|
+
if current_centroid[1] > prev_position[1]: # Moving downward
|
86
|
+
self.in_count += 1
|
87
|
+
self.classwise_counts[self.names[cls]]["IN"] += 1
|
88
|
+
else: # Moving upward
|
89
|
+
self.out_count += 1
|
90
|
+
self.classwise_counts[self.names[cls]]["OUT"] += 1
|
91
|
+
self.counted_ids.append(track_id)
|
92
|
+
|
93
|
+
elif len(self.region) > 2: # Polygonal region
|
94
|
+
polygon = self.Polygon(self.region)
|
95
|
+
if polygon.contains(self.Point(current_centroid)):
|
96
|
+
# Determine motion direction for vertical or horizontal polygons
|
97
|
+
region_width = max([p[0] for p in self.region]) - min([p[0] for p in self.region])
|
98
|
+
region_height = max([p[1] for p in self.region]) - min([p[1] for p in self.region])
|
99
|
+
|
100
|
+
if region_width < region_height: # Vertical-oriented polygon
|
101
|
+
if current_centroid[0] > prev_position[0]: # Moving right
|
102
|
+
self.in_count += 1
|
103
|
+
self.classwise_counts[self.names[cls]]["IN"] += 1
|
104
|
+
else: # Moving left
|
105
|
+
self.out_count += 1
|
106
|
+
self.classwise_counts[self.names[cls]]["OUT"] += 1
|
107
|
+
else: # Horizontal-oriented polygon
|
108
|
+
if current_centroid[1] > prev_position[1]: # Moving downward
|
109
|
+
self.in_count += 1
|
110
|
+
self.classwise_counts[self.names[cls]]["IN"] += 1
|
111
|
+
else: # Moving upward
|
112
|
+
self.out_count += 1
|
113
|
+
self.classwise_counts[self.names[cls]]["OUT"] += 1
|
114
|
+
self.counted_ids.append(track_id)
|
95
115
|
|
96
116
|
def store_classwise_counts(self, cls):
|
97
117
|
"""
|
@@ -174,12 +194,12 @@ class ObjectCounter(BaseSolution):
|
|
174
194
|
self.annotator.draw_centroid_and_tracks(
|
175
195
|
self.track_line, color=colors(int(cls), True), track_thickness=self.line_width
|
176
196
|
)
|
177
|
-
|
197
|
+
current_centroid = ((box[0] + box[2]) / 2, (box[1] + box[3]) / 2)
|
178
198
|
# store previous position of track for object counting
|
179
199
|
prev_position = None
|
180
200
|
if len(self.track_history[track_id]) > 1:
|
181
201
|
prev_position = self.track_history[track_id][-2]
|
182
|
-
self.count_objects(
|
202
|
+
self.count_objects(current_centroid, track_id, prev_position, cls) # Perform object counting
|
183
203
|
|
184
204
|
self.display_counts(im0) # Display the counts on the frame
|
185
205
|
self.display_output(im0) # display output with base class function
|
ultralytics/utils/benchmarks.py
CHANGED
@@ -114,8 +114,6 @@ def benchmark(
|
|
114
114
|
assert LINUX or MACOS, "Windows Paddle exports not supported yet"
|
115
115
|
if i == 12: # MNN
|
116
116
|
assert not isinstance(model, YOLOWorld), "YOLOWorldv2 MNN exports not supported yet"
|
117
|
-
assert not IS_RASPBERRYPI, "MNN export not supported on Raspberry Pi"
|
118
|
-
assert not IS_JETSON, "MNN export not supported on NVIDIA Jetson"
|
119
117
|
if i == 13: # NCNN
|
120
118
|
assert not isinstance(model, YOLOWorld), "YOLOWorldv2 NCNN exports not supported yet"
|
121
119
|
if i == 14: # IMX
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ultralytics
|
3
|
-
Version: 8.3.
|
3
|
+
Version: 8.3.33
|
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=I1RRdCwLdrc3jX06huVxct8HX8ccQOmQgVpuEflRl0U,23560
|
9
9
|
tests/test_solutions.py,sha256=sPYhy2d814mIVvojQeVxeZPu0IVy01_Y8zuMcu_9GF0,3790
|
10
|
-
ultralytics/__init__.py,sha256=
|
10
|
+
ultralytics/__init__.py,sha256=n8OxEih9oU219cyExsB34Wk0-qGn0jWYwauR_mOlGwg,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=ArJow4-pOPN3y6aKOv5KcVXimikI6vAQvQlSRb7IdWE,38743
|
@@ -100,7 +100,7 @@ ultralytics/data/loaders.py,sha256=Fr70Q9p9t7buLW_8R2_lI_nyCMG033gWSxvwy1M-a-U,2
|
|
100
100
|
ultralytics/data/split_dota.py,sha256=eFafJ7Vg52wj6KDCHFJAf1tKzyPD5YaPB8kM4VX5Aeg,10688
|
101
101
|
ultralytics/data/utils.py,sha256=bmWEIrdogj4kssZQSJdSbIF8QsJU00lo-EY-Mgcqv4M,31073
|
102
102
|
ultralytics/engine/__init__.py,sha256=mHtJuK4hwF8cuV-VHDc7tp6u6D1gHz2Z7JI8grmQDTs,42
|
103
|
-
ultralytics/engine/exporter.py,sha256=
|
103
|
+
ultralytics/engine/exporter.py,sha256=USEnyGvaTrF6JZtbMPct2LqyiaQHX_Ddt5kO1BbDmRo,67009
|
104
104
|
ultralytics/engine/model.py,sha256=TfuTczFjNJ3GW0E_qWVH6OaJ_2I-_Srx7i_4GQebDoo,51472
|
105
105
|
ultralytics/engine/predictor.py,sha256=aS4yJdTK2kYq-TTpzIlWxqnAcBz38zIECZoMb_yOPMY,17597
|
106
106
|
ultralytics/engine/results.py,sha256=a1XFZRPwqgKDBOEAibHuT9nP2xefLiWVsMoBJbcr4iA,75058
|
@@ -184,7 +184,7 @@ ultralytics/solutions/ai_gym.py,sha256=Jb9Rbd9gOOj2ox4Q5mqalCdvg3RMXA6Cxe5kS18IF
|
|
184
184
|
ultralytics/solutions/analytics.py,sha256=C57pIghXeKN8hul8QOV7W9YDMpfFfSfPTBb-lE9HeAc,11535
|
185
185
|
ultralytics/solutions/distance_calculation.py,sha256=KN3CC-dm2dTQylj79IrifCJT8ZhE7hc2EweH3KK31mE,5461
|
186
186
|
ultralytics/solutions/heatmap.py,sha256=If9rosSCmE7pAL1HtVnLkx05gQp6nP1K6HzATMcaEEE,5372
|
187
|
-
ultralytics/solutions/object_counter.py,sha256=
|
187
|
+
ultralytics/solutions/object_counter.py,sha256=mGhfNbgjkkFbC3vaPEj7FhuxmLmQS94tXi1vsqFQmZ0,9975
|
188
188
|
ultralytics/solutions/parking_management.py,sha256=1DsEE94eauqcnnFxUYI-BX9eA1GbJVNt7oncj1okYpI,11198
|
189
189
|
ultralytics/solutions/queue_management.py,sha256=D9TqwJSVrZQFxp_M8O62WfBAxkAuDWWnXe7FFmnp7_w,4881
|
190
190
|
ultralytics/solutions/region_counter.py,sha256=w0c0Sz9XG6rwzr5nA6nb1zFW8IVkTQuatfZNBtOik68,4947
|
@@ -202,7 +202,7 @@ ultralytics/trackers/utils/kalman_filter.py,sha256=cH9zD3fwkuezP97H9mw8cSBN7a8hH
|
|
202
202
|
ultralytics/trackers/utils/matching.py,sha256=3Ie1WNNRZ4_q3365F03XD7Nr9juZB_08mw4yUKC3w74,7162
|
203
203
|
ultralytics/utils/__init__.py,sha256=08pFkzKn1eR9xdIFhx8tx_8MO-gqXjt2n0HGwDeUlWE,49159
|
204
204
|
ultralytics/utils/autobatch.py,sha256=nt0nSNNhrQqvtaxeNBBYpU2OkZnI3ihNEAa3jF4pybo,4594
|
205
|
-
ultralytics/utils/benchmarks.py,sha256=
|
205
|
+
ultralytics/utils/benchmarks.py,sha256=Ub--iTq2hL_oHkG2R3HXmZXQ6qcBC-P9MabUv60bMLE,25625
|
206
206
|
ultralytics/utils/checks.py,sha256=KXQSeauhzecy9tSjyDVy8oXbTDkHSSB9lOTYrqRWpok,29582
|
207
207
|
ultralytics/utils/dist.py,sha256=NDFga-uKxkBX2zLxFHSene_cCiGQJoyOeCXcN9JIOIk,2358
|
208
208
|
ultralytics/utils/downloads.py,sha256=fh7I5toTSowAOXtmx5zIzCEDREfTFG45cLIHmsDmuYw,21974
|
@@ -229,9 +229,9 @@ ultralytics/utils/callbacks/neptune.py,sha256=IbGQfEltamUKXJt93uSLQFn8c2rYh3DMTg
|
|
229
229
|
ultralytics/utils/callbacks/raytune.py,sha256=Ck_yFzg7UZXiDWrLHaltjQybzVWSFDfzpdrx9ZYTRfI,700
|
230
230
|
ultralytics/utils/callbacks/tensorboard.py,sha256=SHlE58Fb-sg-uZKtgy-ybIO3SAIfK55aj8kTYGA0Cyg,4167
|
231
231
|
ultralytics/utils/callbacks/wb.py,sha256=5MIG29usEhkc6OmbWFEqxQ9D4Xhe5xvB8TXujK1d5MI,6926
|
232
|
-
ultralytics-8.3.
|
233
|
-
ultralytics-8.3.
|
234
|
-
ultralytics-8.3.
|
235
|
-
ultralytics-8.3.
|
236
|
-
ultralytics-8.3.
|
237
|
-
ultralytics-8.3.
|
232
|
+
ultralytics-8.3.33.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
233
|
+
ultralytics-8.3.33.dist-info/METADATA,sha256=_zjUYB_J9eDBQI2IF03bmXUvFCWwBQsEWj3dG01tgJs,35213
|
234
|
+
ultralytics-8.3.33.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
|
235
|
+
ultralytics-8.3.33.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
|
236
|
+
ultralytics-8.3.33.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
|
237
|
+
ultralytics-8.3.33.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|