Skip to content

Trainer Class Predict Func == Decreasing Prediction Time #1698

Answered by alexriedel1
semaegrii asked this question in Q&A
Discussion options

You must be logged in to vote

you have to save the return of your model call in a variable. then you can access its content. For Padim, the anomaly score is the max of the anomaly map.

In this case the pred_score is calculated as follows:

# Case I: Predictions could be a tensor.
if isinstance(predictions, torch.Tensor):
anomaly_map = predictions.detach().cpu().numpy()
pred_score = anomaly_map.reshape(-1).max()

You also might want to post process the map and the score. Please see the torch inference for details:

Replies: 6 comments 7 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@alexriedel1
Comment options

@semaegrii
Comment options

@alexriedel1
Comment options

Answer selected by semaegrii
@semaegrii
Comment options

Comment options

You must be logged in to vote
1 reply
@alexriedel1
Comment options

Comment options

You must be logged in to vote
2 replies
@alexriedel1
Comment options

@semaegrii
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants