liznerski / fcdd

Repository for the Explainable Deep One-Class Classification paper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Providing ground truth maps to prevent purely black or purely white maps

layadas opened this issue · comments

I have ground truth masks and source images for normal and anomalous data samples in my dataset and I have arranged them in the following format:

datasets/custom/test/class1/normal/  # 59 source images
datasets/custom/test/class1/anomalous/  # 53 source images
 
datasets/custom/test_maps/class1/normal/  # 59 ground truth maps \in {0, 255}^(1, W, H)
datasets/custom/test_maps/class1/anomalous/  # 53 ground truth maps \in {0, 255}^(1, W, H)

datasets/custom/train/class1/normal/  # 2370 source images
datasets/custom/train/class1/anomalous/  # 6 source images

datasets/custom/train_maps/class1/normal/  # 2370 ground truth maps \in {0, 255}^(1, W, H)
datasets/custom/train_maps/class1/anomalous/  # 6 ground truth maps \in {0, 255}^(1, W, H)

With the above arrangement, I use the following command:
python runners/run_custom.py --supervise-mode other --ground-truth-maps --blur-heatmaps

The code runs without any errors. However, when I go into the results folder, then I see that the ground truth maps are completely black or completely white images. They do not include the maps that I stored in the folder above. I am not sure why this is happening. Is there any mistake that I am making in the command, or is there any other reason why it is taking purely white or purely black images as ground truth and not using the ones that I provided?
Thank you in advance for your help and suggestions.

As an update, I also get this message at the end of training:

Computing GT test score...
Skipped computing the gtmap ROC score. for some samples no ground-truth maps were found

It is not able to recognise the gt maps in the folder for some reason.

My first guess is that the names in, e.g., datasets/custom/test_maps/class1/anomalous/ do not match the ones in datasets/custom/test/class1/anomalous/. For example, there is a datasets/custom/test/class1/anomalous/cute_cat_xyz.png but the corresponding ground-truth map is named datasets/custom/test_maps/class1/anomalous/cute_cat_xyz_map.png. The file names need to be exactly the same for the code to recognize them as pairs.

Have a look here. This defines the list of all ground-truth filepaths. You can log/print self.gtm_samples to see which ground-truth samples it found. Can you check that?

PS: You don't need any normal ground-truth maps. The code automatically creates those as completely black images. Missing anomalous training ground-truth maps are also automatically interpolated as completely white images. So you don't need a training ground-truth map for every sample. However, you need all ground-truth maps for anomalous test images. Otherwise, the code skips computing the pixel-wise AUC.

@liznerski Thank you for the link to the code. I did have a difference in the file names - the source images were .jpg while the masks were .png. I thought this would not matter, but the code clarified it. I changed the extensions and now the gt maps are loaded in the ds_preview.png file.