lucasosouza
12/4/2016 - 4:44 PM

color_conversion.py

def process():
    for i in range(len(X_train)):
        X_train[i] = cv2.cvtColor(X_train[i], cv2.COLOR_BGR2GRAY).reshape(32,32,1)

%time process()

# CPU times: user 506 ms, sys: 1.74 ms, total: 508 ms
# Wall time: 508 ms

def process(img):
    return cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

%time X_train = np.array([process(img) for img in X_train]).reshape(-1,32,32,1)

# CPU times: user 183 ms, sys: 22.9 ms, total: 206 ms
# Wall time: 205 ms