Skip to content

How can I get coordination of the object detected via webcam in real time? #6147

Answered by glenn-jocher
HugThePenguin asked this question in Q&A
Discussion options

You must be logged in to vote

@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.

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  #…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@HugThePenguin
Comment options

@glenn-jocher
Comment options

@HugThePenguin
Comment options

Answer selected by HugThePenguin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants