How can I get coordination of the object detected via webcam in real time? #6147
-
QuestionThe title much expresses my question.
Any format is okey. (e.g. xywh). Does anybody has idea? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
@HugThePenguin 👋 Hello! Thanks for asking about handling inference results. YOLOv5 🚀 PyTorch Hub models allow for simple model loading and inference in a python environment. Simple Inference ExampleThis example loads a pretrained YOLOv5s model from PyTorch Hub as import torch
# Model
model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # or yolov5m, yolov5l, yolov5x, custom
# Images
img = 'https://ultralytics.com/images/zidane.jpg' # or file, Path, PIL, OpenCV, numpy, list
# Inference
results = model(img)
# Results
results.print # or .show(), .save(), .crop(), .pandas(), etc.
results.pandas().xyxy[0]
# xmin ymin xmax ymax confidence class name
# 0 749.50 43.50 1148.0 704.5 0.874023 0 person
# 1 433.50 433.50 517.5 714.5 0.687988 27 tie
# 2 114.75 195.75 1095.0 708.0 0.624512 0 person
# 3 986.00 304.00 1028.0 420.0 0.286865 27 tie See YOLOv5 PyTorch Hub Tutorial for details. Good luck 🍀 and let us know if you have any other questions! |
Beta Was this translation helpful? Give feedback.
@HugThePenguin 👋 Hello! Thanks for asking about handling inference results. YOLOv5 🚀 PyTorch Hub models allow for simple model loading and inference in a python environment.
Simple Inference Example
This example loads a pretrained YOLOv5s model from PyTorch Hub as
model
and passes an image for inference.'yolov5s'
is the lightest and fastest YOLOv5 model. For details on all available models please see the README.