GithubHelp home page GithubHelp logo

egesabanci / neural-style-transfer Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 695 KB

:paintbrush: This repository contains, well-structured Python library and runnable fully prepared Python notebook of the "Neural Style Transfer" algorithm

License: MIT License

Jupyter Notebook 74.03% Python 25.97%
deep-learning neural-network neural-style-transfer neural-style computer-vision image-processing image-manipulation image-analysis

neural-style-transfer's Introduction

Neural Style Transfer

Neural Style Transfer (NST) refers to a class of software algorithms that manipulate digital images, or videos, in order to adopt the appearance or visual style of another image. NST algorithms are characterized by their use of deep neural networks for the sake of image transformation. Common uses for NST are the creation of artificial artwork from photographs, for example by transferring the appearance of famous paintings to user-supplied photographs. Several notable mobile apps use NST techniques for this purpose, including DeepArt and Prisma. This method has been used by artists and designers around the globe to develop new artwork based on existent style(s). Wikipedia Article About Neural Style Transfer (NST)

Sample Neural Style Transfer Output

How to try / use this repository?

If you want to try the actual code in one shot, you can directly go to the notebook/neural-style-transfer.ipynb notebook. After you reach there, if you want to try the models with your own images, just drag-and-drop your images to the images folder and replace your image path's in the following section (beginning of the notebook - 1st cell):

# rewrite the paths for your own images and base folder
BASE = "./drive/MyDrive/neural-style-transfer"
CONTENT_IMAGE_PATH = os.path.join(BASE, "images", "content.jpeg")
STYLE_IMAGE_PATH = os.path.join(BASE, "images", "style.png")

After replace the image paths, you are ready to go. Just do a one simple click to the Run all cells option.

How to use these codes in my own case?

There is a folder which is called src in this repository. Once you get there, you will encounter a well-separated and modular folder structure. Scripts' file extension is .py, which means you can import them directly to your own case.

Example usage

from skimage import io
import tensorflow as tf

# train() function from src/train.py
from train import train

# feature extraction model from src/feature_extractor.py
from feature_extractor import FeatureExtractor

# read your custom images 
CONTENT = io.imread("path/to/content/image")
STYLE = io.imread("path/to/style/image")
COMBINED = tf.Variable(CONTENT) # tf.Tensor

# define feature extractor model
model = FeatureExtractor.vgg_extractor_model
# there are three options for models (check the src/feature_extractor.py)

# main training
STYLED_IMAGE = train(model = model,
                    content = CONTENT,
                    style = STYLE,
                    generated = COMBINED,
                    epochs = 50)

neural-style-transfer's People

Contributors

egesabanci avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.