我目前在python中有TensorFlow代码,并试图找到将其添加到Android应用程序的最佳方法.我认为有几个选项可以做到这一点.
我一直在关注ML套件(https://developers.google.com/ml-kit/).但是我不确定这是否可行,因为我使用了一些特定的TensorFlow函数来在图中进行计算.例如这两行:
t_score = tf.reduce_mean(t_obj)
t_grad = tf.gradients(t_score, t_input)[0]
Run Code Online (Sandbox Code Playgroud)
ML套件可以做到吗?
另一种选择是在不使用ML套件的情况下将TensorFlow(lite)用于Java,但是看看它似乎有限的Java API,上面的两个调用是否可以在java中进行?
最后一个选项是托管python代码并将其用作后端,以便Android应用程序可以将数据发送给它并接收结果.由于无法在移动设备上进行计算,因此这将更加昂贵.因此,如果可能,其他选项是首选.
你会怎么做?
我正在尝试使用 ML 套件从七段显示图像中获取数字,但它无法识别图像中的数字或小数。它可以识别图像中的普通文本和数字,但不能识别七段显示图像中的文本和数字。请参阅下面的我的发现。
1.适用于普通文本和数字
2.无法识别七段显示图像中的数字
还有其他方法可以实现这一目标吗?
android text-recognition firebase seven-segment-display firebase-mlkit
嗨,我有一个我在 android 应用程序中使用的自定义模型,但是当我尝试运行它时,会抛出 MLkitExceptions,所述错误的日志输出如下:
Internal error has occurred when executing Firebase ML tasks
Run Code Online (Sandbox Code Playgroud)
我的应用程序的 Java 代码如下所示:
Internal error has occurred when executing Firebase ML tasks
Run Code Online (Sandbox Code Playgroud)
每当我尝试运行 FirebaseModelInterpreter 时,我都会收到该错误,而没有其他任何错误。
输入张量和输出张量的形状分别如下:
[1 3]
<class 'numpy.float32'>
[ 1 1 34]
<class 'numpy.int64'>
Run Code Online (Sandbox Code Playgroud)
任何有关此问题的帮助或见解将不胜感激。
我有一个 Android 应用程序,它使用 Android Mobile Vision API 来识别文本 (OCR)。但是,安装该应用程序的设备未安装 Google Play 服务。
我想知道是否可以仅安装 Mobile Vision API 或 ML Kit,而不安装 Google Play 服务。
操作系统:棒棒糖
android xamarin google-play-services google-vision firebase-mlkit
我正在考虑在我的 Android 应用程序中实现 MLKit 人脸识别库。我唯一不明白的是,如果可能的话,我如何比较两张照片并检测它们是否是同一个人。我已阅读这些指南:
谢谢
我在SO和一些不错的博客文章上挖了很多但似乎我有独特的要求分别阅读视频和音频缓冲区,以便在录制时继续进行处理.
我的用例就像当用户启动视频录制时,我需要使用连续处理视频帧ML-Face-Detection-Kit并连续处理音频帧以确保用户说出某些内容并检测噪声级别.为此,我想我需要一个单独的缓冲区中的视频和音频,并在处理后,我将合并它并保存到MP4文件中作为录制.
我尝试过由伟大的家伙Mattia Iavarone开发的CameraView,但它只提供视频帧.
我愿意接受其他有用的建议/反馈来处理这种情况.
android video-processing audio-processing android-camera2 firebase-mlkit
我的 Android 应用程序需要读取图像中的文本,并且我正在使用 Firebase ML Kit 来实现此目的,它对于标准罗马脚本中的文本效果很好,但它完全无法读取以下字体系列中的数字。
特别是对于数字 0、1 和 6,Firebase 结果给出了 O、i、l、L 和 b,因为它在不同的测试中为同一数字提供了替代字母,我无法应用正则表达式将这些字母替换为数字。
我还尝试过 Firebase ML Kit 云文本识别(Google Cloud Vision)来获取这些数字,但它确实有同样的问题。
所以我剩下的唯一选择是Firebase ML Kit 自定义模型,我想知道使用基于TensorFlowLite模型的ML Kit 自定义模型读取文本的可能性,我问这个是因为我看到的所有 android ML Kit 自定义模型示例都是仅用于检测对象,没有在任何地方看到任何使用 MLKit 自定义模型读取文本的示例。
基本上我想要的是与 Firebase 离线/云文本识别相同的行为,但是使用自定义的 Tensorflow lite 模型,这可能吗?请描述
构建CameraX,调用analyze() 方法并传递图像,然后使用close() 方法关闭(删除)。从此图像 FirebaseVisionImage 被创建并传递以进行处理(文本识别)。代码示例和代码实验室不同,不使用 CameraX 或使用旧 API 版本实现 TextRecognition。
override fun analyze(imageProxy: ImageProxy) {
if (isValidText) {
imageProxy.close()
return
}
val mediaImage = imageProxy.image // requires annotation
val degrees = imageProxy.imageInfo.rotationDegrees
val rotation = rotationDegreesToFirebaseRotation(degrees)
if (mediaImage != null) {
runTextRecognition(mediaImage, rotation) // line 44
}
imageProxy.close()
}
private fun runTextRecognition(mediaImage: Image, rotation: Int) {
// Create FirebaseVisionImage from frame
val visionImage = FirebaseVisionImage.fromMediaImage(mediaImage, rotation) // line 64
val recognizer = FirebaseVision.getInstance()
.onDeviceTextRecognizer
recognizer.processImage(visionImage)
.addOnSuccessListener { texts ->
processTextRecognitionResult(texts!!, …Run Code Online (Sandbox Code Playgroud) ocr out-of-memory text-recognition firebase-mlkit android-camerax
我正在为自己制作一个应用程序来扫描收据,并将数据放入数据库中。我尝试使用机器学习套件文本识别,效果非常好。但是,我在从识别的文本中提取数据时遇到问题。我将用一个例子来解释:
这是收据的格式,这就是我想要获取数据的方式:
+--------+--------+-------+-------+
| Amount | Name | Price | Total |
+--------+--------+-------+-------+
| 1 | Cheese | | 1,15 |
| 1 | Eggs | | 2,59 |
| 2 | Milk | 0,99 | 1,98 |
| 1 | Butter | | 0,80 |
+--------+--------+-------+-------+
Run Code Online (Sandbox Code Playgroud)
然而,当运行文本识别时,它会以非常奇怪的方式格式化数据。例如,上面的收据将给出这些块:
Amount
Price
Name Cheese Eggs Milk 0,99
Butter
Total 1,15 2,59
1,98 0,80
Run Code Online (Sandbox Code Playgroud)
它似乎跳过了金额列中的单个数字,但我可以解决这个问题。但是,我不知道如何将上述数据解析为我想要的数据,尤其是将价格与名称连接起来。有没有办法改变块,以便只需要收据的行或列,而不是这种随机性?
编辑:当使用线条或元素而不是块时,我得到以下结果:
Amount
Price
Name
Cheese
Eggs
Milk
0,99
Butter
Total
1,15
2,59
1,98
0,80
Run Code Online (Sandbox Code Playgroud)
但是我仍然遇到同样的问题:如何将商品与正确的价格配对?
我已成功检测到使用 react-native-camera 拍摄的图像上的文本元素。在vision().textRecognizerProcessImage(photoUri)成功返回检测到的文本。
// take the photo from the camera
takePicture = async () => {
try {
const options = {
quality: 0.8,
base64: true,
skipProcessing: true,
};
const picture = await this.camera.takePictureAsync(options);
console.log('picture', picture);
const {uri, width, height} = picture;
// saving the pixel size of the selected image too
// for boxes position/size calculation
this.setState({
photoUri: uri,
imgPixelHeight: height,
imgPixelWidth: width,
});
} catch (e) {
console.warn(e);
}
};
// processing the image to detect …Run Code Online (Sandbox Code Playgroud) firebase-mlkit ×10
android ×8
firebase ×3
tensorflow ×3
google-mlkit ×2
ocr ×2
kotlin ×1
python ×1
react-native ×1
xamarin ×1