Created
June 29, 2021 06:22
-
-
Save Yuvnish017/208ca6ce3c430a1ef8f78fd4ac252b1f to your computer and use it in GitHub Desktop.
Driver Drowsiness Detection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = np.load('dataset.npz', allow_pickle=True) | |
X = data['arr_0'] | |
Y = data['arr_1'] | |
X = list(X) | |
Y = list(Y) | |
for i in range(len(X)): | |
img = X[i] | |
img = cv2.resize(img, (32, 32)) | |
X[i] = img | |
label_encoder = LabelEncoder() | |
Y = label_encoder.fit_transform(Y) | |
X = np.array(X) | |
Y = np.array(Y) | |
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.2) | |
Y_train = to_categorical(Y_train) | |
Y_test = to_categorical(Y_test) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment