pythontensorflowopenvinomlp

OpenVINO cannot convert MLP Mixer TensorFlow model


I use this GitHub repository to train MLP Mixer TensorFlow 2.5.0 model.

enter image description here

And I try to generate .bin and .xml files with the command

mo --data_type FP16 --saved_model_dir C:\Users\john0\Desktop\mlp --input_shape (1,150,150,3)

The following is the error I faced.

[ 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 'openvino.tools.mo.front.user_data_repack.UserDataRepack'>): Original placeholders: 'serving_default_input_1, saver_filename'. Freezing was requested for ''. --input_shape was provided without --input. Can not deduce which node shape to override

I use openvino_2022.1.0.643 version.

And you can download my model here.


Solution

  • The error is due to the model having multiple inputs, and can be resolved using this MO command mo --data_type FP16 --saved_model_dir model\directory\mlp\ --input_shape (1..,150,150,3). However, I'm getting different errors now:

    [ ERROR ]  List of operations that cannot be converted to Inference Engine IR:
    [ ERROR ]      FusedBatchNormV3 (16)
    [ ERROR ]          StatefulPartitionedCall/mlp_mixer/mlp_block/layer_normalization/FusedBatchNormV3
    [ ERROR ]          StatefulPartitionedCall/mlp_mixer/mlp_block/layer_normalization_1/FusedBatchNormV3
    [ ERROR ]          StatefulPartitionedCall/mlp_mixer/mlp_block_1/layer_normalization_2/FusedBatchNormV3
    [ ERROR ]          StatefulPartitionedCall/mlp_mixer/mlp_block_1/layer_normalization_3/FusedBatchNormV3
    [ ERROR ]          StatefulPartitionedCall/mlp_mixer/mlp_block_2/layer_normalization_4/FusedBatchNormV3
    [ ERROR ]          StatefulPartitionedCall/mlp_mixer/mlp_block_2/layer_normalization_5/FusedBatchNormV3
    [ ERROR ]          StatefulPartitionedCall/mlp_mixer/mlp_block_3/layer_normalization_6/FusedBatchNormV3
    [ ERROR ]          StatefulPartitionedCall/mlp_mixer/mlp_block_3/layer_normalization_7/FusedBatchNormV3
    [ ERROR ]          StatefulPartitionedCall/mlp_mixer/mlp_block_4/layer_normalization_8/FusedBatchNormV3
    [ ERROR ]          StatefulPartitionedCall/mlp_mixer/mlp_block_4/layer_normalization_9/FusedBatchNormV3
    [ ERROR ]          StatefulPartitionedCall/mlp_mixer/mlp_block_5/layer_normalization_10/FusedBatchNormV3
    [ ERROR ]          StatefulPartitionedCall/mlp_mixer/mlp_block_5/layer_normalization_11/FusedBatchNormV3
    [ ERROR ]          StatefulPartitionedCall/mlp_mixer/mlp_block_6/layer_normalization_12/FusedBatchNormV3
    [ ERROR ]          StatefulPartitionedCall/mlp_mixer/mlp_block_6/layer_normalization_13/FusedBatchNormV3
    [ ERROR ]          StatefulPartitionedCall/mlp_mixer/mlp_block_7/layer_normalization_14/FusedBatchNormV3
    [ ERROR ]          StatefulPartitionedCall/mlp_mixer/mlp_block_7/layer_normalization_15/FusedBatchNormV3
    [ ERROR ]  Part of the nodes was not converted to IR. Stopped.
    

    As you can see, the FusedBatchNormV3 layer in your model is not supported in TensorFlow 2, you can refer to Supported Framework Layers for a list of supported operations for TensorFlow 2.