https://github.com/tzutalin/labelImg/issues/31 add support for displaying and saving unicode labels

This commit is contained in:
Ryan Flynn 2016-12-21 23:49:40 -05:00
parent 9a4c922d98
commit 03236397d7
2 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
import _init_path import _init_path
import codecs
import os.path import os.path
import re import re
import sys import sys
@ -1060,7 +1061,7 @@ class MainWindow(QMainWindow, WindowMixin):
def loadPredefinedClasses(self): def loadPredefinedClasses(self):
predefined_classes_path = os.path.join('data', 'predefined_classes.txt') predefined_classes_path = os.path.join('data', 'predefined_classes.txt')
if os.path.exists(predefined_classes_path) is True: 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: for line in f:
line = line.strip() line = line.strip()
if self.labelHist is None: if self.labelHist is None:

View File

@ -74,7 +74,7 @@ class PascalVocWriter:
for each_object in self.boxlist: for each_object in self.boxlist:
object_item = SubElement(top, 'object') object_item = SubElement(top, 'object')
name = SubElement(object_item, 'name') name = SubElement(object_item, 'name')
name.text = str(each_object['name']) name.text = unicode(each_object['name'])
pose = SubElement(object_item, 'pose') pose = SubElement(object_item, 'pose')
pose.text = "Unspecified" pose.text = "Unspecified"
truncated = SubElement(object_item, 'truncated') truncated = SubElement(object_item, 'truncated')