def plot(self):
""" Plot the layer data (for debugging)
:return: The current figure
"""
import pylab as pl
aspect = self.nrows / float(self.ncols)
figure_width = 6 #inches
rows = max(1, int(np.sqrt(self.nlayers)))
cols = int(np.ceil(self.nlayers/rows))
# noinspection PyUnresolvedReferences
pallette = {i:rgb for (i, rgb) in enumerate(pl.cm.jet(np.linspace(0, 1, 4), bytes=True))}
f, a = pl.subplots(rows, cols)
f.set_size_inches(6 * cols, 6 * rows)
a = a.flatten()
for i, label in enumerate(self.label_names):
pl.sca(a[i])
pl.title(label)
pl.imshow(self.color_data)
pl.imshow(colorize(self.label_data[:, :, i], pallette), alpha=0.5)
# axis('off')
return f
评论列表
文章目录