Skip to content

Instantly share code, notes, and snippets.

@123epsilon
Created August 27, 2021 18:57
Show Gist options
  • Save 123epsilon/3ab87a6134d6bd9c0c447df73839166f to your computer and use it in GitHub Desktop.
Save 123epsilon/3ab87a6134d6bd9c0c447df73839166f to your computer and use it in GitHub Desktop.
transform = transforms.Compose([
transforms.RandomHorizontalFlip(),
transforms.RandomVerticalFlip(),
transforms.RandomRotation(90),
transforms.RandomAffine(degrees=15, translate=(0.1, 0.1), scale=(0.8, 0.8))
])
augmented_mri_dataset = Brain_MRI_Segmentation_Dataset(positive_diagnoses, transform=transform)
validation_size = int(0.3 * len(mri_dataset))
atrain_set, aval_set = data.random_split(mri_dataset, [len(mri_dataset)-validation_size, validation_size])
aug_train_loader = data.DataLoader(dataset=atrain_set, batch_size=2, shuffle=True)
aug_val_loader = data.DataLoader(dataset=aval_set, batch_size=2, shuffle=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment