From d7d3449ec60081b728330749cae47e224e912813 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Wed, 14 Aug 2024 02:43:51 +0800 Subject: [PATCH] Update yolov8_sahi.py (#15470) Co-authored-by: UltralyticsAssistant --- examples/YOLOv8-SAHI-Inference-Video/yolov8_sahi.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/YOLOv8-SAHI-Inference-Video/yolov8_sahi.py b/examples/YOLOv8-SAHI-Inference-Video/yolov8_sahi.py index ae140bc5..4243cc35 100644 --- a/examples/YOLOv8-SAHI-Inference-Video/yolov8_sahi.py +++ b/examples/YOLOv8-SAHI-Inference-Video/yolov8_sahi.py @@ -12,11 +12,15 @@ from ultralytics.utils.files import increment_path from ultralytics.utils.plotting import Annotator, colors -class SahiInference: +class SAHIInference: + """Runs YOLOv8 and SAHI for object detection on video with options to view, save, and track results.""" + def __init__(self): + """Initializes the SAHIInference class for performing sliced inference using SAHI with YOLOv8 models.""" self.detection_model = None def load_model(self, weights): + """Loads a YOLOv8 model with specified weights for object detection using SAHI.""" yolov8_model_path = f"models/{weights}" download_yolov8s_model(yolov8_model_path) self.detection_model = AutoDetectionModel.from_pretrained( @@ -98,5 +102,5 @@ class SahiInference: if __name__ == "__main__": - inference = SahiInference() + inference = SAHIInference() inference.inference(**vars(inference.parse_opt()))