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

ValueError: Error when checking target: expected complex_dense_1 to have shape (None, 48) but got array with shape (38400, 24) #31

Open
SpenceraM opened this issue Jul 6, 2018 · 1 comment

Comments

@SpenceraM
Copy link

I am working with the shallownet architecture for my own implementation. The backend is Theano and I am running keras 2.1.1. So far, I have the complex convolution layers working. I am now trying to get the complex dense layers working as well. The model is able to be created and the following is the summary. In the future, once this works I will have more layers and then eventually take the real part of the output and make it a one-hot vector.

_________________________________________________________________
Layer (type)                 Output Shape              Param #
=================================================================
input_1 (InputLayer)         (None, 1024, 2)           0
_________________________________________________________________
complex_conv1d_1 (ComplexCon (None, 1024, 32)          224
_________________________________________________________________
average_pooling1d_1 (Average (None, 256, 32)           0
_________________________________________________________________
permute_1 (Permute)          (None, 32, 256)           0
_________________________________________________________________
flatten_1 (Flatten)          (None, 8192)              0
_________________________________________________________________
complex_dense_1 (ComplexDens (None, 48)                196656
=================================================================
Total params: 196,880
Trainable params: 196,880
Non-trainable params: 0
_________________________________________________________________

After the summary is printed out, the following error occurs:

starting training
saving model to ./weights/training_data_chunk_1_snrs_10.0_2018-07-06_18.34.17.wts.h5
cnn_complex.py:190: UserWarning: The `nb_epoch` argument in `fit` has been renamed `epochs`.
  outs = ComplexDense(24, activation='sigmoid',bias_initializer=Constant(value=-5))(outs)
Traceback (most recent call last):
  File "cnn_complex.py", line 190, in <module>
    outs = ComplexDense(24, activation='sigmoid',bias_initializer=Constant(value=-5))(outs)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 1574, in fit
    batch_size=batch_size)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 1411, in _standardize_user_data
    exception_prefix='target')
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 153, in _standardize_input_data
    str(array.shape))
ValueError: Error when checking target: expected complex_dense_1 to have shape (None, 48) but got array with shape (38400, 24)

The shape (38400, 24) is the shape of the label, i.e. 38400 is the size of the training set and 24 is the number of classes.

@SpenceraM SpenceraM changed the title ValueError: Error when checking target: expected complex_dense_1 to have shape (None, 256) but got array with shape (38400, 24) ValueError: Error when checking target: expected complex_dense_1 to have shape (None, 48) but got array with shape (38400, 24) Jul 6, 2018
@PigpigF
Copy link

PigpigF commented Jun 17, 2019

can you give me your email-address?

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