di vedere solo un paio di filtri CONV1 in Tensorboard, è possibile utilizzare questo codice (che funziona per cifar10)
# this should be a part of the inference(images) function in cifar10.py file
# conv1
with tf.variable_scope('conv1') as scope:
kernel = _variable_with_weight_decay('weights', shape=[5, 5, 3, 64],
stddev=1e-4, wd=0.0)
conv = tf.nn.conv2d(images, kernel, [1, 1, 1, 1], padding='SAME')
biases = _variable_on_cpu('biases', [64], tf.constant_initializer(0.0))
bias = tf.nn.bias_add(conv, biases)
conv1 = tf.nn.relu(bias, name=scope.name)
_activation_summary(conv1)
with tf.variable_scope('visualization'):
# scale weights to [0 1], type is still float
x_min = tf.reduce_min(kernel)
x_max = tf.reduce_max(kernel)
kernel_0_to_1 = (kernel - x_min)/(x_max - x_min)
# to tf.image_summary format [batch_size, height, width, channels]
kernel_transposed = tf.transpose (kernel_0_to_1, [3, 0, 1, 2])
# this will display random 3 filters from the 64 in conv1
tf.image_summary('conv1/filters', kernel_transposed, max_images=3)
Ho anche scritto un semplice gist per visualizzare tutti i 64 filtri CONV1 in una griglia.
Vedere anche [Come visualizzare i filtri di convoluzione tensorflow?] (Http://stackoverflow.com/q/39361943/562769) –
Possibile duplicato di [Come visualizzare i pesi (variabili) in cnn in Tensorflow?] (http://stackoverflow.com/questions/33783672/how-can-i-visualize-the-weightsvariables-in-cnn-in-tensorflow) –
Puoi usare [tensorflow debugger] (https://github.com/) ericjang/tdb) strumento – fabrizioM