how to get the classe names in an image classifer after predection?
I get your problem,  the point is that its correct what the model does, but you have to build a look-up table for its answer. Your ground-truth, looks somethink like that [0,0,0,0,1], a one-hot vector for example. You, the human know what this code stands for, for example cats.  just like that you have to build an numpy array, listing the word-embeddings in the correct order and afterwards calling it like: class_names[prediction],prediction being your CNN-result ->[7].

To sum it up, the Dense-layer in the end is giving you with softmax-activation a propability desnity function P. You are using this in comparing it with your ground-truth desnity function q, and calculate the difference. You just use numbers, not words, so you have to write an interpretation of the models answeres, for example in form of a lookup-table.

An example could be like:

pred = model.predict_classes(new_image)
labels=np.array(["cats","dogs","cars","humans"])
print(labels[pred[0]])

-&gt; &gt;&gt;&gt; cats