Skip to content

Error while running Train your Classifier Code #11

@Aarijit

Description

@Aarijit

Hi,

Thanks for creating such a great post. While following your code, I'm getting an error, which I could not resolve. The error is coming from this portion of the code:

#建立人脸检测模型,加载参数
print('Creating networks and loading parameters')
gpu_memory_fraction=1.0
with tf.Graph().as_default():
    gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=gpu_memory_fraction)
    sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options, log_device_placement=False))
    with sess.as_default():
        pnet, rnet, onet = detect_face.create_mtcnn(sess, './model_check_point/')

The error is the following:

Traceback (most recent call last):
File "/home/ragas/anaconda3/envs/DNN/lib/python3.6/site-packages/numpy/lib/format.py", line 640, in read_array
array = pickle.load(fp, **pickle_kwargs)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc0 in position 2: ordinal not in range(128)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "faceRecognition_training.py", line 44, in <module>
    pnet, rnet, onet = detect_face.create_mtcnn(sess, './model_check_point/')
  File "/home/ragas/Documents/DNN/Face_recognition/real_time_face_recognition/detect_face.py", line 278, in create_mtcnn
    pnet.load(os.path.join(model_path, 'det1.npy'), sess)
  File "/home/ragas/Documents/DNN/Face_recognition/real_time_face_recognition/detect_face.py", line 84, in load
    data_dict = np.load(data_path).item() #pylint: disable=no-member
  File "/home/ragas/anaconda3/envs/DNN/lib/python3.6/site-packages/numpy/lib/npyio.py", line 419, in load
    pickle_kwargs=pickle_kwargs)
  File "/home/ragas/anaconda3/envs/DNN/lib/python3.6/site-packages/numpy/lib/format.py", line 646, in read_array
    "to numpy.load" % (err,))
UnicodeError: Unpickling a python object failed: UnicodeDecodeError('ascii', b'IW\xc0\xbbX\x1d\x7f<\x7f\xf0\xa3;5:\x81\xbb\x9b\x06>;L\x8d\x0c=j$%\xbb\xf4[\x9a\xbcq\xa7k\xbc\xe2#&\xbc\xa8W\x04;O\xa6\xd7;\xa1\x9c\xc8\xbb\xd1+\x17\xbc\xa1Y\x00\xba\x80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d!*H\xbd\x83\x91\xd0<Wa\xef\xbb\xc9\x8d\x08<\x11\x12\xb2;\xa9~\xc3\xbbY\x8d1<\xd9X\xb3<&R\x06\xbe\xb7\xbc >xZT;\x89\xa8\xed\xbbEL\x88\xbb4k\x97<', 2, 3, 'ordinal not in range(128)')
You may need to pass the encoding= option to numpy.load

After Googling, it's saying because of format issue in numpy loading. But if I add encoding='latin1' in load part, it's not solving the issue.

I'm using Ubuntu 16.06 ls, python 3.6 and tf 1.3.

Could you please guide me why this error is coming?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions