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

Getting error in model.evaluate function #2

Open
karunaeerapu opened this issue Nov 22, 2020 · 1 comment
Open

Getting error in model.evaluate function #2

karunaeerapu opened this issue Nov 22, 2020 · 1 comment

Comments

@karunaeerapu
Copy link

Hi Authors,
I am getting errors in the function model. evaluate, and I guess a custom evaluate function is required. Can you please share the custom evaluate function if any?
File "train_my_model.py", line 80, in train_model
loss, acc, sen, spe, F1 = our_model.evaluate(x=[test_X, test_Y], y=test_label, batch_size=1)
File "C:\Users\hp.conda\envs\ChangeDetection\lib\site-packages\keras\engine\training.py", line 1105, in evaluate
batch_size=batch_size)
File "C:\Users\hp.conda\envs\ChangeDetection\lib\site-packages\keras\engine\training.py", line 792, in _standardize_user_data
exception_prefix='target')
File "C:\Users\hp.conda\envs\ChangeDetection\lib\site-packages\keras\engine\training_utils.py", line 100, in standardize_input_data
str(len(data)) + ' arrays: ' + str(data)[:200] + '...')
ValueError: Error when checking model target: the list of Numpy arrays that you are passing to your model is not the size the model expected. Expected to see 1 array(s), but instead got the following list of 2 arrays: [array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0....

@ChenHongruixuan
Copy link
Owner

Hi, we didn't use any custom evaluation function. In your illustrated code, "our_model.evaluate()" is the built-in function of Keras. And according to your errors that say "Expected to see 1 array(s), but instead got the following list of 2 arrays", we think it could be caused by the dimension inconsistency between your given label and the network prediction result.

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