2017-08-09 32 views
0

私のコードを書き換えて、私のデータセットのすべてのラベルを視覚化し、比較する結果を見ることができます。テンソルボードで複数の画像を表示するには?

あなたはラベル画像を左に見ることができると右手側に学ん出力:

tensorboard

はすべての私のイメージは異なる形状を持っていると私は

for i in range(len(files_mask)): 
    t_image_left = tf.read_file(files_left[i], name='read_fileimage_left') 
    t_image_right = tf.read_file(files_right[i], name='read_fileimage_right') 
    t_image_mask = tf.read_file(files_mask[i], name='read_fileimage_mask') 

でそれらを読んで、それらを再構成する

t_left = tf.reshape(t_left, [1, sh[0]/scaling, sh[1]/scaling, 3], name='reshape_t_left') 
    t_right = tf.reshape(t_right, [1, sh[0]/scaling, sh[1]/scaling, 3], name='reshape_t_right') 
    t_mask = tf.reshape(t_mask, [1, sh[0]/scaling, sh[1]/scaling, 1], name='reshape_t_mask') 

次に、私はdeいくつかのプレースホルダを罰金、と....

t_im0 = tf.placeholder(tf.float32, [None, None, None, 3], name='left_img') 
t_im1 = tf.placeholder(tf.float32, [None, None, None, 3], name='right_img') 
t_label = tf.placeholder(tf.float32, [None, None, None, 1], name='label') 

...私の神経回路網にそれらを置く:私はそれらを印刷範囲の電車の中で

tn_prediction0, tn_prediction1 = cnn.construct_stereo_img(t_im0, t_im1) 
t_img = tf.subtract(tn_prediction0, tn_prediction1) 
tn_logits = cnn.construct_nn2(t_img) 

with tf.name_scope("Train"): 
    optimizer = tf.train.AdamOptimizer(FLAGS.learning_rate).minimize(cost_function) 
    tf.summary.image('logits', tn_logits, max_outputs=4) 
    tf.summary.image('label', t_label, max_outputs=4) 

としましょうそれらはセッションで実行されます:

with tf.Session(config=tf.ConfigProto(gpu_options=tf.GPUOptions(per_process_gpu_memory_fraction=0.333))) as sess: 

    coord = tf.train.Coordinator() 
    threads = tf.train.start_queue_runners(sess=sess, coord=coord) 
    sess.run(init) 

    for epoch in range(FLAGS.training_epochs): 
     for img in images: 
      _, summary_str, costs = sess.run([optimizer, merged_summary_op, cost_function], 
              feed_dict={t_im0: img.l_img.eval(), t_im1: img.r_img.eval(), 
                 t_label: img.mask.eval()}) 

今、h私の問題は次のとおりです:ループをsess.run()に置き換えて、すべての画像を反復処理しないようにしたい。

現在、1つの画像を3つずつ次々と供給しています。どのように複数の画像を同時に表示するか(例:[4, ?, ?, 3])。 tf.concat()を使用しようとしましたが、画像の高さと幅が異なるため、img.l_img.eval()を実行するとエラーが発生します。

私はプロジェクト全体を再構築することもできます。

+0

tf.image.resize_image_with_crop_or_pad()を使用して連結する前に、すべての画像を同じサイズにパディングするとどうなりますか? – RobR

+0

結果は良くないと思います – j35t3r

答えて

0

イメージ/バッチのサイズが同じでない限り、イメージ[1、h、w、rgb]の最初のサイズを増やすことはできません。

サイズ変更/切り抜きが悪い結果につながります。

短くできません。

関連する問題