-2
在我下面的算法中,resize_images將我的圖像的顏色更改爲錯誤。爲什麼?我的形象是375行1242科拉姆3通道tensorflow調整圖像顏色變化
# Typical setup to include TensorFlow.
import tensorflow as tf
import matplotlib.pyplot as plt
# Make a queue of file names including all the JPEG images files in the relative
# image directory.
filename_queue = tf.train.string_input_producer(
tf.train.match_filenames_once("./MNIST_data/*.png"))
reader = tf.WholeFileReader()
key, value = reader.read(filename_queue)
image_f = tf.image.decode_png(value) # use png or jpg decoder based on your files.
image = tf.image.resize_images(image_f, [375, 1242])
#Generate batch
# num_preprocess_threads = 1
# min_queue_examples = 256
# batch_size=2;
# images = tf.train.shuffle_batch(
# [image],
# batch_size=batch_size,
# num_threads=num_preprocess_threads,
# capacity=min_queue_examples + 3 * batch_size,
# min_after_dequeue=min_queue_examples)
init_op = tf.initialize_all_variables()
with tf.Session() as sess:
sess.run(init_op)
# Start populating the filename queue.
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(coord=coord)
my_image = image.eval() #here is your image Tensor :)
print(my_image.shape)
fig = plt.figure()
plt.imshow(my_image)
plt.show()
coord.request_stop()
coord.join(threads)
它看起來像我的帖子主要是代碼,所以我增加了一些更多的細節,它看起來像我的帖子主要是代碼,所以我增加了一些更detailsit看起來像我的帖子主要是代碼,所以我增加了一些更detailsit看起來像我的帖子主要是代碼,所以我增加了一些更detailsit看起來像我的帖子主要是代碼,所以我增加了一些細節
你認爲StackOverflow是一些編碼服務嗎?這是您在2天內提出的第6個問題! – martianwars