在代码期间,会发现,tensorflow是float类型,而scipy.imread为int类型,则需要强制转换类型,这里有两种方法
(1)numpy.asarry(dtype)
(2)tf.image.convert_image_dtype(dtype)
(3)tf.cast(image, tf.float32)
(4)tf.to_float(tensor)
在代码期间,会发现,tensorflow是float类型,而scipy.imread为int类型,则需要强制转换类型,这里有两种方法
(1)numpy.asarry(dtype)
(2)tf.image.convert_image_dtype(dtype)
(3)tf.cast(image, tf.float32)
(4)tf.to_float(tensor)