https://github.com/smoke-trees/fast-style-transfer
Making people look like anime characters
https://github.com/smoke-trees/fast-style-transfer
edge-detection fast-style-transfer sobel-filter tape-gradient tensorflow2 tf-hub variational-loss vgg19
Last synced: 12 days ago
JSON representation
Making people look like anime characters
- Host: GitHub
- URL: https://github.com/smoke-trees/fast-style-transfer
- Owner: smoke-trees
- Created: 2019-06-19T14:17:59.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-18T07:05:22.000Z (over 5 years ago)
- Last Synced: 2025-04-08T01:03:57.279Z (6 months ago)
- Topics: edge-detection, fast-style-transfer, sobel-filter, tape-gradient, tensorflow2, tf-hub, variational-loss, vgg19
- Language: Jupyter Notebook
- Size: 8.44 MB
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
```python
import utilsimport tensorflow as tf
import tensorflow_hub as hub
import matplotlib.pyplot as plt
``````python
from tensorflow.compat.v1 import ConfigProto
from tensorflow.compat.v1 import InteractiveSessionconfig = ConfigProto()
config.gpu_options.allow_growth = True
session = InteractiveSession(config = config)
``````python
content_path = tf.keras.utils.get_file('YellowLabradorLooking_new.jpg', 'https://storage.googleapis.com/download.tensorflow.org/example_images/YellowLabradorLooking_new.jpg')style_path = tf.keras.utils.get_file('kandinsky5.jpg','https://storage.googleapis.com/download.tensorflow.org/example_images/Vassily_Kandinsky%2C_1913_-_Composition_7.jpg')
``````python
content_image = utils.load_img(content_path)
style_image = utils.load_img(style_path)plt.subplot(1, 2, 1)
utils.imshow(content_image, 'Content Image')plt.subplot(1, 2, 2)
utils.imshow(style_image, 'Style Image')
```
## Fast Style Transfer using TF-Hub
Module built on the original paper
```python
hub_module = hub.load('https://tfhub.dev/google/magenta/arbitrary-image-stylization-v1-256/1')
stylized_image = hub_module(tf.constant(content_image), tf.constant(style_image))[0]
utils.tensor_to_image(stylized_image)
```
```python
```