This is the implementation of "Neural Style Transfer".
Original paper: L. A. Gatys, A. S. Ecker, and M. Bethge. Image Style Transfer Using Convolutional Neural Networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2016. link
Please download VGG19 pre-trained model with ImageNet.
$ wget https://huggingface.co/koba-jon/pre-train_cpp/resolve/main/models/vgg19_bn.pth
Please build the source file according to the procedure.
$ mkdir build
$ cd build
$ cmake ..
$ make -j4
$ cd ..
The following hierarchical relationships are recommended.
datasets
|--Dataset1
| |--content.png
| |--style.png
|
|--Dataset2
|--Dataset3
- Content: "Tokyo Night View" — Hiroki Kobayashi
- Style: "The Starry Night" — Vincent van Gogh
Source: https://commons.wikimedia.org/wiki/File:Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg
License: Public Domain
Changes: resized for NST input.
Please set the shell for executable file.
$ vi scripts/TheStarryNight.sh
The following is an example of the generation phase.
If you want to view specific examples of command line arguments, please view "src/main.cpp" or add "--help" to the argument.
#!/bin/bash
DATA='TheStarryNight'
./NST \
--generate true \
--iterations 1000 \
--dataset ${DATA} \
--content "content.png" \
--style "style.png" \
--gpu_id 0
Please execute the following to start the program.
$ sh scripts/TheStarryNight.sh
- Content: "Tokyo Night View" — Hiroki Kobayashi
- Style: "The Scream" — Edvard Munch
Source: https://commons.wikimedia.org/wiki/File:The_Scream.jpg
License: Public Domain
Changes: resized for NST input.
Please set the shell for executable file.
$ vi scripts/TheScream.sh
The following is an example of the generation phase.
If you want to view specific examples of command line arguments, please view "src/main.cpp" or add "--help" to the argument.
#!/bin/bash
DATA='TheScream'
./NST \
--generate true \
--iterations 1000 \
--dataset ${DATA} \
--content "content.png" \
--style "style.png" \
--gpu_id 0
Please execute the following to start the program.
$ sh scripts/TheScream.sh