我已经训练了一个网络(下面的git链接),并以保存的模型格式保存。并希望将其转换为tflite。我正在将Python API用于tflite掩盖程序(以下git链接中的tflite.py
)。但是我无法这样做。
系统信息:
OS平台和发行版:Ubuntu 18.04.3 LTS
TensorFlow版本: tensorflow / tensorflow:2.2.0-gpu(docker)
The link连接到网络并保存模型代码。
转换器调用的输出:
File "tflite.py", line 22, in convert_model
tflite_model = converter.convert()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/lite/python/lite.py", line 459, in convert
self._funcs[0], lower_control_flow=False))
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/convert_to_constants.py", line 706, in convert_variables_to_constants_v2_as_graph
func, lower_control_flow, aggressive_inlining)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/convert_to_constants.py", line 457, in _convert_variables_to_constants_v2_impl
tensor_data = _get_tensor_data(func)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/convert_to_constants.py", line 217, in _get_tensor_data
data = val_tensor.numpy()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 961, in numpy
maybe_arr = self._numpy() # pylint: disable=protected-access
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 929, in _numpy
six.raise_from(core._status_to_exception(e.code, e.message), None)
File "<string>", line 3, in raise_from
tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot convert a Tensor of dtype resource to a NumPy array.
The link到保存的模型