Closed hayoyo12 closed 2 years ago
There is no information on your environment and no way to investigate. I will not support any use of containers other than those I provide. I am not a handyman.
docker run --gpus all -it --rm \
-v `pwd`:/home/user/workdir \
ghcr.io/pinto0309/openvino2tensorflow:latest
$INTEL_OPENVINO_DIR/deployment_tools/model_optimizer/mo.py \
--input_model mnist-8.onnx \
--data_type FP32 \
--output_dir openvino/FP32 \
--model_name mnist_8
openvino2tensorflow \
--model_path openvino/FP32/mnist_8.xml \
--output_saved_model \
--output_pb \
--output_no_quant_float32_tflite \
--non_verbose
TensorFlow/Keras model building process starts ======================================
Layer structure =====================================================================
layer_type: Input
layer_id: 0
tf_layers_dict: KerasTensor(type_spec=TensorSpec(shape=(1, 28, 28, 1), dtype=tf.float32, name='Input3'), name='Input3', description="created by layer 'Input3'")
====================================================================================
layer_type: Const
layer_id: 1
tf_layers_dict_shape: (8, 1, 5, 5)
====================================================================================
layer_type: Convolution
layer_id: 2
input_layer0: layer_id=0: KerasTensor(type_spec=TensorSpec(shape=(1, 28, 28, 1), dtype=tf.float32, name='Input3'), name='Input3', description="created by layer 'Input3'")
input_layer1_shape: layer_id=1: (8, 1, 5, 5)
tf_layers_dict: KerasTensor(type_spec=TensorSpec(shape=(1, 28, 28, 8), dtype=tf.float32, name=None), name='conv2d/Conv2D:0', description="created by layer 'conv2d'")
====================================================================================
layer_type: Const
layer_id: 3
tf_layers_dict_shape: (1, 8, 1, 1)
====================================================================================
layer_type: Add
layer_id: 4
input_layer0: layer_id=2: KerasTensor(type_spec=TensorSpec(shape=(1, 28, 28, 8), dtype=tf.float32, name=None), name='conv2d/Conv2D:0', description="created by layer 'conv2d'")
input_layer1_shape: layer_id=3: (1, 8, 1, 1)
tf_layers_dict: KerasTensor(type_spec=TensorSpec(shape=(1, 28, 28, 8), dtype=tf.float32, name=None), name='tf.math.add/Add:0', description="created by layer 'tf.math.add'")
====================================================================================
layer_type: ReLU
layer_id: 5
input_layer0: layer_id=4: KerasTensor(type_spec=TensorSpec(shape=(1, 28, 28, 8), dtype=tf.float32, name=None), name='tf.math.add/Add:0', description="created by layer 'tf.math.add'")
tf_layers_dict: KerasTensor(type_spec=TensorSpec(shape=(1, 28, 28, 8), dtype=tf.float32, name=None), name='tf.nn.relu/Relu:0', description="created by layer 'tf.nn.relu'")
====================================================================================
layer_type: MaxPool
layer_id: 6
input_layer0: layer_id=5: KerasTensor(type_spec=TensorSpec(shape=(1, 28, 28, 8), dtype=tf.float32, name=None), name='tf.nn.relu/Relu:0', description="created by layer 'tf.nn.relu'")
tf_layers_dict: KerasTensor(type_spec=TensorSpec(shape=(1, 14, 14, 8), dtype=tf.float32, name=None), name='tf.nn.max_pool2d/MaxPool2d:0', description="created by layer 'tf.nn.max_pool2d'")
====================================================================================
layer_type: Const
layer_id: 7
tf_layers_dict_shape: (16, 8, 5, 5)
====================================================================================
layer_type: Convolution
layer_id: 8
input_layer0: layer_id=6: KerasTensor(type_spec=TensorSpec(shape=(1, 14, 14, 8), dtype=tf.float32, name=None), name='tf.nn.max_pool2d/MaxPool2d:0', description="created by layer 'tf.nn.max_pool2d'")
input_layer1_shape: layer_id=7: (16, 8, 5, 5)
tf_layers_dict: KerasTensor(type_spec=TensorSpec(shape=(1, 14, 14, 16), dtype=tf.float32, name=None), name='conv2d_1/Conv2D:0', description="created by layer 'conv2d_1'")
====================================================================================
layer_type: Const
layer_id: 9
tf_layers_dict_shape: (1, 16, 1, 1)
====================================================================================
layer_type: Add
layer_id: 10
input_layer0: layer_id=8: KerasTensor(type_spec=TensorSpec(shape=(1, 14, 14, 16), dtype=tf.float32, name=None), name='conv2d_1/Conv2D:0', description="created by layer 'conv2d_1'")
input_layer1_shape: layer_id=9: (1, 16, 1, 1)
tf_layers_dict: KerasTensor(type_spec=TensorSpec(shape=(1, 14, 14, 16), dtype=tf.float32, name=None), name='tf.math.add_1/Add:0', description="created by layer 'tf.math.add_1'")
====================================================================================
layer_type: ReLU
layer_id: 11
input_layer0: layer_id=10: KerasTensor(type_spec=TensorSpec(shape=(1, 14, 14, 16), dtype=tf.float32, name=None), name='tf.math.add_1/Add:0', description="created by layer 'tf.math.add_1'")
tf_layers_dict: KerasTensor(type_spec=TensorSpec(shape=(1, 14, 14, 16), dtype=tf.float32, name=None), name='tf.nn.relu_1/Relu:0', description="created by layer 'tf.nn.relu_1'")
====================================================================================
layer_type: MaxPool
layer_id: 12
input_layer0: layer_id=11: KerasTensor(type_spec=TensorSpec(shape=(1, 14, 14, 16), dtype=tf.float32, name=None), name='tf.nn.relu_1/Relu:0', description="created by layer 'tf.nn.relu_1'")
tf_layers_dict: KerasTensor(type_spec=TensorSpec(shape=(1, 4, 4, 16), dtype=tf.float32, name=None), name='tf.nn.max_pool2d_1/MaxPool2d:0', description="created by layer 'tf.nn.max_pool2d_1'")
====================================================================================
layer_type: Const
layer_id: 13
tf_layers_dict_shape: (2,)
====================================================================================
layer_type: Reshape
layer_id: 14
input_layer0: layer_id=12: KerasTensor(type_spec=TensorSpec(shape=(1, 4, 4, 16), dtype=tf.float32, name=None), name='tf.nn.max_pool2d_1/MaxPool2d:0', description="created by layer 'tf.nn.max_pool2d_1'")
input_layer1_shape: layer_id=13: (2,)
tf_layers_dict: KerasTensor(type_spec=TensorSpec(shape=(1, 256), dtype=tf.float32, name=None), name='tf.reshape/Reshape:0', description="created by layer 'tf.reshape'")
====================================================================================
layer_type: Const
layer_id: 15
tf_layers_dict_shape: (10, 256)
====================================================================================
layer_type: MatMul
layer_id: 16
input_layer0: layer_id=14: KerasTensor(type_spec=TensorSpec(shape=(1, 256), dtype=tf.float32, name=None), name='tf.reshape/Reshape:0', description="created by layer 'tf.reshape'")
input_layer1_shape: layer_id=15: (10, 256)
tf_layers_dict: KerasTensor(type_spec=TensorSpec(shape=(1, 10), dtype=tf.float32, name=None), name='tf.linalg.matmul/MatMul:0', description="created by layer 'tf.linalg.matmul'")
====================================================================================
layer_type: Const
layer_id: 17
tf_layers_dict_shape: (1, 10)
====================================================================================
layer_type: Add
layer_id: 18
input_layer0: layer_id=16: KerasTensor(type_spec=TensorSpec(shape=(1, 10), dtype=tf.float32, name=None), name='tf.linalg.matmul/MatMul:0', description="created by layer 'tf.linalg.matmul'")
input_layer1_shape: layer_id=17: (1, 10)
tf_layers_dict: KerasTensor(type_spec=TensorSpec(shape=(1, 10), dtype=tf.float32, name=None), name='tf.math.add_2/Add:0', description="created by layer 'tf.math.add_2'")
====================================================================================
layer_type: Result
layer_id: 19
input_layer0: layer_id=18: KerasTensor(type_spec=TensorSpec(shape=(1, 10), dtype=tf.float32, name=None), name='tf.math.add_2/Add:0', description="created by layer 'tf.math.add_2'")
tf_layers_dict: KerasTensor(type_spec=TensorSpec(shape=(1, 10), dtype=tf.float32, name=None), name='tf.identity/Identity:0', description="created by layer 'tf.identity'")
====================================================================================
TensorFlow/Keras model building process complete!
saved_model output started ==========================================================
WARNING:absl:Function `_wrapped_model` contains input name(s) Input3 with unsupported characters which will be renamed to input3 in the SavedModel.
saved_model output complete!
.pb output started ==================================================================
.pb output complete! - saved_model/model_float32.pb
tflite Float32 convertion started ===================================================
WARNING:absl:Function `_wrapped_model` contains input name(s) Input3 with unsupported characters which will be renamed to input3 in the SavedModel.
Estimated count of arithmetic ops: 1.591 M ops, equivalently 0.796 M MACs
WARNING:absl:Buffer deduplication procedure will be skipped when flatbuffer library is not properly loaded
tflite Float32 convertion complete! - saved_model/model_float32.tflite
All the conversion process is finished! =============================================
no information on your environment and no way to investigat
I mean the environment is a kind of docker container. Now, I'm working on my compnay's docker environment, so I was prefer to install using pypi rather than docker. But, I will try it!
Any way, I was wondering why the model is not converter after I re-install all the packages... Thank you always. :)
This is only an expectation, but it is likely that there is just an inconsistency in the versions of packages that should be referenced because of the use of conda, etc. Please refer to the Dockerfile and faithfully maintain consistency between versions.
@hayoyo12 @PINTO0309 I am facing exactly the same error. I use colab to convert openvino to tflite. Did you solve this problem?
Issue Type
Others
OS
Ubuntu
OS architecture
x86_64
Programming Language
Python
Framework
OpenVINO, ONNX, TensorFlow
Download URL for ONNX / OpenVINO IR
https://github.com/onnx/models/blob/main/vision/classification/mnist/model/mnist-8.onnx
I used pre-trained mnist-8.onnx model. And I converted the onnx model to OpenVINO IR. So, Now I am trying to convert the OpenVINO IR model to pb model by using openvino2tensorflow
Convert Script
Description
While I reset the environment, I needed to re-install onnx-tf, tensorflow-cpu, openvino, openvino2tensorflow.
(all PYPI: onnx-tf==1.9.0, tensorflow-cpu==2.6.2, openvino-dev==2022.1.0[onnx, tensorflow2], openvino2tensorflow==1.29.3 or 1.29.4, tensorflow-datasets==4.5.2)
Before, there was no problem to convert mnist-8.xml (OpenVINO IR) to tensorflow model using openvino2tensorflow. However, after the reset up environment, it gets 'KeyError' problem. I cannot find what is the 'KeyError'. And I want to know why it suddenly showed up............
It does not show only for the mnist model, other models do too :(. Firstly, I thought it showed up only after the maxpool node, but sometimes it showed up at weird layers...:( Is this issue can solve to change input shape? like 6-7 in the README? https://github.com/PINTO0309/openvino2tensorflow
I tried to search the issue, but I cannot find any related issue. I really want to understand the problem. Please help me.
Relevant Log Output
Source code for simple inference testing code
It is same as convert script.