Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

NST

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

Usage

0. Download pre-trained model

Please download VGG19 pre-trained model with ImageNet.

$ wget https://huggingface.co/koba-jon/pre-train_cpp/resolve/main/models/vgg19_bn.pth

1. Build

Please build the source file according to the procedure.

$ mkdir build
$ cd build
$ cmake ..
$ make -j4
$ cd ..

2. Dataset Setting

Setting

The following hierarchical relationships are recommended.

datasets
|--Dataset1
|    |--content.png
|    |--style.png
|
|--Dataset2
|--Dataset3

3. Image Generation

Example 1

Setting

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
Run

Please execute the following to start the program.

$ sh scripts/TheStarryNight.sh

Example 2

Setting

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
Run

Please execute the following to start the program.

$ sh scripts/TheScream.sh