Closed iwillflyandfly closed 2 years ago
This seems to be pointing to the issue that either the generated anomaly segmentation maps OR the ground truth masks are of different sizes, since compute_pixelwise_retrieval_metrics
flattens the generated anomaly segmentations and the ground truth masks for evaluation.
Can you check this?
Many thanks!
I also encountered this problem during the evaluation. I would like to know how to solve this problem.
When I try to evaluating a pretrained PatchCore model like cable, it raises ValueError :" Found input variables with inconsistent numbers of samples: [15360000, 7526400]" INFO:main:Evaluating dataset [mvtec_cable] (1/1)... INFO:patchcore.patchcore:Loading and initializing PatchCore. INFO:main:Embedding test data with models (1/1) INFO:main:Computing evaluation metrics. Traceback (most recent call last): File "src/load_and_evaluate_patchcore.py", line 286, in
main()
File "/home/lihang/anaconda3/envs/lihang-conda/lib/python3.8/site-packages/click/core.py", line 1130, in call
return self.main(args, kwargs)
File "/home/lihang/anaconda3/envs/lihang-conda/lib/python3.8/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/lihang/anaconda3/envs/lihang-conda/lib/python3.8/site-packages/click/core.py", line 1689, in invoke
return _process_result(rv)
File "/home/lihang/anaconda3/envs/lihang-conda/lib/python3.8/site-packages/click/core.py", line 1626, in _process_result
value = ctx.invoke(self._result_callback, value, ctx.params)
File "/home/lihang/anaconda3/envs/lihang-conda/lib/python3.8/site-packages/click/core.py", line 760, in invoke
return __callback(args, **kwargs)
File "src/load_and_evaluate_patchcore.py", line 154, in run
pixel_scores = patchcore.metrics.compute_pixelwise_retrieval_metrics(
File "/home/lihang/patchcore/patchcore-inspection/src/patchcore/metrics.py", line 47, in compute_pixelwise_retrieval_metrics
fpr, tpr, thresholds = metrics.roc_curve(
File "/home/lihang/anaconda3/envs/lihang-conda/lib/python3.8/site-packages/sklearn/metrics/_ranking.py", line 979, in roc_curve
fps, tps, thresholds = _binary_clf_curve(
File "/home/lihang/anaconda3/envs/lihang-conda/lib/python3.8/site-packages/sklearn/metrics/_ranking.py", line 740, in _binary_clf_curve
check_consistent_length(y_true, y_score, sample_weight)
File "/home/lihang/anaconda3/envs/lihang-conda/lib/python3.8/site-packages/sklearn/utils/validation.py", line 387, in check_consistent_length
raise ValueError(
ValueError: Found input variables with inconsistent numbers of samples: [15360000, 7526400]