This repo provides PyTorch Implementation of MSG-Net and Neural Style.
- Download the pre-trained model
git clone git@github.com:xmg2024/Picture-Transfer.git cd Picture-Transfer python -m venv .venv source .venv/bin/activate pip install -r requirements.txt cd experiments
- Camera Demo
python camera_demo.py demo --model models/21styles.model

- Test the model
python main.py eval --content-image images/content/venice-boat.jpg --style-image images/21styles/candy.jpg --model models/21styles.model --content-size 1024python main.py eval --content-image images/content/summer.jpg --style-image images/21styles/starry_night.jpg --model models/21styles.model --output-image my_images/summer_output.jpg
-
If you don't have a GPU, simply set
--cuda=0. For a different style, set--style-image path/to/style. If you would to stylize your own photo, change the--content-image path/to/your/photo. More options:--content-image: path to content image you want to stylize.--style-image: path to style image (typically covered during the training).--model: path to the pre-trained model to be used for stylizing the image.--output-image: path for saving the output image.--content-size: the content image size to test on.--cuda: set it to 1 for running on GPU, 0 for CPU.
- Download the COCO dataset
bash dataset/download_dataset.sh
- Train the model
python main.py train --epochs 4 python main.py train --epochs 4 --style-folder ./images/21styles/ --cuda 0
- If you would like to customize styles, set
--style-folder path/to/your/styles. More options:--style-folder: path to the folder style images.--vgg-model-dir: path to folder where the vgg model will be downloaded.--save-model-dir: path to folder where trained model will be saved.--cuda: set it to 1 for running on GPU, 0 for CPU.
Image Style Transfer Using Convolutional Neural Networks by Leon A. Gatys, Alexander S. Ecker, and Matthias Bethge.
python main.py optim --content-image images/content/venice-boat.jpg --style-image images/21styles/candy.jpg --output-image my_images/venice_boat_output.jpg--content-image: path to content image.--style-image: path to style image.--output-image: path for saving the output image.--content-size: the content image size to test on.--style-size: the style image size to test on.--cuda: set it to 1 for running on GPU, 0 for CPU.

















