@@ -95,13 +95,12 @@ def run(
9595 dnn = False , # use OpenCV DNN for ONNX inference
9696 vid_stride = 1 , # video frame-rate stride
9797):
98- """
99- Run YOLOv3 detection inference on various input sources such as images, videos, streams, and YouTube URLs.
98+ """Run YOLOv3 detection inference on various input sources such as images, videos, streams, and YouTube URLs.
10099
101100 Args:
102101 weights (str | Path): Path to the model weights file or a Triton URL (default: 'yolov5s.pt').
103102 source (str | Path): Source of input data such as a file, directory, URL, glob pattern, or device identifier
104- (default: 'data/images').
103+ (default: 'data/images').
105104 data (str | Path): Path to the dataset YAML file (default: 'data/coco128.yaml').
106105 imgsz (tuple[int, int]): Inference size as a tuple (height, width) (default: (640, 640)).
107106 conf_thres (float): Confidence threshold for detection (default: 0.25).
@@ -120,7 +119,8 @@ def run(
120119 update (bool): Whether to update all models (default: False).
121120 project (str | Path): Path to the project directory where results will be saved (default: 'runs/detect').
122121 name (str): Name for the specific run within the project directory (default: 'exp').
123- exist_ok (bool): Whether to allow existing project/name directory without incrementing run index (default: False).
122+ exist_ok (bool): Whether to allow existing project/name directory without incrementing run index (default:
123+ False).
124124 line_thickness (int): Thickness of bounding box lines in pixels (default: 3).
125125 hide_labels (bool): Whether to hide labels in the results (default: False).
126126 hide_conf (bool): Whether to hide confidences in the results (default: False).
@@ -131,12 +131,6 @@ def run(
131131 Returns:
132132 None
133133
134- Notes:
135- This function supports a variety of input sources such as image files, video files, directories, URL patterns,
136- webcam streams, and YouTube links. It also supports multiple model formats including PyTorch, ONNX, OpenVINO,
137- TensorRT, CoreML, TensorFlow, PaddlePaddle, and others. The results can be visualized in real-time or saved to
138- specified directories. Use command-line arguments to modify the behavior of the function.
139-
140134 Examples:
141135 ```python
142136 # Run YOLOv3 inference on an image
@@ -148,6 +142,12 @@ def run(
148142 # Run YOLOv3 inference on a webcam
149143 run(weights='yolov5s.pt', source='0', view_img=True)
150144 ```
145+
146+ Notes:
147+ This function supports a variety of input sources such as image files, video files, directories, URL patterns,
148+ webcam streams, and YouTube links. It also supports multiple model formats including PyTorch, ONNX, OpenVINO,
149+ TensorRT, CoreML, TensorFlow, PaddlePaddle, and others. The results can be visualized in real-time or saved to
150+ specified directories. Use command-line arguments to modify the behavior of the function.
151151 """
152152 source = str (source )
153153 save_img = not nosave and not source .endswith (".txt" ) # save inference images
@@ -286,8 +286,7 @@ def run(
286286
287287
288288def parse_opt ():
289- """
290- Parses and returns command-line options for running YOLOv3 model detection.
289+ """Parses and returns command-line options for running YOLOv3 model detection.
291290
292291 Args:
293292 --weights (list[str]): Model path or Triton URL. Default: ROOT / "yolov3-tiny.pt".
@@ -321,7 +320,7 @@ def parse_opt():
321320 Returns:
322321 argparse.Namespace: Parsed command-line arguments for YOLOv3 inference configurations.
323322
324- Example :
323+ Examples :
325324 ```python
326325 options = parse_opt()
327326 run(**vars(options))
@@ -364,8 +363,7 @@ def parse_opt():
364363
365364
366365def main (opt ):
367- """
368- Entry point for running the YOLO model; checks requirements and calls `run` with parsed options.
366+ """Entry point for running the YOLO model; checks requirements and calls `run` with parsed options.
369367
370368 Args:
371369 opt (argparse.Namespace): Parsed command-line options, which include:
@@ -400,7 +398,7 @@ def main(opt):
400398 Returns:
401399 None
402400
403- Example :
401+ Examples :
404402 ```python
405403 if __name__ == "__main__":
406404 opt = parse_opt()
0 commit comments