diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-08 11:28:31 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-08 11:28:31 +0200 |
| commit | 51c9b793874173ec778e67c339eef0f9f2e8cb26 (patch) | |
| tree | 7b301bdb7d04348093f5da08d2a7b544b73a9da5 | |
| parent | 4c0e69685e2945c2317a296d21874d87b4678285 (diff) | |
fix
| -rw-r--r-- | live-mogrify.py | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/live-mogrify.py b/live-mogrify.py index e26df3e..0725753 100644 --- a/live-mogrify.py +++ b/live-mogrify.py @@ -156,13 +156,42 @@ def list_sequences(module): }) return results +import torchvision.transforms as transforms + +def get_transform(opt): + transform_list = [] + # if opt.resize_or_crop == 'resize_and_crop': + # osize = [opt.loadSize, opt.loadSize] + # transform_list.append(transforms.Scale(osize, Image.BICUBIC)) + # if opt.center_crop: + # transform_list.append(transforms.CenterCrop(opt.fineSize)) + # else: + # transform_list.append(transforms.RandomCrop(opt.fineSize)) + # elif opt.resize_or_crop == 'crop': + # transform_list.append(transforms.RandomCrop(opt.fineSize)) + # elif opt.resize_or_crop == 'scale_width': + # transform_list.append(transforms.Lambda( + # lambda img: __scale_width(img, opt.fineSize))) + # elif opt.resize_or_crop == 'scale_width_and_crop': + # transform_list.append(transforms.Lambda( + # lambda img: __scale_width(img, opt.loadSize))) + # transform_list.append(transforms.RandomCrop(opt.fineSize)) + + # if opt.isTrain and not opt.no_flip: + # transform_list.append(transforms.RandomHorizontalFlip()) + + transform_list += [transforms.ToTensor(), + transforms.Normalize((0.5, 0.5, 0.5), + (0.5, 0.5, 0.5))] + return transforms.Compose(transform_list) + def load_frame(opt, index): A_path = os.path.join(opt.render_dir, "frame_{:05d}.png".format(index)) if not os.path.exists(A_path): print("path doesn't exist: {}".format(A_path)) return None - A_img = Image.open(A_path).convert('RGB') - # A = self.transform(A_img) + A = Image.open(A_path).convert('RGB') + A = self.transform(A_img) # if self.opt.which_direction == 'BtoA': # input_nc = self.opt.output_nc # else: |
