I am using the following code:
import tensorflow as tf
##############################################################
traindata = tf.keras.preprocessing.image.ImageDataGenerator(
rescale=1. / 255,
shear_range=0.2,
zoom_range=0.2,
horizontal_flip=True)
input = traindata.flow_from_directory('VS/train')
modelo = tf.keras.Sequential()
modelo.add(tf.keras.layers.Conv2D(32, (3, 3),
activation=tf.keras.activations.relu))
modelo.add(tf.keras.layers.Flatten())
modelo.add(tf.keras.layers.Dense(64, activation=tf.keras.activations.relu))
modelo.add(tf.keras.layers.Dense(2, activation=tf.keras.activations.relu))
modelo.compile(loss='categorical_crossentropy', optimizer='rmsprop')
modelo.fit_generator(input, epochs=1)
However, I am getting this error:
So by running the code below I get this error
NotImplementedError: `fit_generator` is not yet enabled for unbuilt Model subclasses
Can someone tell me what's wrong?
You didn't specify the input_shape
in the first layer, so the model is not fully defined. This process has not been implemented with fit_generator
, so you should fully define the model with the initial input_shape
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With