在准备张量分配时发生意外错误

我正在使用tflite进行语义分割。我有一个训练好的模型,用于将对象从背景中分割出来,这个模型是在deeplab上训练的。

我使用以下代码将这个模型(冻结的推理图)转换为tflite格式:

tflite_convert \  --output_file=test.lite \  --graph_def_file=frozen_inference_graph.pb \  --input_arrays=ImageTensor \  --output_arrays=SemanticPredictions \  --input_shapes=1,600,450,3 \  --inference_input_type=QUANTIZED_UINT8 \  --inference_type=FLOAT \  --mean_values=128 \  --std_dev_values=128 

模型在安卓上可以加载,但是当我尝试运行推理时,它给出了以下错误:

由以下原因引起:java.lang.IllegalStateException: 内部错误:在准备张量分配时发生意外错误:third_party/tensorflow/lite/kernels/unpack.cc:54 NumDimensions(input)

1 was not true.Node number 4 (UNPACK) failed to prepare.

我该如何解决这个错误?


回答:

以下命令可以正常工作:

bazel-bin/tensorflow/lite/toco/toco \  --input_file=deeplabv3_mnv2_pascal_tain.pb \  --output_file=test.tflite \  --inference_input_type=QUANTIZED_UINT8  \  --inference_type=FLOAT \  --input_arrays=ImageTensor  \  --output_arrays=SemanticPredictions  \  --input_shapes=1,513,513,3 \  --mean_values=128 \  --std_dev_values=128

当我从源代码安装tensorflow时,它可以正常工作。为了从源代码安装tensorflow,我使用了(链接

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注