Skip to content

Chinese Landscape Painting style transfer by adversarial network(中国山水画风格化)

License

Notifications You must be signed in to change notification settings

Robin-WZQ/Chinese-Landscape-Painting-Style-Transfer

Repository files navigation

Chinese-Landscape-Painting-style-transfer

Chinese Landscape Painting style transfer by adversarial network.

图片2

Result

图片1

Installation

The code was tested with Anaconda and Python 3.7. After installing the Anaconda environment:

  1. Clone the repo:

    git clone https://github.com/Robin-WZQ/Chinese-Landscape-Painting-Style-Transfer.git
    cd Chinese-Landscape-Painting-Style-Transfer
  2. Install dependencies:

    For PyTorch dependency, see pytorch.org for more details.

    For custom dependencies:

    pip install -r requirements.txt
  3. Download pretrained model from BaiduYun extract code: qls1

    I trained the model for 100 epoches.

  4. Pre-process the dataset

    python canny.py
    python picture2texture.py
    python process_all.py
  5. Configure your dataset and pretrained model path in opts.py.

    To train the model, please do:

    python pix2pix.py

    To do a style trasfer, please do:

    python test.py
  6. In the folder UI, I make a simple interactive interface by tkinter.

    This is a separate folder. Do not use it in the same directory as other folders!!

    To run the DEMO, please do:

    python UI/UI.py

Datasets:

I used the dataset from here

Dataset directory tree is shown below

  • Alice Make sure to put the files as the following structure:
    Alice
    ├── Harvard
    │   ├── Harvard_0.jpg
    │   └── ...
    ├── met-1
    │   ├── met_0.jpg
    │   └── ...
    └── met-2
    │   ├── met-221.jpg
    │   └── ...
    

Also, I graped some pictures(nearly 800) from website and I added these pictures into the Alice dataset. U can run tools/Web_Spider.py to generate you own dataset. (And modify names in tools/name.txt)

After preprocessing, it will generate 3 dataset:

  • processed by canny (I use Histogram Equalization for image enhancement first), like:

- processed by HED, like:

- canny + HED, like:

Experiments

These models were trained in machine with NVIDIA TITAN X 11gb GPU. I trained it in 100 epoches and bachsize is 1. More details please see in my code.

About

Chinese Landscape Painting style transfer by adversarial network(中国山水画风格化)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages