In [1]:
from tfs.network import Network
net = Network()
net.load('lenet_epoch_1')
In [2]:
from tfs.adapter import DeconvVisNet
visnet = DeconvVisNet(net)
In [3]:
print net
In [4]:
net.print_shape()
In [5]:
from tfs.dataset import Mnist
dataset = Mnist()
In [6]:
datablob = dataset.train.data[0,:,:,0]
In [7]:
%pylab inline
imshow(datablob,cmap='gray')
Out[7]:
In [8]:
ls = ['conv1','conv2','ip1','ip2']
for l in ls:
figure(figsize=(10,10))
img = visnet.img_layer(l,datablob.reshape(1,28,28,1)) # reshape to fill into the network
imshow(img,cmap='gray',interpolation='nearest')
axis('off')
title('%s'%l)
In [9]:
ls = ['conv1','conv2','ip1','ip2']
for l in ls:
figure(figsize=(20,20))
img = visnet.img_weight(l,datablob.reshape(1,28,28,1))
imshow(img,cmap='gray',interpolation='nearest')
axis('off')
title('%s'%l)
In [10]:
img = visnet.img_deconv_channel('conv1',0,datablob.reshape(1,28,28,1))
imshow(img,cmap='gray')
Out[10]:
In [ ]: