ultralytics 8.3.150__py3-none-any.whl → 8.3.151__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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
- __version__ = "8.3.150"
3
+ __version__ = "8.3.151"
4
4
 
5
5
  import os
6
6
 
@@ -44,6 +44,7 @@ class TrackZone(BaseSolution):
44
44
  super().__init__(**kwargs)
45
45
  default_region = [(75, 75), (565, 75), (565, 285), (75, 285)]
46
46
  self.region = cv2.convexHull(np.array(self.region or default_region, dtype=np.int32))
47
+ self.mask = None
47
48
 
48
49
  def process(self, im0):
49
50
  """
@@ -66,10 +67,10 @@ class TrackZone(BaseSolution):
66
67
  """
67
68
  annotator = SolutionAnnotator(im0, line_width=self.line_width) # Initialize annotator
68
69
 
69
- # Create a mask for the region and extract tracks from the masked image
70
- mask = np.zeros_like(im0[:, :, 0])
71
- mask = cv2.fillPoly(mask, [self.region], 255)
72
- masked_frame = cv2.bitwise_and(im0, im0, mask=mask)
70
+ if self.mask is None: # Create a mask for the region
71
+ self.mask = np.zeros_like(im0[:, :, 0])
72
+ cv2.fillPoly(self.mask, [self.region], 255)
73
+ masked_frame = cv2.bitwise_and(im0, im0, mask=self.mask)
73
74
  self.extract_tracks(masked_frame)
74
75
 
75
76
  # Draw the region boundary
@@ -92,8 +92,6 @@ def on_predict_postprocess_end(predictor: object, persist: bool = False) -> None
92
92
  predictor.vid_path[i if is_stream else 0] = vid_path
93
93
 
94
94
  det = (result.obb if is_obb else result.boxes).cpu().numpy()
95
- if len(det) == 0:
96
- continue
97
95
  tracks = tracker.update(det, result.orig_img, getattr(result, "feats", None))
98
96
  if len(tracks) == 0:
99
97
  continue
@@ -515,7 +515,7 @@ class ConfusionMatrix(DataExportMixin):
515
515
  decimals (int): Number of decimal places to round the output values to.
516
516
 
517
517
  Returns:
518
- List[Dict[str, float]]: A list of dictionaries, each representing one predicted class with corresponding values for all actual classes.
518
+ (List[Dict[str, float]]): A list of dictionaries, each representing one predicted class with corresponding values for all actual classes.
519
519
 
520
520
  Examples:
521
521
  >>> results = model.val(data="coco8.yaml", plots=True)
@@ -1039,12 +1039,27 @@ class DetMetrics(SimpleClass, DataExportMixin):
1039
1039
  """Return dictionary of computed performance metrics and statistics."""
1040
1040
  return self.box.curves_results
1041
1041
 
1042
- def summary(self, **kwargs) -> List[Dict[str, Union[str, float]]]:
1043
- """Return per-class detection metrics with shared scalar values included."""
1042
+ def summary(self, normalize: bool = True, decimals: int = 5) -> List[Dict[str, Union[str, float]]]:
1043
+ """
1044
+ Generate a summarized representation of per-class detection metrics as a list of dictionaries. Includes shared
1045
+ scalar metrics (mAP, mAP50, mAP75) alongside precision, recall, and F1-score for each class.
1046
+
1047
+ Args:
1048
+ normalize (bool): For Detect metrics, everything is normalized by default [0-1].
1049
+ decimals (int): Number of decimal places to round the metrics values to.
1050
+
1051
+ Returns:
1052
+ (List[Dict[str, Union[str, float]]]): A list of dictionaries, each representing one class with corresponding metric values.
1053
+
1054
+ Examples:
1055
+ >>> results = model.val(data="coco8.yaml")
1056
+ >>> detection_summary = results.summary()
1057
+ >>> print(detection_summary)
1058
+ """
1044
1059
  scalars = {
1045
- "box-map": self.box.map,
1046
- "box-map50": self.box.map50,
1047
- "box-map75": self.box.map75,
1060
+ "box-map": round(self.box.map, decimals),
1061
+ "box-map50": round(self.box.map50, decimals),
1062
+ "box-map75": round(self.box.map75, decimals),
1048
1063
  }
