-
Notifications
You must be signed in to change notification settings - Fork 690
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
Add Torch Inferencer and Update Openvino and Gradio Inferencers. #453
Conversation
@@ -141,9 +149,30 @@ def post_process( | |||
anomaly_map = predictions.squeeze() | |||
pred_score = anomaly_map.reshape(-1).max() | |||
|
|||
# Common practice in anomaly detection is to assign anomalous | |||
# label to the prediction if the prediction score is greater | |||
# than the image threshold. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we warn users if thresholds are not present in meta_data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would bring up another discussion. Do you think we should check if they are in meta_data?
For example,
if "image_threshold" in meta_data:
pred_label = pred_score >= meta_data["image_threshold"]
We cannot calculate the pred-label if we don't have this. The question is whether we should have this if statement here, and for the rest of the computation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the default threshold is 0.5 so if we don't have image_threshold
in meta_data then we can throw a warning and reduce the if statement to pred_label = pred_score >= meta_data.get("image_threshold", 0.5)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as we throw a warning it should be fine. Because the users need to be made aware that there is a problem with the metadata file.
pred_mask = cv2.resize(pred_mask, (image_width, image_height)) | ||
|
||
return { | ||
"anomaly_map": anomaly_map, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this work for task type of classification?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it returns none, which ImageResults handles ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! All my comments have been addressed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Description
Add Torch Inferencer.
Return all the predictions from
inferencer.predict(image)
. This way, the user will be able to access to any info they need.Fixes # 294
Changes
Checklist