Nadavc220 / SemanticSegmentationInArtPaintings

25 stars 6 forks source link

Segmentation Dataset Confusion #6

Open veb-101 opened 1 year ago

veb-101 commented 1 year ago

Hey, what steps do I need to perform to get/generate the segmentation maps? I downloaded the DRAM processed set, the labels directory is filled with images that are black (all pixel values are 0). Is this an error?

The link provided for the SBD dataset redirects to: https://www.cs.cornell.edu/~bharathh/. I'm sure what SBD is and where to download it from the link provided.

Is it possible to share a drive or Dropbox link to the final segmentation dataset that is used in the paper?

Nadavc220 commented 1 year ago

Hi, The segmentation maps provided may seem totally black but if you load them to your python script you will see that they are not. They include values between 0 and 11 as the number of classes used by the dataset. The naked eye can't see the difference between 0 to 11 in pixel value so you may think its only 0.

I checked the link of the SBD dataset and you are right, it does not link to the right place. Unfortunately this change was made by the dataset owner and it seems that the owner he changed the SBD website to redirect to his own personal page. I did not find a way to reach the dataset now. I recommend you to get in touch with the owner and explaining your affiliation and your dataset needs and he may share the dataset with you.

The "DRAM processed" zip holds the exact same data as we used in our paper and PascalVoc12 can be downloaded from the given link. As I am not the owner of the SBD dataset I don't think I can share the dataset myself.

If there is any other way I can help, I would be glad to do so.

veb-101 commented 1 year ago

Hey, thanks for the quick reply.

Can you tell me the location of the segmentation maps?

I ran this short script to go over each image in the "labels" directory to verify:

High-level directory structure info:

DRAM_processed
├─── labels
├─── test
├─── train
└─── test.py
import os
import cv2
import numpy as np

for dir, folders, files in os.walk("labels"):
    if not files:
        continue
    # print(dir)
    file_paths = [os.path.join(dir, file) for file in files]
    for file_path in file_paths:
        try:
            image = cv2.imread(file_path, cv2.IMREAD_COLOR)
            if image.sum() > 0:  # if np.unique(image).sum() > 0:
                print(file_path)
        except Exception as e:
            print(e)
        # break
    # break
python test.py

No outputs returned

Nadavc220 commented 1 year ago

Switch the "cv2.imread..." with np.array(Image.open(file_path)). (from PIL import Image) Not sure why cv2 does load the images properly. You can follow the dataloader found in core/datasets/dram.py to see how we load the images. Same for Pascal\Sbd in case you have problems there too.

veb-101 commented 1 year ago

Thank you it worked. I'll check out that file as well.