Dlib "Error deserializing object of type short"
Asked Answered
T

3

8

I am getting error on pose_predictor = dlib.shape_predictor(predictor_model) on dlib python.

RuntimeError: Error deserializing object of type short
   while deserializing a floating point number.
   while deserializing a dlib::matrix
   while deserializing object of type std::vector
   while deserializing object of type std::vector
   while deserializing object of type std::vector
Tuque answered 15/5, 2017 at 13:47 Comment(3)
this is very common error. you should download shape predictor model file and unpack it from archive. its also possible that file is corrupted while downloading, its size should be (unpacked) 99693937 bytes, sha1 = c7b0e0780a4fda180f75aadf654838c1866ee5fbBrocky
Thanks @Brocky i'll try to download model again , and will verify with given sha1.Tuque
Yeah @Brocky it worked <3 can u write this comment as answer ? so that i can accept the answer.Tuque
T
12

I met the same issue and tried re-downloading the file, then it's OK now.

I downloaded from https://github.com/JeffTrain/selfie/blob/master/shape_predictor_68_face_landmarks.dat

Trapp answered 5/6, 2018 at 10:48 Comment(0)
N
4

Download using command

wget -nd https://github.com/JeffTrain/selfie/raw/master/shape_predictor_68_face_landmarks.dat

when downloading from github download raw file instead of blob.

Neoteny answered 22/12, 2018 at 10:39 Comment(0)
C
0

Hopefully this will help someone. I was using google colab and redownloading and reuploading did not work for me. So I cloned a git repo which had the shape predictor and used it's path

This is what I did

!git clone https://github.com/nicolasmetallo/eameo-faceswap-generator

cd eameo-faceswap-generator

Then change your shape predictor's path to

predictor = dlib.shape_predictor("shape_predictor_68_face_landmarks.dat")

Then run your code

Casie answered 7/5, 2021 at 11:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.