import torch
import glob
import os
import pathlib
from ultralytics import YOLO
model_name='MyBest.pt'
model = torch.hub.load(<?>, 'custom', source='local', path = model_name, force_reload = True)
results = model(person.png) # predict on an image
results.save()
yoloV8: how I can to predict and save the image with boxes on the objects with pytorch
Share
The code you posted is not complete and there are some missing pieces. To predict and save an image with boxes on the objects using YOLOv8 in PyTorch, you need to follow these steps:
torch.hub.load()
function.Here is an example implementation of the code to perform the steps mentioned above: