how to calculate Precision/Recall/Accuracy in v1.1.10? #2213
-
Discussed in #781When I do |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 3 replies
-
@stevensagaert, what torchmetrics version are you using? Also, can you provide the full error message you are seeing |
Beta Was this translation helpful? Give feedback.
-
1.4.0.post0
The error message is was I gave. The code continues.
…________________________________
From: Samet Akcay ***@***.***>
Sent: Tuesday, July 23, 2024 9:03 AM
To: openvinotoolkit/anomalib ***@***.***>
Cc: Steven Sagaert ***@***.***>; Mention ***@***.***>
Subject: Re: [openvinotoolkit/anomalib] how to calculate Precision/Recall/Accuracy in v1.1.10? (Issue #2205)
CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
@stevensagaert<https://github.com/stevensagaert>, what torchmetrics version are you using? Also, can you provide the full error message you are seeing
—
Reply to this email directly, view it on GitHub<#2205 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A7A5SMFLBWKRYIZI3YWVELDZNX52RAVCNFSM6AAAAABLI7TCAKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBUGQYDIMJTGA>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
@stevensagaert newer version of Torchmetrics require you to also pass the from anomalib.data import MVTec
from anomalib.engine import Engine
from anomalib.models import Padim
if __name__ == "__main__":
model = Padim()
data = MVTec()
engine = Engine(
image_metrics={
"Precision": {
"class_path": "torchmetrics.Precision",
"init_args": {"task": "binary"},
}
},
)
engine.train(model, datamodule=data) |
Beta Was this translation helpful? Give feedback.
-
Got it. Thanks.
…________________________________
From: Ashwin Vaidya ***@***.***>
Sent: Wednesday, July 24, 2024 2:02 PM
To: openvinotoolkit/anomalib ***@***.***>
Cc: Steven Sagaert ***@***.***>; Mention ***@***.***>
Subject: Re: [openvinotoolkit/anomalib] how to calculate Precision/Recall/Accuracy in v1.1.10? (Issue #2205)
CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
@stevensagaert<https://github.com/stevensagaert> newer version of Torchmetrics require you to also pass the task parameter. One solution would be to use dict to pass the argument
from anomalib.data import MVTec
from anomalib.engine import Engine
from anomalib.models import Padim
if __name__ == "__main__":
model = Padim()
data = MVTec()
engine = Engine(
image_metrics={
"Precision": {
"class_path": "torchmetrics.Precision",
"init_args": {"task": "binary"},
}
},
)
engine.train(model, datamodule=data)
afbeelding.png (view on web)<https://github.com/user-attachments/assets/aacc4a02-80fc-48d1-9896-2960ee0e54a1>
—
Reply to this email directly, view it on GitHub<#2205 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A7A5SMCLKR7LAXHQWUB7G2TZN6JVNAVCNFSM6AAAAABLI7TCAKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBXG4ZTKMJQGQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
@ashwinvaidya17 Hi,
print(predictions) gave me tensors and masks which i dont require at this point. |
Beta Was this translation helpful? Give feedback.
-
Thanks @ashwinvaidya17 it was helpful. I was able to get the metrics as needed. Is it possible to get metrics for each image or each class? |
Beta Was this translation helpful? Give feedback.
@stevensagaert newer version of Torchmetrics require you to also pass the
task
parameter. One solution would be to use dict to pass the argument