I’m doing a image classification excerise, with the following model:
_input = keras.layers.Input(shape=(IMAGE_HEIGHT, IMAGE_WIDTH, 3))
model = keras.models.Sequential([
_input,
keras.layers.Conv2D(filters=64, kernel_size=(3,3), activation="relu"),
keras.layers.MaxPool2D(),
keras.layers.Conv2D(filters=32, kernel_size=(3,3), activation="relu"),
keras.layers.MaxPool2D(),
keras.layers.Flatten(),
keras.layers.Dense(64, kernel_regularizer=keras.regularizers.l2(0.001), activation="relu"),
keras.layers.Dropout(0.2),
keras.layers.Dense(32, kernel_regularizer=keras.regularizers.l2(0.001), activation="relu"),
keras.layers.Dense(16, kernel_regularizer=keras.regularizers.l2(0.001), activation="relu"),
keras.layers.Flatten(),
keras.layers.Dense(2, activation="softmax"),
])
Where IMAGE_HEIGHT = 640
and IMAGE_WIDTH = 360
Because of the last layer, I’m expecting it to output only 2 values. However, when I call predict, it outputs:
[[9.6326274e-01 3.6737300e-02]
[9.9999464e-01 5.3239705e-06]
[1.0000000e+00 1.4427736e-08]
[9.9398309e-01 6.0168877e-03]]
It is predicting 2 labels, a 1 and a 0.
What exactly am I doing wrong?