yunjey/show-attend-and-tell

problem in prepro.py

xiami2019 opened this issue · 5 comments

When running prepro.py, KeyError: 'conv1_1'

do you solve it ?can you tell me, thanks!

do you solve it ?can you tell me, thanks!

Sry for answering too late, i have fixed vggnet.py to load the vggnet's parameters.
You should fix the function build_params() in ./core/vggnet.py using the codes below:

def build_params(self):
model = scipy.io.loadmat(self.vgg_path)
layers = model['layers'][0]
self.params = {}
with tf.variable_scope('encoder'):
for i, name in enumerate(vgg_layers):
layer_type = name[:4]
layer_name = name
if layer_type == 'conv':
w = layers[i][0][0][0][0][0].transpose(1, 0, 2, 3)
b = layers[i][0][0][0][0][1].reshape(-1)
self.params[layer_name] = {}
self.params[layer_name]['w'] = tf.get_variable(layer_name+'/w', initializer=tf.constant(w))
self.params[layer_name]['b'] = tf.get_variable(layer_name+'/b',initializer=tf.constant(b))

Hope it could help you.

Thanks for your answering

thanks for your answering,I did this yesterday. but I have the following error
InvalidArgumentError: Shape must be rank 1 but is rank 2 for 'BiasAdd_7' (op: 'BiasAdd') with input shapes: [?,224,224,64], [1,64].

I didn't encounter this porb, but it seems like your bias in neural network's node has an inconsistent shape size.

I slove it by using your approach,thanks very much