Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'val_loss' #52

Open
MichaelCong opened this issue Aug 18, 2019 · 1 comment
Open

KeyError: 'val_loss' #52

MichaelCong opened this issue Aug 18, 2019 · 1 comment

Comments

@MichaelCong
Copy link

Epoch 3/30
306/306 [==============================] - 255s 834ms/step - loss: 35.1770
Traceback (most recent call last):
File "train_Mobilenet.py", line 200, in
_main()
File "train_Mobilenet.py", line 75, in _main
callbacks=[logging, checkpoint])
File "/home/rencong/anaconda3/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "/home/rencong/anaconda3/lib/python3.6/site-packages/keras/engine/training.py", line 1418, in fit_generator
initial_epoch=initial_epoch)
File "/home/rencong/anaconda3/lib/python3.6/site-packages/keras/engine/training_generator.py", line 251, in fit_generator
callbacks.on_epoch_end(epoch, epoch_logs)
File "/home/rencong/anaconda3/lib/python3.6/site-packages/keras/callbacks.py", line 79, in on_epoch_end
callback.on_epoch_end(epoch, logs)
File "/home/rencong/anaconda3/lib/python3.6/site-packages/keras/callbacks.py", line 429, in on_epoch_end
filepath = self.filepath.format(epoch=epoch + 1, **logs)
KeyError: 'val_loss'

@funmonty
Copy link

funmonty commented Jul 2, 2020

I also got this error. This was present because the validation set was not given to model.fit(). Initially the following lines would be commented. Just uncomment it to get it working.

# with open(val_path) as v_f:
# v_lines = v_f.readlines()
# np.random.seed(10010)
# np.random.shuffle(v_lines)
# np.random.seed(None)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants