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