Tesseract-为什么我获得了不同于原始语言的另一种语言的字符级信心

时间:2020-08-27 19:16:37

标签: python-3.x ocr tesseract python-tesseract

我正在尝试根据tesseract生成的置信度分数来检测图像中的语言。我正在检查每个图像中的不同语言。我正在使用什么:

text1 = pytesseract.image_to_data(full_path, lang='eng', config=tessdata_dir_config, output_type='data.frame') 
text1 = pd.DataFrame(text1) text1 = text1[text1.conf != -1] 
text1 = text1[~text1.text.str.contains('-')] 
text1 = text1[~text1.text.str.contains(' ')] 
text1 = text1[~text1.text.str.contains("\.")] 
text1 = text1[~text1.text.str.contains("[0-9]")] 
text1 = text1[~text1.text.str.contains("[:,\n,/,%,|,;,!,&,(,),\*,\",\?,\',_,=,é,$,@,#]")]


text2 = pytesseract.image_to_data(full_path, lang='hin', config=tessdata_dir_config, output_type='data.frame') 
text2 = pd.DataFrame(text2) 
text2 = text2[text2.conf != -1] 
text2 = text2[~text2.text.str.contains('-')] 
text2 = text2[~text2.text.str.contains(' ')] 
text2 = text2[~text2.text.str.contains("\.")] 
text2 = text2[~text2.text.str.contains("[0-9]")] 
text2 = text2[~text2.text.str.contains("[:,\n,/,%,|,;,!,&,(,),\*,\",\?,\',_,=,é,$,@,#]")]

对于英语,它会生成文本和相应的置信度分数,但是当我通过指定印地语作为语言时,我也正在获取的文本和置信度分数>印地语,而图片中仅包含英语语言。

以下是示例图片:Sample image

我在做什么错? ?

0 个答案:

没有答案
相关问题