Hi. I’m having an issue with the alpaca_model where I’m getting the error:
The number of layers in the model is incorrect. Expected: 8 Found: 7
I’m not sure if I’m adding the end layers and binary classification correctly?
add the new Binary classification layers
# use global avg pooling to summarize the info in each channel
x = tf.keras.layers.GlobalAveragePooling2D()(x)
# include dropout with probability of 0.2 to avoid overfitting
x = tf.keras.layers.Dropout(.2)(x)
# use a prediction layer with one neuron (as a binary classifier only needs one)
outputs = tf.keras.layers.Dense(1)(x)
I didn’t see a specific binary classification layer in the keras.layers documentation and I’m not sure sure if I need to use the tf.keras.layers.Add() function, but I tried that and it still gave me the same error.
These are the layers I see in the model2:
[‘InputLayer’, [(None, 160, 160, 3)], 0]
[‘TensorFlowOpLayer’, [(None, 160, 160, 3)], 0]
[‘TensorFlowOpLayer’, [(None, 160, 160, 3)], 0]
[‘Functional’, (None, 5, 5, 1280), 2257984]
[‘GlobalAveragePooling2D’, (None, 1280), 0]
[‘Dropout’, (None, 1280), 0, 0.2]
[‘Dense’, (None, 1), 1281, ‘linear’]
I think it’s looking to match the following alpaca_summary:
[[‘InputLayer’, [(None, 160, 160, 3)], 0],
[‘Sequential’, (None, 160, 160, 3), 0],
[‘TensorFlowOpLayer’, [(None, 160, 160, 3)], 0],
[‘TensorFlowOpLayer’, [(None, 160, 160, 3)], 0],
[‘Functional’, (None, 5, 5, 1280), 2257984],
[‘GlobalAveragePooling2D’, (None, 1280), 0],
[‘Dropout’, (None, 1280), 0, 0.2],
[‘Dense’, (None, 1), 1281, ‘linear’]] #linear is the default activation
so it’s missing the sequential layer? I didn’t see in the assignment steps where the sequential layer should have been added?