Skip to content

Commit

Permalink
fix(python): Modify the way CTCLabelDecode calculates confidence (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
HiDolen authored May 18, 2024
1 parent 0e1cb18 commit 41a23c0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion python/rapidocr_onnxruntime/ch_ppocr_v3_rec/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ def decode(self, text_index, text_prob=None, is_remove_duplicate=False):
else:
conf_list.append(1)
text = "".join(char_list)
result_list.append((text, np.mean(conf_list + [1e-50])))
result_list.append((text, np.mean(conf_list if any(conf_list) else [0])))
return result_list
2 changes: 1 addition & 1 deletion python/rapidocr_openvino/ch_ppocr_v3_rec/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ def decode(self, text_index, text_prob=None, is_remove_duplicate=False):
else:
conf_list.append(1)
text = "".join(char_list)
result_list.append((text, np.mean(conf_list + [1e-50])))
result_list.append((text, np.mean(conf_list if any(conf_list) else [0])))
return result_list
2 changes: 1 addition & 1 deletion python/rapidocr_paddle/ch_ppocr_v3_rec/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ def decode(self, text_index, text_prob=None, is_remove_duplicate=False):
else:
conf_list.append(1)
text = "".join(char_list)
result_list.append((text, np.mean(conf_list + [1e-50])))
result_list.append((text, np.mean(conf_list if any(conf_list) else [0])))
return result_list

0 comments on commit 41a23c0

Please sign in to comment.