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

Error when checking model target: expected dense_2 to have shape (None, 2) but got array with shape (24, 13) #2

Open
ohmerhe opened this issue Aug 2, 2018 · 1 comment

Comments

@ohmerhe
Copy link

ohmerhe commented Aug 2, 2018

Traceback (most recent call last):
File "fine_tune_inceptionv3.py", line 129, in
callbacks=[mc_top, tb])
File "/home/heliangwei/tensorflow3/lib/python3.6/site-packages/keras/engine/training.py", line 1557, in fit_generator
class_weight=class_weight)
File "/home/heliangwei/tensorflow3/lib/python3.6/site-packages/keras/engine/training.py", line 1314, in train_on_batch
check_batch_axis=True)
File "/home/heliangwei/tensorflow3/lib/python3.6/site-packages/keras/engine/training.py", line 1033, in _standardize_user_data
exception_prefix='model target')
File "/home/heliangwei/tensorflow3/lib/python3.6/site-packages/keras/engine/training.py", line 124, in standardize_input_data
str(array.shape))
ValueError: Error when checking model target: expected dense_2 to have shape (None, 2) but got array with shape (24, 13)

@ParthPurani
Copy link

ParthPurani commented Jan 2, 2019

it may be because your generator is not getting 2 classes. (getting an array )

Found 25000 images belonging to 2 classes.
Found 1000 images belonging to 2 classes.

you must get this (ignore no. of images).

to get it, follow this convention(also given in code itself).

data/
    train/
        dogs/
            dog001.jpg
            dog002.jpg
            ...
        cats/
            cat001.jpg
            cat002.jpg
            ...
    validation/
        dogs/
            dog001.jpg
            dog002.jpg
            ...
        cats/
            cat001.jpg
            cat002.jpg
            ...

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