提交 c620b939 编写于 作者: L LDOUBLEV

return None when no boxes found

上级 51bd3a6b
...@@ -53,9 +53,11 @@ class DetLabelEncode(object): ...@@ -53,9 +53,11 @@ class DetLabelEncode(object):
txt_tags.append(True) txt_tags.append(True)
else: else:
txt_tags.append(False) txt_tags.append(False)
if len(boxes) == 0:
return None
boxes = self.expand_points_num(boxes) boxes = self.expand_points_num(boxes)
#boxes = np.array(boxes, dtype=np.float32) boxes = np.array(boxes, dtype=np.float32)
#txt_tags = np.array(txt_tags, dtype=np.bool) txt_tags = np.array(txt_tags, dtype=np.bool)
data['polys'] = boxes data['polys'] = boxes
data['texts'] = txts data['texts'] = txts
...@@ -387,10 +389,10 @@ class TableLabelEncode(object): ...@@ -387,10 +389,10 @@ class TableLabelEncode(object):
character_num = int(substr[0]) character_num = int(substr[0])
elem_num = int(substr[1]) elem_num = int(substr[1])
for cno in range(1, 1+character_num): for cno in range(1, 1 + character_num):
character = lines[cno].decode('utf-8').strip("\r\n") character = lines[cno].decode('utf-8').strip("\r\n")
list_character.append(character) list_character.append(character)
for eno in range(1+character_num, 1+character_num+elem_num): for eno in range(1 + character_num, 1 + character_num + elem_num):
elem = lines[eno].decode('utf-8').strip("\r\n") elem = lines[eno].decode('utf-8').strip("\r\n")
list_elem.append(elem) list_elem.append(elem)
return list_character, list_elem return list_character, list_elem
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册