nelson1425 / EfficientAD

Unofficial implementation of EfficientAD https://arxiv.org/abs/2303.14535
https://arxiv.org/abs/2303.14535
Apache License 2.0
240 stars 62 forks source link

Error when evaluate with MVTec code #42

Open winstonchu498 opened 2 months ago

winstonchu498 commented 2 months ago

I used the python script you gave as follow:

python mvtec_ad_evaluation/evaluate_experiment.py --dataset_base_dir './mvtec_anomaly_detection/' --anomaly_maps_dir './output/1/anomaly_maps/mvtec_ad/' --output_dir './output/1/metrics/mvtec_ad/' --evaluated_objects bottle

but there are errors:

`python mvtec_ad_evaluation/evaluate_experiment.py --dataset_base_dir './mvtec_anomaly_detection/' --anomaly_maps_dir './output/1/anomaly_maps/mvtec_ad/' --output_dir './output/1/metrics/mvtec_ad/' --evaluated_objects bottle === Evaluate bottle === Parsed 83 ground truth image files. Read ground truth files and corresponding predictions... 0%| | 0/83 [00:00<?, ?it/s] Traceback (most recent call last): File "F:\implementation_anomalydetection\nelson1425_EfficientAD\nelson_data\mvtec_ad_evaluation\evaluate_experiment.py", line 247, in main() File "F:\implementation_anomalydetection\nelson1425_EfficientAD\nelson_data\mvtec_ad_evaluation\evaluate_experiment.py", line 215, in main calculate_au_pro_au_roc( File "F:\implementation_anomalydetection\nelson1425_EfficientAD\nelson_data\mvtec_ad_evaluation\evaluate_experiment.py", line 148, in calculate_au_pro_au_roc prediction = util.read_tiff(pred_name) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\implementation_anomalydetection\nelson1425_EfficientAD\nelson_data\mvtec_ad_evaluation\generic_util.py", line 102, in read_tiff raise FileNotFoundError('Could not find a file with a TIFF extension' FileNotFoundError: Could not find a file with a TIFF extension at ./output/1/anomaly_maps/mvtec_ad/bottle\test\broken_large\000 (base) PS F:\implementation_anomalydetection\nelson1425_EfficientAD\nelson_data>

`

all the mvtec_ad_evaluation.tar.xz and mvtec_anomaly_detection.tar.xz are from what you share. I am running from aconda powershell from windows 10

can anyone point a way ?

HoseinHashemi commented 2 months ago

Pass the argument exts=['.tiff'] to the util.read_tiff(pred_name) and it must solve the issue. So line 148 of evaluate_experiment.py should look like : prediction = util.read_tiff(pred_name, exts=['.tiff'])

Or alternatively, the function could be changed to deal with the issue.