datadir_unaligned = join(datadir, 'unaligned', 'unaligned_train400') # train_dataset = datasets.CEILDataset(datadir_syn, read_fns('VOC2012_224_train_png.txt'), size=opt.max_dataset_size) # train_dataset_real = datasets.CEILTestDataset(datadir_real, enable_transforms=True) train_dataset_unaligned = datasets.CEILTestDataset(datadir_unaligned, enable_transforms=True, flag={'unaligned':True}, size=None) # train_dataset_fusion = datasets.FusionDataset([train_dataset, train_dataset_unaligned, train_dataset_real], [0.25,0.5,0.25]) train_dataloader_fusion = datasets.DataLoader( train_dataset_unaligned, batch_size=opt.batchSize, shuffle=not opt.serial_batches, # train_dataset_fusion num_workers=opt.nThreads, pin_memory=True) eval_dataset_ceilnet = datasets.CEILTestDataset(join(datadir, 'testdata_CEILNET_table2')) eval_dataset_real = datasets.CEILTestDataset( join(datadir, 'real20'), fns=read_fns('real_test.txt')) eval_dataloader_ceilnet = datasets.DataLoader( eval_dataset_ceilnet, batch_size=1, shuffle=False, num_workers=opt.nThreads, pin_memory=True) eval_dataloader_real = datasets.DataLoader( eval_dataset_real, batch_size=1, shuffle=False, num_workers=opt.nThreads, pin_memory=True) # -------------------- engine start --------------------------- engine = Engine(opt) # ----------------------Main Loop for direct training--------------------------- engine.model.opt.lambda_gan = 0 # engine.model.opt.lambda_gan = 0.01
import data.reflect_dataset as datasets import util.util as util import data opt = TrainOptions().parse() cudnn.benchmark = True # modify the following code to datadir = '/media/kaixuan/DATA/Papers/Code/Data/Reflection/' datadir_syn = join(datadir, 'VOCdevkit/VOC2012/PNGImages') datadir_real = join(datadir, 'real_train') datadir_unaligned = join(datadir, 'unaligned', 'unaligned_train250') train_dataset = datasets.CEILDataset(datadir_syn, read_fns('VOC2012_224_train_png.txt'), size=opt.max_dataset_size) train_dataset_real = datasets.CEILTestDataset(datadir_real, enable_transforms=True) train_dataset_unaligned = datasets.CEILTestDataset(datadir_unaligned, enable_transforms=True, flag={'unaligned':True}, size=None) train_dataset_fusion = datasets.FusionDataset([train_dataset, train_dataset_unaligned, train_dataset_real], [0.25,0.5,0.25]) train_dataloader_fusion = datasets.DataLoader( train_dataset_fusion, batch_size=opt.batchSize, shuffle=not opt.serial_batches, num_workers=opt.nThreads, pin_memory=True) engine = Engine(opt) """Main Loop""" def set_learning_rate(lr):
opt.display_freq = 20 opt.print_freq = 20 opt.nEpochs = 40 opt.max_dataset_size = 100 opt.no_log = False opt.nThreads = 0 opt.decay_iter = 0 opt.serial_batches = True opt.serial_batches = True opt.serial_batches = True opt.no_flip = True datadir_syn = '/content/gdrive/My Drive/Datasets/SIRR/voc_reshaped_224x224/' datadir_real = '/content/gdrive/My Drive/Datasets/SIRR/real_dataset_CEILNet_Berkley/real/' train_dataset = datasets.CEILDataset(datadir_syn, read_fns('VOC17k_train.txt'), size=opt.max_dataset_size, enable_transforms=True, low_sigma=opt.low_sigma, high_sigma=opt.high_sigma, low_gamma=opt.low_gamma, high_gamma=opt.high_gamma) train_dataset_real = datasets.CEILTestDataset(datadir_real, fns=read_fns('real_train.txt'), enable_transforms=True) # train_dataset_fusion = datasets.FusionDataset([train_dataset, train_dataset_real], [0.7, 0.3]) train_dataset_fusion = train_dataset train_dataloader_fusion = datasets.DataLoader(train_dataset_fusion, batch_size=opt.batchSize,
opt.max_dataset_size = 100 opt.no_log = False opt.nThreads = 0 opt.decay_iter = 0 opt.serial_batches = True opt.no_flip = True # modify the following code to datadir = '/home/centos/reflection_removal/train_dataset/' #'/media/kaixuan/DATA/Papers/Code/Data/Reflection/' datadir_syn = join(datadir, 'VOCdevkit/VOC2012/PNGImages') datadir_real = join(datadir, 'real_train') train_dataset = datasets.CEILDataset(datadir_syn, read_fns('VOC2012_224_train_png.txt'), size=opt.max_dataset_size, enable_transforms=True, low_sigma=opt.low_sigma, high_sigma=opt.high_sigma, low_gamma=opt.low_gamma, high_gamma=opt.high_gamma) train_dataset_real = datasets.CEILTestDataset(datadir_real, enable_transforms=True) train_dataset_fusion = datasets.FusionDataset( [train_dataset, train_dataset_real], [0.7, 0.3]) train_dataloader_fusion = datasets.DataLoader(train_dataset_fusion, batch_size=opt.batchSize,
opt.nEpochs = 40 opt.max_dataset_size = 100 opt.no_log = False opt.nThreads = 0 opt.decay_iter = 0 opt.serial_batches = True opt.no_flip = True # modify the following code to datadir = '/media/kaixuan/DATA/Papers/Code/Data/Reflection/' datadir_syn = join(datadir, 'VOCdevkit/VOC2012/PNGImages') datadir_real = join(datadir, 'real_train') train_dataset = datasets.CEILDataset( datadir_syn, read_fns('VOC2012_224_train_png.txt'), size=opt.max_dataset_size, enable_transforms=True, low_sigma=opt.low_sigma, high_sigma=opt.high_sigma, low_gamma=opt.low_gamma, high_gamma=opt.high_gamma) train_dataset_real = datasets.CEILTestDataset(datadir_real, enable_transforms=True) train_dataset_fusion = datasets.FusionDataset([train_dataset, train_dataset_real], [0.7, 0.3]) train_dataloader_fusion = datasets.DataLoader( train_dataset_fusion, batch_size=opt.batchSize, shuffle=not opt.serial_batches, num_workers=opt.nThreads, pin_memory=True) eval_dataset_ceilnet = datasets.CEILTestDataset(join(datadir, 'testdata_CEILNET_table2')) eval_dataset_real = datasets.CEILTestDataset( join(datadir, 'real20'),