Skip to content

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

Notifications You must be signed in to change notification settings

VikramShenoy97/Naive-Background-Style-Transfer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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