Skip to content

Commit

Permalink
add inference time
Browse files Browse the repository at this point in the history
  • Loading branch information
fpaissan committed Nov 27, 2023
1 parent d6ae1cd commit 4e32723
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions recipes/image_classification/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"""

import sys
import time
import torch
from train import ImageClassification
from micromind.utils import parse_configuration
Expand Down Expand Up @@ -96,7 +97,9 @@ def acc(pred, batch):
)

img = preprocess(img.float() / 255)
now = time.time()
logits = mind((img[None],))
print("Inference took %.3f ms." % (time.time() - now) * 1e-3)

print(
"Model prediction: %d with probability: %.2f."
Expand Down

0 comments on commit 4e32723

Please sign in to comment.