Created
July 9, 2018 10:38
-
-
Save siakon89/27ff70399eea208a9b98621d9bd740e8 to your computer and use it in GitHub Desktop.
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
def open_train_data(path): | |
train = [] | |
with open(path, 'r') as f: | |
reader = csv.reader(f) | |
lines = list(reader) | |
for line in tqdm(lines[1:]): | |
label = line[0] | |
image = np.array([x for x in line[1:]]) | |
image = image.astype('float32') | |
# Format the data to 28x28x1 (in grey scale) | |
image = np.reshape(image, (28, 28, 1)) | |
train.append([image, label]) | |
return np.array(train) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment