This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# feature - the tensor you want to visualise in shape [num_examples, dimX, dimY, channels]. If dims are provided, the feature tensor can be flattened. Eg shape: [20, 7, 7, 16] | |
# grid - the dimensions of a grid on which the features will be displayed. Expects a touple (x,y) where x * y have to equal to channels of the feature. Eg, for 16 channels, grid=[4,4] | |
# dims (optional) - dimensions of each feature. Eg. for feature [20, 7, 7, 16], dims=[7,7] (although in non-flattened tensor the dims can be ommited) | |
# max_outputs - number of examples to draw | |
def visualise_feature(feature, grid, dims=None, max_outputs=10): | |
with tf.name_scope('Visualize_filters') as scope: | |
original_shape = feature.get_shape().as_list() | |
original_len = len(original_shape) |
NewerOlder