Skip to content

How to detect objects in real time with a cv2 image? #2803

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

You must be logged in to vote

@HamkiWhite you can use YOLOv5 PyTorch Hub models for inference in your loop.

PyTorch Hub

Inference with YOLOv5 and PyTorch Hub:

import torch

# Model
model = torch.hub.load('ultralytics/yolov5', 'yolov5s')

# Image
img = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg'

# Inference
results = model(img)

Replies: 1 comment 15 replies

Comment options

You must be logged in to vote
15 replies
@shershunov
Comment options

@9christian9
Comment options

@shershunov
Comment options

@shershunov
Comment options

@9christian9
Comment options

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