You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何为多输入TensorFlow SavedModel转换OpenVino IR格式指定输入层名称?

How to Specify Input Layer Names for Multi-Input TensorFlow SavedModel Conversion

When dealing with a multi-input SavedModel, the Model Optimizer (MO) can’t map input shapes to the correct layers unless you explicitly pair each shape with its corresponding input layer name—that’s exactly why you’re seeing the [ ERROR ] Please provide input layer names for input layer shapes error. Here’s how to fix this:

Step 1: Get your input layer names first

You need to know the exact names of your model’s input layers. There are two easy ways to get this info:

Option 1: Use TensorFlow code to inspect the SavedModel

Run this snippet to load the model and print input names:

import tensorflow as tf

# Load the SavedModel
saved_model = tf.saved_model.load("C:/path_to/model_saved")
# Access the default serving signature (adjust if your model uses a different signature)
infer_signature = saved_model.signatures["serving_default"]
# Extract input layer names
input_names = list(infer_signature.structured_input_signature[1].keys())
print("Your model's input layer names:", input_names)

Option 2: Use the saved_model_cli command line tool

Open a terminal and run:

saved_model_cli show --dir C:/path_to/model_saved --all

Look for the section labeled Inputs in the output—this will list all input layer names and their shapes.

Step 2: Update your Model Optimizer command

Once you have the input names, pair each name with its corresponding shape in the --input parameter. You can do this in two formats:

Format 1: Single --input parameter with comma-separated name-shape pairs

Suppose your input names are input_1 and input_2 (replace with your actual names). Your command becomes:

python mo_tf.py --saved_model_dir C:/path_to/model_saved --input "input_1[1,128,128,3],input_2[1,1,1,64]"

Format 2: Separate --input parameters for each input layer

You can also specify each input individually for clarity:

python mo_tf.py --saved_model_dir C:/path_to/model_saved --input input_1[1,128,128,3] --input input_2[1,1,1,64]

Quick Note

If your SavedModel uses a non-default signature definition (not serving_default), add the --signature_def_name flag to your command to specify it, e.g., --signature_def_name my_custom_signature.

内容的提问来源于stack exchange,提问作者YScharf

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.28 21:53:12