环境:
tf2.1
报错:
call() missing 4 required positional argument x y w h
修改:
@tf.function(
input_signature=(
tf.TensorSpec(shape=[None, None, 3], dtype=tf.float32),
tf.TensorSpec(shape=[], dtype=tf.int32),
tf.TensorSpec(shape=[], dtype=tf.float32),
tf.TensorSpec(shape=[], dtype=tf.float32),
tf.TensorSpec(shape=[], dtype=tf.float32),
tf.TensorSpec(shape=[], dtype=tf.float32),
tf.TensorSpec(shape=[], dtype=tf.float32),)
)
def __call__(self, img, steps, step_size, x, y, w, h):
解释:
函数签名要和call变量个数和类型对得上,如果写的签名个数少于call的变量个数,就会导致以上报错。