fchollet / deep-learning-models

Keras code and weights files for popular deep learning models.
MIT License
7.32k stars 2.46k forks source link

Making a Keras layer dynamic for Tensorflow operations(Tensorflow object detection API) #109

Open rohith513 opened 5 years ago

rohith513 commented 5 years ago

Hello, I am replacing a Convolution layer with a Locally connected layer in ResNet (with Faster RCNN). Tensorflow imports this layer from keras and and it says that the dimensions of the input to this layer should be fully defined. When I run it it throws the below error.

So how to make this keras layer dynamic?

Source code / logs Bottleneck block from Resnet (resnet_v1.py):

residual = slim.conv2d(inputs, depth_bottleneck, [1, 1], stride=1, scope='conv1') residual = Local_connection.LocallyConnected2D(filters=depth_bottleneck, kernel_size=3, strides = (2,2), data_format='channels_last')(residual) residual = slim.conv2d(residual, depth, [1, 1], stride=1,activation_fn=None, scope='conv3')

Error: ValueError: The spatial dimensions of the inputs to a LocallyConnected2D layer should be fully-defined, but layer received the inputs shape (1, None, None, 256)

Link to the keras layer (check line 309): https://github.com/tensorflow/models/issues/url

rohith513 commented 5 years ago

@fchollet