polish #1

Merged
scott merged 6 commits from jazz/YOLOv8_test_example:fork into main 2026-09-17 11:26:36 -05:00
Showing only changes of commit 7df0ad92ae - Show all commits
Regular → Executable
+8 -2
View File
@@ -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":