question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to interpret det1.npy as a pickle while running ``align_dataset_mtcnn.py``

See original GitHub issue

I got the following error while following the guide to validate facenet on LFW:

Traceback (most recent call last):
  File "src/align/align_dataset_mtcnn.py", line 143, in <module>
    main(parse_arguments(sys.argv[1:]))
  File "src/align/align_dataset_mtcnn.py", line 55, in main
    pnet, rnet, onet = align.detect_face.create_mtcnn(sess, None)
  File "/Users/tomheaven/Documents/facenet/build/lib/src/align/detect_face.py", line 283, in create_mtcnn
    pnet.load(os.path.join(model_path, 'det1.npy'), sess)
  File "/Users/tomheaven/Documents/facenet/build/lib/src/align/detect_face.py", line 85, in load
    data_dict = np.load(data_path, encoding='latin1').item() #pylint: disable=no-member
  File "/Library/Python/2.7/site-packages/numpy/lib/npyio.py", line 429, in load
    "Failed to interpret file %s as a pickle" % repr(file))
IOError: Failed to interpret file '/Users/tomheaven/Documents/facenet/build/lib/src/align/det1.npy' as a pickle

I’m using python 2.7.10 on Mac OS X 10.12. I also load det1.npy manually with

import numpy as np
np.load('det1.npy')

but still failed.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
vantuan5644commented, Apr 22, 2019

You need to modify a little bit in numpy lib.

Look inside your env’s site-packages directory: …/site-packages/numpy/lib/npio.py

In line 292: def load(file, mmap_mode=None, allow_pickle=False, fix_imports=True, …)

Change allow_pickle attribute from False to True and everything gonna work again.

3reactions
Shmarkuscommented, May 15, 2019

The correct solution here would be to fix the src not the numpy lib (which most probably will be overwritten when you upgrade numpy version) I’ll post a pull request later on but for the impatient (facenet/src/align/detect_face.py, line 85):

data_dict = np.load(data_path, encoding='latin1', allow_pickle=True).item() #pylint: disable=no-member
Read more comments on GitHub >

github_iconTop Results From Across the Web

numpy/scipy/ipython:Failed to interpret file as a pickle
The numpy.load routine is for loading pickled .npy or .npz binary files, which can be created using numpy.save and numpy.savez ...
Read more >
Cellpose - numpy unable to interpret file model.npy as a pickle
Hello all, again. I am running cellpose 0.6.5 on my computer and until yesterday everything was running smoothly.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found