Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Mix Data type issue on inferencer #77

Merged
merged 3 commits into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions anomalib/deploy/inferencers/torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,16 @@ def post_process(
anomaly_map = predictions
pred_score = anomaly_map.reshape(-1).max()
else:
anomaly_map, pred_score = predictions
pred_score = pred_score.detach().cpu().numpy()
# NOTE: Patchcore `forward`` returns heatmap and score.
# We need to add the following check to ensure the variables
# are properly assigned. Without this check, the code
# throws an error regarding type mismatch torch vs np.
if isinstance(predictions[1], (Tensor)):
anomaly_map, pred_score = predictions
pred_score = pred_score.detach()
ashwinvaidya17 marked this conversation as resolved.
Show resolved Hide resolved
else:
anomaly_map, pred_score = predictions
pred_score = pred_score.detach().numpy()

anomaly_map = anomaly_map.squeeze()

Expand Down
1 change: 0 additions & 1 deletion anomalib/models/cflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,3 @@ All results gathered with seed `42`.
![Sample Result 2](../../../docs/source/images/cflow/results/1.png "Sample Result 2")

![Sample Result 3](../../../docs/source/images/cflow/results/2.png "Sample Result 3")