From abb8daa35267978f72dce4be7ebf1123960c9ce1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 2 Feb 2024 15:45:39 +0000 Subject: [PATCH] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20auto=20form?= =?UTF-8?q?at=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/tools/csv_sink.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/supervision/detection/tools/csv_sink.py b/supervision/detection/tools/csv_sink.py index d5ae4994..a42e6127 100644 --- a/supervision/detection/tools/csv_sink.py +++ b/supervision/detection/tools/csv_sink.py @@ -19,14 +19,14 @@ BASE_HEADER = [ class CSVSink: """ - A utility class for saving detection data to a CSV file. This class is designed to - efficiently serialize detection objects into a CSV format, allowing for the - inclusion of bounding box coordinates and additional attributes like `confidence`, + A utility class for saving detection data to a CSV file. This class is designed to + efficiently serialize detection objects into a CSV format, allowing for the + inclusion of bounding box coordinates and additional attributes like `confidence`, `class_id`, and `tracker_id`. - + !!! tip - CSVSink allow to pass custom data alongside the detection fields, providing + CSVSink allow to pass custom data alongside the detection fields, providing flexibility for logging various types of information. Args: @@ -41,7 +41,7 @@ class CSVSink: model = YOLO() csv_sink = sv.CSVSink() frames_generator = sv.get_video_frames_generator() - + with csv_sink: for frame in frames_generator: result = model(frame)[0] @@ -67,7 +67,6 @@ class CSVSink: self.field_names = [] def __enter__(self) -> CSVSink: - self.open() return self @@ -77,7 +76,6 @@ class CSVSink: exc_val: Optional[Exception], exc_tb: Optional[Any], ) -> None: - self.close() def open(self) -> None: