fengju514/Face-Pose-Net

Problem in loading PAM_frontal_ALexNet.npy

Opened this issue · 1 comments

It shows a runtime error at

  File "Face-Pose-Net/get_Rts.py", line 53, in run_pose_estimation
    net_data = np.load(root_model_path +"PAM_frontal_ALexNet.npy").item()

with the message

ValueError: Object arrays cannot be loaded when allow_pickle=False
and if I set allow_pickle=True, it just keeps on printing endless bytes of strings and doesn't give any output

The original project seems to only have been tested in python 2.7 on linux, using tensorflow 1 and opencv 2.
The model file to which you refer contains weights and biases of several layers in a sort of two level dictionary format, but apparently saved using numpy with a pickling feature (which attempts have shown is necessary in these so called "object arrays").
However, per the documentation of np.load, pickling causes issues between python releases - for example the dump you've experienced. To get around this issue, I've exported the object array as individual arrays sans pickling to flattened files in py2, which I rewrote to be loaded back as a proper dictionary structure per their later usage, hopefully more version agnostic. At least, the main function is now compatible with more recent libraries, and windows.

Long story short, check out my fork, and the new alexnet model link in its readme page.