Skip to main content

Initial release with StyleTransfer

Project description

StyleTx

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

Installation

You can install the StyleTx package using the command given below

pip3 install styletx

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.

Implementation

# import necessary packages
from styletx import StyleTransfer
from PIL import Image
import matlibplot.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=500)

# 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 = 500. You can play around these values to get desired output image.

Example

License

License: MIT

Resources

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

styletx-1.0.5.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

styletx-1.0.5-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file styletx-1.0.5.tar.gz.

File metadata

  • Download URL: styletx-1.0.5.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

File hashes

Hashes for styletx-1.0.5.tar.gz
Algorithm Hash digest
SHA256 0c09305ade651b75b98f6486dbcc9648a0ae3b5cefe3ad019933bda3022e210b
MD5 9d7c462273346e611a7f53744d7d694f
BLAKE2b-256 4332a67393e695f9cebcb3cb39f933d9edcb577ba74fd5ae8438ae10cd601c1b

See more details on using hashes here.

File details

Details for the file styletx-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: styletx-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

File hashes

Hashes for styletx-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 84c5516a8cc8fbb1ed74cf1e2b4635fa0876fa7623935b46eaa7024d0fbaaa3f
MD5 f08b5d05e81080d3ccf7417c160116c3
BLAKE2b-256 b686de8a8278102fa83fc3c1ddb42ddfe814184d6f6941d984ca843225be58b5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page