ultralytics 8.3.142__py3-none-any.whl → 8.3.144__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.
Files changed (148) hide show
  1. tests/conftest.py +7 -24
  2. tests/test_cli.py +1 -1
  3. tests/test_cuda.py +7 -2
  4. tests/test_engine.py +7 -8
  5. tests/test_exports.py +16 -16
  6. tests/test_integrations.py +1 -1
  7. tests/test_solutions.py +12 -12
  8. ultralytics/__init__.py +1 -1
  9. ultralytics/cfg/__init__.py +16 -13
  10. ultralytics/data/annotator.py +6 -5
  11. ultralytics/data/augment.py +127 -126
  12. ultralytics/data/base.py +54 -51
  13. ultralytics/data/build.py +47 -23
  14. ultralytics/data/converter.py +47 -43
  15. ultralytics/data/dataset.py +51 -50
  16. ultralytics/data/loaders.py +77 -44
  17. ultralytics/data/split.py +22 -9
  18. ultralytics/data/split_dota.py +63 -39
  19. ultralytics/data/utils.py +59 -39
  20. ultralytics/engine/exporter.py +79 -27
  21. ultralytics/engine/model.py +39 -39
  22. ultralytics/engine/predictor.py +37 -28
  23. ultralytics/engine/results.py +187 -157
  24. ultralytics/engine/trainer.py +36 -19
  25. ultralytics/engine/tuner.py +12 -9
  26. ultralytics/engine/validator.py +7 -9
  27. ultralytics/hub/__init__.py +11 -13
  28. ultralytics/hub/auth.py +22 -2
  29. ultralytics/hub/google/__init__.py +19 -19
  30. ultralytics/hub/session.py +37 -51
  31. ultralytics/hub/utils.py +19 -5
  32. ultralytics/models/fastsam/model.py +30 -12
  33. ultralytics/models/fastsam/predict.py +5 -6
  34. ultralytics/models/fastsam/utils.py +3 -3
  35. ultralytics/models/fastsam/val.py +10 -6
  36. ultralytics/models/nas/model.py +9 -5
  37. ultralytics/models/nas/predict.py +6 -6
  38. ultralytics/models/nas/val.py +3 -3
  39. ultralytics/models/rtdetr/model.py +7 -6
  40. ultralytics/models/rtdetr/predict.py +14 -7
  41. ultralytics/models/rtdetr/train.py +10 -4
  42. ultralytics/models/rtdetr/val.py +36 -9
  43. ultralytics/models/sam/amg.py +30 -12
  44. ultralytics/models/sam/build.py +22 -22
  45. ultralytics/models/sam/model.py +10 -9
  46. ultralytics/models/sam/modules/blocks.py +76 -80
  47. ultralytics/models/sam/modules/decoders.py +6 -8
  48. ultralytics/models/sam/modules/encoders.py +23 -26
  49. ultralytics/models/sam/modules/memory_attention.py +13 -1
  50. ultralytics/models/sam/modules/sam.py +57 -26
  51. ultralytics/models/sam/modules/tiny_encoder.py +232 -237
  52. ultralytics/models/sam/modules/transformer.py +13 -13
  53. ultralytics/models/sam/modules/utils.py +11 -19
  54. ultralytics/models/sam/predict.py +114 -101
  55. ultralytics/models/utils/loss.py +98 -77
  56. ultralytics/models/utils/ops.py +116 -67
  57. ultralytics/models/yolo/classify/predict.py +5 -5
  58. ultralytics/models/yolo/classify/train.py +32 -28
  59. ultralytics/models/yolo/classify/val.py +7 -8
  60. ultralytics/models/yolo/detect/predict.py +1 -0
  61. ultralytics/models/yolo/detect/train.py +15 -14
  62. ultralytics/models/yolo/detect/val.py +37 -36
  63. ultralytics/models/yolo/model.py +106 -23
  64. ultralytics/models/yolo/obb/predict.py +3 -4
  65. ultralytics/models/yolo/obb/train.py +14 -6
  66. ultralytics/models/yolo/obb/val.py +29 -23
  67. ultralytics/models/yolo/pose/predict.py +9 -8
  68. ultralytics/models/yolo/pose/train.py +24 -16
  69. ultralytics/models/yolo/pose/val.py +44 -26
  70. ultralytics/models/yolo/segment/predict.py +5 -5
  71. ultralytics/models/yolo/segment/train.py +11 -7
  72. ultralytics/models/yolo/segment/val.py +2 -2
  73. ultralytics/models/yolo/world/train.py +33 -23
  74. ultralytics/models/yolo/world/train_world.py +11 -3
  75. ultralytics/models/yolo/yoloe/predict.py +11 -11
  76. ultralytics/models/yolo/yoloe/train.py +73 -21
  77. ultralytics/models/yolo/yoloe/train_seg.py +10 -7
  78. ultralytics/models/yolo/yoloe/val.py +42 -18
  79. ultralytics/nn/autobackend.py +59 -15
  80. ultralytics/nn/modules/__init__.py +4 -4
  81. ultralytics/nn/modules/activation.py +4 -1
  82. ultralytics/nn/modules/block.py +178 -111
  83. ultralytics/nn/modules/conv.py +6 -5
  84. ultralytics/nn/modules/head.py +469 -121
  85. ultralytics/nn/modules/transformer.py +147 -58
  86. ultralytics/nn/tasks.py +227 -20
  87. ultralytics/nn/text_model.py +30 -33
  88. ultralytics/solutions/ai_gym.py +1 -1
  89. ultralytics/solutions/analytics.py +7 -4
  90. ultralytics/solutions/config.py +10 -10
  91. ultralytics/solutions/distance_calculation.py +11 -10
  92. ultralytics/solutions/heatmap.py +1 -1
  93. ultralytics/solutions/instance_segmentation.py +6 -3
  94. ultralytics/solutions/object_blurrer.py +3 -3
  95. ultralytics/solutions/object_counter.py +16 -8
  96. ultralytics/solutions/object_cropper.py +12 -5
  97. ultralytics/solutions/parking_management.py +29 -28
  98. ultralytics/solutions/queue_management.py +6 -6
  99. ultralytics/solutions/region_counter.py +10 -3
  100. ultralytics/solutions/security_alarm.py +3 -3
  101. ultralytics/solutions/similarity_search.py +85 -24
  102. ultralytics/solutions/solutions.py +215 -85
  103. ultralytics/solutions/speed_estimation.py +28 -22
  104. ultralytics/solutions/streamlit_inference.py +17 -12
  105. ultralytics/solutions/trackzone.py +4 -4
  106. ultralytics/trackers/basetrack.py +16 -23
  107. ultralytics/trackers/bot_sort.py +30 -20
  108. ultralytics/trackers/byte_tracker.py +70 -64
  109. ultralytics/trackers/track.py +4 -8
  110. ultralytics/trackers/utils/gmc.py +31 -58
  111. ultralytics/trackers/utils/kalman_filter.py +37 -37
  112. ultralytics/trackers/utils/matching.py +1 -1
  113. ultralytics/utils/__init__.py +105 -89
  114. ultralytics/utils/autobatch.py +16 -3
  115. ultralytics/utils/autodevice.py +54 -24
  116. ultralytics/utils/benchmarks.py +42 -28
  117. ultralytics/utils/callbacks/base.py +3 -3
  118. ultralytics/utils/callbacks/clearml.py +9 -9
  119. ultralytics/utils/callbacks/comet.py +67 -25
  120. ultralytics/utils/callbacks/dvc.py +7 -10
  121. ultralytics/utils/callbacks/mlflow.py +2 -5
  122. ultralytics/utils/callbacks/neptune.py +7 -13
  123. ultralytics/utils/callbacks/raytune.py +1 -1
  124. ultralytics/utils/callbacks/tensorboard.py +5 -6
  125. ultralytics/utils/callbacks/wb.py +14 -14
  126. ultralytics/utils/checks.py +14 -13
  127. ultralytics/utils/dist.py +5 -5
  128. ultralytics/utils/downloads.py +94 -67
  129. ultralytics/utils/errors.py +5 -5
  130. ultralytics/utils/export.py +61 -47
  131. ultralytics/utils/files.py +23 -22
  132. ultralytics/utils/instance.py +48 -52
  133. ultralytics/utils/loss.py +78 -40
  134. ultralytics/utils/metrics.py +186 -130
  135. ultralytics/utils/ops.py +186 -190
  136. ultralytics/utils/patches.py +15 -17
  137. ultralytics/utils/plotting.py +71 -27
  138. ultralytics/utils/tal.py +21 -15
  139. ultralytics/utils/torch_utils.py +53 -50
  140. ultralytics/utils/triton.py +5 -4
  141. ultralytics/utils/tuner.py +5 -5
  142. {ultralytics-8.3.142.dist-info → ultralytics-8.3.144.dist-info}/METADATA +1 -1
  143. ultralytics-8.3.144.dist-info/RECORD +272 -0
  144. ultralytics-8.3.142.dist-info/RECORD +0 -272
  145. {ultralytics-8.3.142.dist-info → ultralytics-8.3.144.dist-info}/WHEEL +0 -0
  146. {ultralytics-8.3.142.dist-info → ultralytics-8.3.144.dist-info}/entry_points.txt +0 -0
  147. {ultralytics-8.3.142.dist-info → ultralytics-8.3.144.dist-info}/licenses/LICENSE +0 -0
  148. {ultralytics-8.3.142.dist-info → ultralytics-8.3.144.dist-info}/top_level.txt +0 -0
