tf_weights icon indicating copy to clipboard operation
tf_weights copied to clipboard

Alexnet model

Open iridescent303 opened this issue 8 years ago • 10 comments

Could you please show me the exact Alexnet model which you use ? I want to compile it with cudnn 5.1.3 . Thank you!

iridescent303 avatar Oct 17 '16 09:10 iridescent303

I find one, but I get an error when I follow the instructions and get both py and npy. The error: Traceback (most recent call last): File "myalexnet.py", line 93, in conv1W = tf.Variable(net_data["conv1"][0]) KeyError: 0 Could anyone help me? Thank you!

iridescent303 avatar Oct 17 '16 12:10 iridescent303

Are you using Python 3? There are some issues with with line net_data = load("bvlc_alexnet.npy").item()

in Python 3. You can try net_data = load("bvlc_alexnet.npy", encoding="latin1").item()

instead, which works with newer versions of NumPy.

guerzh avatar Oct 17 '16 12:10 guerzh

No,I am using python 2.7,but I find that the bvlc_alexnet.pyc generated by myself will make net_data["conv1"]["weight"] and net_data["conv1"]["bias"]

iridescent303 avatar Oct 17 '16 12:10 iridescent303

If i use the bvlc_alexnet.npy, i will get net_data["conv1"][0] and net_data["conv1"][1]. Could you please tell me why?

iridescent303 avatar Oct 17 '16 12:10 iridescent303

Did i do somthing wrong?

iridescent303 avatar Oct 17 '16 12:10 iridescent303

Sorry, I'm not sure. Do I understand correctly that when you just run python2 myalexnet.py, it doesn't give an error?

This still seems to do with different versions of numpy.load() to me.

guerzh avatar Oct 17 '16 12:10 guerzh

Sorry for my poor english. What i want to say is that the new bvlc.alexnet.npy save as net_data["conv1"]["weight"] and net_data["conv1"]["bias"], not net_data["conv1"][0] and net_data["conv1"][1], so when i use net_data["conv1"][0], the program will go wrong.(Actually I don't setup Python 3 on my computer.)

iridescent303 avatar Oct 17 '16 13:10 iridescent303

Where do you get the new bvlc_alexnet.npy?

Here is what works on my system: Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import numpy as np >>> np.version.version '1.10.2' >>> net_data = np.load("bvlc_alexnet.npy").item() >>> a = net_data["conv1"][0] >>>

I know that for different versions of NumPy (not even Python, just NumPy), np.load() works differently, so I suspect that may be the issue.

guerzh avatar Oct 17 '16 13:10 guerzh

O,your bvlc_alexnet.npy is compiled on cudnn4.0.0 ,but i need to compile on cudnn5.1.0.3. So I follow the instruction from https://github.com/ethereon/caffe-tensorflow and get the new bvlc_alexnet.npy.Does the version of the caffe-tensorflow matter?

iridescent303 avatar Oct 17 '16 13:10 iridescent303

I'm not sure, but this seems like it may be the issue.

guerzh avatar Oct 17 '16 13:10 guerzh