string_input_producerが読み込んだファイル名の数を確認するにはどうすればよいですか?入力データのサイズに応じて異なる操作が実行されるので、読み取る画像の数や読み込んだ画像の数を知る必要があります。tensorflow string_input_producerのサイズを取得
以下のコードは、私が読んだか、読んでいるかを教えてくれません。 string_input_producer
よう
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 = tf.image.decode_png(value) # use png or jpg decoder based on your files.
num_preprocess_threads = 1
min_queue_examples = 256
batch_size=2;
images = tf.train.shuffle_batch([image], batch_size, min_queue_examples + 3 * batch_size, num_threads=num_preprocess_threads, min_after_dequeue=min_queue_examples)
with tf.Session() as sess:
sess.run(tf.initialize_all_variables())
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(coord=coord)
t_image = image.eval() #here is your image Tensor :)
fig = plt.figure()
plt.imshow(t_image)
plt.show()
coord.request_stop()
coord.join(threads)
答えのアルゴリズムはありますか? shuffle_batchを含めるようにコードを編集しましたが、エラーが発生しました。イメージを読んでプロットするための完全なコードを表示できますか? fensortlowは難しいですか? – kong
あなたはどんな種類のエラーがありますか?私はあなたのコードを見て、私はそれがすべての図形が完全に定義されていなければならないと言っていることはOK –
だと思う。エラーはtf.train.shuffle_batchを指しています – kong