@@ -20,12 +20,12 @@ class KalmanFilterXYAH:
20
20
  _std_weight_velocity (float): Standard deviation weight for velocity.
21
21
 
22
22
  Methods:
23
- initiate: Creates a track from an unassociated measurement.
24
- predict: Runs the Kalman filter prediction step.
25
- project: Projects the state distribution to measurement space.
26
- multi_predict: Runs the Kalman filter prediction step (vectorized version).
27
- update: Runs the Kalman filter correction step.
28
- gating_distance: Computes the gating distance between state distribution and measurements.
23
+ initiate: Create a track from an unassociated measurement.
24
+ predict: Run the Kalman filter prediction step.
25
+ project: Project the state distribution to measurement space.
26
+ multi_predict: Run the Kalman filter prediction step (vectorized version).
27
+ update: Run the Kalman filter correction step.
28
+ gating_distance: Compute the gating distance between state distribution and measurements.
29
29
 
30
30
  Examples:
31
31
  Initialize the Kalman filter and create a track from a measurement
@@ -70,8 +70,8 @@ class KalmanFilterXYAH:
70
70
  and height h.
71
71
 
72
72
  Returns:
73
- (np.ndarray): Mean vector (8-dimensional) of the new track. Unobserved velocities are initialized to 0 mean.
74
- (np.ndarray): Covariance matrix (8x8 dimensional) of the new track.
73
+ mean (np.ndarray): Mean vector (8-dimensional) of the new track. Unobserved velocities are initialized to 0 mean.
74
+ covariance (np.ndarray): Covariance matrix (8x8 dimensional) of the new track.
75
75
 
76
76
  Examples:
77
77
  >>> kf = KalmanFilterXYAH()
@@ -104,8 +104,8 @@ class KalmanFilterXYAH:
104
104
  covariance (np.ndarray): The 8x8-dimensional covariance matrix of the object state at the previous time step.
105
105
 
106
106
  Returns:
107
- (np.ndarray): Mean vector of the predicted state. Unobserved velocities are initialized to 0 mean.
108
- (np.ndarray): Covariance matrix of the predicted state.
107
+ mean (np.ndarray): Mean vector of the predicted state. Unobserved velocities are initialized to 0 mean.
108
+ covariance (np.ndarray): Covariance matrix of the predicted state.
109
109
 
110
110
  Examples:
111
111
  >>> kf = KalmanFilterXYAH()
@@ -141,8 +141,8 @@ class KalmanFilterXYAH:
141
141
  covariance (np.ndarray): The state's covariance matrix (8x8 dimensional).
142
142
 
143
143
  Returns:
144
- (np.ndarray): Projected mean of the given state estimate.
145
- (np.ndarray): Projected covariance matrix of the given state estimate.
144
+ mean (np.ndarray): Projected mean of the given state estimate.
145
+ covariance (np.ndarray): Projected covariance matrix of the given state estimate.
146
146
 
147
147
  Examples:
148
148
  >>> kf = KalmanFilterXYAH()
@@ -171,8 +171,8 @@ class KalmanFilterXYAH:
171
171
  covariance (np.ndarray): The Nx8x8 covariance matrix of the object states at the previous time step.
172
172
 
173
173
  Returns:
174
- (np.ndarray): Mean matrix of the predicted states with shape (N, 8).
175
- (np.ndarray): Covariance matrix of the predicted states with shape (N, 8, 8).
174
+ mean (np.ndarray): Mean matrix of the predicted states with shape (N, 8).
175
+ covariance (np.ndarray): Covariance matrix of the predicted states with shape (N, 8, 8).
176
176
 
177
177
  Examples:
178
178
  >>> mean = np.random.rand(10, 8) # 10 object states
@@ -213,8 +213,8 @@ class KalmanFilterXYAH:
213
213
  position, a the aspect ratio, and h the height of the bounding box.
214
214
 
215
215
  Returns:
216
- (np.ndarray): Measurement-corrected state mean.
217
- (np.ndarray): Measurement-corrected state covariance.
216
+ new_mean (np.ndarray): Measurement-corrected state mean.
217
+ new_covariance (np.ndarray): Measurement-corrected state covariance.
218
218
 
219
219
  Examples:
220
220
  >>> kf = KalmanFilterXYAH()
@@ -254,8 +254,8 @@ class KalmanFilterXYAH:
254
254
  covariance (np.ndarray): Covariance of the state distribution (8x8 dimensional).
255
255
  measurements (np.ndarray): An (N, 4) matrix of N measurements, each in format (x, y, a, h) where (x, y) is the
256
256
  bounding box center position, a the aspect ratio, and h the height.
257
- only_position (bool): If True, distance computation is done with respect to box center position only.
258
- metric (str): The metric to use for calculating the distance. Options are 'gaussian' for the squared
257
+ only_position (bool, optional): If True, distance computation is done with respect to box center position only.
258
+ metric (str, optional): The metric to use for calculating the distance. Options are 'gaussian' for the squared
259
259
  Euclidean distance and 'maha' for the squared Mahalanobis distance.
260
260
 
261
261
  Returns:
@@ -302,11 +302,11 @@ class KalmanFilterXYWH(KalmanFilterXYAH):
302
302
  _std_weight_velocity (float): Standard deviation weight for velocity.
303
303
 
304
304
  Methods:
305
- initiate: Creates a track from an unassociated measurement.
306
- predict: Runs the Kalman filter prediction step.
307
- project: Projects the state distribution to measurement space.
308
- multi_predict: Runs the Kalman filter prediction step in a vectorized manner.
309
- update: Runs the Kalman filter correction step.
305
+ initiate: Create a track from an unassociated measurement.
306
+ predict: Run the Kalman filter prediction step.
307
+ project: Project the state distribution to measurement space.
308
+ multi_predict: Run the Kalman filter prediction step in a vectorized manner.
309
+ update: Run the Kalman filter correction step.
310
310
 
311
311
  Examples:
312
312
  Create a Kalman filter and initialize a track
@@ -325,8 +325,8 @@ class KalmanFilterXYWH(KalmanFilterXYAH):
325
325
  measurement (np.ndarray): Bounding box coordinates (x, y, w, h) with center position (x, y), width, and height.
326
326
 
327
327
  Returns:
328
- (np.ndarray): Mean vector (8 dimensional) of the new track. Unobserved velocities are initialized to 0 mean.
329
- (np.ndarray): Covariance matrix (8x8 dimensional) of the new track.
328
+ mean (np.ndarray): Mean vector (8 dimensional) of the new track. Unobserved velocities are initialized to 0 mean.
329
+ covariance (np.ndarray): Covariance matrix (8x8 dimensional) of the new track.
330
330
 
331
331
  Examples:
332
332
  >>> kf = KalmanFilterXYWH()
@@ -361,7 +361,7 @@ class KalmanFilterXYWH(KalmanFilterXYAH):
361
361
  covariance = np.diag(np.square(std))
362
362
  return mean, covariance
363
363
 
364
- def predict(self, mean, covariance):
364
+ def predict(self, mean: np.ndarray, covariance: np.ndarray):
365
365
  """
366
366
  Run Kalman filter prediction step.
367
367
 
@@ -370,8 +370,8 @@ class KalmanFilterXYWH(KalmanFilterXYAH):
370
370
  covariance (np.ndarray): The 8x8-dimensional covariance matrix of the object state at the previous time step.
371
371
 
372
372
  Returns:
373
- (np.ndarray): Mean vector of the predicted state. Unobserved velocities are initialized to 0 mean.
374
- (np.ndarray): Covariance matrix of the predicted state.
373
+ mean (np.ndarray): Mean vector of the predicted state. Unobserved velocities are initialized to 0 mean.
374
+ covariance (np.ndarray): Covariance matrix of the predicted state.
375
375
 
376
376
  Examples:
377
377
  >>> kf = KalmanFilterXYWH()
@@ -398,7 +398,7 @@ class KalmanFilterXYWH(KalmanFilterXYAH):
398
398
 
399
399
  return mean, covariance
400
400
 
401
- def project(self, mean, covariance):
401
+ def project(self, mean: np.ndarray, covariance: np.ndarray):
402
402
  """
403
403
  Project state distribution to measurement space.
404
404
 
@@ -407,8 +407,8 @@ class KalmanFilterXYWH(KalmanFilterXYAH):
407
407
  covariance (np.ndarray): The state's covariance matrix (8x8 dimensional).
408
408
 
409
409
  Returns:
410
- (np.ndarray): Projected mean of the given state estimate.
411
- (np.ndarray): Projected covariance matrix of the given state estimate.
410
+ mean (np.ndarray): Projected mean of the given state estimate.
411
+ covariance (np.ndarray): Projected covariance matrix of the given state estimate.
412
412
 
413
413
  Examples:
414
414
  >>> kf = KalmanFilterXYWH()
@@ -428,7 +428,7 @@ class KalmanFilterXYWH(KalmanFilterXYAH):
428
428
  covariance = np.linalg.multi_dot((self._update_mat, covariance, self._update_mat.T))
429
429
  return mean, covariance + innovation_cov
430
430
 
431
- def multi_predict(self, mean, covariance):
431
+ def multi_predict(self, mean: np.ndarray, covariance: np.ndarray):
432
432
  """
433
433
  Run Kalman filter prediction step (Vectorized version).
434
434
 
@@ -437,8 +437,8 @@ class KalmanFilterXYWH(KalmanFilterXYAH):
437
437
  covariance (np.ndarray): The Nx8x8 covariance matrix of the object states at the previous time step.
438
438
 
439
439
  Returns:
440
- (np.ndarray): Mean matrix of the predicted states with shape (N, 8).
441
- (np.ndarray): Covariance matrix of the predicted states with shape (N, 8, 8).
440
+ mean (np.ndarray): Mean matrix of the predicted states with shape (N, 8).
441
+ covariance (np.ndarray): Covariance matrix of the predicted states with shape (N, 8, 8).
442
442
 
443
443
  Examples:
444
444
  >>> mean = np.random.rand(5, 8) # 5 objects with 8-dimensional state vectors
@@ -469,7 +469,7 @@ class KalmanFilterXYWH(KalmanFilterXYAH):
469
469
 
470
470
  return mean, covariance
471
471
 
472
- def update(self, mean, covariance, measurement):
472
+ def update(self, mean: np.ndarray, covariance: np.ndarray, measurement: np.ndarray):
473
473
  """
474
474
  Run Kalman filter correction step.
475
475
 
@@ -480,8 +480,8 @@ class KalmanFilterXYWH(KalmanFilterXYAH):
480
480
  position, w the width, and h the height of the bounding box.
481
481
 
482
482
  Returns:
483
- (np.ndarray): Measurement-corrected state mean.
484
- (np.ndarray): Measurement-corrected state covariance.
483
+ new_mean (np.ndarray): Measurement-corrected state mean.
484
+ new_covariance (np.ndarray): Measurement-corrected state covariance.
485
485
 
486
486
  Examples:
487
487
  >>> kf = KalmanFilterXYWH()
@@ -17,7 +17,7 @@ except (ImportError, AssertionError, AttributeError):
17
17
  import lap
18
18
 
19
19
 
20
- def linear_assignment(cost_matrix: np.ndarray, thresh: float, use_lap: bool = True) -> tuple:
20
+ def linear_assignment(cost_matrix: np.ndarray, thresh: float, use_lap: bool = True):
21
21
  """
22
22
  Perform linear assignment using either the scipy or lap.lapjv method.
23
23