Commit adafa3e6 authored by WenmuZhou's avatar WenmuZhou
Browse files

Merge branch 'dygraph' of https://github.com/PaddlePaddle/PaddleOCR into dygraph_rc

parents 8ebaf27d 301b0d34
...@@ -60,7 +60,7 @@ class BaseRecLabelDecode(object): ...@@ -60,7 +60,7 @@ class BaseRecLabelDecode(object):
def add_special_char(self, dict_character): def add_special_char(self, dict_character):
return dict_character return dict_character
def decode(self, text_index, text_prob=None, is_remove_duplicate=True): def decode(self, text_index, text_prob=None, is_remove_duplicate=False):
""" convert text-index into text-label. """ """ convert text-index into text-label. """
result_list = [] result_list = []
ignored_tokens = self.get_ignored_tokens() ignored_tokens = self.get_ignored_tokens()
...@@ -110,7 +110,7 @@ class CTCLabelDecode(BaseRecLabelDecode): ...@@ -110,7 +110,7 @@ class CTCLabelDecode(BaseRecLabelDecode):
text = self.decode(preds_idx, preds_prob) text = self.decode(preds_idx, preds_prob)
if label is None: if label is None:
return text return text
label = self.decode(label, is_remove_duplicate=False) label = self.decode(label)
return text, label return text, label
def add_special_char(self, dict_character): def add_special_char(self, dict_character):
......
...@@ -57,7 +57,7 @@ def get_image_file_list(img_file): ...@@ -57,7 +57,7 @@ def get_image_file_list(img_file):
elif os.path.isdir(img_file): elif os.path.isdir(img_file):
for single_file in os.listdir(img_file): for single_file in os.listdir(img_file):
file_path = os.path.join(img_file, single_file) file_path = os.path.join(img_file, single_file)
if imghdr.what(file_path) in img_end: if os.path.isfile(file_path) and imghdr.what(file_path) in img_end:
imgs_lists.append(file_path) imgs_lists.append(file_path)
if len(imgs_lists) == 0: if len(imgs_lists) == 0:
raise Exception("not found any img file in {}".format(img_file)) raise Exception("not found any img file in {}".format(img_file))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment