def visualize_conv_weights(filters, name):
    """Visualize use weights in convolution filters.

    Args:
        filters: tensor containing the weights [H,W,Cin,Cout]
        name: label for tensorboard

    Returns:
        image of all weight
    """
    with tf.name_scope('visualize_w_' + name):
        filters = tf.transpose(filters, (3, 2, 0, 1))   # [h, w, cin, cout] -> [cout, cin, h, w]
        filters = tf.unstack(filters)                   # --> cout * [cin, h, w]
        filters = tf.concat(filters, 1)                 # --> [cin, cout * h, w]
        filters = tf.unstack(filters)                   # --> cin * [cout * h, w]
        filters = tf.concat(filters, 1)                 # --> [cout * h, cin * w]
        filters = tf.expand_dims(filters, 0)
        filters = tf.expand_dims(filters, -1)

    tf.summary.image('visualize_w_' + name, filters)
def visualize_conv_weights ( filters , name ) : with tf . name_scope ( 'visualize_w_' + name ) : filters = tf . transpose ( filters , ( 3 , 2 , 0 , 1 ) ) filters = tf . unstack ( filters ) filters = tf . concat ( filters , 1 ) filters = tf . unstack ( filters ) filters = tf . concat ( filters , 1 ) filters = tf . expand_dims ( filters , 0 ) filters = tf . expand_dims ( filters , - 1 ) tf . summary . image ( 'visualize_w_' + name , filters )
Visualize use weights in convolution filters.

    Args:
        filters: tensor containing the weights [H,W,Cin,Cout]
        name: label for tensorboard

    Returns:
        image of all weight