VikramShenoy97 / Naive-Background-Style-Transfer

An algorithm to transform the background of an Image to a user specified style.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Naive Background Style Transfer

Naive Background Style Transfer implemented using Keras and TensorFlow by Vikram Shenoy.

Overview

Naive background style transfer performs style transfer only on the background of the given content image. This naive approach uses two networks to reproduce this style transfer. The DeepLabv3+ model generates a segmentation map of the image which is processed to create a binary mask highlighting the foreground from the background. The style transfer model uses this segmented mask to guide the stylized pixels only onto the background of the given content image. For more details, check out the report.

Architecture

The above architecture shows how the algorithm works and creates the resulting output image.

The picture below is of me taken on my trip to Amsterdam.

Content

The picture displayed here is the result of Naive Background Style Transfer in the style of one of my favorite pieces of art, The Starry Night by Vincent Van Gogh.

Style_Transfer

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

For using Naive Background Style Transfer, you need to install Keras, TensorFlow, PIL, and Imageio.

pip install keras
pip install tensorflow
pip install Pillow
pip install imageio

Images

Content Image Style Image
Original Style

Run

Run the script main.py in the terminal as follows.

Python main.py

Results

The final output is stored in Output Images.

Intermediate Stages of Style Transfer

Here is the generated image through different intervals of the run.

Intermediate_Image

Transition through epochs

Transition

Result of Style Transfer

Final_Image

Ablation Study of Hyperparameters

This section takes a closer look at the hyperparameters of NBST, mainly the content weight and the style weight.

Default Parameters

• Content Weight = 1e3

• Style Weight = 1e-2

default

High Content Weight

• Content Weight = 1e10

• Style Weight = 1e-2

content_increase

High Style Weight

• Content Weight = 1e3

• Style Weight = 1e15

style_increase

Built With

Authors

Acknowledgments

About

An algorithm to transform the background of an Image to a user specified style.


Languages

Language:Python 100.0%