Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.