Very low accuracy

hi, my accuracy is too low:

Since I can’t upload code, let me just describe the model:
Conv2D(64, (3,3), activation=‘relu’, input_shape=(28, 28, 1))
MaxPooling2D(2, 2)
Conv2D(128, (3,3), activation=‘relu’)
Dense(512, activation=‘relu’)
Dense(1, activation=‘softmax’)

optimizer = ‘rmsprop’,
loss = ‘categorical_crossentropy’,

If I put more than 1 neuron in 2nd dense layer then I get value error.
Removing the dropout layer still gives similar results
I tried adding more conv2d layers but not much of a difference

My notebook got 100/100 from the grader but I am just not satisfied with the accuracy. Please help

For how long have you been training this network? The loss seems to be very low for training which should be good.

1 Like

I trained for 15 epochs, the accuracy is 0.06 thats like 6%.
What can i do?

I took this course many years ago and don’t have access to the current notebooks, but is this MNIST data? Guessing from the input shape. If so, don’t you need/want the output layer to have a dimension of 10? And if that causes a conflict with your chosen loss function, the solution isn’t to change the output dimension…it’s to choose a suitable loss function.

My take is that the real issue with your plot isn’t the low accuracy number, which is an effect, not a cause. The flat line means the network isn’t learning at all. Which means a fundamental problem with the model. Take a look here for some guidance on choice of loss function:

Use this crossentropy loss function when there are two or more label classes. We expect labels to be provided in a one_hot representation. If you want to provide labels as integers, please use SparseCategoricalCrossentropy loss

Hope this helps

1 Like

What is the horizontal axis on those plots?


It’s loss or accuracy by epoch

Looks like there’s no training happening, and the validation cost is the default value of 0.

1 Like

I am also facing similar problem. The loss is showing as nan (and you could have gotten 0 loss on the plot because of this). Please let me know if you have fixed the issue.

NaN means “not a number”. It means your code has an error.

This is what my data looks like as well. I just posted about this issue too.