예제 #1
0
파일: wkwdata.py 프로젝트: genEM3/genEM3
 def get_common_transforms():
     """
     Get the transform object with the common transforms (Flips, rotation90)
     Args: None
     Returns:
         transformation: the transformation
     """
     common_transforms = transforms.Compose([
         transforms.RandomFlip(p=0.5, flip_plane=(1, 2)),
         transforms.RandomFlip(p=0.5, flip_plane=(2, 1)),
         transforms.RandomRotation90(p=1.0,
                                     mult_90=[0, 1, 2, 3],
                                     rot_plane=(1, 2))
     ])
     return common_transforms
예제 #2
0
state_dict_path = '/u/flod/code/genEM3/runs/training/ae_v05_skip/.log/epoch_60/model_state_dict'
input_shape = (140, 140, 1)
output_shape = (140, 140, 1)

data_split = DataSplit(train=0.85, validation=0.15, test=0.00)
cache_RAM = True
cache_HDD = True
cache_root = os.path.join(run_root, '.cache/')
batch_size = 256
num_workers = 8

data_sources = WkwData.datasources_from_json(datasources_json_path)

transforms = transforms.Compose([
    transforms.RandomFlip(p=0.5, flip_plane=(1, 2)),
    transforms.RandomFlip(p=0.5, flip_plane=(2, 1)),
    transforms.RandomRotation90(p=1.0, mult_90=[0, 1, 2, 3], rot_plane=(1, 2))
])

dataset = WkwData(input_shape=input_shape,
                  target_shape=output_shape,
                  data_sources=data_sources,
                  data_split=data_split,
                  transforms=transforms,
                  cache_RAM=cache_RAM,
                  cache_HDD=cache_HDD,
                  cache_HDD_root=cache_HDD_root)
# Create the weighted samplers which create imbalance given the factor
imbalance_factor = 20
data_loaders = subsetWeightedSampler.get_data_loaders(
    dataset,