三维的读取图片(w, h, c):
import tensorflow as tf
import glob
import os
def _parse_function(filename):
# print(filename)
image_string = tf.read_file(filename)
image_decoded = tf.image.decode_image(image_string) # (375, 500, 3)
image_resized = tf.image.resize_image_with_crop_or_pad(image_decoded, 200, 200)
return image_resized
with tf.Session() as sess:
print( sess.run( img ).shape )
读取批量图片的读取图片(b, w, h, c):
import tensorflow as tf
import glob
import os
'''
Dataset 批量读取图片
'''
def _parse_function(filename):
# print(filename)
image_string = tf.read_file(filename)
image_decoded = tf.image.decode_image(image_string) # (375, 500, 3)
image_decoded = tf.expand_dims(image_decoded, axis=0)
image_resized &#