In [4]:
# As usual, a bit of setup
import numpy as np
import matplotlib.pyplot as plt
import cPickle
import sys
sys.path.append('../../deuNet/')
from deuNet.utils.vis_utils import visualize_grid
%matplotlib inline
plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.cmap'] = 'gray'
# for auto-reloading external modules
# see http://stackoverflow.com/questions/1907993/autoreload-of-modules-in-ipython
%load_ext autoreload
%autoreload 2
def rel_error(x, y):
""" returns relative error """
return np.max(np.abs(x - y) / (np.maximum(1e-8, np.abs(x) + np.abs(y))))
In [9]:
weights = cPickle.load(open('tmpweights.plk'))
In [8]:
print weights.shape
grid = visualize_grid(weights.transpose(0, 2, 3, 1))
plt.imshow(grid[:,:,0])
Out[8]:
In [12]:
print weights.shape
grid = visualize_grid(weights.transpose(0, 2, 3, 1))
plt.imshow(grid[:,:,0])
Out[12]:
In [ ]: