Add docstrings and improve comments (#11229)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Glenn Jocher 2024-05-03 22:51:26 +02:00 committed by GitHub
parent ccfc1cf925
commit d5458f27cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 34 additions and 17 deletions

View file

@ -118,6 +118,7 @@ After creating the AWS CloudFormation Stack, the next step is to deploy YOLOv8.
import json
def output_fn(prediction_output, content_type):
"""Formats model outputs as JSON string according to content_type, extracting attributes like boxes, masks, keypoints."""
print("Executing output_fn from inference.py ...")
infer = {}
for result in prediction_output:

View file

@ -53,6 +53,7 @@ model = YOLO("yolov8n.pt")
def predict_image(img, conf_threshold, iou_threshold):
"""Predicts and plots labeled objects in an image using YOLOv8 model with adjustable confidence and IOU thresholds."""
results = model.predict(
source=img,
conf=conf_threshold,