小编Chr*_*agh的帖子

TensorFlow 标签编号与轴上的形状不匹配

尝试运行代码实验室: https://codelabs.developers.google.com/codelabs/recognize-flowers-with-tensorflow-on-android/#6

我已经开发了自己的文件和列表文件,尽管当我开始通过 Android 运行它时似乎收到此错误:

java.lang.IllegalArgumentException: Label number 6 mismatch the shape on axis 1

然后它将我链接到这部分代码:

Map<String, Float> labeledProbability =
        new TensorLabel(labels, probabilityProcessor.process(outputProbabilityBuffer))
            .getMapWithFloatValue();
    Trace.endSection();

Run Code Online (Sandbox Code Playgroud)

这是在分类结果部分

public List<Recognition> recognizeImage(final Bitmap bitmap, int sensorOrientation) {
    // Logs this method so that it can be analyzed with systrace.
    Trace.beginSection("recognizeImage");

    Trace.beginSection("loadImage");
    long startTimeForLoadImage = SystemClock.uptimeMillis();
    inputImageBuffer = loadImage(bitmap, sensorOrientation);
    long endTimeForLoadImage = SystemClock.uptimeMillis();
    Trace.endSection();
    LOGGER.v("Timecost to load the image: " + (endTimeForLoadImage - startTimeForLoadImage));

    // Runs the inference call.
    Trace.beginSection("runInference");
    long startTimeForReference = …
Run Code Online (Sandbox Code Playgroud)

java android classification tensorflow tensorflow-lite

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