【发布时间】:2022-01-13 13:23:54
【问题描述】:
现在我通过这些方法将图像 (32,32) 更改为 (32,32,1)
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
img = np.expand_dims(img, axis=-1)
img = img.astype(np.float32)/255
img = tf.image.resize(img, [32,32])
但是现在,我想从(32,32,1)变成(1,32,32,1),所以我尝试使用
img = img.reshape(1,32,32,1)
但是,它显示'EagerTensor' object has no attribute 'reshape'. 那我还能用什么方法呢?
【问题讨论】:
标签: python numpy tensorflow opencv