Skip to content

Instantly share code, notes, and snippets.

@aiwithshekhar
Created December 13, 2019 18:57
Show Gist options
  • Save aiwithshekhar/755e3aa6deee369cbffbd1310cd94525 to your computer and use it in GitHub Desktop.
Save aiwithshekhar/755e3aa6deee369cbffbd1310cd94525 to your computer and use it in GitHub Desktop.
create transforms for image and mask
# during traning/val phase make a list of transforms to be used.
# input-->"phase",mean,std
# output-->list
def get_transform(phase,mean,std):
list_trans=[]
if phase=='train':
list_trans.extend([HorizontalFlip(p=0.5)])
list_trans.extend([Normalize(mean=mean,std=std, p=1), ToTensor()]) #normalizing the data & then converting to tensors
list_trans=Compose(list_trans)
return list_trans
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment