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

unable to load model #3

Open
DLeeeeeee opened this issue Oct 17, 2018 · 2 comments
Open

unable to load model #3

DLeeeeeee opened this issue Oct 17, 2018 · 2 comments

Comments

@DLeeeeeee
Copy link

when I ran:
python pred.py --img_dir test --model face_model.pkl

got error:
Traceback (most recent call last):
File "pred.py", line 103, in
main()
File "pred.py", line 81, in main
clf, labels = pickle.load(f)
TypeError: a bytes-like object is required, not 'str'

I tried pickle loading using other encoding option and also tried open file with "rb", but no good result.

Could you please tell me how to solve it? is it a version problem?
OS: ubuntu 16.04
python: 3.5

@Akashpanchal95
Copy link

If you are using the python3 then use this code to read pickle file.

with open(model_path,'rb') as f: clf, labels = pickle.load(f,encoding='latin1')

@halfendt
Copy link

halfendt commented Sep 3, 2019

Hi, this still doesn't work for me. Here is my error now:

in main(input_dir, output_dir, model_path)
49 # load the model
50 with open(model_path, 'rb') as f:
---> 51 clf, labels = pickle.load(f, encoding='latin1')
52
53 print("classifying images in {}".format(input_dir))
ModuleNotFoundError: No module named 'copy_reg\r'

OS: windows 10
python 3.6.8

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