Deep learning, general-purpose detection. Ultralytics YOLOv8n pretrained on COCO's 80 classes.
Ultralytics YOLOv8n ("nano," the smallest, fastest variant) pretrained on COCO — 80 general classes: person, bicycle, car, motorcycle, bus, truck, and 74 others, mostly household, street, and animal objects. Nothing industrial.
Terminal output
image 1/1 traffic.jpg: 352x640 7 cars, 1 bus, 1 truck, 219.0ms
Speed: 8.4ms preprocess, 219.0ms inference, 21.6ms postprocess per image at shape (1, 3, 352, 640)
Total vehicles detected: 9
car: 7
bus: 1
truck: 1
Saved annotated image as output.jpgI also tried this same model on a straight-down aerial traffic photo, as a deliberate anomaly test — a viewpoint the highway camera above doesn't cover. I didn't save that image, so there's no demo photo for this one, just the result.
0 cars detected, with a false positive of "2 broccolis" — tree canopies viewed from directly above visually resembled COCO's broccoli class. Root cause: YOLO's COCO training data is almost entirely street-level/dashcam-angle photos; a nadir (straight-down) viewpoint is a different visual distribution the model never learned.