Reputation: 11
I am trying to "custom dataset for image" using tensorflow 2.0 my directory structure is: say (PetImage)as root directory which contains two classes: Cat and Dog which contains respective images. /PetImage| |Cat | img1.jpg | img2.jpg | imgn.jpg | ...
|Dog | img1.jpg
| img2.jpg
| ig3.jpg
| ig.jpg
| ...
My code is as follows: img_height = 64 img_width = 64
ds_train = tf.keras.preprocessing.image_dataset_from_directory( "I:\Image\Data\kagglecatsanddogs_5340\PetImages", labels="inferred", label_mode="int", color_mode="rgb", image_size=(img_height, img_width), shuffle=True, seed=123, validation_split=0.3, subset="training", interpolation="bicubic" )
history = model.fit(ds_train, epochs=2)
Error:
InvalidArgumentError: Graph execution error:
Input is empty. [[{{node decode_image/DecodeImage}}]] [[IteratorGetNext]] [Op:__inference_train_function_1704]
Upvotes: 0
Views: 80
Reputation: 86
In tensorflow 2.0, there is no function - tf.keras.preprocessing.image_dataset_from_directory()
and even in the latest version of tensorflow 2.11 there is a function tf.keras.utils.image_dataset_from_directory()
Refer to this link - "https://www.tensorflow.org/api_docs/python/tf/keras/utils/image_dataset_from_directory"
Upvotes: 0