Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Tensorflow 将tf.extract_图像_面片转换为批处理形状_Tensorflow - Fatal编程技术网

Tensorflow 将tf.extract_图像_面片转换为批处理形状

Tensorflow 将tf.extract_图像_面片转换为批处理形状,tensorflow,Tensorflow,我将数据批处理在一起 batch_size = 50 min_after_dequeue = 100 capacity = min_after_dequeue + 3 * batch_size mr_batch, us_batch = tf.train.shuffle_batch( [mr, us], batch_size=batch_size, capacity=capacity, min_after_dequeue=min_after_dequeue) mr_bat

我将数据批处理在一起

batch_size = 50
min_after_dequeue = 100
capacity = min_after_dequeue + 3 * batch_size

mr_batch, us_batch = tf.train.shuffle_batch(
      [mr, us], batch_size=batch_size, capacity=capacity,
      min_after_dequeue=min_after_dequeue)
mr_batch, us_batch
这给了我张量形状:

(<tf.Tensor 'shuffle_batch_2:0' shape=(50, 466, 394, 1) dtype=int16>,
 <tf.Tensor 'shuffle_batch_2:1' shape=(50, 366, 323, 1) dtype=uint8>)
这给了我形状:

(<tf.Tensor 'ResizeBilinear_13:0' shape=(50, 366, 323, 1) dtype=float32>,
 <tf.Tensor 'shuffle_batch_2:1' shape=(50, 366, 323, 1) dtype=uint8>)
并具有以下形状:

(<tf.Tensor 'ExtractImagePatches_8:0' shape=(50, 92, 81, 1225) dtype=uint8>,
 <tf.Tensor 'ExtractImagePatches_9:0' shape=(50, 92, 81, 1225) dtype=float32>)
(,
)
我现在想把这个形状转换成
(50*1225,92,81)
,这样我就可以把它输入我的火车踏板了


这个张量运算是如何调用的?

您可以使用带有特殊参数
-1
tf.reformate
来填充剩余值:

tf.reshape(us_patch, [-1, 92, 81])


但是,这可能是危险的,因为当您将以前的形状弄错时(例如,如果
us\u patch
具有形状
[50,92,81,1000]
),TensorFlow不会输出错误,只需将整个形状重新整形为
[50*1000,92,81]

tf.重新整形(us\u patch,[-1,92,81])
工作?@OlivierMoindrot是的!
(<tf.Tensor 'ExtractImagePatches_8:0' shape=(50, 92, 81, 1225) dtype=uint8>,
 <tf.Tensor 'ExtractImagePatches_9:0' shape=(50, 92, 81, 1225) dtype=float32>)
tf.reshape(us_patch, [-1, 92, 81])