Image classification problem

I am facing a problem in multiclass image classification, I’m using CNN model and have 4 classes, but when ever i put a random unknown image it will predict the wrong class.

I also try to find the solution then i find it is because of activator function that is softmax
But i changed it butt my problem is not solved.

Anyone can help?

Have you choosen the right loss for your case, if the classes are one hot encoded you use categorical_crossentropy else sparse_categorical_crossentropy. Have you trained the model long enough to achieve good accuracy? Are you testing it one images that are similar the ones used in training (same distribution)? Have a look about on these!

I used to train both way with onehot encoded and also without, but with one hot encoder accuracy is good but still got wrong predictions