In [11]:
import matplotlib.pyplot as plt
import numpy as np
import glob
from scipy import misc
%matplotlib inline
y_test = np.load('./y_masks.npy')
print(y_test.shape)
for img in y_test[0]:
print(img.shape)
print(img)
plt.figure()
plt.imshow(img)
(165, 1, 128, 128, 1)
(128, 128, 1)
[[[ 0.50000006]
[ 0.50000012]
[ 0.50000012]
...,
[ 0.49999976]
[ 0.49999976]
[ 0.49999988]]
[[ 0.5 ]
[ 0.49999994]
[ 0.5 ]
...,
[ 0.49999952]
[ 0.49999946]
[ 0.49999976]]
[[ 0.5 ]
[ 0.50000024]
[ 0.50000012]
...,
[ 0.4999994 ]
[ 0.4999994 ]
[ 0.49999976]]
...,
[[ 0.49999964]
[ 0.49999988]
[ 0.49999964]
...,
[ 0.49999952]
[ 0.49999982]
[ 0.5 ]]
[[ 0.49999952]
[ 0.49999958]
[ 0.4999994 ]
...,
[ 0.49999911]
[ 0.49999952]
[ 0.4999997 ]]
[[ 0.49999976]
[ 0.49999994]
[ 0.49999976]
...,
[ 0.49999976]
[ 0.50000006]
[ 0.5 ]]]
TypeErrorTraceback (most recent call last)
<ipython-input-11-6f99615cfb3a> in <module>()
13 print(img)
14 plt.figure()
---> 15 plt.imshow(img)
/home/andy/anaconda2/lib/python2.7/site-packages/matplotlib/pyplot.pyc in imshow(X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, hold, data, **kwargs)
3027 filternorm=filternorm, filterrad=filterrad,
3028 imlim=imlim, resample=resample, url=url, data=data,
-> 3029 **kwargs)
3030 finally:
3031 ax.hold(washold)
/home/andy/anaconda2/lib/python2.7/site-packages/matplotlib/__init__.pyc in inner(ax, *args, **kwargs)
1817 warnings.warn(msg % (label_namer, func.__name__),
1818 RuntimeWarning, stacklevel=2)
-> 1819 return func(ax, *args, **kwargs)
1820 pre_doc = inner.__doc__
1821 if pre_doc is None:
/home/andy/anaconda2/lib/python2.7/site-packages/matplotlib/axes/_axes.pyc in imshow(self, X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, **kwargs)
4920 resample=resample, **kwargs)
4921
-> 4922 im.set_data(X)
4923 im.set_alpha(alpha)
4924 if im.get_clip_path() is None:
/home/andy/anaconda2/lib/python2.7/site-packages/matplotlib/image.pyc in set_data(self, A)
451 if (self._A.ndim not in (2, 3) or
452 (self._A.ndim == 3 and self._A.shape[-1] not in (3, 4))):
--> 453 raise TypeError("Invalid dimensions for image data")
454
455 self._imcache = None
TypeError: Invalid dimensions for image data
In [ ]:
Content source: andrewkeenan/PlantSeg
Similar notebooks: