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 was archived by the owner on Aug 25, 2025. It is now read-only.
Hello, thanks for the great library! Is it possible to return the top k predictions in the output for the ResNet18 image classification example? And is it possible to include their confidence score? This is what I am currently doing in PyTorch:
predict_values=model(input_object)
preds=torch.nn.functional.softmax(predict_values, dim=1)
# Get top 5 resultstop_k=5top_preds_raw=preds.topk(top_k)
top_preds= [
{"label": DEFAULT_MODEL_CLASSES[i], "score": float(score)}
fori, scoreinzip(top_preds_raw.indices[0], top_preds_raw.values[0])
]
returntop_preds