TensorFlow, how to look inside 'blob', the response in through CNN TensorFlow, how to look inside 'blob', the response in through CNN numpy numpy

TensorFlow, how to look inside 'blob', the response in through CNN


You can use session.run to get the current values of elements in your computation graph.

layer7_values = session.run(layer7_tf, feed_dict={<your inputs>})

In this example session is a tf.Session() object. layer7_tf is a reference to the Tensor output of a layer in the TensorFlow model, and layer7_values will contain the layer values for the given input as a numpy array.

To get a handle to layer7_tf, you have a couple of options. You can either modify TensorFace/vggface/init.py to return a reference to the appropriate layer; or you can explore the session.graph_def structure to find the name of the node that corresponds to that tensor, and pass the string name of the tensor (e.g. layer7_tf/foo/bar:0, where the :0 corresponds to the 0th output of the op called layer7_tf/foo/bar) to session.run() instead.


Oh.. I think I found solution.

Just removing some lines in TensorFace/vggface/init.py

# (37): nn.ReLU# (38): nn.Dropout(0.500000)# (39): nn.Linear(4096 -> 2622)#self.layers.append(('linear','39',2622,False))# (40): nn.SoftMax#self.layers.append(('softmax'))

looks working