Skip to content

Instantly share code, notes, and snippets.

@manashmandal
Created December 17, 2017 17:54
Show Gist options
  • Save manashmandal/2989804570312faf09c0ead6f75bb002 to your computer and use it in GitHub Desktop.
Save manashmandal/2989804570312faf09c0ead6f75bb002 to your computer and use it in GitHub Desktop.
train_X = np.empty((18000, 200, 200))
for i in range(0,18000):
if i >= 3600 and i < 5400:
img = np.rot90(org_train_x[i].reshape(28,28),k =3, axes=(0,1))
img = np.fliplr(img)
elif i >= 9000 and i < 10800:
img = np.rot90(org_train_x[i].reshape(28,28),k =3, axes=(0,1))
img = np.fliplr(img)
elif i >= 12600 and i < 14400:
img = np.rot90(org_train_x[i].reshape(28,28),k =3, axes=(0,1))
img = np.fliplr(img)
elif i>= 14400 and i < 16200:
img = np.rot90(org_train_x[i].reshape(28,28),k =3, axes=(0,1))
img = np.fliplr(img)
else:
img = org_train_x[i].reshape(28,28)
height, width = img.shape[:2]
dst = cv2.resize(img, (5*width, 5*height), interpolation = cv2.INTER_CUBIC)
x = np.pad(dst,pad_width=30, mode='constant', constant_values=[0])
train_X[i] = x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment