commit a9a3f2142b6c0a1e05c3c83965630e7ce58408f4 Author: scott Date: Wed Sep 16 14:23:43 2026 -0500 first commit diff --git a/bus.jpg b/bus.jpg new file mode 100644 index 0000000..40eaaf5 Binary files /dev/null and b/bus.jpg differ diff --git a/bus.png b/bus.png new file mode 100644 index 0000000..5e77754 Binary files /dev/null and b/bus.png differ diff --git a/bus2.png b/bus2.png new file mode 100644 index 0000000..70bd999 Binary files /dev/null and b/bus2.png differ diff --git a/bus3.jpg b/bus3.jpg new file mode 100644 index 0000000..07b4096 Binary files /dev/null and b/bus3.jpg differ diff --git a/bus4.jpg b/bus4.jpg new file mode 100644 index 0000000..a368b48 Binary files /dev/null and b/bus4.jpg differ diff --git a/notabus.png b/notabus.png new file mode 100644 index 0000000..826d4d5 Binary files /dev/null and b/notabus.png differ diff --git a/readme.MD b/readme.MD new file mode 100755 index 0000000..027d20f --- /dev/null +++ b/readme.MD @@ -0,0 +1,7 @@ +it works on pictures of busses but not the hand-drawn image i made. + +This program tells you whether or not the selected image is a bus. + +python3 test.py + +To change the file to run the operation on, change this line in the source code: results = model("bus4.jpg") diff --git a/test.py b/test.py new file mode 100644 index 0000000..67c0064 --- /dev/null +++ b/test.py @@ -0,0 +1,30 @@ +from ultralytics import YOLO + +# Load the small pretrained YOLOv8 object-detection model. +model = YOLO("yolov8n.pt") + +# Run object detection on a test image. +results = model("bus4.jpg") + +has_bus = False +max_confidence = 0.0 + +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": + has_bus = True + # Keep track of the highest confidence if there are multiple buses + if conf > max_confidence: + max_confidence = conf + +# Output the Yes/No answer and the confidence percentage +if has_bus: + print("Yes") + print(f"Confidence: {max_confidence * 100:.1f}%") +else: + print("No") diff --git a/yolov8n.pt b/yolov8n.pt new file mode 100644 index 0000000..0db4ca4 Binary files /dev/null and b/yolov8n.pt differ