Ruff format docstring Python code (#15792)
Signed-off-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
parent
c1882a4327
commit
d27664216b
63 changed files with 370 additions and 374 deletions
|
|
@ -42,7 +42,7 @@ class STrack(BaseTrack):
|
|||
|
||||
Examples:
|
||||
Initialize and activate a new track
|
||||
>>> track = STrack(xywh=[100, 200, 50, 80, 0], score=0.9, cls='person')
|
||||
>>> track = STrack(xywh=[100, 200, 50, 80, 0], score=0.9, cls="person")
|
||||
>>> track.activate(kalman_filter=KalmanFilterXYAH(), frame_id=1)
|
||||
"""
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ class STrack(BaseTrack):
|
|||
Examples:
|
||||
>>> xywh = [100.0, 150.0, 50.0, 75.0, 1]
|
||||
>>> score = 0.9
|
||||
>>> cls = 'person'
|
||||
>>> cls = "person"
|
||||
>>> track = STrack(xywh, score, cls)
|
||||
"""
|
||||
super().__init__()
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class GMC:
|
|||
|
||||
Examples:
|
||||
Create a GMC object and apply it to a frame
|
||||
>>> gmc = GMC(method='sparseOptFlow', downscale=2)
|
||||
>>> gmc = GMC(method="sparseOptFlow", downscale=2)
|
||||
>>> frame = np.array([[1, 2, 3], [4, 5, 6]])
|
||||
>>> processed_frame = gmc.apply(frame)
|
||||
>>> print(processed_frame)
|
||||
|
|
@ -51,7 +51,7 @@ class GMC:
|
|||
|
||||
Examples:
|
||||
Initialize a GMC object with the 'sparseOptFlow' method and a downscale factor of 2
|
||||
>>> gmc = GMC(method='sparseOptFlow', downscale=2)
|
||||
>>> gmc = GMC(method="sparseOptFlow", downscale=2)
|
||||
"""
|
||||
super().__init__()
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ class GMC:
|
|||
(np.ndarray): Processed frame with applied object detection.
|
||||
|
||||
Examples:
|
||||
>>> gmc = GMC(method='sparseOptFlow')
|
||||
>>> gmc = GMC(method="sparseOptFlow")
|
||||
>>> raw_frame = np.random.rand(480, 640, 3)
|
||||
>>> processed_frame = gmc.apply(raw_frame)
|
||||
>>> print(processed_frame.shape)
|
||||
|
|
@ -127,7 +127,7 @@ class GMC:
|
|||
(np.ndarray): The processed frame with the applied ECC transformation.
|
||||
|
||||
Examples:
|
||||
>>> gmc = GMC(method='ecc')
|
||||
>>> gmc = GMC(method="ecc")
|
||||
>>> processed_frame = gmc.applyEcc(np.array([[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]]))
|
||||
>>> print(processed_frame)
|
||||
[[1. 0. 0.]
|
||||
|
|
@ -173,7 +173,7 @@ class GMC:
|
|||
(np.ndarray): Processed frame.
|
||||
|
||||
Examples:
|
||||
>>> gmc = GMC(method='orb')
|
||||
>>> gmc = GMC(method="orb")
|
||||
>>> raw_frame = np.random.randint(0, 255, (480, 640, 3), dtype=np.uint8)
|
||||
>>> processed_frame = gmc.applyFeatures(raw_frame)
|
||||
>>> print(processed_frame.shape)
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ class KalmanFilterXYAH:
|
|||
>>> mean = np.array([0, 0, 1, 1, 0, 0, 0, 0])
|
||||
>>> covariance = np.eye(8)
|
||||
>>> measurements = np.array([[1, 1, 1, 1], [2, 2, 1, 1]])
|
||||
>>> distances = kf.gating_distance(mean, covariance, measurements, only_position=False, metric='maha')
|
||||
>>> distances = kf.gating_distance(mean, covariance, measurements, only_position=False, metric="maha")
|
||||
"""
|
||||
mean, covariance = self.project(mean, covariance)
|
||||
if only_position:
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ def embedding_distance(tracks: list, detections: list, metric: str = "cosine") -
|
|||
Compute the embedding distance between tracks and detections using cosine metric
|
||||
>>> tracks = [STrack(...), STrack(...)] # List of track objects with embedding features
|
||||
>>> detections = [BaseTrack(...), BaseTrack(...)] # List of detection objects with embedding features
|
||||
>>> cost_matrix = embedding_distance(tracks, detections, metric='cosine')
|
||||
>>> cost_matrix = embedding_distance(tracks, detections, metric="cosine")
|
||||
"""
|
||||
|
||||
cost_matrix = np.zeros((len(tracks), len(detections)), dtype=np.float32)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue