1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
import tensorflow as tf #tensor flow
import numpy as np
import glob, os
from pprint import pprint
filenames = list()
os.chdir(".")
for file in glob.glob("*.jpg"):
filenames.append( file)
#filenames = ['0.jpg','1.jpg','2.jpg','3.jpg']
# filenames = ['im_01.jpg', 'im_02.jpg', 'im_03.jpg', 'im_04.jpg']
filename_queue = tf.train.string_input_producer(filenames)
reader = tf.WholeFileReader()
filename, content = reader.read(filename_queue)
image = tf.image.decode_jpeg(filename, channels=3)
image = tf.cast(image, tf.float32)
resized_image = tf.image.resize_images(image, [224, 224])
labels=[1,0,1,0]
image_batch, label_batch=tf.train.batch([resized_image, labels], batch_size=2)
#image_batch = tf.train.batch([resized_image], batch_size=64)
print (image_batch) |
Partager