How can i get all XYHW-confidence for detected objects in image? #5056
Answered
by
glenn-jocher
lirilkumar
asked this question in
Q&A
-
I want to use custom trained model, to score images in notebook environment. Can someone point me how can i get back X,Y,H,W and confidence for each class identified in image(s). goal is to get cropped class sub images from input image (extracting number plates from cars) using XYHW and confidence. Thanks for great library bdw. |
Beta Was this translation helpful? Give feedback.
Answered by
glenn-jocher
Oct 5, 2021
Replies: 1 comment
-
@lirilkumar see PyTorch Hub tutorial for returning inference results and producing detection crops automatically: import torch
# Model
model = torch.hub.load('ultralytics/yolov5', 'yolov5s')
# Image
img = 'https://ultralytics.com/images/zidane.jpg'
# Inference
results = model(img)
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 YOLOv5 Tutorials
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
lirilkumar
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@lirilkumar see PyTorch Hub tutorial for returning inference results and producing detection crops automatically:
YOLOv5 Tutorials