0
我一起批我的数据转换tf.extract_image_patches批量形状
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>)
然后我调整图像具有相同的分辨率:
mr_batch = tf.image.resize_bilinear(mr_batch, [366, 323])
mr_batch, us_batch
这给了我形状:
(<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>)
最后我提取图像补丁:
us_patch = tf.extract_image_patches(label, [1, 7, 7, 1], [1, 2, 2, 1], [1, 1, 1, 1], 'SAME')
mr_patch = tf.extract_image_patches(image, [1, 7, 7, 1], [1, 2, 2, 1], [1, 1, 1, 1], 'SAME')
us_patch, mr_patch
而且具有形状:
(<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)
这样我就可以将其提供给我的火车一步。
这个张量操作是如何调用的?
'tf.reshape(us_patch,[-1,92,81])'工作吗? –
@OlivierMoindrot是的! – bodokaiser