From 7df0ad92ae6ad8a424f36c3d8252656cb8a60866 Mon Sep 17 00:00:00 2001 From: "jazz (gitea)" Date: Thu, 17 Sep 2026 10:44:51 -0500 Subject: [PATCH] parse image path from argument --- test.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) mode change 100644 => 100755 test.py diff --git a/test.py b/test.py old mode 100644 new mode 100755 index 67c0064..29edd2f --- a/test.py +++ b/test.py @@ -1,10 +1,16 @@ +#!/usr/bin/env python3 + +import sys + from ultralytics import YOLO +image_path = sys.argv[1] + # Load the small pretrained YOLOv8 object-detection model. model = YOLO("yolov8n.pt") # Run object detection on a test image. -results = model("bus4.jpg") +results = model(image_path) has_bus = False max_confidence = 0.0 @@ -13,7 +19,7 @@ for result in results: class_names = result.names detected_classes = result.boxes.cls.tolist() confidences = result.boxes.conf.tolist() - + # Check each detected object and its matching confidence score for cls_id, conf in zip(detected_classes, confidences): if class_names[int(cls_id)] == "bus":