Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Official Torch implementation can be found [here](https://github.com/Yijunmaveri
## Prerequisites
- [Pytorch](http://pytorch.org/)
- [torchvision](https://github.com/pytorch/vision)
- Pretrained encoder and decoder [models](https://drive.google.com/file/d/1M5KBPfqrIUZqrBZf78CIxLrMUT4lD4t9/view?usp=sharing) for image reconstruction only (download and uncompress them under models/)
- Pretrained encoder and decoder [models](https://drive.google.com/file/d/1M5KBPfqrIUZqrBZf78CIxLrMUT4lD4t9/view?usp=sharing) for image reconstruction only (download and uncompress them under models/), in China, [here](https://github.com/mtobeiyf/sketch-to-art/releases) download the model.
- CUDA + CuDNN

## Prepare images
Expand Down
21 changes: 11 additions & 10 deletions WCT.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import os
import torch
import argparse
from PIL import Image
from torch.autograd import Variable
import os
import time

import torchvision.utils as vutils
import torchvision.datasets as datasets
import torch.nn.functional as F
from torch.autograd import Variable

from tensorboardX import SummaryWriter

from Loader import Dataset
from util import *
import scipy.misc
from torch.utils.serialization import load_lua
import time

parser = argparse.ArgumentParser(description='WCT Pytorch')
parser.add_argument('--contentPath',default='images/content',help='path to train')
Expand Down Expand Up @@ -102,8 +102,9 @@ def styleTransfer(contentImg,styleImg,imname,csF):
if (args.cuda):
contentImg = contentImg.cuda(args.gpu)
styleImg = styleImg.cuda(args.gpu)
cImg = Variable(contentImg,volatile=True)
sImg = Variable(styleImg,volatile=True)
with torch.no_grad():
cImg = Variable(contentImg)
sImg = Variable(styleImg)
start_time = time.time()
# WCT Style Transfer
styleTransfer(cImg,sImg,imname,csF)
Expand Down
Loading