Skip to content

StyleTx is a python project that applies effects of one image to another image using machine learning.

License

Notifications You must be signed in to change notification settings

dinesh-GDK/StyleTx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StyleTx

StyleTx is a python project that applies effects of an image to another image using machine learning.

Requirements

Requires Python >=3.8

Required packages are specified in requirements.txt file, which you can install using

pip3 install -r requirements.txt

torch and torchvision versions in requirements.txt are CPU only, if you want to use the GPU versions that suit your hardware requirements visit this link.

pip Package

Installation

You can install the StyleTx package using the command given below

pip3 install styletx

Implementation

# import necessary packages
from styletx import StyleTransfer
from PIL import Image
import matplotlib.pyplot as plt

# import the images
content_image = Image.open('path/filename')
style_image = Image.open('path/filename')

# implement StyleTransfer
output_image = StyleTransfer(content_image, style_image, alpha=1, beta=10, epochs=5)

# display the results
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(20, 10))
ax1.imshow(content_image)
ax2.imshow(output_image)
plt.show()

The above code will apply the effects of the style_image to content_image.

Inputs

content_image - a PIL object
style_image - a PIL object
alpha - a positive integer
beta - a positive integer
epochs - a positive integer

By default alpha = 1, beta = 10 and epochs = 10.
High alpha value implies that the content image will have more influence on the output image.
High beta value implies that the style image will have more influence on the output image.
You can play with these values to get desired output image.

GUI

To use GUI version of StyleTx, just clone the repository using

git clone https://github.com/dinesh-GDK/StyleTx.git

Get into the directory and run

python3 main.py

The GUI is intuitive to follow and you can generate your image.

Example

License

License: MIT

Resources

About

StyleTx is a python project that applies effects of one image to another image using machine learning.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages