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

Léo*_*aes 5 ios dart flutter firebase-mlkit

我正在开发一个可以进行面部识别的应用程序。步骤之一包括检测用户微笑。为此,我目前正在使用谷歌的 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();
    }
    else {
      return face;
    }
  } else if (processedImages.length > 1) {
    throw new TooManyFacesDetectedException();
  }
}
Run Code Online (Sandbox Code Playgroud)

如果有人有任何提示或可以告诉我做错了什么,我将不胜感激。

小智 0

很多地方都有配置,所以我最好给你留下这个视频(尽管也许你已经看过它),这样你就可以看到一些代码以及 Matt Sullivan 如何制作你想要做的代码。

让met知道您是否已经看到它,并请添加一个我可以使用的示例存储库,以便查看确切的代码。