Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem in prepro.py #84

Open
xiami2019 opened this issue Nov 17, 2018 · 5 comments
Open

problem in prepro.py #84

xiami2019 opened this issue Nov 17, 2018 · 5 comments

Comments

@xiami2019
Copy link

When running prepro.py, KeyError: 'conv1_1'

@gorgeousyouth
Copy link

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

@xiami2019
Copy link
Author

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.

@gorgeousyouth
Copy link

Thanks for your answering

@xiami2019
Copy link
Author

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.

@gorgeousyouth
Copy link

I slove it by using your approach,thanks very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants