Failed to interpret det1.npy as a pickle while running ``align_dataset_mtcnn.py``
See original GitHub issueI 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:
- Created 6 years ago
- Comments:13 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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):