Search code examples
pythontensorflowconv-neural-networkopenvino

OpenVINO cannot convert 1D CNN model with model optimizer


I convert my 1D CNN .h5 file to .pb file as the picture shows.

(Please download my converted .pb file in need.)

enter image description here

Then I try to use model optimizer to generate .bin and .xml files with the command

python mo_tf.py --saved_model_dir C:\Users\john0\Desktop\saved_model_LA_A --input_shape [1,2,60] --data_type FP16

But the following error message occurs.

[ WARNING ]  Failed to parse a tensor with Unicode characters. Note that Inference Engine does not support string literals, so the string constant should be eliminated from the graph.
[ WARNING ]  Failed to parse a tensor with Unicode characters. Note that Inference Engine does not support string literals, so the string constant should be eliminated from the graph.
[ ERROR ]  Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.front.user_data_repack.UserDataRepack'>): Original placeholders: 'serving_default_embedding_10_input, saver_filename'. Freezing was requested for ''. --input_shape was provided without --input. Can not deduce which node shape to override

I am not sure whether 1D CNN model is supported or not.

Here comes my 1D CNN model architecture, which is traind with TensorFlow 1.15.0 version.

(My input is CSV file with 60 signal records.)

 Layer (type)                Output Shape              Param #
=================================================================
 embedding_10 (Embedding)    (None, 60, 2)             396

 conv1_1 (Conv1D)            (None, 53, 100)           1700

 conv1_2 (Conv1D)            (None, 46, 100)           80100

 max_pooling1d_10 (MaxPoolin  (None, 15, 100)          0
 g1D)

 dropout_19 (Dropout)        (None, 15, 100)           0

 conv2_1 (Conv1D)            (None, 8, 160)            128160

 conv2_2 (Conv1D)            (None, 1, 160)            204960

 global_average_pooling1d_10  (None, 160)              0
  (GlobalAveragePooling1D)

 dropout_20 (Dropout)        (None, 160)               0

 dense (Dense)               (None, 2)                 322

I use openvino_2021.4.689 version with Windows 11, and I would like to use NCS2.


Solution

  • Install openvino-dev 2022.1.0 and convert your model with the following command:

    mo --saved_model_dir=<path_to_saved_model_dir> -b=1
    

    converted_to_IR