Created
December 13, 2019 18:57
-
-
Save aiwithshekhar/755e3aa6deee369cbffbd1310cd94525 to your computer and use it in GitHub Desktop.
create transforms for image and mask
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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