Example #1
0
    img.replace(right_test_dir, label_dir).replace('_R', '').replace(
        '_1500_maskImg', '').replace('.png', '.dpt').replace('.tif', '.dpt')
    for img in close_right_filelist
]

angle = 5
x_translation = 0
y_translation = 0
scale = 1.0

close_db = myImageloader(left_img_files=close_left_filelist,
                         right_img_files=close_right_filelist,
                         label_files=close_label_filelist,
                         angle=angle,
                         x_translation=x_translation,
                         y_translation=y_translation,
                         scale=scale,
                         train_patch_w=256,
                         transform=transforms.Compose([transforms.ToTensor()]),
                         label_transform=transforms.Compose(
                             [transforms.ToTensor()]))

train_loader = torch.utils.data.DataLoader(myImageloader(
    left_img_files=left_train_filelist,
    right_img_files=right_train_filelist,
    label_files=train_labels,
    angle=angle,
    x_translation=x_translation,
    y_translation=y_translation,
    scale=scale,
    train_patch_w=256,
angle = 30
translate = 0.1
scale = 1.1

train_filelist = [
    os.path.join(train_dir, img) for img in os.listdir(train_dir)
]
train_labels = [img.replace(train_dir, label_dir) for img in train_filelist]
test_filelist = [os.path.join(train_dir, img) for img in os.listdir(test_dir)]
test_labels = [img.replace(test_dir, label_dir) for img in test_filelist]

train_loader = torch.utils.data.DataLoader(myImageloader(
    img_files=train_filelist,
    label_files=train_labels,
    angle=angle,
    translation=translate,
    scale=scale,
    transform=transforms.Compose([transforms.ToTensor()]),
    label_transform=transforms.Compose([transforms.ToTensor()])),
                                           batch_size=1,
                                           shuffle=True,
                                           num_workers=4)

test_loader = torch.utils.data.DataLoader(myImageloader(
    img_files=test_filelist,
    label_files=test_labels,
    angle=angle,
    translation=translate,
    scale=scale,
    transform=transforms.Compose([transforms.ToTensor()]),
    label_transform=transforms.Compose([transforms.ToTensor()])),