1049
1064
  per_class = {
1050
1065
  "box-p": self.box.p,
@@ -1052,11 +1067,7 @@ class DetMetrics(SimpleClass, DataExportMixin):
1052
1067
  "box-f1": self.box.f1,
1053
1068
  }
1054
1069
  return [
1055
- {
1056
- "class_name": self.names[i] if hasattr(self, "names") and i in self.names else str(i),
1057
- **{k: v[i] for k, v in per_class.items()},
1058
- **scalars,
1059
- }
1070
+ {"class_name": self.names[i], **{k: round(v[i], decimals) for k, v in per_class.items()}, **scalars}
1060
1071
  for i in range(len(next(iter(per_class.values()), [])))
1061
1072
  ]
1062
1073
 
@@ -1200,15 +1211,30 @@ class SegmentMetrics(SimpleClass, DataExportMixin):
1200
1211
  """Return dictionary of computed performance metrics and statistics."""
1201
1212
  return self.box.curves_results + self.seg.curves_results
1202
1213
 
1203
- def summary(self, **kwargs) -> List[Dict[str, Union[str, float]]]:
1204
- """Return per-class segmentation metrics with shared scalar values included (box + mask)."""
1214
+ def summary(self, normalize: bool = True, decimals: int = 5) -> List[Dict[str, Union[str, float]]]:
1215
+ """
1216
+ Generate a summarized representation of per-class segmentation metrics as a list of dictionaries. Includes both
1217
+ box and mask scalar metrics (mAP, mAP50, mAP75) alongside precision, recall, and F1-score for each class.
1218
+
1219
+ Args:
1220
+ normalize (bool): For Segment metrics, everything is normalized by default [0-1].
1221
+ decimals (int): Number of decimal places to round the metrics values to.
1222
+
1223
+ Returns:
1224
+ (List[Dict[str, Union[str, float]]]): A list of dictionaries, each representing one class with corresponding metric values.
1225
+
1226
+ Examples:
1227
+ >>> results = model.val(data="coco8-seg.yaml")
1228
+ >>> seg_summary = results.summary(decimals=4)
1229
+ >>> print(seg_summary)
1230
+ """
1205
1231
  scalars = {
1206
- "box-map": self.box.map,
1207
- "box-map50": self.box.map50,
1208
- "box-map75": self.box.map75,
1209
- "mask-map": self.seg.map,
1210
- "mask-map50": self.seg.map50,
1211
- "mask-map75": self.seg.map75,
1232
+ "box-map": round(self.box.map, decimals),
1233
+ "box-map50": round(self.box.map50, decimals),
1234
+ "box-map75": round(self.box.map75, decimals),
1235
+ "mask-map": round(self.seg.map, decimals),
1236
+ "mask-map50": round(self.seg.map50, decimals),
1237
+ "mask-map75": round(self.seg.map75, decimals),
1212
1238
  }
1213
1239
  per_class = {
1214
1240
  "box-p": self.box.p,
@@ -1219,7 +1245,7 @@ class SegmentMetrics(SimpleClass, DataExportMixin):
1219
1245
  "mask-f1": self.seg.f1,
1220
1246
  }
1221
1247
  return [
1222
- {"class_name": self.names[i], **{k: v[i] for k, v in per_class.items()}, **scalars}
1248
+ {"class_name": self.names[i], **{k: round(v[i], decimals) for k, v in per_class.items()}, **scalars}
1223
1249
  for i in range(len(next(iter(per_class.values()), [])))
1224
1250
  ]
1225
1251
 
@@ -1363,15 +1389,30 @@ class PoseMetrics(SegmentMetrics):
1363
1389
  """Return dictionary of computed performance metrics and statistics."""
1364
1390
  return self.box.curves_results + self.pose.curves_results
1365
1391
 
