Я преобразовал свою обученную модель в замороженный график .pb. но при конвертации в .tflite выдает ошибку. ниже приведен код, который я использовал для его преобразования.
import tensorflow as tf
graph_def_file = "frozen_graph.pb"
input_arrays = ["prefetch_queue/fifo_queue"]
output_arrays = ["InceptionV3/Predictions/Reshape_1"]
converter = tf.lite.TFLiteConverter.from_frozen_graph(
graph_def_file, input_arrays, output_arrays)
tflite_model = converter.convert()
open("converted_model.tflite", "wb").write(tflite_model)
и он выдает эту ошибку:
2020-02-05 11:35:49.553636: I tensorflow/core/grappler/devices.cc:60] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 0 (Note: TensorFlow was not compiled with CUDA support)
2020-02-05 11:35:49.562301: I tensorflow/core/grappler/clusters/single_machine.cc:359] Starting new session
2020-02-05 11:35:51.706004: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:716] Optimization results for grappler item: graph_to_optimize
2020-02-05 11:35:51.712864: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718] constant folding: Graph size after: 812 nodes (-198), 846 edges (-200), time = 1112.05701ms.
2020-02-05 11:35:51.719496: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718] constant folding: Graph size after: 812 nodes (0), 846 edges (0), time = 315.532ms.
Traceback (most recent call last):
File "pbtf.py", line 9, in <module>
tflite_model = converter.convert()
File "C:\Users\oldrrd\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\lite\python\lite.py", line 898, in convert
**converter_kwargs)
File "C:\Users\oldrrd\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\lite\python\convert.py", line 401, in toco_convert_impl
input_tensors, output_tensors, *args, **kwargs)
File "C:\Users\oldrrd\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\lite\python\convert.py", line 304, in build_toco_convert_protos
input_tensor.dtype)
File "C:\Users\oldrrd\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\lite\python\util.py", line 58, in convert_dtype_to_tflite_type
raise ValueError("Unsupported tf.dtype {0}".format(tf_dtype))
ValueError: Unsupported tf.dtype <dtype: 'resource'>
есть ли способ конвертировать его в .tflite? Я устал от конвертера ТОСО. Была показана та же ошибка.
я использую python 3.7 и тензор потока 1.14.0