I have been trying to convert a large list of rgb arrays to hsv arrays in the following way and it got killed every time due to memory, could anyone kindly suggest a better way to do it? Preferably the result should be a large list of hsv arrays but if that's not the way to go, I'm good with any other forms of storage to work with.
Here are my current codes:
os.chdir("/mnt/saswork/sh2264/vision/code")
X_train_matched = np.load("X_train_scores.npy")
R = [r[0] for r in X_train_matched]
G = [g[1] for g in X_train_matched]
B = [b[2] for b in X_train_matched]
import colorsys
#hsv = [[[colorsys.rgb_to_hsv(x,y,z) for x,y,z in zip(a,b,c)]for a,b,c in zip(d,e,f)] for d,e,f in zip(R,G,B)]
# this is too memory intense
hsv = []
for image in X_train_matched:
hsv.append([colorsys.rgb_to_hsv(x,y,z) for x,y,z in zip(a,b,c)] for a,b,c in zip(image[0],image[1],image[2])])
Thanks a million!