You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 20, 2022. It is now read-only.
Hi @hysts , I've trained and evaluated successfully with my own dataset. And now I want to test with only an image, but I'm not sure about any files I need to change. Can you help me this problem? I've tried to change some files and some functions but it's not work.
Thank you so much!
The text was updated successfully, but these errors were encountered:
Then, you can use the snippet below to show top5 predictions.
transform=pytorch_image_classification.transforms.create_transform(
config, is_train=False)
image=cv2.imread('/path/to/your/image.jpg')
data=transform(PIL.Image.fromarray(image))
withtorch.no_grad():
pred=model(data.unsqueeze(0).to(device))
prob=F.softmax(pred, dim=1).cpu()
scores, indices=prob.topk(k=5)
scores=scores.numpy().ravel()
indices=indices.numpy().ravel()
names= [dic[index] forindexinindices] # Here, `dic` is a dictionary that maps indices to label names. You need to define it before this line.forname, scoreinzip(names, scores):
print(f'{name}: {score:.3f}')
plt.imshow(image[:, :, ::-1])
plt.show()
Hi @hysts , I've trained and evaluated successfully with my own dataset. And now I want to test with only an image, but I'm not sure about any files I need to change. Can you help me this problem? I've tried to change some files and some functions but it's not work.
Thank you so much!
The text was updated successfully, but these errors were encountered: