Hello,
I have a question about the ResNet class in the example code of Lab2 of Course1, Week 4.
After instantiating and compiling our custom ResNet class, when I call the keras summary() method on the model object, it returns the following ValueError:
ValueError: This model has not yet been built. Build the model first by calling build()
or calling fit()
with some data, or specify an input_shape
argument in the first layer(s) for automatic build.
This makes sense: if we create our model as a custom class, we do not use an Input layer (as opposed to the Functional API) so at this point the program has no way of knowing the input shape of the data we will use. The error message and the TensorFlow documentation say that we can pass an input_shape argument to the first layer of the model in order to pass that information, so that the computation of the subsequent output shapes by the summary() method will work.
But when I do this, i.e., I pass the input_shape=(28,28,1) extra argument to the first Conv2D layer in the ResNet class, I still get the exact same error as above.
What am I doing wrong?
Best regards,
Istvan