diff --git a/docs/detection/tools/smoother.md b/docs/detection/tools/smoother.md index f27fe529..9f90636e 100644 --- a/docs/detection/tools/smoother.md +++ b/docs/detection/tools/smoother.md @@ -1,3 +1,3 @@ ## Detection Smoother -:::supervision.detection.tools.smoother.Smoother +:::supervision.detection.tools.smoother.DetectionsSmoother diff --git a/supervision/__init__.py b/supervision/__init__.py index 1f5b9fcb..aadd201d 100644 --- a/supervision/__init__.py +++ b/supervision/__init__.py @@ -35,7 +35,7 @@ from supervision.detection.core import Detections from supervision.detection.line_counter import LineZone, LineZoneAnnotator from supervision.detection.tools.inference_slicer import InferenceSlicer from supervision.detection.tools.polygon_zone import PolygonZone, PolygonZoneAnnotator -from supervision.detection.tools.smoother import Smoother +from supervision.detection.tools.smoother import DetectionsSmoother from supervision.detection.utils import ( box_iou_batch, calculate_masks_centroids, diff --git a/supervision/detection/tools/smoother.py b/supervision/detection/tools/smoother.py index 98894457..5168693c 100644 --- a/supervision/detection/tools/smoother.py +++ b/supervision/detection/tools/smoother.py @@ -6,9 +6,9 @@ import numpy as np from supervision.detection.core import Detections -class Smoother: +class DetectionsSmoother: """ - Smooth out noise in predictions over time with the `Smoother` class. + Smooth out noise in predictions over time with the `DetectionsSmoother` class. This classes uses an existing `Tracker` to track objects over time. Detections are averaged out over the `length` most recent frames. @@ -16,7 +16,7 @@ class Smoother: > _On the left are the model's raw predictions, - > on the right is the output of Smoother._ + > on the right is the output of DetectionsSmoother._ !!! warning @@ -38,7 +38,7 @@ class Smoother: byte_tracker = sv.ByteTrack() # Initialize the Smoother - smoother = sv.Smoother() + smoother = sv.DetectionsSmoother() def render(detections, video_frame): # Parse the detections @@ -129,7 +129,7 @@ class Smoother: return self.get_smoothed_detections() - def get_track(self, track_id: int) -> Optional[dict]: + def get_track(self, track_id: int) -> Optional[Detections]: track = self.tracks.get(track_id, None) if track is None: return None @@ -138,7 +138,7 @@ class Smoother: if len(track) == 0: return None - ret = track[0] + ret = track.copy()[0] ret.xyxy = np.mean([d.xyxy for d in track], axis=0) ret.confidence = np.mean([d.confidence for d in track], axis=0)