mathDR / reading-text-in-the-wild

A Keras/Theano implementation of "Reading Text in the Wild with Convolutional Neural Networks" by M Jaderberg et.al.
GNU General Public License v3.0
116 stars 30 forks source link

You tried to call layer "convolution2d_1" #1

Closed laskarcyber closed 8 years ago

laskarcyber commented 8 years ago

Hi, I get the following error when execute

make_keras_charnet_model.py make_keras_dictnet_model.py

Exception                                 Traceback (most recent call last)
<ipython-input-2-0d2a63d93e7b> in <module>()
     42     weights = [all_weights['conv1W'],all_weights['conv1b']]
     43     model.add(Convolution2D(nb_filters[layer1], nb_conv[layer1], nb_conv[layer1],weights=weights,
---> 44         input_shape=(1, 1, img_rows, img_cols),activation='relu',border_mode='same'))
     45 
     46     model.add(MaxPooling2D(pool_size=(nb_pool, nb_pool)))

/anaconda/envs/py35/lib/python3.5/site-packages/keras/models.py in add(self, layer)
    273                 else:
    274                     input_dtype = None
--> 275                 layer.create_input_layer(batch_input_shape, input_dtype)
    276 
    277             if len(layer.inbound_nodes) != 1:

/anaconda/envs/py35/lib/python3.5/site-packages/keras/engine/topology.py in create_input_layer(self, batch_input_shape, input_dtype, name)
    365         # and create the node connecting the current layer
    366         # to the input layer we just created.
--> 367         self(x)
    368 
    369     def assert_input_compatibility(self, input):

/anaconda/envs/py35/lib/python3.5/site-packages/keras/engine/topology.py in __call__(self, x, mask)
    476                 else:
    477                     raise Exception('You tried to call layer "' + self.name +
--> 478                                     '". This layer has no information'
    479                                     ' about its expected input shape, '
    480                                     'and thus cannot be built. '

Exception: You tried to call layer "convolution2d_1". This layer has no information about its expected input shape, and thus cannot be built. You can build it manually via: `layer.build(batch_input_shape)`
mathDR commented 8 years ago

Hey @laskarcyber did you successfully download the required matlab data and run extract_charnet_weights.py? Also, did you update the keras installation with the new functions? If so, then make sure the file 'matlab_charnet_weights.npz' is able to be seen from make_keras_charnet.py It seems as if there is no input data being seen from the network.

laskarcyber commented 8 years ago

Sorry, i used keras 1.0.8 It works using version 0.3.3

mathDR commented 8 years ago

Okay, I will go ahead and close this