-
Notifications
You must be signed in to change notification settings - Fork 709
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
[Bug]: Strict flag not passed when Metrics istantiend #2541
Comments
EDIT: in my case i try to see the base.py file for metrcis in the anomalib installaion but the strict parameter it is not present in that file |
Yes I think the feature is not yet present in the pypy build available via pip. You have to go via development install: https://github.com/openvinotoolkit/anomalib?tab=readme-ov-file#-development-install |
yes infact installing it by cloning the repository and using !pip install -e .[full] the strict parameter was added |
You could try to |
ok unnderstood, thanks. |
If you installed it via |
Describe the bug
If i want to train patchore for a classification task, i see that in v2 folder does not accept as input parameter task="classification". So i trying using the strict parameter (set to false to evaluator's pixel metrics) but it say that
"Unexpected keyword arguments:
strict
"for adding the strict = False to the pixel metrics and if i remove this it worked but during the train i recevie another bug :
"NoneType' object has no attribute 'flatten' that indicates that i'm trying to call the flatten method on a variable that is currently None. The problem arises i think in the BinaryPrecisionRecallCurve._binary_precision_recall_curve_format function within the post-processing step of Anomalib, where it expects the target (ground truth mask) to be a valid tensor. However, it seems that for some of my validation data in datamodule_DISCHITOP, the ground truth mask is missing or not properly loaded, resulting in target being None"
Dataset
Folder
Model
PatchCore
Steps to reproduce the behavior
IMPORT
from anomalib.data import Folder
from anomalib.models import Patchcore
from anomalib.models import Padim
from anomalib.engine import Engine
from anomalib.metrics import F1Score, AUROC
from anomalib.metrics import Evaluator
from anomalib.post_processing import OneClassPostProcessor
DATA PREPARATION
datamodule_DISCHITOP = Folder(
name = "DISCHITOP",
root = Dataset_path_DISCHITOP ,
normal_dir = "train/good",
abnormal_dir = "test/defective",
normal_test_dir = "test/good",
)
datamodule_DISCHITOP.setup()
SETUP
engine = Engine()
test_metrics = [
AUROC(fields=["pred_score", "gt_label"], prefix="image_"), # Image-level AUROC
F1Score(fields=["pred_label", "gt_label"], prefix="image_"), # Image-level F1
AUROC(fields=["anomaly_map", "gt_mask"], prefix = "pixel_", strict = False), # Pixel-level AUROC
F1Score(fields=["pred_mask", "gt_mask"], prefix = "pixel_", strict = False) # Pixel-level F1
]
evaluator_DISCHITOP = Evaluator(test_metrics = test_metrics)
model_patchcore_DISCHITOP = Patchcore(evaluator = evaluator)
TRAIN
engine.fit(model = model_patchcore_DISCHITOP, datamodule = datamodule_DISCHITOP)
OS information
OS information:
Expected behavior
The model trained for classification
Screenshots
No response
Pip/GitHub
pip
What version/branch did you use?
No response
Configuration YAML
N/A
Logs
Code of Conduct
The text was updated successfully, but these errors were encountered: