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

Error in Decoding #1

Open
ebnuakoh opened this issue Sep 28, 2018 · 3 comments
Open

Error in Decoding #1

ebnuakoh opened this issue Sep 28, 2018 · 3 comments

Comments

@ebnuakoh
Copy link

ebnuakoh commented Sep 28, 2018

Hi, I run into this error while trying your code in Jupyter. Here is the error. Kindly help. Thanks!

UnicodeDecodeError Traceback (most recent call last)
in ()
----> 1 run()

in run()
12 batch_extractor(images_path)
13
---> 14 ma = Matcher('features.pck')
15
16 for s in sample:

in init(self, pickled_db_path)
3 def init(self, pickled_db_path="features.pck"):
4 with open(pickled_db_path) as fp:
----> 5 self.data = pickle.load(fp)
6 self.names = []
7 self.matrix = []

~/anaconda3/lib/python3.6/codecs.py in decode(self, input, final)
319 # decode input (taking the buffer into account)
320 data = self.buffer + input
--> 321 (result, consumed) = self._buffer_decode(data, self.errors, final)
322 # keep undecoded input until the next call
323 self.buffer = data[consumed:]

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte

@creotiv
Copy link
Owner

creotiv commented Sep 28, 2018

  1. dont use UTF8 filenames, and many problems go away
  2. here is fix https://stackoverflow.com/questions/17303266/how-to-pickle-unicodes-and-save-them-in-utf-8-databases

@ebnuakoh
Copy link
Author

1. dont use UTF8 filenames, and many problems go away

2. here is fix https://stackoverflow.com/questions/17303266/how-to-pickle-unicodes-and-save-them-in-utf-8-databases

Thanks for your quick response. I'm using python 3.6 in Anaconda 1.8.7
I fixed it by:

  1. modifying init method in Matcher class:
    with open(pickled_db_path**, 'rb'**) as fp:
  2. And replaced iteritems with items in same method:
    for k, v in self.data.items():

@barhaiya11
Copy link

Even i am having the same problem but after doing this i have one more error

names, match = ma.match(s, topn=3)

AttributeError: 'Matcher' object has no attribute 'match'
please help me through this.

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