标签: firebase-mlkit

ML Kit条形码扫描仪提供空输出

ML Kit条形码扫描仪出现问题。当我尝试解码样本QR码时,

Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.qr_code_sample);
        FirebaseVisionImage image = FirebaseVisionImage.fromBitmap(bitmap);
        FirebaseVisionBarcodeDetector detector = FirebaseVision.getInstance().getVisionBarcodeDetector();
        Task<List<FirebaseVisionBarcode>> result = detector.detectInImage(image)
                .addOnSuccessListener(new OnSuccessListener<List<FirebaseVisionBarcode>>() {
                    @Override
                    public void onSuccess(List<FirebaseVisionBarcode> barcodes) {
                        for (FirebaseVisionBarcode barcode:barcodes) {
                            Log.e("Log", "QR Code: "+barcode.getUrl().getUrl());
                        }
                    }
                })
                .addOnFailureListener(new OnFailureListener() {
                    @Override
                    public void onFailure(@NonNull Exception e) {
                        Log.e("Log", "Decode QR Code failed");
                    }
                });
Run Code Online (Sandbox Code Playgroud)

输出是这样的:

QR Code: ""
Run Code Online (Sandbox Code Playgroud)

如何解决这个问题呢?

android firebase firebase-mlkit

5
推荐指数
1
解决办法
1142
查看次数

适用于Android的Google ML工具包条形码扫描仪示例应用程序无法检测条形码

我正在尝试使用Google ML工具包条形码检测功能。为此,我已经安装了由Google提供的示例应用程序。我还将我的应用程序连接到了我的一个Firebase项目。当我打开应用程序并转到该条形码检测中的LivePreviewActivity时。相机启动,但未检测到条形码!根据快速入门指南,我还添加了

<meta-data
    android:name="com.google.firebase.ml.vision.DEPENDENCIES"
    android:value="barcode" />
Run Code Online (Sandbox Code Playgroud)

在我的清单文件中。我也包括了这个

FirebaseVisionBarcodeDetectorOptions options =
            new FirebaseVisionBarcodeDetectorOptions.Builder()
                    .setBarcodeFormats(
                            FirebaseVisionBarcode.FORMAT_CODE_128)
                    .build(); 
Run Code Online (Sandbox Code Playgroud)

在BarcodeScanningProcessor.java文件中。

我得到的错误是:

条形码检测失败com.google.firebase.ml.common.FirebaseMLException:等待条形码检测模型下载。请稍候。

E / BarcodeNativeHandle:错误加载模块

java.lang.ClassNotFoundException:找不到类“ com.google.android.gms.chimera.DynamiteModuleInitializer”

我已经在两部手机华为Mate 8和三星Galaxy S7 Edge上安装了此应用程序。该应用程序无法从两部手机检测条形码。

我的目的是从实时摄像机预览中检测/扫描条形码。谢谢。

android firebase firebase-mlkit

5
推荐指数
1
解决办法
5339
查看次数

ML Kit条形码扫描:无效的图像数据大小

我想在捕获的图像中检测条形码。我使用android的camera2捕获图像。此后,将检索图像的元数据并将图像保存到设备。元数据全部传递到下一个活动,该活动是应用程序尝试检测条形码的地方。

下一个活动是从先前保存的文件创建一个byte []。接下来,使用随意图传递的数据创建相关的FirebaseVision对象。最后,应用程序尝试detectInImage()在抛出错误的地方调用该方法:

“ java.lang.IllegalArgumentException:无效的图像数据大小。”

我怀疑这是因为捕获的图像太大,但是我似乎无法弄清楚如何捕获较小的图像,并且在参考文档中也找不到有关允许的最大尺寸的任何信息。非常感谢您提供有关此错误及其解决方法的信息。以下是我认为是相关的代码。

private final ImageReader.OnImageAvailableListener onImageAvailableListener
        = new ImageReader.OnImageAvailableListener() {
    @Override
    public void onImageAvailable(ImageReader imageReader) {
        try{
            // Semaphore ensures date is recorded before starting next activity
            storeData.acquire();
            Image resultImg = imageReader.acquireNextImage(); // Image from camera
            imgWidth = resultImg.getWidth();
            imgHeight = resultImg.getHeight();
            ByteBuffer buffer = resultImg.getPlanes()[0].getBuffer();
            data = new byte[buffer.remaining()]; // Byte array with the images data
            buffer.get(data);
            String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());

            // Note: mediaFile directs to Pictures/"ThisProject" folder
            File media = …
Run Code Online (Sandbox Code Playgroud)

java android firebase android-camera2 firebase-mlkit

5
推荐指数
1
解决办法
1683
查看次数

无法使用Firebase ML Kit视觉文本检测器编译iOS React Native应用

我正在使用React Native构建一个应用程序,该应用程序已“弹出”到其自己的iOS本地应用程序项目中。我对使用新的Firebase ML Kit视觉文本检测器以使用设备上模型识别图像中的文本感兴趣,并且我愿意为此编写自己的NativeModule包装器(因为它很新,所以我看不到项目中的任何现有包装器(例如react-native-firebase)。

因此,我使用Cocoapods引入了Firebase依赖项,但是当我尝试编译新的工作区时,出现以下链接器错误:

duplicate symbol __ZN3fLB28FLAGS_nosymbolize_stacktraceE in:
    /Users/francisli/Projects/clients/app/apptag-app/ios/Pods/GoogleMobileVision/TextDetector/Frameworks/TextDetector.framework/TextDetector(examine_stack_b03c119c7358b452600b1afd20ca186c.o)
    /Users/francisli/Library/Developer/Xcode/DerivedData/AppTag-arpnqvohzbwieueghdomemjvqvxt/Build/Products/Debug-iphonesimulator/libReact.a(utilities.o)
duplicate symbol __ZN3fLB26FLAGS_symbolize_stacktraceE in:
    /Users/francisli/Projects/clients/app/apptag-app/ios/Pods/GoogleMobileVision/TextDetector/Frameworks/TextDetector.framework/TextDetector(examine_stack_b03c119c7358b452600b1afd20ca186c.o)
    /Users/francisli/Library/Developer/Xcode/DerivedData/AppTag-arpnqvohzbwieueghdomemjvqvxt/Build/Products/Debug-iphonesimulator/libReact.a(utilities.o)
duplicate symbol __ZN3fLI9FLAGS_novE in:
    /Users/francisli/Projects/clients/app/apptag-app/ios/Pods/GoogleMobileVision/TextDetector/Frameworks/TextDetector.framework/TextDetector(vlog_is_on_ec23571a5409c45b7e2ca681c18af4cb.o)
    /Users/francisli/Library/Developer/Xcode/DerivedData/AppTag-arpnqvohzbwieueghdomemjvqvxt/Build/Products/Debug-iphonesimulator/libReact.a(vlog_is_on.o)
duplicate symbol __ZN3fLI7FLAGS_vE in:
    /Users/francisli/Projects/clients/app/apptag-app/ios/Pods/GoogleMobileVision/TextDetector/Frameworks/TextDetector.framework/TextDetector(vlog_is_on_ec23571a5409c45b7e2ca681c18af4cb.o)
    /Users/francisli/Library/Developer/Xcode/DerivedData/AppTag-arpnqvohzbwieueghdomemjvqvxt/Build/Products/Debug-iphonesimulator/libReact.a(vlog_is_on.o)
duplicate symbol __ZN3fLS13FLAGS_vmoduleE in:
    /Users/francisli/Projects/clients/app/apptag-app/ios/Pods/GoogleMobileVision/TextDetector/Frameworks/TextDetector.framework/TextDetector(vlog_is_on_ec23571a5409c45b7e2ca681c18af4cb.o)
    /Users/francisli/Library/Developer/Xcode/DerivedData/AppTag-arpnqvohzbwieueghdomemjvqvxt/Build/Products/Debug-iphonesimulator/libReact.a(vlog_is_on.o)
duplicate symbol __ZN3fLB18FLAGS_nolog_prefixE in:
    /Users/francisli/Projects/clients/app/apptag-app/ios/Pods/GoogleMobileVision/TextDetector/Frameworks/TextDetector.framework/TextDetector(logging_2072041cb58f7b92d4eb8dae33e75a0d.o)
    /Users/francisli/Library/Developer/Xcode/DerivedData/AppTag-arpnqvohzbwieueghdomemjvqvxt/Build/Products/Debug-iphonesimulator/libReact.a(logging.o)
duplicate symbol __ZN3fLB16FLAGS_log_prefixE in:
    /Users/francisli/Projects/clients/app/apptag-app/ios/Pods/GoogleMobileVision/TextDetector/Frameworks/TextDetector.framework/TextDetector(logging_2072041cb58f7b92d4eb8dae33e75a0d.o)
    /Users/francisli/Library/Developer/Xcode/DerivedData/AppTag-arpnqvohzbwieueghdomemjvqvxt/Build/Products/Debug-iphonesimulator/libReact.a(logging.o)
ld: 7 duplicate symbols for architecture x86_64
Run Code Online (Sandbox Code Playgroud)

根据我对React Native项目中其他重复符号错误情况的了解,这通常是由于除了手动将React项目链接到主应用程序项目之外,还包括依赖于React的Pod弹出后,以及其他使用react-native link)链接的库。但是,事实并非如此-我要通过Podfile插入的唯一库与Firebase相关,所以我不确定冲突是如何发生的。

任何人(也许是Firebase团队正在研究适用于iOS的新ML工具包)的任何见解?注意,我什至还没有编写任何引用框架的代码,我只是想让工作区配置得以编译。这是Podfile供参考:

# Uncomment the next line to define a global platform for your project
platform :ios, '11.3' …
Run Code Online (Sandbox Code Playgroud)

ios firebase react-native firebase-mlkit

5
推荐指数
1
解决办法
673
查看次数

从SurfaceView使用ByteBuffer时如何暂停android ML-kit中的条形码扫描

语境

我正在使用Android firebase-ml-vision使用SurfaceView和相框的连续ByteBuffer扫描条形码。我以ML工具包快速入门项目作为起点,并且效果很好。

我项目的目的是识别与条形码关联的产品,并将其添加到扫描项目列表中。

问题

相机对焦后,条形码处理器将多次检测到相同的条形码,因此您将在一秒钟内扫描20条而不是1条条形码。

这是来自CamereSource.FrameProcessingRunnable.run的 javadoc

 * As long as the processing thread is active, this executes detection on frames continuously.
 * The next pending frame is either immediately available or hasn't been received yet. Once it
 * is available, we transfer the frame info to local variables and run detection on that frame.
 * It immediately loops back for the next frame without pausing.
Run Code Online (Sandbox Code Playgroud)

我曾尝试在FrameProcessingRunnable中添加“已暂停”检查,但由于至少一个帧已被送入检测,因此我仍然至少两次被识别相同的条形码:

private class FrameProcessingRunnable implements Runnable {
private volatile …
Run Code Online (Sandbox Code Playgroud)

android barcode-scanner surfaceview firebase firebase-mlkit

5
推荐指数
1
解决办法
877
查看次数

来自外部摄像头的 Firebase MLKit Android

我相信我在Firebase MLKit for Android 中发现了一个错误,但也许其他人对此有所了解。

我目前正在将视频从无人机传输到我的 Android 设备。它被解码为YUV420-888MediaCodec和写入的InputReader表面。当我使用ImageInputReader回调中收到的信息传递给 MLKit 时fromMediaImage没有错误,但无法检测到图像中的任何内容。如果我将 转换ImageBitmapusing PixelCopy,然后使用将其传递到 MLKit fromBitmap,则它会成功检测图像中的特征。

我认为问题可能是视频不是来自手机的摄像头,而是来自无人机上的外部摄像头(因此不使用Camera2API)。我知道我的视频信息源一般工作,因为它可以在预览SurfaceView因为它正在变成一个作品之后Bitmap。这让我相信 MLKit 对YUV420-888数据的解析肯定是不正确的,这就是导致问题的原因。

任何人都有任何见解?

android yuv android-mediacodec firebase-mlkit

5
推荐指数
0
解决办法
244
查看次数

Flutter 上的离线人脸识别

我正在尝试构建一个具有两个功能的 Flutter 应用程序。1. 保存人脸数据 2. 根据保存的人脸数据识别人脸。

我想离线执行此操作。我在 google 上找到的可能解决方案是使用 Firebase ML Kit,但这需要网络连接。

有没有什么方法可以在不需要网络连接的情况下进行实时人脸识别?

提前致谢。

computer-vision face-detection android-vision flutter firebase-mlkit

5
推荐指数
1
解决办法
2559
查看次数

机器学习套件人脸识别不适用于 IOS

我正在开发一个可以进行面部识别的应用程序。步骤之一包括检测用户微笑。为此,我目前正在使用谷歌的 Ml Kit。该应用程序在 Android 平台上运行良好,但当我在 Ios(Iphone Xr 和其他)上运行时,它无法识别任何图像上的任何面孔。我已经遵循了如何集成 Ios 和 Firebase 的每个步骤,并且运行良好。

这是我的代码。它总是落在 length == 0 上,因为图像不包含任何人脸。作为参数传递的图像来自 image_picker 插件。

Future<Face> verifyFace(File thisImage) async {
  var beforeTime = new DateTime.now();
  final image = FirebaseVisionImage.fromFile(thisImage);
  final faceDetector = FirebaseVision.instance.faceDetector(
    FaceDetectorOptions(
      mode: FaceDetectorMode.accurate,
      enableClassification: true,
    ),
  );

  var processedImages = await faceDetector.processImage(image);
  print('Processing time: ' +
      DateTime.now().difference(beforeTime).inMilliseconds.toString());

  if (processedImages.length == 0) {
    throw new NoFacesDetectedException();
  } else if (processedImages.length == 1) {
    Face face = processedImages.first;
    if(face.smilingProbability == null){
      throw new LipsNotFoundException();
    } …
Run Code Online (Sandbox Code Playgroud)

ios dart flutter firebase-mlkit

5
推荐指数
1
解决办法
1246
查看次数

如何在 OCR 中区分斜线零和八 (0-&gt;8)

我正在将 ML Kit for Firebase 用于我的 Android 应用程序(ReCalc:Receipt Calculator),除了斜线零的情况外,它的性能非常好。在大约一半或更多的情况下,它会将斜线零识别为八。

我的一个想法是在区域中对包含零的矩形进行切片,并检测中间上方和下方的区域是否暗。但实际上...

我计划训练一个模型来对零和八进行分类

这是很多工作,因此我决定首先在这里询问另一个解决方案/想法。

下面是一个例子:

错误识别的零和八的示例

类似问题:Tesseract OCR 将 slashed 0 混淆为 8

ocr machine-learning firebase-mlkit

5
推荐指数
1
解决办法
487
查看次数

无法使用 Firebase ML Kit 加载自定义 tflite 模型

我正在使用 ML 套件集成对象检测我正在使用 firebase ML 创建自定义 tflite 模型并按照此文档https://firebase.google.com/docs/ml-kit/android/use-custom-models加载自定义模型但得到加载模型时出现以下错误

com.google.firebase.ml.common.FirebaseMLException:本地模型加载失败,模型选项为:本地模型名称:模型名称。远程型号名称:未指定。

   private fun configureLocalModelSource() {
        // [START mlkit_local_model_source]
        val localSource = FirebaseLocalModel.Builder("my_local_model") // Assign a name to this model
                .setAssetFilePath("my_model.tflite")
                .build()
        FirebaseModelManager.getInstance().registerLocalModel(localSource)
        // [END mlkit_local_model_source]
    }

    @Throws(FirebaseMLException::class)
    private fun createInterpreter(): FirebaseModelInterpreter? {
        // [START mlkit_create_interpreter]
        val options = FirebaseModelOptions.Builder()
                .setRemoteModelName("my_cloud_model")
                .setLocalModelName("my_local_model")
                .build()
        val interpreter = FirebaseModelInterpreter.getInstance(options)
        // [END mlkit_create_interpreter]

        return interpreter
    }
Run Code Online (Sandbox Code Playgroud)

android tensorflow tensorflow-lite firebase-mlkit

5
推荐指数
0
解决办法
698
查看次数