I use python and tensorflow CNN for text classification. lrp_toolbox is a explain model of the neural network, it will provide the reason of classification of neural network model like "CNN", "RNN". The input of lrp_toolbox is trained "CNN" model with the following format.
I don't know how to make this format from the sess or graph of tensorflow CNN. I try to pickle the sess use code:
filename = 'trainedCNN_model_%s.pickle' % str(current_step)
pickle.dump(sess, open(filename, 'wb'))
,
but it fails and shows TypeError: can't pickle module objects
.
And actually, I think sess can't meet the input format of lrp_toolbox. The example input of lrp_toolbox is text format like
Linear 2 3
-2.01595799878 -2.05379403106 0.688953420218 1.20338836267 -1.7518249173 -1.90515935663
-0.519917325831 0.400368842573 0.0699950389094
Tanh
Linear 3 3
-1.18542075899 -1.62921811225 0.134698917906 0.111469267787 1.85227669488 -0.350827317469 0.102194311719 -1.67678396935 0.256312518679
0.116095097279 -0.0138454065897 0.0469443958438
Tanh
Linear 3 2
1.10940574175 0.26799513777 2.51842248017 -1.5497671807 -0.606042655911 0.197763706892
-0.115832556216 0.115832556216
SoftMax
Here is the manual of lrp_toolbox.