Course Project of AU332@SJTU (renamed to AI3603). Implementing transferring a real photo containing natural scenery into Chinese painting style.
APACHE-2.0 License
Project for SJTU-AU332 (AI3603).
Implementing transferring a real photo containing natural scenery into Chinese painting style using CycleGAN and Neural Style Transfer.
CycleGAN/
: source code of CycleGAN
NeuralStyleTransfer/
: source code of Neural Style Transfer
main.py
: main script to run neural style transferLossFunction.py
: loss function scriptdata/
: style images and content imagesresults/
: some sample resultsTo run training script, first, change directory to where the script locates, and put trainA and trainB into directory dataroot
. Then use command python train.py --dataroot dataroot
in terminal. Use command python train.py --help
for more instructions.
To run testing script, first, change directory to where the script locates, put test data into directory dataroot
and put pretrained model into directory ./checkpoints/xxx
where xxx
is the name
you defined in terminal. Then use command python test.py --dataroot dataroot --name name
in terminal. Use command python test.py --help
for more instructions.
Our pretrained Model:
Baidu NetDisk (key: eplt)
First, change directory to where the main.py
script locates, put content images into directory content_img_dir
, and put style images into path style_img_path
. Then use command python main.py --content_img_dir content_img_dir --style_img_path style_img_path
in terminal. Use command python main.py --help
for more instructions.
The code requires only common Python environments for machine learning; Basically, it was tested with
Higher (or lower) versions should also work (perhaps with minor modifications).
download:
Baidu NetDisk (key: 1t61)
Adapted from :
Traditional Chinese Landscape Painting Dataset
This repo borrows a lot from junyanz/pytorch-CycleGAN-and-pix2pix and pytorch tutorials.