I have trained a model with a very good val_accuracy, but the predictions are completely wrong. Unfortunately answers to similar questions didn't help me. My network has a mutli label problem. The end result is to predict the 3 best labels for each picture from an album.
This is my function, which makes the output with the predictions.
def recognition(path):
class = np.array(classes)
for picture in os.listdir(path):
pic = os.path.join(path, picture)
pic = image.load_img(pic, size)
pic = image.img_to_array(pic)
pic = pic/255
This is my CNN:
model = models.Sequential()
model.add(pretrained)
model.add(layers.Dropout(0.3))
model.add(layers.Flatten())
model.add(layers.Dropout(0.3))
model.add(layers.Dense(256, activation = 'relu'))
model.add(layers.Dropout(0.3))
model.add(layers.Dense(7, activation = 'sigmoid'))
The val_acc is at 0.9527.