问题描述
我正在尝试根据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',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("[:,#]")]
对于英语,它会生成文本和相应的置信度分数,但是当我通过指定印地语作为语言时,我也正在获取的文本和置信度分数>印地语,而图片中仅包含英语语言。
以下是示例图片:Sample image
我在做什么错? ?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)