Giter Site home page Giter Site logo

dhruvsrikanth / neuralartisticrecreation-cli-tool Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 4.38 MB

A Command Line Tool (or CLI) to perform Neural Style Transfer along with image filtering to produce an artistic recreation of an input image!

Python 100.00%
style-transfer deep-learning neural-networks machine-learning neural-style-transfer tesnorflow tensorflow-2 application tool cli command-line-tool command-line-interface python

neuralartisticrecreation-cli-tool's Introduction

Project - "Neural Artistic Recreation"

  1. Project Idea - I would like to create an API to enable people to experience the art of their choosing on a more personal level.

  2. Project To Do's -

    1. Convert an input image to an stylized image by the artist and in the theme of their choosing. The style (artist style and color style) will be used in recreating the input image as a stylized output. This can be done through neural style transfer.

    2. Apply certain filters (like invert, black-and-white) to the stylized image to further customize the art to the users choosing.

  3. Project Execution Plan -

    1. By the end of week 1, I will have explored methods for neural style transfer and methods to apply certain filters on images.
    2. By the end of week 2, I will have created a pipeline that takes an input image and outputs an image with a filter (by choice) applied to it.
    3. By the end of week 3, I will have created a pipeline that performs neural style transfer (users will use the style image of their choice and the input image of their choice in the pipeline).
    4. By the end of week 4, I will have integrated both of the above pipelines.
    5. By the end of week 5, I will have created a module/package for the entire pipeline.
    6. Finally, I will include some "popular" style images that users can use if they do not have a style image in mind.
  4. Project Demo - Neural Artistic Recreation


User CLI Guide


This tool aims to create an API to enable people to experience the art of their choosing on a more personal level using filters from the Python Imaging Library and Neural Style Transfer.



Video Demo:

Neural Artistic Recreation - Video Demo

Sample:

There are samples for an input and corresponding output of the model with different styles present in the samples folder.

References


Given below are some of references that can be used for better understanding some of the underlying concepts and code used in this tool:

  1. Python Imaging Library: https://pillow.readthedocs.io/en/stable/
  2. Neural Style Transfer: https://www.cv-foundation.org/openaccess/content_cvpr_2016/html/Gatys_Image_Style_Transfer_CVPR_2016_paper.html
  3. Style Transfer with Tensorflow: https://www.tensorflow.org/tutorials/generative/style_transfer
  4. Transfer Learning: https://www.tensorflow.org/tutorials/images/transfer_learning


Requirements

All requirements can be found in the requirements.txt file. I would recommend running commenting out all tensorflow and keras related lines as the version required for these packages differs from system to system. For tensorflow and keras, please refer to tensorflow's guide on installing tensorflow, cuda and cudnn for the correct versions for your system. Furthermore, before installing all the requirements, I would recommend creating a virutal environment. I use venv for this. After pulling this repository into a particular directory of your choice, you may activate your virtual environment and run the following command to install all of the required packages -

pip install -r /path/to/requirements.txt

I recommend using a system with an powerful NVIDIA GPU if you want to train the model for a higher number of epochs if you would like to further refine the output.



Using the Tool

Run the below command to use the tool -

python main.py --inp_img_path=/path/to/input_image --style_choice=choice_of_style --filter_choice=choice_of_filter --save_path=/path/to/stylized_image"

Filter Choices:

  1. No Filter
  2. Blur
  3. Contour
  4. Detail
  5. Edge Enhance
  6. Strong Edge Enhance
  7. Emboss
  8. Find Edges
  9. Smooth
  10. Strong Smooth
  11. Sharpen

More on these filters can be found here.

Style Choices:

  1. No Style
  2. Piccaso
  3. Van Gogh
  4. Michelangelo
  5. Leonardo Da Vinci
  6. Edward Munch
  7. Sandro Botticelli

These styles can also be viewed in the styles directory.

Customization:

If you would like to add more styles, this can be done in the following way:

  1. Download the style image of your choice and move this to the styles directory.
  2. Open the styles.py file inside src.
  3. Add a path variable containing the path to the new style image to the file.
  4. Add this variable to the end of the STYLES list.

If you would like to refine your output, this can be done in the following way:

  1. Open the parameters.py file inside src.
  2. Change the EPOCHS and STEPS_PER_EPOCH variable values. The higher these values are, the more time the tool will take to run as the model will train for a longer period of time, however, this will result in a more refined output.

If you would like to test out different weights for the different losses or tune the hyperparameters further, this can be done in the following way:

  1. Open the parameters.py file inside src.
  2. Change the parameters and/or hyperparameters to the values you would like to test with the model.

neuralartisticrecreation-cli-tool's People

Contributors

dhruvsrikanth avatar

Stargazers

 avatar

Watchers

 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.