Skip to content

Instantly share code, notes, and snippets.

@Yuvnish017
Created July 10, 2021 06:23
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/90119d8c5899fca27336c5daab1b07ba to your computer and use it in GitHub Desktop.
Save Yuvnish017/90119d8c5899fca27336c5daab1b07ba to your computer and use it in GitHub Desktop.
Parkinson_disease_detection
train_data_generator = ImageDataGenerator(rotation_range=360,
width_shift_range=0.0,
height_shift_range=0.0,
# brightness_range=[0.5, 1.5],
horizontal_flip=True,
vertical_flip=True)
x = list(x_train)
y = list(y_train)
x_aug_train = []
y_aug_train = []
for (i, v) in enumerate(y):
x_img = x[i]
x_img = np.array(x_img)
x_img = np.expand_dims(x_img, axis=0)
aug_iter = train_data_generator.flow(x_img, batch_size=1, shuffle=True)
for j in range(70):
aug_image = next(aug_iter)[0].astype('uint8')
x_aug_train.append(aug_image)
y_aug_train.append(v)
print(len(x_aug_train))
print(len(y_aug_train))
x_train = x + x_aug_train
y_train = y + y_aug_train
print(len(x_train))
print(len(y_train))
test_data_generator = ImageDataGenerator(rotation_range=360,
width_shift_range=0.0,
height_shift_range=0.0,
# brightness_range=[0.5, 1.5],
horizontal_flip=True,
vertical_flip=True)
x = list(x_test)
y = list(y_test)
x_aug_test = []
y_aug_test = []
for (i, v) in enumerate(y):
x_img = x[i]
x_img = np.array(x_img)
x_img = np.expand_dims(x_img, axis=0)
aug_iter = test_data_generator.flow(x_img, batch_size=1, shuffle=True)
for j in range(20):
aug_image = next(aug_iter)[0].astype('uint8')
x_aug_test.append(aug_image)
y_aug_test.append(v)
print(len(x_aug_test))
print(len(y_aug_test))
x_test = x + x_aug_test
y_test = y + y_aug_test
print(len(x_test))
print(len(y_test))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment