Hi,
I'm trying to build a CNN using Keras. The inputs are (128, 128) images and I need to predict 7 parameters from these images (not a classification problem, I need values of all 7 parameters).
The input data has been normalized to be in the range (-1, 1). The 7 output labels have also been normalized the same way. My model code is shown as below:
from keras.models import Sequential
from keras.layers import Dense, Conv2D, MaxPooling2D, Flatten
model = Sequential()
model.add(Conv2D(64, kernel_size=3, activation='relu', input_shape=(128,128,1)))
model.add(MaxPooling2D((2,2), padding="valid"))
model.add(Conv2D(32, kernel_size=3, activation='relu'))
model.add(MaxPooling2D((2,2), padding="valid"))
model.add(Conv2D(16, kernel_size=3, activation='relu'))
model.add(MaxPooling2D((2,2), padding="valid"))
model.add(Flatten())
model.add(Dense(7, activation='tanh'))
model.compile(optimizer="adam", loss="binary_crossentropy", metrics=["accuracy"])
sol = model.fit(X_train, Y_train, epochs=5, batch_size=128)
The problem now is that the model always predicts the same 7 parameters for any example in the test set. Even for the training set, the predicted values are not satisfactory (I'm getting an accuracy of 11%). My question is that is there some problem with my implementation of this CNN? Is it some problem with the activation functions or loss function?
If not, then it must be that my data is not properly fed into this model. Any suggestions on that will also be very helpful.
Best regards