Created
July 13, 2021 06:36
-
-
Save Yuvnish017/4869f8a51d2026fa00da49b9174a2f66 to your computer and use it in GitHub Desktop.
OCR
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
X = [] | |
for i in range(len(x)): | |
# print(i) | |
img = x[i] | |
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) | |
threshold_image = cv2.threshold(img_gray, 0, 255, cv2.THRESH_BINARY_INV|cv2.THRESH_OTSU)[1] | |
threshold_image = cv2.resize(threshold_image, (32, 32)) | |
X.append(threshold_image) | |
print(len(X)) | |
label_encoder = LabelEncoder() | |
y = label_encoder.fit_transform(y) | |
print(len(y)) | |
X_train, X_test, Y_train, Y_test = train_test_split(X, y, test_size=0.2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment