`ultralytics 8.0.222` introduce new `ultralytics.solutions` (#6759)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Yujiao Jiang <36917338+Alex-JYJ@users.noreply.github.com>
Co-authored-by: snyk-bot <snyk-bot@snyk.io>
pull/6661/head v8.0.222
Glenn Jocher 12 months ago committed by GitHub
parent 63fcc2a9ff
commit d12411ec0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      docker/Dockerfile-cpu
  2. 2
      ultralytics/__init__.py
  3. 2
      ultralytics/engine/results.py
  4. 8
      ultralytics/trackers/utils/gmc.py
  5. 22
      ultralytics/trackers/utils/kalman_filter.py
  6. 6
      ultralytics/trackers/utils/matching.py

@ -3,7 +3,7 @@
# Image is CPU-optimized for ONNX, OpenVINO and PyTorch YOLOv8 deployments
# Start FROM Ubuntu image https://hub.docker.com/_/ubuntu
FROM ubuntu:mantic-20231011
FROM ubuntu:23.10
# Downloads to user config dir
ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Arial.Unicode.ttf /root/.config/Ultralytics/

@ -1,6 +1,6 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license
__version__ = '8.0.221'
__version__ = '8.0.222'
from ultralytics.models import RTDETR, SAM, YOLO
from ultralytics.models.fastsam import FastSAM

@ -323,7 +323,7 @@ class Results(SimpleClass):
for d in self.boxes:
save_one_box(d.xyxy,
self.orig_img.copy(),
file=Path(save_dir) / self.names[int(d.cls)] / f'{Path(file_name).stem}.jpg',
file=Path(save_dir) / self.names[int(d.cls)] / f'{Path(file_name)}.jpg',
BGR=True)
def tojson(self, normalize=False):

@ -89,7 +89,7 @@ class GMC:
detections (list): List of detections to be used in the processing.
Returns:
np.array: Processed frame.
(np.array): Processed frame.
Examples:
>>> gmc = GMC()
@ -115,7 +115,7 @@ class GMC:
detections (list): List of detections to be used in the processing.
Returns:
np.array: Processed frame.
(np.array): Processed frame.
Examples:
>>> gmc = GMC()
@ -162,7 +162,7 @@ class GMC:
detections (list): List of detections to be used in the processing.
Returns:
np.array: Processed frame.
(np.array): Processed frame.
Examples:
>>> gmc = GMC()
@ -301,7 +301,7 @@ class GMC:
detections (list): List of detections to be used in the processing.
Returns:
np.array: Processed frame.
(np.array): Processed frame.
Examples:
>>> gmc = GMC()

@ -39,7 +39,7 @@ class KalmanFilterXYAH:
and height h.
Returns:
tuple[ndarray, ndarray]: Returns the mean vector (8 dimensional) and covariance matrix (8x8 dimensional) of
(tuple[ndarray, ndarray]): Returns the mean vector (8 dimensional) and covariance matrix (8x8 dimensional) of
the new track. Unobserved velocities are initialized to 0 mean.
"""
mean_pos = measurement
@ -62,7 +62,7 @@ class KalmanFilterXYAH:
covariance (ndarray): The 8x8 dimensional covariance matrix of the object state at the previous time step.
Returns:
tuple[ndarray, ndarray]: Returns the mean vector and covariance matrix of the predicted state. Unobserved
(tuple[ndarray, ndarray]): Returns the mean vector and covariance matrix of the predicted state. Unobserved
velocities are initialized to 0 mean.
"""
std_pos = [
@ -87,7 +87,7 @@ class KalmanFilterXYAH:
covariance (ndarray): The state's covariance matrix (8x8 dimensional).
Returns:
tuple[ndarray, ndarray]: Returns the projected mean and covariance matrix of the given state estimate.
(tuple[ndarray, ndarray]): Returns the projected mean and covariance matrix of the given state estimate.
"""
std = [
self._std_weight_position * mean[3], self._std_weight_position * mean[3], 1e-1,
@ -107,7 +107,7 @@ class KalmanFilterXYAH:
covariance (ndarray): The Nx8x8 covariance matrix of the object states at the previous time step.
Returns:
tuple[ndarray, ndarray]: Returns the mean vector and covariance matrix of the predicted state. Unobserved
(tuple[ndarray, ndarray]): Returns the mean vector and covariance matrix of the predicted state. Unobserved
velocities are initialized to 0 mean.
"""
std_pos = [
@ -138,7 +138,7 @@ class KalmanFilterXYAH:
position, a the aspect ratio, and h the height of the bounding box.
Returns:
tuple[ndarray, ndarray]: Returns the measurement-corrected state distribution.
(tuple[ndarray, ndarray]): Returns the measurement-corrected state distribution.
"""
projected_mean, projected_cov = self.project(mean, covariance)
@ -174,7 +174,7 @@ class KalmanFilterXYAH:
squared Euclidean distance and 'maha' for the squared Mahalanobis distance. Defaults to 'maha'.
Returns:
ndarray: Returns an array of length N, where the i-th element contains the squared distance between
(np.ndarray): Returns an array of length N, where the i-th element contains the squared distance between
(mean, covariance) and `measurements[i]`.
"""
mean, covariance = self.project(mean, covariance)
@ -212,7 +212,7 @@ class KalmanFilterXYWH(KalmanFilterXYAH):
measurement (ndarray): Bounding box coordinates (x, y, w, h) with center position (x, y), width, and height.
Returns:
tuple[ndarray, ndarray]: Returns the mean vector (8 dimensional) and covariance matrix (8x8 dimensional) of
(tuple[ndarray, ndarray]): Returns the mean vector (8 dimensional) and covariance matrix (8x8 dimensional) of
the new track. Unobserved velocities are initialized to 0 mean.
"""
mean_pos = measurement
@ -236,7 +236,7 @@ class KalmanFilterXYWH(KalmanFilterXYAH):
covariance (ndarray): The 8x8 dimensional covariance matrix of the object state at the previous time step.
Returns:
tuple[ndarray, ndarray]: Returns the mean vector and covariance matrix of the predicted state. Unobserved
(tuple[ndarray, ndarray]): Returns the mean vector and covariance matrix of the predicted state. Unobserved
velocities are initialized to 0 mean.
"""
std_pos = [
@ -261,7 +261,7 @@ class KalmanFilterXYWH(KalmanFilterXYAH):
covariance (ndarray): The state's covariance matrix (8x8 dimensional).
Returns:
tuple[ndarray, ndarray]: Returns the projected mean and covariance matrix of the given state estimate.
(tuple[ndarray, ndarray]): Returns the projected mean and covariance matrix of the given state estimate.
"""
std = [
self._std_weight_position * mean[2], self._std_weight_position * mean[3],
@ -281,7 +281,7 @@ class KalmanFilterXYWH(KalmanFilterXYAH):
covariance (ndarray): The Nx8x8 covariance matrix of the object states at the previous time step.
Returns:
tuple[ndarray, ndarray]: Returns the mean vector and covariance matrix of the predicted state. Unobserved
(tuple[ndarray, ndarray]): Returns the mean vector and covariance matrix of the predicted state. Unobserved
velocities are initialized to 0 mean.
"""
std_pos = [
@ -312,6 +312,6 @@ class KalmanFilterXYWH(KalmanFilterXYAH):
position, w the width, and h the height of the bounding box.
Returns:
tuple[ndarray, ndarray]: Returns the measurement-corrected state distribution.
(tuple[ndarray, ndarray]): Returns the measurement-corrected state distribution.
"""
return super().update(mean, covariance, measurement)

@ -67,7 +67,7 @@ def iou_distance(atracks: list, btracks: list) -> np.ndarray:
btracks (list[STrack] | list[np.ndarray]): List of tracks 'b' or bounding boxes.
Returns:
np.ndarray: Cost matrix computed based on IoU.
(np.ndarray): Cost matrix computed based on IoU.
"""
if (len(atracks) > 0 and isinstance(atracks[0], np.ndarray)) \
@ -96,7 +96,7 @@ def embedding_distance(tracks: list, detections: list, metric: str = 'cosine') -
metric (str, optional): Metric for distance computation. Defaults to 'cosine'.
Returns:
np.ndarray: Cost matrix computed based on embeddings.
(np.ndarray): Cost matrix computed based on embeddings.
"""
cost_matrix = np.zeros((len(tracks), len(detections)), dtype=np.float32)
@ -119,7 +119,7 @@ def fuse_score(cost_matrix: np.ndarray, detections: list) -> np.ndarray:
detections (list[BaseTrack]): List of detections with scores.
Returns:
np.ndarray: Fused similarity matrix.
(np.ndarray): Fused similarity matrix.
"""
if cost_matrix.size == 0:

Loading…
Cancel
Save