I wanted to see how little code it took to try object detection on a familiar photograph using a model that was already trained. I used the football photo from Ultralytics’ YOLOv5 example so I could concentrate on getting the image into the detector.
My test script loads YOLOv5s through PyTorch and asks it to print a summary of the detections.
The inference workflow
The test uses Ultralytics’ zidane.jpg football photograph. It loads yolov5s with PyTorch Hub, passes the image URL to model(img), then calls results.print(). The script ends at that console summary. The weight file is still in the project, but I have no saved detection output from which to quote a box count or confidence score.
That convenience can hide assumptions. A detector recognizes its trained categories, and a confidence score needs to be interpreted in that setting. It does not automatically understand a new application's purpose.
Detection inside a product
A bounding box can be useful for displaying a label, counting objects, requesting a better photo, or starting another process. The surrounding application must decide which response makes sense.
For a practical use case, I would want images resembling the intended inputs, including difficult lighting, partial objects, unusual viewpoints, and cases where the relevant object is absent.
A sample image is a starting point for that evaluation. It does not establish general accuracy.
The scope of the experiment
The script uses the detector as supplied by Ultralytics. My part of the experiment was connecting a photograph to its predictions.
It fits alongside my browser photo analyzer and later depth-estimation work as another way of using model output in a conventional application. The application workflow determines what the detector's output is useful for.