show-attend-and-tell icon indicating copy to clipboard operation
show-attend-and-tell copied to clipboard

problem in prepro.py

Open xiami2019 opened this issue 6 years ago • 5 comments

When running prepro.py, KeyError: 'conv1_1'

xiami2019 avatar Nov 17 '18 09:11 xiami2019

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

gorgeousyouth avatar Nov 23 '18 07:11 gorgeousyouth

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.

xiami2019 avatar Nov 24 '18 07:11 xiami2019

Thanks for your answering

gorgeousyouth avatar Nov 24 '18 07:11 gorgeousyouth

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.

xiami2019 avatar Nov 24 '18 07:11 xiami2019

I slove it by using your approach,thanks very much

gorgeousyouth avatar Nov 24 '18 07:11 gorgeousyouth