Search code examples
pythontensorflowtensorflow-datasets

Tensorflow Datasets "so2sat" dataset only provides black rgb images


I succesfully downloaded the so2sat LCZ42 dataset with tensorflow datasets. However when sampling rgb images (expected range 0-255) they are all allmost completely black. Reproduce:

import tensorflow_datasets as tfds
import numpy as np
import matplotlib.pyplot as plt

train_ds, test_ds = tfds.load('so2sat', split=['train', 'validation'])
images = []
for i, example in enumerate(train_ds.take(10000)):
  image, label = example["image"], example["label"]
  # only show when perhaps not black
  if image.numpy().max()>150:
    print(i)
    print(image.numpy().max())
    images.append(image)
    plt.imshow(image.numpy())
    plt.show()

This shows allmost entirely black pictures

installed:

tensoflow-datasets==1.2.0
tensorflow==2.1.0
matplotlib==3.3.2
numpy==1.19.2

This behaviour is unexpected since I expect at least some daytime normal sattelite rgb pictures. Am I missing something here?


Solution

  • Issue can be resolve once you upgrade Tensorflow Datasets to 4.0 and Tensorflow 2.4.