classes = []
print out.shape
colors = [[255,0,0], [255,208,191], [204,163,0], [0,140,0], [0,255,204], [0,34,51], [34,0,255], [179,89,173],
[89,67,76], [229,0,0], [242,133,61], [153,150,115], [0,64,0], [191,255,251], [0,116,217], [137,121,242],
[102,51,99], [191,0,51], [217,0,0], [140,98,70], [97,102,26], [61,242,61], [0,83,89], [64,98,128], [34,19,77],
[229,0,122], [191,96,121], [102,14,0], [229,176,115], [238,242,182], [67,89,70], [115,150,153], [0,37,140], [143,0,179], [51,0,27], [191,108,96],
[64,48,16], [195,230,57], [38,153,115], [0,204,255], [182,182,242], [255,64,242], [255,191,225]]
data = np.zeros( (out.shape[0],out.shape[1],3), dtype=np.uint8 )
for x in range(0,out.shape[0]):
for y in range(0,out.shape[1]):
if out[x][y] not in classes:
classes.append(out[x][y])
data[x,y] = colors[classes.index(out[x][y])]
print classes
img = smp.toimage( data ) # Create a PIL image
img.show() # View in default viewer