Python transforms.RandomHorizontalFlip() Examples
The following are 1
code examples of transforms.RandomHorizontalFlip().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
transforms
, or try the search function
.
Example #1
Source File: train.py From deconvolution with GNU General Public License v3.0 | 6 votes |
def get_transform(mode,base_size): #base_size = 520 #crop_size = 480 crop_size=int(480*base_size/520) min_size = int((0.5 if mode=='train' else 1.0) * base_size) max_size = int((2.0 if mode=='train' else 1.0) * base_size) transforms = [] transforms.append(T.RandomResize(min_size, max_size)) if mode=='train': transforms.append(T.RandomHorizontalFlip(0.5)) transforms.append(T.RandomCrop(crop_size)) transforms.append(T.ToTensor()) transforms.append(T.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])) return T.Compose(transforms)