Rubikplayer / flame-fitting

Example code for the FLAME 3D head model. The code demonstrates how to sample 3D heads from the model, fit the model to 3D keypoints and 3D scans.
http://flame.is.tue.mpg.de/
719 stars 108 forks source link

_pickle.UnpicklingError: the STRING opcode argument must be quoted #26

Open mohamedwahba129 opened 2 years ago

mohamedwahba129 commented 2 years ago

def load_binary_pickle( filepath ): with open(filepath, 'rb') as f: data = pickle.load(f, encoding="latin1") return data

shreyaschincholkar commented 2 years ago

Hi @mohamedwahba129 were you able to fix this issue? I am facing a similar issue in "flame-fitting\fitting\util.py" line 48

def load_binary_pickle( filepath ):
    with open(filepath, 'rb') as f:
        data = pickle.load(f, encoding="latin1")
    return data

This error:

 data = pickle.load(f, encoding="latin1")
_pickle.UnpicklingError: invalid load key, '\x0a'.
199ChenNuo commented 1 year ago

Hi, I met the same problem. I'm using Windows, and I think this problem may be caused by different encodings between OS.

I processed the original ./models/flame_static_embedding.pkl, replaced the file path in fit_lmk3d.py in line 137 and this problem is solved. The processing code is:

original = "./models/flame_static_embedding.pkl"
destination = "./models/processed_embeeding.pkl"

content = ''
outsize = 0
with open(original, 'rb') as infile:
  content = infile.read()
with open(destination, 'wb') as output:
  for line in content.splitlines():
    outsize += len(line) + 1
    output.write(line + str.encode('\n'))

print("Done. Saved %s bytes." % (len(content)-outsize))
443421190 commented 9 months ago

_pickle.UnpicklingError: the STRING opcode argument must be quoted

How