I want to get the input images of the trainset unlabeled.
When loading the dataset I get an odd dictionary first, but I got rid of it.
What I just can't manage is to resize all images to (200,200,3).
My attempt so far:
@tf.function
def pre(img):
return img["image"]
training_daten = tfds.as_numpy(tfds.load(name="cars196", batch_size = 8, split="train").map(pre))
# I got the pictures now, but they're all of a different shape
def pre2(i):
img_pil = Image.fromarray(i)
i = img_pil.thumbnail((200,200), Image.ANTIALIAS)
return np.array(i)
training_daten = [list(map(pre2,i)) for i in training_daten]
I'm already 5 hours on this.. Thank you very much!
EDIT:
Output of the first batch of my code is:
[array(None, dtype=object), array(None, dtype=object), array(None, dtype=object), array(None, dtype=object), array(None, dtype=object), array(None, dtype=object), array(None, dtype=object), array(None, dtype=object)]
So, something doesn't work.