【问题标题】:Tensorflow image classification Android example fails to buildTensorFlow 图像分类 Android 示例构建失败
【发布时间】:2019-08-05 20:38:42
【问题描述】:

我克隆了https://github.com/tensorflow/examples/tree/master/lite/examples/image_classification/android这个链接来尝试图像分类示例,但构建失败。

我尝试了下面链接中列出的建议,但没有帮助。

Could not resolve org.tensorflow:tensorflow-lite:0.0.0-nightly

解决不了

implementation 'org.tensorflow:tensorflow-lite-gpu:0.0.0-nightly'

我在 android studio 3.4.2 中遇到错误:

ERROR: Failed to resolve: org.tensorflow:tensorflow-lite-gpu:0.0.0-nightly
Show in Project Structure dialog
Affected Modules: app

【问题讨论】:

  • 您的build.gradle 中有jcenter() 作为存储库吗?
  • @Blundell 是的,它已经是其中的一部分。您还可以通过访问 github 链接来验证这一点。我认为它应该在没有我修改任何东西的情况下构建,对吗?当它甚至无法构建时,举个例子有什么意义?

标签: android tensorflow tensorflow-lite


【解决方案1】:

对于 Tensorflow lite GPU,您必须在 app build.gradle 文件中使用以下依赖项:

implementation 'org.tensorflow:tensorflow-lite-gpu:0.0.0-nightly-SNAPSHOT'

这在项目 build.gradle 文件中:

allprojects {     // should be already there
    mavenCentral  // should be already there
    maven {       // add this repo to use snapshots
      name 'ossrh-snapshot'
      url 'http://oss.sonatype.org/content/repositories/snapshots'
    }
}

您可以找到更多信息here

【讨论】:

    【解决方案2】:

    像这样改变你的依赖:

    implementation 'org.tensorflow:tensorflow-lite:0.0.0-nightly-SNAPSHOT'
    // The GPU delegate library is optional. Depend on it as needed.
    implementation 'org.tensorflow:tensorflow-lite-gpu:0.0.0-nightly-SNAPSHOT'
    implementation 'org.tensorflow:tensorflow-lite-support:0.0.0-nightly-SNAPSHOT'
    

    【讨论】:

      猜你喜欢
      • 2020-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-08
      相关资源
      最近更新 更多