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

NameError: name 'unicode' is not defined in object_detection/utils/object_detection_evaluation.py #5203

Closed
schen119 opened this issue Aug 29, 2018 · 7 comments

Comments

@schen119
Copy link

@pkulzc I ran the legacy/eval.py and the error shows up NameError: name 'unicode' is not defined in object_detection/utils/object_detection_evaluation.py, line 332

try:
    category_name = unicode(category_name, 'utf-8')
except TypeError:
    pass

The Python3 doesn't have the type unicode anymore and it has been renamed to str.
Is there any better way to avoid this error?
Most people work in Python 3, it's great to be compatible with python 3.

@pkulzc
Copy link
Contributor

pkulzc commented Aug 29, 2018

#4982 (comment)

@pkulzc
Copy link
Contributor

pkulzc commented Aug 29, 2018

@jillelajitta It's better to ask this question on StackOverflow. Adding more class increase the conv nodes in detection head, so it should be slower.

@pkulzc pkulzc closed this as completed Aug 29, 2018
@kunerer
Copy link

kunerer commented Nov 9, 2018

anyone solute the problem? i am not

@Manish-rai21bit
Copy link

@kunerer As mentioned by pkulzc, You need to replace the unicode by string in the particular line of code mentioned in the error.

@omkarvijay5
Copy link

Python 3 renamed the unicode type to str, the old str type has been replaced by bytes
renaming unicode occurrences to str worked for me

@rhimanshu909
Copy link

Write for Python3
item = str(item.encode('utf-8'))

@Subodhrai898
Copy link

just replace unicode(category_name, 'utf-8') to str(category_name.encode('utf-8')) everywhere in the document.

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

7 participants