2017-08-09 94 views
0

這是我的代碼片段,我怎樣做conatenate所有列車圖像(左,右,面罩)。在變數l,用[4, ?, ?, 3]形狀řtensores被分配。InvalidArgumentError:ConcatOp:輸入尺寸應當匹配:形狀[0] = [1,246,381,3]對形狀[1] = [1,252,367,3]

with tf.Session() as session: 
    l_train = [x.l_img for x in images][:4] 
    r_train = [x.r_img for x in images][:4] 
    m_train = [x.mask for x in images][:4] 
    l = tf.concat(l_train, 0) 
    r = tf.concat(r_train, 0) 
    m = tf.concat(m_train, 0) 

    l.eval() 

當使用eval()我得到這個錯誤?

Traceback (most recent call last): 

    File "/home/test/anaconda2/envs/tensorflow/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2881, in run_code 
exec(code_obj, self.user_global_ns, self.user_ns) 

    File "<ipython-input-5-f78dccf94f7f>", line 1, in <module> 
l.eval() 

    File "/home/test/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 606, in eval 
return _eval_using_default_session(self, feed_dict, self.graph, session) 

    File "/home/test/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3928, in _eval_using_default_session 
return session.run(tensors, feed_dict) 

    File "/home/test/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 789, in run 
run_metadata_ptr) 

    File "/home/test/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 997, in _run 
feed_dict_string, options, run_metadata) 

    File "/home/test/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1132, in _do_run 
target_list, options, run_metadata) 

File "/home/test/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1152, in _do_call 
raise type(e)(node_def, op, message) 

InvalidArgumentError: ConcatOp : Dimensions of inputs should match: shape[0] = [1,246,381,3] vs. shape[1] = [1,252,367,3] 
[[Node: concat = ConcatV2[N=4, T=DT_FLOAT, Tidx=DT_INT32, _device="/job:localhost/replica:0/task:0/gpu:0"](Reading/reshape_t_left/_1, Reading/reshape_t_left_1/_3, Reading/reshape_t_left_2/_5, Reading/reshape_t_left_3/_7, concat/axis)]] 
[[Node: concat/_9 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_370_concat", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]()]] 

如何訓練我的訓練集動態補丁大小?同時,循環播放我的圖像並將一個圖像接連送入CNN。

_, summary_str, costs = sess.run([optimizer, merged_summary_op, cost_function], 
             feed_dict={t_im0: l.eval(), t_im1: r.eval(), 
                t_label: m.eval()}) 

回答

0

我有完全相同的問題,我認爲這是因爲在更快的R-CNN紙上的批量大小是1。

相關問題