MCPcopy Create free account
hub / github.com/Topdu/OpenOCR / decode

Method decode

openrec/postprocess/ce_postprocess.py:29–40  ·  view source on GitHub ↗

convert text-index into text-label.

(self, text_index, text_prob=None)

Source from the content-addressed store, hash-verified

27 return text, label
28
29 def decode(self, text_index, text_prob=None):
30 """convert text-index into text-label."""
31 result_list = []
32 batch_size = len(text_index)
33 for batch_idx in range(batch_size):
34 text = self.character[text_index[batch_idx]]
35 if text_prob is not None:
36 conf_list = text_prob[batch_idx]
37 else:
38 conf_list = 1.0
39 result_list.append((text, conf_list))
40 return result_list
41
42 def add_special_char(self, dict_character):
43 return dict_character

Callers 1

__call__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected