(b, mb=36)
return img
Turn a batch of images into a single image mosaic.
Turn a batch of images into a single image mosaic.
Turn a batch of images into a single image mosaic .
def tf_batch_image(b, mb=36):
  """Turn a batch of images into a single image mosaic."""
  b_shape = b.get_shape().as_list()
  rows = int(np.ceil(np.sqrt(mb)))
  cols = rows
  diff = rows * cols - mb
  b = tf.concat(
      [b[:mb], tf.zeros([diff, b_shape[1], b_shape[2], b_shape[3]])], axis=0)
  tmp = tf.reshape(b, [-1, cols * b_shape[1], b_shape[2], b_shape[3]])
  img = tf.concat([tmp[i:i + 1] for i in range(rows)], axis=2)
  return img
def tf_batch_image ( b , mb = 36 ) : b_shape = b . get_shape ( ) . as_list ( ) rows = int ( np . ceil ( np . sqrt ( mb ) ) ) cols = rows diff = rows * cols - mb b = tf . concat ( [ b [ : mb ] , tf . zeros ( [ diff , b_shape [ 1 ] , b_shape [ 2 ] , b_shape [ 3 ] ] ) ] , axis = 0 ) tmp = tf . reshape ( b , [ - 1 , cols * b_shape [ 1 ] , b_shape [ 2 ] , b_shape [ 3 ] ] ) img = tf . concat ( [ tmp [ i : i + 1 ] for i in range ( rows ) ] , axis = 2 ) return img