【问题标题】:FaceDetectorHandle﹕ Native face detector not yet available. Reverting to no-op detectionFaceDetectorHandle﹕本机人脸检测器尚不可用。恢复到无操作检测
【发布时间】:2015-11-10 19:45:03
【问题描述】:

我正在尝试将 Google Play Services 7.8 Face API 合并到我的应用中,但每次我尝试检测人脸时都会出现错误:

FaceDetectorHandle﹕本机人脸检测器尚不可用。恢复到无操作检测

根据帖子底部Android-er Face Detection,此问题出现在运行 Lollipop 或更高版本的设备上。具体来说,他们说它适用于“RedMi 2,运行 Android 4.4.4 并安装了 Google Play 服务版本 7.8.99,但不适用于运行 Android 5.1.1 的 Nexus 7 2012(不带前置摄像头),具有相同的 Google Play服务版本 7.8.99 已安装。”它也不适用于我运行 5.0.2 的 OnePlus One。有谁知道原因或解决方法?它最终会安装库并工作吗?

编辑: 这里有一些日志。我只是在使用面部检测器时复制了日志警告和更高版本,因此可能并非全部相关。

08-19 17:29:17.828 W/ResourcesManager(25536): Asset path '/system/framework/com.android.media.remotedisplay.jar' does not exist or contains no resources.
08-19 17:29:17.828 W/ResourcesManager(25536): Asset path '/system/framework/com.android.location.provider.jar' does not exist or contains no resources.
08-19 17:29:17.908 W/FaceDetectorHandle(25536): Native face detector not yet available.  Reverting to no-op detection.
08-19 17:29:18.060 W/ResourcesManager(25536): Asset path '/system/framework/com.android.media.remotedisplay.jar' does not exist or contains no resources.
08-19 17:29:18.060 W/ResourcesManager(25536): Asset path '/system/framework/com.android.location.provider.jar' does not exist or contains no resources.
08-19 17:29:20.267 W/LatinIME( 1645): Deprecated private IME option specified: nm,com.google.android.inputmethod.latin.noGestureFloatingPreview
08-19 17:29:20.267 W/LatinIME( 1645): Use com.google.android.inputmethod.latin.noMicrophoneKey instead
08-19 17:29:20.294 E/EntSec  (  923): [QSB   ] [QSB_CLIENT ] No connection with the NQS
08-19 17:29:20.306 E/EntSec  (  923): [QSB   ] [QSB_CLIENT ] No connection with the NQS
08-19 17:29:20.317 E/EntSec  (  923): [QSB   ] [QSB_CLIENT ] No connection with the NQS
08-19 17:29:20.532 E/EntSec  (  923): [QSB   ] [QSB_CLIENT ] No connection with the NQS
08-19 17:29:20.655 W/OpenGLRenderer( 1814): Incorrectly called buildLayer on View: CoreSuggestionView, destroying layer...
08-19 17:29:20.655 W/OpenGLRenderer( 1814): Incorrectly called buildLayer on View: CoreSuggestionView, destroying layer...
08-19 17:29:20.655 W/OpenGLRenderer( 1814): Incorrectly called buildLayer on View: CoreSuggestionView, destroying layer...
08-19 17:29:20.655 W/OpenGLRenderer( 1814): Incorrectly called buildLayer on View: NowProgressBar, destroying layer...
08-19 17:29:20.655 W/OpenGLRenderer( 1814): Incorrectly called buildLayer on View: CrossfadingWebImageView, destroying layer...
08-19 17:29:20.655 W/OpenGLRenderer( 1814): Incorrectly called buildLayer on View: ew, destroying layer...
08-19 17:29:20.912 W/LatinIME( 1645): Deprecated private IME option specified: nm,com.google.android.inputmethod.latin.noGestureFloatingPreview
08-19 17:29:20.912 W/LatinIME( 1645): Use com.google.android.inputmethod.latin.noMicrophoneKey instead
08-19 17:29:20.924 E/EntSec  (  923): [QSB   ] [QSB_CLIENT ] No connection with the NQS
08-19 17:29:20.934 W/Search.SearchUrlHelper( 1969): URL param or header with a key: "oq" has an empty value.
08-19 17:29:20.941 E/EntSec  (  923): [QSB   ] [QSB_CLIENT ] No connection with the NQS
08-19 17:29:20.956 E/EntSec  (  923): [QSB   ] [QSB_CLIENT ] No connection with the NQS
08-19 17:29:21.038 W/IInputConnectionWrapper( 1814): performPrivateCommand on inactive InputConnection
08-19 17:29:21.085 W/BindingManager( 1969): Cannot call determinedVisibility() - never saw a connection for the pid: 1969
08-19 17:29:21.764 W/VelvetPresenter( 1969): Still observing while not the active client
08-19 17:29:21.765 W/VelvetPresenter( 1969): Still observing while not the active client
08-19 17:29:22.067 W/BindingManager( 1969): Cannot call determinedVisibility() - never saw a connection for the pid: 1969
08-19 17:29:22.250 W/WebViewRenderState( 1969): resultsPageEnd: not current commit, new=27, committed=0
08-19 17:29:22.344 W/SurfaceFlinger(  243): couldn't log to binary event log: overflow.
08-19 17:29:22.371 W/OpenGLRenderer( 1814): Incorrectly called buildLayer on View: ew, destroying layer...
08-19 17:29:22.462 E/WebViewWorkerImpl( 1969): onShowedSrp: No SearchResult found being shown in WebView.
08-19 17:29:26.635 W/FaceDetector(25536): FaceDetector was not released with FaceDetector.release()

【问题讨论】:

  • 完成。如果您想要更多或其他任何内容,请告诉我。

标签: android google-play-services google-vision


【解决方案1】:

首次在设备上运行人脸检测功能时,需要将人脸检测库下载到设备。 “本机面部检测器尚不可用。”消息表明该库尚未下载。

建议将移动视觉依赖项添加到 AndroidManifest.xml。这将在安装应用程序时主动请求库下载。请参阅文档中的此注释:

将视觉依赖添加到您的 Android 清单中

将视觉功能依赖项添加到项目的 AndroidManifest.xml 将向安装程序指示它应该 下载对应用安装时间的依赖。虽然这不是 严格要求,它可以使用户体验更好 最初运行您的应用程序。例如,将以下内容添加到 AndroidManifest.xml(在应用程序部分)将表明 应下载条形码和面部检测依赖项 在应用安装时:

有效的视觉依赖值是:条形码或人脸

但是,即使提供了这个,在某些情况下 可以按需下载运行检测器所需的依赖项 当您的应用程序第一次运行而不是安装时。 有关更多信息,请参见 isOperational() 和检测器IsOperational() 检查您应用中的依赖项下载状态。

如上所述,您的应用可以使用 isOperational() 方法检查这一点:

https://developers.google.com/android/reference/com/google/android/gms/vision/face/FaceDetector.html#isOperational()

检测器将在您的应用运行时尝试下载库,并在获取库后自动运行。

但在某些情况下,下载可能不会成功(例如,如果设备没有足够的可用存储空间,或者设备未连接到网络)。首先要尝试的是释放更多存储空间。

调用 release()

日志中的以下警告表明存在不同的问题:

W/FaceDetector(25536): FaceDetector was not released with FaceDetector.release()

您的应用应在不再需要检测器(或摄像头源)时调用 release() 方法。这将释放资源。虽然这与下载问题无关,但总的来说还是不错的。例如,如果检测器是在活动中创建的,最好在 onDestroy() 中释放该资源:

protected void onDestroy() {
    super.onDestroy();
    mCameraSource.release();
}

【讨论】:

  • 谢谢,但不幸的是我已经尝试了所有这些东西。我有足够的空间(600 MB),所以我认为这不是问题。 ://
  • 请注意,w.r.t 有点保守。空间——它想在设备上留下相当多的可用空间。如果可用空间不足 10%,则可能无法下载。
  • 我们更新了示例应用程序以包含低存储空间检查。例如:github.com/googlesamples/android-vision/blob/master/…
  • @pm0733464 在我的情况下,低存储检查不会警告我存储空间不足,但仍然没有下载库。我的 logcat 中有与 OP 相同的错误。有什么办法可以调整 lib 的保守行为?
  • 除最后一条日志消息外,以上其他日志消息均与人脸检测无关。我建议在您的日志中搜索带有“Vision”或“DownloadManager”标签的条目,然后告诉我您发现了什么。
【解决方案2】:

Mobile Vision 所需的一项服务现在由于该服务的问题而被禁用。这将阻止尚未使用面部或条形码检测的用户使用这些功能。在此问题得到解决之前,我们不建议您向您的应用添加新的 Mobile Vision 功能。

公告

有一项服务可以下载 Mobile Vision 运行所需的文件,但由于在开发后期发现了一个严重错误,该服务现已被禁用。这将阻止尚未使用人脸或条形码检测的用户使用人脸或条形码扫描。我们向 Google Play 服务开发者提供以下建议:

在此问题得到解决之前,请勿添加新的 Mobile Vision 功能。 对于已经使用 Mobile Vision 功能的应用,请调用 FaceDetector.isOperational() 或 BarcodeDetector.isOperational() 以检查检测器是否准备就绪并相应地降低功能操作。 我们正在努力尽快解决问题。我们预计需要数周时间才能对其进行彻底测试。

来源:https://developers.google.com/vision/announcement

【讨论】:

猜你喜欢
  • 2019-11-18
  • 2013-09-24
  • 2016-09-16
  • 2019-12-01
  • 2016-09-22
  • 2022-01-13
  • 2019-02-27
  • 2016-02-04
  • 2013-07-03
相关资源
最近更新 更多