flame-fitting icon indicating copy to clipboard operation
flame-fitting copied to clipboard

_pickle.UnpicklingError: the STRING opcode argument must be quoted

Open mohamedwahba129 opened this issue 3 years ago • 3 comments

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

mohamedwahba129 avatar Apr 23 '22 22:04 mohamedwahba129

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'.

shreyaschincholkar avatar May 09 '22 11:05 shreyaschincholkar

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))

199ChenNuo avatar Dec 17 '22 14:12 199ChenNuo

_pickle.UnpicklingError: the STRING opcode argument must be quoted

How

443421190 avatar Dec 08 '23 00:12 443421190