1

I am using Autokeras for RGB image classification on Google Colab. My directory looks like this:

train
---class1
------img1.jpg
------img2.jpg
---class2
------img3.jpg
------img4.jpg

I load the image using tf.data.Dataset as follows:

train_ds = tfk.preprocessing.image_dataset_from_directory("/content/train",
                                                          image_size=(300,300))

Then I import Autokeras and use it like this:

import autokeras as ak

clf = ak.ImageClassifier(objective="val_accuracy")
clf.fit(train_ds)

But it gives me the error:

IndexError: tuple index out of range

I use element_spec and the results are as follows:

(TensorSpec(shape=(None, 300, 300, 3), dtype=tf.float32, name=None),
 TensorSpec(shape=(None,), dtype=tf.int32, name=None))

where None should be the batch size.

I wonder what causes this and how should I fix this?

Minh-Long Luu
  • 2,393
  • 1
  • 17
  • 39

0 Answers0