diff --git a/labelImg.py b/labelImg.py index a4d37f65..ab74772c 100755 --- a/labelImg.py +++ b/labelImg.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # -*- coding: utf8 -*- import _init_path +import codecs import os.path import re import sys @@ -1060,7 +1061,7 @@ class MainWindow(QMainWindow, WindowMixin): def loadPredefinedClasses(self): predefined_classes_path = os.path.join('data', 'predefined_classes.txt') if os.path.exists(predefined_classes_path) is True: - with open(predefined_classes_path) as f: + with codecs.open(predefined_classes_path, 'r', 'utf8') as f: for line in f: line = line.strip() if self.labelHist is None: diff --git a/libs/pascal_voc_io.py b/libs/pascal_voc_io.py index 11d654d4..8284fda9 100644 --- a/libs/pascal_voc_io.py +++ b/libs/pascal_voc_io.py @@ -74,7 +74,7 @@ class PascalVocWriter: for each_object in self.boxlist: object_item = SubElement(top, 'object') name = SubElement(object_item, 'name') - name.text = str(each_object['name']) + name.text = unicode(each_object['name']) pose = SubElement(object_item, 'pose') pose.text = "Unspecified" truncated = SubElement(object_item, 'truncated')