NoneType Shape problem
Opened this issue · 0 comments
I'm currently creating a simple model with VGG16 as a base, cropped at the conv5 layer, like so:
cropped_VGG16 = keras.models.Model(inputs=VGG16_base.input
,outputs=VGG16_base.get_layer('block5_conv3').output)
# this is where I use the VLAD layer
vlad_layer = VLAD_pooling(inputs=cropped_VGG16.output,
k_centers=64,
scope="vlad",
use_xavier=True,
stddev=1e-3)
final_model = keras.models.Model(inputs=cropped_VGG16,
outputs=vlad_layer)
However, I get the following error message at line 56:
TypeError: Failed to convert object of type <class 'list'> to Tensor. Contents: [None, 1]. Consider casting elements to a supported type.
Here is a snip of my model summary:
I directly use the output from the Keras VGG16 model as the input to the netVLAD_pooling() function. As can be seen from the screenshot above in Keras, the batch dimension (the first dimension) is set as None
to allow for variable batch size. This seems to be the one that causes the issue, since your implementation of netVLAD in line 56 attempts to retrieve an int for num_batches
. This also causes a problem of matmul as well
do you have any suggestions on how I can get around this?
If not, can I ask what your original implementation was like when using this netVLAD layer with a CNN?
PS
also, in line 25, you retrieve num_features
from the 2nd dimension of input
which according to your documentation seems to be the feature map width (BxHxWxC). is that intentional?