tensorflow中输入图片的增加维度

增加一维
xs = np.array([np.expand_dims(cv2.resize(x, (32, 32)), 2) for x in xs])

增加三维
xs=mnist.train.images
xs=np.array([np.reshape(t,[28,28]) for t in xs])
print(xs.shape)
print(xs[0].shape)
xs=np.array([cv2.resize(t,(224,244)) for t in xs])

start=0
end=10
xs=xs[start:end]
xs=np.array([cv2.cvtColor(x,cv2.COLOR_GRAY2BGR) for x in xs])

print(xs.shape)

猜你喜欢

转载自blog.csdn.net/weiyumeizi/article/details/81710277