报错
ValueError: Could not find matching function to call loaded from the SavedModel. Got:
Positional arguments (3 total):
* <_VariantDataset shapes: ((, , , ), ), types: ((tf.float32, tf.float32, tf.float32, tf.float32), tf.float32)>
* False
* None
Keyword arguments: {}Expected these arguments to match one of the following 4 option(s):Option 1:
Positional arguments (3 total):
* (TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='input_1'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='input_2'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='input_3'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='input_4'))
* True
* None
Keyword arguments: {}Option 2:
Positional arguments (3 total):
* (TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='inputs/0'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='inputs/1'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='inputs/2'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='inputs/3'))
* True
* None
Keyword arguments: {}Option 3:
Positional arguments (3 total):
* (TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='inputs/0'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='inputs/1'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='inputs/2'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='inputs/3'))
* False
* None
Keyword arguments: {}Option 4:
Positional arguments (3 total):
* (TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='input_1'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='input_2'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='input_3'), TensorSpec(shape=(None, 3, 24, 72), dtype=tf.float32, name='input_4'))
* False
* None
Keyword arguments: {}
解决方法
- 检查输入是否和训练时的输入格式、大小一样
- 如果输入有多个元素,采用tuple作为整体输入
推荐阅读
- YoloV5的原理与实现-开源TensorFlow版
- 机器学习实践(onnx模型转为Tensorflow2的pb模型2020)
- Pytorch|Pytorch optimizer.step() 和loss.backward()和scheduler.step()的关系与区别
- pandas|Pandas 速查手册
- AI|从零开始搭建自己的卷积神经网络(day.2--LeNet.5复现)
- 机器学习|翻译(AdaRNN:时间序列的自适应学习与预测:AdaRNN: Adaptive Learning and Forecasting for Time Series?)
- python|利用新闻情绪预测股市
- 【机器学习PAI实战】—— 玩转人工智能之综述
- 【提高】机器学习相关理论|【机器学习周志华】读书笔记 P2 假设空间与归纳偏好