https://github.com/emla2805/fast-style-transfer
Fast Style Transfer using Tensorflow 2
https://github.com/emla2805/fast-style-transfer
fast-neural-style style-transfer tensorflow
Last synced: 9 months ago
JSON representation
Fast Style Transfer using Tensorflow 2
- Host: GitHub
- URL: https://github.com/emla2805/fast-style-transfer
- Owner: emla2805
- Created: 2019-06-30T12:12:02.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-25T00:18:29.000Z (over 3 years ago)
- Last Synced: 2023-08-21T15:11:55.664Z (almost 3 years ago)
- Topics: fast-neural-style, style-transfer, tensorflow
- Language: Python
- Homepage:
- Size: 151 MB
- Stars: 9
- Watchers: 2
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Fast Style Transfer
Tensorflow 2 implementation of Fast Style Transfer which merges the style of one picture with the content of another.
The algorithm is based on [Perceptual Losses for Real-Time Style Transfer and Super-Resolution](https://arxiv.org/abs/1603.08155)
with the addition of [Instance Normalization](https://arxiv.org/pdf/1607.08022.pdf).
## Requirements
Create a Python 3.7 virtual environment and activate it:
```bash
virtualenv -p python3.7 venv
source ./venv/bin/activate
```
Next, install the required dependencies:
```bash
pip install -r requirements.txt
```
## Usage
To style an image using a pre-trained model specify the input and output image paths and the log directory containing model checkpoints.
### Style image
```bash
python style.py \
--image-path images/content/amber.jpg \
--log-dir models/mosaic/lr=0.001_bs=16_sw=10.0_cw=10.0/ \
--output-path images/output/output-image.png
```
### Train model
```bash
python train.py \
--log-dir models/mosaic/ \
--style-image images/style/mosaic.jpg \
--test-image images/content/amber.jpg
```
Training, which uses the COCO 2014 train dataset, takes about 1-2 hours on a Tesla P100 GPU.
To track metrics, start `Tensorboard`
```bash
tensorboard --logdir models/
```
and navigate to [localhost:6006](localhost:6006).
## Example models