respond to feedback

This commit is contained in:
James Gallagher 2024-01-23 12:57:31 +00:00
parent 310a09859d
commit c299a929c5
3 changed files with 8 additions and 8 deletions

View File

@ -1,3 +1,3 @@
## Detection Smoother
:::supervision.detection.tools.smoother.Smoother
:::supervision.detection.tools.smoother.DetectionsSmoother

View File

@ -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,

View File

@ -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:
<source src="https://media.roboflow.com/supervision/video-examples/smoothed-grocery-example-720.mp4" type="video/mp4">
</video>
> _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)