farizrahman4u / recurrentshop

Framework for building complex recurrent neural networks with Keras
MIT License
767 stars 218 forks source link

Number of inputs mismatch when calling RecurrentModel #95

Closed JaviFuentes94 closed 2 years ago

JaviFuentes94 commented 6 years ago

Following the same style from one of the examples I wrote the following simple code:

`def RecurrentSegnet():

    input_image = KL.Input(
            shape=[128, 128, 3, ], name="input_image")

    readout_input = KL.Input((128, 128, 1, ))

     input = KL.concatenate([input_image, readout_input], axis=-1)

    x = KL.Conv2D(256, (3, 3), name="Conv1")(input)
    x = KL.Conv2D(256, (3, 3), name="Conv2", activation=K.relu)(x)
    x = KL.MaxPool2D((3, 3), strides=1, padding="SAME", name="Pool1")(x)
    x = KL.Conv2D(512, (3, 3), name="Conv3")(x)
    x = KL.Conv2D(512, (3, 3), name="Conv4", activation=K.relu)(x)
    x = KL.MaxPool2D((3, 3), strides=1, padding="SAME", name="Pool2")(x)

    x = KL.UpSampling2D((3, 3))(x)
    x = KL.Conv2D(256, (3, 3), name="Conv5")(x)
    x = KL.Conv2D(256, (3, 3), name="Conv6", activation=K.relu)(x)
    x = KL.UpSampling2D((3, 3))(x)
    x = KL.Conv2D(128, (3, 3), name="Conv7")(x)
    x = KL.Conv2D(64, (3, 3), name="Conv8", activation=K.relu)(x)
    y = KL.Conv2D(1, (3, 3), name="Conv9", activation=K.relu)(x)

rnn = RecurrentModel(input=input_image, output=y, readout_input=readout_input)

return rnn
#Define the model

images_per_sequence = 5

input_sequence = KL.Input(
            shape=[images_per_sequence, 128, 128, 3], name="input_sequence")

out = RecurrentSegnet()(input_sequence)

model = keras.Model(inputs=input_sequence, outputs=out)`

However, it raises the following assertion error, and I don't understand why:

File "/home/javi/anaconda3/envs/tensorflow-gpu/lib/python3.5/site-packages/recurrentshop-1.0.0-py3.5.egg/recurrentshop/engine.py", line 473, in call AssertionError: Required 2 inputs, received 3.

Thanks for your help and good job with the package!