I know that we can directly use “results.show()” to get the image with objects being figured out. But what if I want to just show some objects that have bigger confidence than a threshold? Then we need to fetch the results one by one manually:import torch
import cv2
model = torch.hub.load('.', 'custom', path='best.pt', source='local')
model.eval()
colors = {
14: (0,255,0),
80: (0,0,255)
}
names = {
14: "bird",
80: "squirrel"
}
for index in ["1.jpeg", "2.jpeg", "4.jpeg", "7.jpeg", "3.webp", "5.webp", "6.webp", "8.png"]:
img_name = f"squirrel_bird{index}"
...
继续阅读
(95)