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

weights converted in wrong order #31

Closed
scenarios opened this issue Dec 19, 2017 · 5 comments
Closed

weights converted in wrong order #31

scenarios opened this issue Dec 19, 2017 · 5 comments

Comments

@scenarios
Copy link

Hi @Vladkryvoruchko , I noticed you convert the parameter of bn layer in caffe to the numpy array by the order of 'mean = v[0], variance = v[1], scale = v[2], offset = v[3]' . However, the v[0-3] actually hold the value for scale, offset, mean, variance respectively according to the caffe blob's definition in bn layer.

The reason that you can still reproduce the results is that you reverse the order again when you try to restore the parameter for the keras model from the numpy array, i.e. model.get_layer(layer.name).set_weights([mean, variance, scale, offset]).

This may not hurt when using your code completely, but it is very unexpected for those people who just use the parameter converted by the code.

Thanks for your efforts!

@jmtatsch
Copy link
Contributor

@scenarios Seems like a valid point. Can you check #32? Do you have pycaffe installed to test converting the weights again?

@scenarios
Copy link
Author

@jmtatsch Checked and everything works well now.

@jmtatsch
Copy link
Contributor

@scenarios Perfect. Would you be so kind and contribute new npy weights for the models? I don't have the whole PSPNET, pycaffe etc chain running anymore ...

@jmtatsch
Copy link
Contributor

jmtatsch commented Jan 9, 2018

I think we can safely close this now.

@Vladkryvoruchko
Copy link
Owner

@jmtatsch yup

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

3 participants