cudnn.benchmark = True
    opt.display_freq = 10 # copy from train_errnet.py
    datadir = opt.root_dir # datadir = '/media/kaixuan/DATA/Papers/Code/Data/Reflection/'

    # -------------delete previous model checkpoints --------------
    checkpoint_path = join(opt.checkpoints_dir, opt.name)
    if os.path.exists(checkpoint_path): shutil.rmtree(checkpoint_path)

    # ----------------------- data preparation -------------------
    # datadir_syn = join(datadir, 'VOCdevkit/VOC2012/PNGImages')
    # datadir_real = join(datadir, 'real_train')
    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)
Example #2
0
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):
    for optimizer in engine.model.optimizers:
Example #3
0
import data.reflect_dataset as datasets
import util.util as util

opt = TrainOptions().parse()

opt.isTrain = False
cudnn.benchmark = True
opt.no_log = True
opt.display_id = 0
opt.verbose = False

datadir = opt.root_dir  # datadir = '/media/kaixuan/DATA/Papers/Code/Data/Reflection/'

# Define evaluation/test dataset

eval_dataset_ceilnet = datasets.CEILTestDataset(
    join(datadir, 'testdata_CEILNET_table2'))
eval_dataset_sir2 = datasets.CEILTestDataset(join(datadir, 'sir2_withgt'))

eval_dataset_real = datasets.CEILTestDataset(join(datadir, 'real20'),
                                             fns=read_fns('real_test.txt'),
                                             size=20)

eval_dataset_postcard = datasets.CEILTestDataset(join(datadir, 'postcard'))
eval_dataset_solidobject = datasets.CEILTestDataset(
    join(datadir, 'solidobject'))

# test_dataset_internet = datasets.RealDataset(join(datadir, 'internet'))
# test_dataset_unaligned300 = datasets.RealDataset(join(datadir, 'refined_unaligned_data/unaligned300/blended'))
# test_dataset_unaligned150 = datasets.RealDataset(join(datadir, 'refined_unaligned_data/unaligned150/blended'))
# test_dataset_unaligned_dynamic = datasets.RealDataset(join(datadir, 'refined_unaligned_data/unaligned_dynamic/blended'))
# test_dataset_sir2 = datasets.RealDataset(join(datadir, 'sir2_wogt/blended'))
Example #4
0
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,
                                              shuffle=not opt.serial_batches,
                                              num_workers=opt.nThreads,
                                              pin_memory=True)

eval_dataset_ceilnet = datasets.CEILTestDataset(join(
    datadir, 'testdata_CEILNET_table2'),
                                                enable_transforms=True)

eval_dataset_real = datasets.CEILTestDataset(join(datadir, 'real20'),
Example #5
0
    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,
                                              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(datadir_real, fns=read_fns('real_test.txt'))

# eval_dataloader_ceilnet = datasets.DataLoader(
Example #6
0
if __name__ == "__main__":
    mp.set_start_method('spawn')

    opt = TrainOptions().parse()

    opt.isTrain = True
    cudnn.benchmark = True
    opt.no_log = True
    opt.display_id = 0
    opt.verbose = False

    datadir = opt.root_dir

    # ----------------------- data preparation -------------------
    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)