Skip to content

Instantly share code, notes, and snippets.

@Yuvnish017
Created June 29, 2021 06:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yuvnish017/208ca6ce3c430a1ef8f78fd4ac252b1f to your computer and use it in GitHub Desktop.
Save Yuvnish017/208ca6ce3c430a1ef8f78fd4ac252b1f to your computer and use it in GitHub Desktop.
Driver Drowsiness Detection
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