I'm learning neural networks and I created a CNN that based on a dataset with faces determine whether someone is of an infant, a teenager, young adult, adult... Basically is determines your age category.
The results I get regarding val_loss and val_mae are ok (~0.5 val loss, ~0.5 val mae), however, my val_accuracy is barely changing. It's usually stuck at 0.088 and barely changes at all. And even if changes, it goes back to 0.088 in the next epoch. It changes after 10 or so epochs, but it starts decreasing.
I'm not sure what could be causing this. Can you help me?
I'm doing it for the first time and the model is mine, so I'm not sure whether I created it correctly.
This is my neural network:
x_train,x_validation,y_train,y_validation = train_test_split(pictures,ages,train_size=.85, shuffle=True,random_state=100)
input = Input(shape=(200,200,3))
conv1 = Conv2D(filters=64,kernel_size=(3,3),activation="relu")(input)
maxPool1 = MaxPool2D((2,2))(conv1)
conv2 = Conv2D(filters=128,kernel_size=(3,3),activation="relu")(maxPool1)
maxPool2 = MaxPool2D((2,2))(conv2)
conv3 = Conv2D(filters=256,kernel_size=(3,3),activation="relu")(maxPool2)
maxPool3 = MaxPool2D((2,2))(conv3)
conv4 = Conv2D(filters=512,kernel_size=(3,3),activation="relu")(maxPool3)
maxPool4 = MaxPool2D((2,2))(conv4)
conv5 = Conv2D(filters=1024,kernel_size=(3,3),activation="relu")(maxPool4)
GAP = tf.keras.layers.GlobalAveragePooling2D()(conv5)
age = Dense(64,activation="relu")(GAP)
age = Dense(32,activation="relu")(age)
drop=Dropout(rate=.4, seed=123)(age)
age = Dense(1,activation="linear")(drop)
model = Model(inputs=input,outputs=age)
model.compile(optimizer="adam",loss=["mse","sparse_categorical_crossentropy"],metrics=['mae','accuracy'])