Closed julien-blanchon closed 2 years ago
You can find an updated version here: https://github.com/julien-blanchon/anomalib And download eurosat from here: https://github.com/phelber/EuroSAT
@julien-blanchon, thanks for the update.
Regarding the following error:
Shape error :(, any idea ? ❌
Patchcore currently doesn't support multiple test batch_size. See #268. If you set it to test_batch_size: 1
it will work. We'll add a hotfix in the next release.
For the early stopping issue,
RuntimeError: Early stopping conditioned on metric
pixel_AUROC
which is not available. Pass in or modify yourEarlyStopping
callback to use any of the following:image_F1Score
,image_AUROC
It's because you set the task: segmentation
but haven't provided mask mask: null
. In this case the folder dataset converts the task to classification
. Maybe we should add some warning messages for this case.
Why did the folder dataset convert my task: segmentation
into a classification
if I don't provide any mask. Anomaly Detection is rarely supervised, most case mask aren't provide
segmentation task means that there are ground-truth masks in the dataset so pixel-level performance computed. If there is no ground-truth mask in the dataset, which is quite common as you said, the task simply becomes a classification task, where the metrics are computed based on the normal/abnormal test labels.
I think I misunderstood something, most of the current segmentation model did not use the mask information for training (only for validation/visualization purpose). So why enforce the need for a ground truth map (for example here in order to make Padim work I've had to bypass the mask dependency but then everything work fine). Classification task only give a binary output as result, so we don't get any information about anomaly location (it still may be possible to sample image tile to specifically locate the abnormal part for the image)
I'm very confused, everything seems to work just fine with task: classification
.
So if I understand well the vocabulary, 'task' only define the evaluation metrics.
-> task classification = image wide normal/abnormal (binary) prediction for evaluation (f1, auroc)
-> task segmentation = pixel wide normal/abnormal (binary) prediction for evaluation (also f1, auroc)
But it didn't change the inner behaviour of my model. For a segmentation algorithm it will just average the number of abnormal pixel in order to get a image wide classification and to evaluate it as an classification model
Exactly, as you said, task ensures the right performance evaluation and saving the images.
So if I understand well the vocabulary, 'task' only define the evaluation metrics. -> task classification = image wide normal/abnormal (binary) prediction for evaluation (f1, auroc) -> task segmentation = pixel wide normal/abnormal (binary) prediction for evaluation (also f1, auroc)
In addition to this, tasks saves the images accordingly
NOTE However, note that not every model in anomalib supports both classification and segmentation tasks. Some of them such as ganomaly, dfm, dfkde are only classification models since they do not have the mechanism to genearate the anomaly maps.
You could refer to this link to see which models support both classification and segmentation (The list has the terms detection vs segmentation, but the same idea).
Does it make any more sense?
Thanks you very much, I was struggling on that for a long time now it's crystal clear !
Great! We'll try to simplify the parameters a further to make it more intuitive.
I'm trying to adapt the current pipeline for some ad hoc dataset (ie EuroSAT) in order to test anomalib and make it more robust. For using the
FolderDataset
for unsupervised segmentation task.So I'm using the EuroSAT RGB Dataset (https://madm.dfki.de/files/sentinel/EuroSAT.zip), Residential as normal and Industrial as abnormal, and of course no mask/groundtruth.
As everything is fine now on development branch with torchmetrics, I will use 24ccb585319dd10ef81778364350eb972bf1cf41.
Updating config with EuroSAT
Here is my dataset section I'm adding using to
cflow
,ganomaly
,padim
andpatchcore
(others settings are not modified)Change early_stopping >
metric: pixel_AUROC
tometric: image_AUROC
. :heavy_check_mark:Padim:
KeyError: 'mask'
I get an
KeyError: 'mask'
after the first epoch, as ground truth is not provide the mask visualization step of on_batch_end must be disable. https://github.com/openvinotoolkit/anomalib/blob/24ccb585319dd10ef81778364350eb972bf1cf41/anomalib/utils/callbacks/visualizer_callback.py#L140 After a small fix (ie skip ground truth visualization) everything work fine. :heavy_check_mark:Patchcore
Shape error :(, any idea ? :x: