def imageSummary(opt,image,tag,H,W):
blockSize = opt.visBlockSize
imageOne = tf.batch_to_space(image[:blockSize**2],crops=[[0,0],[0,0]],block_size=blockSize)
imagePermute = tf.reshape(imageOne,[H,blockSize,W,blockSize,-1])
imageTransp = tf.transpose(imagePermute,[1,0,3,2,4])
imageBlocks = tf.reshape(imageTransp,[1,H*blockSize,W*blockSize,-1])
imageBlocks = tf.cast(imageBlocks*255,tf.uint8)
summary = tf.summary.image(tag,imageBlocks)
return summary
# make image summary from image batch (mean/variance)
评论列表
文章目录