Visualising masks in Cityscapes testset

887574002: <p>Hi, I am working on Segmentation task in Cityscapes. To do that I downloaded the dataset and when I visualise trainset and valset I can see the images and masks correctly. But for images in test set it returns only a black mask. For masks I use <code>_leftImg8bit.png'</code> in dataset. I mean I am using 3-channel masks.</p>
<p>Here is a short script of how I visualise masks:</p>
<pre><code class="lang-auto">
img_root = os.path.join(root_path,'test')

mask_root = os.path.join(root_path,'test_labels')

img_city_list = os.listdir(img_root)

mask_city_list = os.listdir(mask_root)

assert img_city_list==mask_city_list

cities = img_city_list

cities

berlin_img_list= sorted(os.listdir(os.path.join(img_root,'berlin'))) 

berlin_mask_list= sorted(os.listdir(os.path.join(mask_root,'berlin')))

img_sample = berlin_img_list[10]

img_sample:```



```berlin_000010_000019_leftImg8bit.png```

Here I visualise images:

```image = Image.open(os.path.join(img_root,'berlin',img_sample))
plt.imshow(image)```

now we have the following files in label folder:

```mask_lists = ['berlin_000010_000019_gtFine_color.png',
 'berlin_000010_000019_gtFine_instanceIds.png',
 'berlin_000010_000019_gtFine_labelIds.png',
 'berlin_000010_000019_gtFine_polygons.json']```

And when I visualise it using the following code:

```mask1 = Image.open(os.path.join(mask_root,'berlin',mask_lists[0])).convert('RGB')

mask2 = Image.open(os.path.join(mask_root,'berlin',mask_lists[2])).convert('L')```

```plt.imshow(mask1)```

```plt.imshow(mask2)```

I would just get a black mask. I would appreciate any help.</code></pre>

ptrblck: <p>Are you able to open these images in any picture viewer and are you seeing a valid output?<br>
If so, it would point towards a failure in opening or deciding the images.<br>
Are you visualizing the training and validation masks using the same or similar code?</p>

887574002: <p>Regarding the first question, I did not try to open the images in any viewer. Except opening them using PIL library and visualising them using <code>plt.imshow</code>.</p>
<p>Regarding the second question, yes, I am visualising images and masks in training and validation sets exactly with the similar code.<br>
Can you help me? I really need to visualise these masks in my work. I even tried the implementation of pytorch:</p>
<pre><code class="lang-auto">dataset = Cityscapes('./data/cityscapes', split='test', mode='fine',
                     target_type= 'color')

img, col = dataset[0]
</code></pre>
<p>But I couldn’t visualise the masks.</p>

ptrblck: <p>Could you try to visualize these images using an image viewer and verify, that they are indeed not empty images?</p>

887574002: <p>I just tried that.</p>
<p>training and validation masks are not empty but the test masks are empty.</p>

ptrblck: <p>In that case it seems that <code>PIL</code> is correctly loading the test images and you would have to check, why these images are empty. Maybe they are corrupt or never contained any valid data.</p>

887574002: <p>How can I check that then?</p>
<p>I can visualise the test images but not test masks. I mean the masks in test set are empty.</p>
<p>Is that the reason that when I evaluate my model on test set I got large value for loss?</p>

rlagudtn0934: <p>I think you downloaded dummy test label.</p>
<p>In the cityscapes site, they provide only train and validation dataset labels.</p>
<p>Plz check your test dataset labels are correct.</p>