1366
- def summary(self, **kwargs) -> List[Dict[str, Union[str, float]]]:
1367
- """Return per-class pose metrics with shared scalar values included (box + pose)."""
1392
+ def summary(self, normalize: bool = True, decimals: int = 5) -> List[Dict[str, Union[str, float]]]:
1393
+ """
1394
+ Generate a summarized representation of per-class pose metrics as a list of dictionaries. Includes both box and
1395
+ pose scalar metrics (mAP, mAP50, mAP75) alongside precision, recall, and F1-score for each class.
1396
+
1397
+ Args:
1398
+ normalize (bool): For Pose metrics, everything is normalized by default [0-1].
1399
+ decimals (int): Number of decimal places to round the metrics values to.
1400
+
1401
+ Returns:
1402
+ (List[Dict[str, Union[str, float]]]): A list of dictionaries, each representing one class with corresponding metric values.
1403
+
1404
+ Examples:
1405
+ >>> results = model.val(data="coco8-pose.yaml")
1406
+ >>> pose_summary = results.summary(decimals=4)
1407
+ >>> print(pose_summary)
1408
+ """
1368
1409
  scalars = {
1369
- "box-map": self.box.map,
1370
- "box-map50": self.box.map50,
1371
- "box-map75": self.box.map75,
1372
- "pose-map": self.pose.map,
1373
- "pose-map50": self.pose.map50,
1374
- "pose-map75": self.pose.map75,
1410
+ "box-map": round(self.box.map, decimals),
1411
+ "box-map50": round(self.box.map50, decimals),
1412
+ "box-map75": round(self.box.map75, decimals),
1413
+ "pose-map": round(self.pose.map, decimals),
1414
+ "pose-map50": round(self.pose.map50, decimals),
1415
+ "pose-map75": round(self.pose.map75, decimals),
1375
1416
  }
1376
1417
  per_class = {
1377
1418
  "box-p": self.box.p,
@@ -1382,7 +1423,7 @@ class PoseMetrics(SegmentMetrics):
1382
1423
  "pose-f1": self.pose.f1,
1383
1424
  }
1384
1425
  return [
1385
- {"class_name": self.names[i], **{k: v[i] for k, v in per_class.items()}, **scalars}
1426
+ {"class_name": self.names[i], **{k: round(v[i], decimals) for k, v in per_class.items()}, **scalars}
1386
1427
  for i in range(len(next(iter(per_class.values()), [])))
1387
1428
  ]
1388
1429
 
@@ -1443,9 +1484,23 @@ class ClassifyMetrics(SimpleClass, DataExportMixin):
1443
1484
  """Return a list of curves for accessing specific metrics curves."""
1444
1485
  return []
1445
1486
 
1446
- def summary(self, **kwargs) -> List[Dict[str, float]]:
1447
- """Return a single-row summary for classification metrics (top1/top5)."""
1448
- return [{"classify-top1": self.top1, "classify-top5": self.top5}]
1487
+ def summary(self, normalize: bool = True, decimals: int = 5) -> List[Dict[str, float]]:
1488
+ """
1489
+ Generate a single-row summary of classification metrics (Top-1 and Top-5 accuracy).
1490
+
1491
+ Args:
1492
+ normalize (bool): For Classify metrics, everything is normalized by default [0-1].
1493
+ decimals (int): Number of decimal places to round the metrics values to.
1494
+
1495
+ Returns:
1496
+ (List[Dict[str, float]]): A list with one dictionary containing Top-1 and Top-5 classification accuracy.
1497
+
1498
+ Examples:
1499
+ >>> results = model.val(data="imagenet10")
1500
+ >>> classify_summary = results.summary(decimals=4)
1501
+ >>> print(classify_summary)
1502
+ """
1503
+ return [{"classify-top1": round(self.top1, decimals), "classify-top5": round(self.top5, decimals)}]
1449
1504
 
1450
1505
 
1451
1506
  class OBBMetrics(SimpleClass, DataExportMixin):
@@ -1547,15 +1602,30 @@ class OBBMetrics(SimpleClass, DataExportMixin):
1547
1602
  """Return a list of curves for accessing specific metrics curves."""
1548
1603
  return []
1549
1604
 
1550
- def summary(self, **kwargs) -> List[Dict[str, Union[str, float]]]:
1551
- """Return per-class detection metrics with shared scalar values included."""
1605
+ def summary(self, normalize: bool = True, decimals: int = 5) -> List[Dict[str, Union[str, float]]]:
1606
+ """
1607
+ Generate a summarized representation of per-class detection metrics as a list of dictionaries. Includes shared
1608
+ scalar metrics (mAP, mAP50, mAP75) along with precision, recall, and F1-score for each class.
1609
+
1610
+ Args:
1611
+ normalize (bool): For OBB metrics, everything is normalized by default [0-1].
1612
+ decimals (int): Number of decimal places to round the metrics values to.
1613
+
1614
+ Returns:
1615
+ (List[Dict[str, Union[str, float]]]): A list of dictionaries, each representing one class with detection metrics.
1616
+
1617
+ Examples:
1618
+ >>> results = model.val(data="dota8.yaml")
1619
+ >>> detection_summary = results.summary(decimals=4)
1620
+ >>> print(detection_summary)
1621
+ """
1552
1622
  scalars = {
1553
- "box-map": self.box.map,
1554
- "box-map50": self.box.map50,
1555
- "box-map75": self.box.map75,
1623
+ "box-map": round(self.box.map, decimals),
1624
+ "box-map50": round(self.box.map50, decimals),
1625
+ "box-map75": round(self.box.map75, decimals),
1556
1626
  }
1557
1627
  per_class = {"box-p": self.box.p, "box-r": self.box.r, "box-f1": self.box.f1}
