'InvalidArgumentError_Graph execution error

img_height,img_width=100,100

batch_size=32

import tensorflow as tf

train_ds = tf.keras.preprocessing.image_dataset_from_directory(train_Path,validation_split=0.2,subset="training",seed=123,image_size=(img_height, img_width),batch_size=batch_size)

val_ds = tf.keras.preprocessing.image_dataset_from_directory(train_Path,validation_split=0.2,subset="validation",seed=123,image_size=(img_height, img_width),batch_size=batch_size)

model = Sequential()

model.add(ResNet50(include_top=False,pooling='avg',input_shape=(100,100,3)))

model.add(Dense(5, activation='softmax'))

model.layers[0].trainable = False

model.summary()

model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])steps_per_epoch_training = len(train_ds)/ batch_size_training

steps_per_epoch_validation = len(val_ds)/ batch_size_validation

num_epochs = 10

history = model.fit(train_ds , epochs=num_epochs, batch_size=64, validation_data = val_ds)

InvalidArgumentError: Graph execution error



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source