十位数错误

2024-04-26 18:58:47 发布

您现在位置:Python中文网/ 问答频道 /正文

我现在正在运行项目deeplab_v2,它至少由tfr0.11支持,但我的实验室机器上只有r0.10。因此,当我修改一些代码以适应旧版本时,我会遇到以下问题。你知道吗

 if input_size is not None:
    h, w = input_size
    if random_scale:
        scale = tf.random_uniform([1], minval=0.75, maxval=1.25, dtype=tf.float32, seed=None)
        h_new = tf.to_int32(tf.mul(tf.to_float(tf.shape(img)[1]), scale))
        w_new = tf.to_int32(tf.mul(tf.to_float(tf.shape(img)[1]), scale))
        new_shape = tf.squeeze(tf.pack([h_new, w_new]), squeeze_dims=[1])

        img = tf.image.resize_images(img, new_shape)

这里是原始代码,input_size是[312312,312],而tf.image.resize_image(img, [height, width])是tfr0.11中的函数。你知道吗

但是在tfr0.10中,函数被更改为tf.image.size_image(img, height, width),所以我不知道如何将new_shape更改为两个元素[height , width]。你知道吗


Tags: to代码imagenoneimgnewinputsize