1558
1628
  return [
1559
- {"class_name": self.names[i], **{k: v[i] for k, v in per_class.items()}, **scalars}
1629
+ {"class_name": self.names[i], **{k: round(v[i], decimals) for k, v in per_class.items()}, **scalars}
1560
1630
  for i in range(len(next(iter(per_class.values()), [])))
1561
1631
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ultralytics
3
- Version: 8.3.150
3
+ Version: 8.3.151
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=HmMKOTCia9ZDC0VYc_EPmvBTM5LM5eeI1NF_pKjLpd8,9677
7
7
  tests/test_integrations.py,sha256=cQfgueFhEZ8Xs-tF0uiIEhvn0DlhOH-Wqrx96LXp3D0,6303
8
8
  tests/test_python.py,sha256=_7xc7mqQxw3OsLhAdx-P85u9sqkfIXVhIloxmhBXph4,27800
9
9
  tests/test_solutions.py,sha256=tuf6n_fsI8KvSdJrnc-cqP2qYdiYqCWuVrx0z9dOz3Q,13213
10
- ultralytics/__init__.py,sha256=b1gP1CTT997_tAp7hv6UPKMwpghRdoEwqFL5qSQp8vI,730
10
+ ultralytics/__init__.py,sha256=nVHAIlQdq5me2c0MXYh2Pb9IfhWNpGSgjZ8zWtGLoK4,730
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=H19EalaxuIa44J_nVBrNxMj8EAPmlZl3ecbX0-xK8y8,39600
@@ -222,14 +222,14 @@ ultralytics/solutions/similarity_search.py,sha256=GdrPEpfBwLpM5Mx4XQiTrahgdQgiSI
222
222
  ultralytics/solutions/solutions.py,sha256=3JGuGGzEvgKHw_XYNv11yo_PxZlSqduIuW8fyrNeZ4E,37407
223
223
  ultralytics/solutions/speed_estimation.py,sha256=_4tIfWPI7O_hYRQAvNrALMzdy2sBR5_0BxnPdJb0Gks,5823
224
224
  ultralytics/solutions/streamlit_inference.py,sha256=menjJLsuP7AsQJSnBo7gRHfMlYE8HzMp0YNGqCU64n0,9986
225
- ultralytics/solutions/trackzone.py,sha256=LRCG5HhcZb9PiYWbkUPeWuIOnNskPE4FEDY6a3Y4ctA,3850
225
+ ultralytics/solutions/trackzone.py,sha256=C51IgbNG_kGsTi04ZKUThLPYZXthP7Rad0ImSjKwa0g,3873
226
226
  ultralytics/solutions/vision_eye.py,sha256=LCb-2YPVvEks9e7xqZtNGftpAXNaZhEUb5yb3N0ni_U,2952
227
227
  ultralytics/solutions/templates/similarity-search.html,sha256=DPoAO-1H-KXNt_T8mGtSCsYUEi_5Nrx01p0cZfX-E8Q,3790
228
228
  ultralytics/trackers/__init__.py,sha256=Zlu_Ig5osn7hqch_g5Be_e4pwZUkeeTQiesJCi0pFGI,255
229
229
  ultralytics/trackers/basetrack.py,sha256=-skBFFatzgJFAPN9Frm1u1h_RDUg3WOlxG6eHQxp2Gw,4384
230
230
  ultralytics/trackers/bot_sort.py,sha256=knP5oo1LC45Lrato8LpcY_j4KBojQFP1lxT_NJxhEUo,12134
231
231
  ultralytics/trackers/byte_tracker.py,sha256=CNS10VOGPtXXEimi0TaO88TAIcOBgo8ALF9H79iK_uQ,21633
232
- ultralytics/trackers/track.py,sha256=EmYi42ujLP3_CKuS6CmO_9dw8Ekg7-0WWJQeYfQucv0,4804
232
+ ultralytics/trackers/track.py,sha256=MHMydDt_MfXdj6naO2lLuEPF46pZUbDmz5Sqtr18-J4,4757
233
233
  ultralytics/trackers/utils/__init__.py,sha256=lm6MckFYCPTbqIoX7w0s_daxdjNeBeKW6DXppv1-QUM,70
234
234
  ultralytics/trackers/utils/gmc.py,sha256=9IvCf5MhBYY9ppVHykN02_oBWHmE98R8EaYFKaykdV0,14032
235
235
  ultralytics/trackers/utils/kalman_filter.py,sha256=PPmM0lwBMdT_hGojvfLoUsBUFMBBMNRAxKbMcQa3wJ0,21619
@@ -246,7 +246,7 @@ ultralytics/utils/export.py,sha256=ZmxiY5Y2MuL4iBFsLr8ykbUsnvT01DCs0Kg1w3_Ikac,9
246
246
  ultralytics/utils/files.py,sha256=ZCbLGleiF0f-PqYfaxMFAWop88w7U1hpreHXl8b2ko0,8238
247
247
  ultralytics/utils/instance.py,sha256=vhqaZRGT_4K9Q3oQH5KNNK4ISOzxlf1_JjauwhuFhu0,18408
248
248
  ultralytics/utils/loss.py,sha256=fbOWc3Iu0QOJiWbi-mXWA9-1otTYlehtmUsI7os7ydM,39799
249
- ultralytics/utils/metrics.py,sha256=aHVagoemzNLPiQwpb1BxoNfKOebyYUJj679EKN8RBJc,63888
249
+ ultralytics/utils/metrics.py,sha256=mOu6VnLfBqsTcWeQ04xIFSuIVnDnmsF5QqT4NIIFMNc,67582
250
250
  ultralytics/utils/ops.py,sha256=Yjm397sirPt9wNlgHU2SeVEApeEeYX1msSg5cTBGN8g,34381
251
251
  ultralytics/utils/patches.py,sha256=GI7NXCJ5H22FGp3sIvj5rrGfwdYNRWlxFcW-Jhjgius,5181
252
252
  ultralytics/utils/plotting.py,sha256=QMwedj19XNHus5NbUY3cQI1PGDgriPhHOzGirBsxdK8,48277
@@ -265,9 +265,9 @@ ultralytics/utils/callbacks/neptune.py,sha256=j8pecmlcsM8FGzLKWoBw5xUsi5t8E5HuxY
265
265
  ultralytics/utils/callbacks/raytune.py,sha256=S6Bq16oQDQ8BQgnZzA0zJHGN_BBr8iAM_WtGoLiEcwg,1283
266
266
  ultralytics/utils/callbacks/tensorboard.py,sha256=MDPBW7aDes-66OE6YqKXXvqA_EocjzEMHWGM-8z9vUQ,5281
267
267
  ultralytics/utils/callbacks/wb.py,sha256=Tm_-aRr2CN32MJkY9tylpMBJkb007-MSRNSQ7rDJ5QU,7521
268
- ultralytics-8.3.150.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
269
- ultralytics-8.3.150.dist-info/METADATA,sha256=g6IJVaIctp7vnVQ89KLcPzHiuomkUlWOFm5Bjw7PwJw,37200
270
- ultralytics-8.3.150.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
271
- ultralytics-8.3.150.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
272
- ultralytics-8.3.150.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
273
- ultralytics-8.3.150.dist-info/RECORD,,
268
+ ultralytics-8.3.151.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
269
+ ultralytics-8.3.151.dist-info/METADATA,sha256=oHqvHykRvHkBax6aDIFUv5tTwIzUlWtW6LPHKahJjTo,37200
270
+ ultralytics-8.3.151.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
271
+ ultralytics-8.3.151.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
272
+ ultralytics-8.3.151.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
273
+ ultralytics-8.3.151.dist-info/RECORD,,