1 回答

TA貢獻1860條經驗 獲得超9個贊
經過進一步的研究,我能夠通過改變來管理:
images = list(image)
extracted_patches = tf.image.extract_patches(images=images,
sizes=[1,int(0.25*image_height),int(0.25*image_width),3],
strides=[1,int(0.25*image_height),int(0.25*image_width),3],
rates=[1,1,1,1],
padding="SAME")
到 :
image = tf.expand_dims(image ,0)
extracted_patches = tf.image.extract_patches(images=image,
sizes=[1,int(0.25*image_height),int(0.25*image_width),1],
strides=[1,int(0.25*image_height),int(0.25*image_width),1],
rates=[1,1,1,1],
padding="SAME")
然后重塑以獲得3通道圖像:
patches = tf.reshape(extracted_patches,[-1,int(0.25*image_height),int(0.25*image_width),3])
添加回答
舉報