parser.add_argument("--gamma", help="Learning rate decay factor", type=float, default=0.9) parser.add_argument("--epochs", help="Total number of epochs to train", type=int, default=250) parser.add_argument("--len_epoch", help="Number of iteration in each epoch", type=int, default=100) parser.add_argument("--test_freq", help="Number of epochs between each test stage", type=int, default=1) parser.add_argument("--train_batch_size", help="Batch size in the training stage", type=int, default=4) parser.add_argument("--test_batch_size", help="Batch size in the testing stage", type=int, default=4) args = parser.parse_args() print('[%s] Arguments: ' % (datetime.datetime.now())) print('[%s] %s' % (datetime.datetime.now(), args)) args.input_size = [int(item) for item in args.input_size.split(',')] """ Fix seed (for reproducibility) """ set_seed(args.seed) """ Setup logging directory """ print('[%s] Setting up log directories' % (datetime.datetime.now())) if not os.path.exists(args.log_dir): os.mkdir(args.log_dir) """ Load the data """ df = json.load(open(args.data_file)) input_shape = (1, args.input_size[0], args.input_size[1]) print('[%s] Loading data' % (datetime.datetime.now())) augmenter = Compose(
"-c", help="Path to the configuration file", type=str, default='clem1.yaml') parser.add_argument( "--clean-up", help="Boolean flag that specifies cleaning of the checkpoints", action='store_true', default=False) args = parser.parse_args() with open(args.config) as file: params = parse_params(yaml.load(file, Loader=yaml.FullLoader)) """ Fix seed (for reproducibility) """ set_seed(params['seed']) """ Load the data """ print_frm('Loading data') input_shape = (1, *(params['input_size'])) split_src = params['src']['train_val_split'] split_tar = params['tar']['train_val_split'] transform = Compose([ Rotate90(), Flip(prob=0.5, dim=0), Flip(prob=0.5, dim=1), ContrastAdjust(adj=0.1), AddNoise(sigma_max=0.05) ]) print_frm('Train data...')