【问题标题】:Tensorflow not working right, not sure what is wrongTensorflow 无法正常工作,不知道出了什么问题
【发布时间】:2018-11-19 23:35:29
【问题描述】:

我使用 Android Studio 进行编码,在 tensorflowObjectDetection 示例中,我注释掉了 @Disable 并添加了我们的 Vuforia 密钥,但当我运行程序时它就崩溃了。我已将其范围缩小到以下代码:

private void initTfod() {
    int tfodMonitorViewId = hardwareMap.appContext.getResources().getIdentifier(
        "tfodMonitorViewId", "id", hardwareMap.appContext.getPackageName());
    TFObjectDetector.Parameters tfodParameters = new TFObjectDetector.Parameters(tfodMonitorViewId);
    tfod = ClassFactory.getInstance().createTFObjectDetector(tfodParameters, vuforia);
    tfod.loadModelFromAsset(TFOD_MODEL_ASSET, LABEL_GOLD_MINERAL, LABEL_SILVER_MINERAL);
}

通过注释掉最后两行,它不会崩溃,但它不明白为什么。

【问题讨论】:

    标签: java android android-studio tensorflow


    【解决方案1】:

    想通了。 vuforia 需要更多时间来初始化,所以我们这样做了:

    robot.initVuforia(hardwareMap);
    
    while(robot.vuforiaLoaded == false && !isStopRequested()){
    
    }
    
    if (ClassFactory.getInstance().canCreateTFObjectDetector()) {
        robot.initTfod(hardwareMap);
    } else {
        telemetry.addData("Sorry!", "This device is not compatible with TFOD");
    }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-23
      • 1970-01-01
      • 1970-01-01
      • 2023-04-02
      • 1970-01-01
      相关资源
      最近更新 更多