ios - MLkIT 的文本识别不识别非英文文本
问题描述
我在 IOS 上实现了 MLkit 的文本识别,但它无法识别非英文文本(例如阿拉伯文本)。
它仅适用于英语。
这是文档 https://developers.google.com/ml-kit/vision/text-recognition/ios
我的代码:
let textRecognizer = TextRecognizer.textRecognizer()
let visionImage = VisionImage(image: image)
textRecognizer.process(visionImage) { result, error in
guard error == nil, let result = result else { return }
let resultText = result.text
print("MLKit : " + resultText)
}
解决方案
更新:如果不需要完全在本地(在没有网络的设备上),您可以尝试 MLKit for cloud,它支持“100 多种不同的语言和脚本”。Firebase 文本识别
对于本地推理:Google 的“MLKit 文本识别”基于“TensorFlow Lite”,它使用本地模型来识别文本。根据我的研究,Google 并未声明预定义模型专门用于拉丁字母。但似乎是这样。所以你现在有三个选择:
- 寻找针对阿拉伯字母进行训练的自定义“TensorFlow Lite”模型。
- 训练自己的“TensorFlow Lite”模型:TensorFlow Lite Model Maker
- 查找/训练“张量流”模型(不是精简版!)并将其转换为“TensorFlow Lite”模型
推荐阅读
- prolog - Prolog DCG 选择不同的项目
- reactjs - 反应:onClick 方法不适用于参数
- swift - 如何将 UIImage 设置为 ttf 字体中的图标
- python - 有关如何改进此猜数游戏代码的提示
- python - 使用条件值创建新的 pandas 数据框值
- javascript - 如何通过单击按钮在移动 iOS Safari 中打开多个窗口/选项卡?
- python - 为什么退货时商品不显示?我正在获取内存位置
- lisp - max-lisp-eval-depth 找到 sqrt-iter
- javascript - 棘手的正则表达式问题?我该怎么做?
- algorithm - 在位串中找到“适合”位模式的更好算法