In [1]:
import matplotlib.pyplot as plt
import numpy as np
import glob
from scipy import misc

%matplotlib inline

data_dir = './data/raw/Ara2013-Canon/'

x_train = np.array([np.array(misc.imread(fname), dtype=np.int32) for fname in glob.glob(data_dir+'*rbg.png')])
y_train = np.array([np.array(misc.imread(fname), dtype=np.int32) for fname in glob.glob(data_dir+'*label.png')])
print(y_train.shape)


temp_img = y_train[1]
colors = set( tuple(v) for m2d in temp_img for v in m2d )

plt.figure()
plt.imshow(temp_img)
sums = [sum(color) for color in colors]
sums.remove(0)

temp_sums = np.sum(temp_img,axis=2)
for i in sums:
    inds = temp_sums == i
    temp = np.zeros(temp_img.shape[:2])
    temp[inds] = 1
    plt.figure()
    plt.imshow(temp)


(165,)

In [1]:


In [1]:


In [ ]: