Git Product home page Git Product logo

openvino-ai-plugins-gimp's Introduction

OpenVINO™ AI Plugins for GIMP

This branch is currently under development.
Dedicated for GIMP 3, Python 3 and OpenVino.
⭐ ⭐ ⭐ ⭐ are welcome.

Current list of plugins:

[1] Super-Resolution
[2] Style-Transfer
[3] Inpainting
[4] Semantic-Segmentation
[5] Stable-Diffusion (Suppports - SD 1.4, SD 1.5 (landscape & portrait), SD 1.5 Inpainting, SD 1.5 Controlnet-Openpose)

Objectives

[1] Provides a set of OpenVino based plugins that add AI features to GIMP.
[2] Serve as a refrence code for how to make use of OpenVino in GIMP application for inferencing on Intel's' CPU & GPU
[3] Add AI to routine image editing workflows.

Contribution

Welcome people interested in contribution !! Please raise a PR for any new features, modifactions or bug fixes.

Use with GIMP

gimp-screenshot

Installation Steps

Windows

Skip steps 1 and 2 if you already have Python3 and Git on Windows

1. Install Python

  • Download a Python installer from python.org. Choose Python 3.7, 3.8, 3.9 and make sure to pick a 64 bit version. For example, this 3.9.13 installer: https://www.python.org/ftp/python/3.9.13/python-3.9.13-amd64.exe
  • Double click on the installer to run it, and follow the steps in the installer. Check the box to add Python to your PATH, and to install py. At the end of the installer, there is an option to disable the PATH length limit. It is recommended to click this.

2. Install Git

  • Download and install GIT

3. Install the GIMP Plugin

  1. Install GIMP 2.99.10 (revision 2) or Install GIMP 2.99.14

  2. Clone and run install script:

    • clone this repo:
      git clone https://github.com/intel/openvino-ai-plugins-gimp.git

    • run install script - this will create the virtual environment "gimpenv3", install all required packages and will also walk you through models setup.
      openvino-ai-plugins-gimp\install.bat
      You can re-run "run install script" step later again to install & setup models that you may have missed.

  3. Start the GIMP application, and add the gimpenv3 path that was printed when running the above step to the list of plugin folders [Edit-> Preferences-> Folders-> Plugins].
    Example: Plug-ins in GIMP : <path\to>\gimpenv3\lib\site-packages\gimpopenvino\plugins Add this path to [Edit-> Preferences-> Folders-> Plugins] in GIMP

  4. Restart GIMP, and you should see 'OpenVINO-AI-Plugins' show up in 'Layer' menu

Linux (Tested on Ubuntu 20.04)

  1. Install flatpak distribution of GIMP development package -- instructions here: GIMP Development Downloads

  2. Clone, run install script, copy weights:

    # clone this repo:
    git clone https://github.com/intel/openvino-ai-plugins-gimp.git
    
    # run install script - this will create the virtual environment "gimpenv3", install all required packages and will also walk you through models setup. 
    openvino-ai-plugins-gimp/install.sh
    

    You can re-run "run install script" step later again to install & setup models that you may have missed.

  3. Start the GIMP application (flatpak run org.gimp.GIMP), and add the gimpenv3 path that was printed when running the above step to the list of plugin folders [Edit-> Preferences-> Folders-> Plugins].

  4. Restart GIMP, and you should see 'OpenVINO-AI-Plugins' show up in 'Layer' menu

OpenVINO™ Image Generator Plugin with Stable Diffusion - This GIF doesn't represent the current GUI

A. Prompt to Image

  1. Create or choose a layer
  2. Select Stable Diffusion from the drop down list in layers -> OpenVINO-AI-Plugins
  3. Choose the desired model and device from the drop down list.
  4. Click on "Load Models" to compile & load the model on the selected device. Wait for it to complete. Please note that you need to perform this step only if you change the model or device or both. For any subsequent runs just click "Run Inference"
  5. Enter prompt and other parameters
  6. Click on “Run Inference”. Wait for the total inference steps to get completed.

B. Image to Image

  1. Create or choose a layer or open an image
  2. Follow steps 2,3,4,5 from section A.
  3. Select "Use Initial Image"
  4. By default the opened image in canvas will be used as initial image to the model. You can also select a different image by browsing from files.
  5. Click on “Run Inference”. Wait for the total inference steps to get completed.

C. Stable-Diffusion-1.5 Inpainting - Make sure to download and convert the model during install process.

  1. Choose a layer or Open an image of size 512x512. (Currently works best with this resolution)
  2. Use "Free select tool" to select the area in your image that you wish to change.
  3. Right click on your image and click on "Add layer mask". Then choose "Selection" in "Initalize layer Mask to". This should create a mask with your selection.
  4. Follow steps 2,3,4,5 from section A. Please note that you will only see "SD_1.5_Inpainting" in model options if you added a mask layer to your image.
  5. Click on “Run Inference”. Wait for the total inference steps to get completed.

D. Stable-Diffusion-1.5 Controlnet-Openpose - Make sure to download and convert the model during install process.

  1. Open an image with some pose that you want to see in new image.
  2. Select Stable Diffusion from the drop down list in layers -> OpenVINO-AI-Plugins
  3. Choose the controlnet_openpose model and device from the drop down list.
  4. Make sure to select -- "Use Initial Image" option from the GUI. If not selected then it will fail.
  5. Follow steps 4,5 from section A.
  6. Click on “Run Inference”. Wait for the total inference steps to get completed.

If create gif option is selected, please note that performance will reduce. The generated gif is located in below path. You can play it in GIMP by going to Filters -> Animations -> Playback
C:\Users\<user_name>\openvino-ai-plugins-gimp\gif\stable_diffusion.gif

OpenVINO™ Semantic Segmentation Plugin

OpenVINO™ Super Resolution Plugin

OpenVINO™ Style Transfer Plugin

OpenVINO™ Inpainting Plugin

  1. Open an image in GIMP.
  2. Make sure there is alpha channel added to the image by right clicking on the image from layer section and selecting “Add alpha channel”
  3. Add a new transparent layer of the same size as original image.
  4. Select paint brush with white foreground color and black background color. Choose the thickness of the brush
  5. Now paint the object that you want to remove from the image.
  6. Select the new layer and image at the same. You should see “two items selected in layer section”

Acknowledgements

License

Apache 2.0

Disclaimer

Stable Diffusion’s data model is governed by the Creative ML Open Rail M license, which is not an open source license. https://github.com/CompVis/stable-diffusion. Users are responsible for their own assessment whether their proposed use of the project code and model would be governed by and permissible under this license.

openvino-ai-plugins-gimp's People

Contributors

arisha07 avatar ryanmetcalfeint8 avatar gblong1 avatar rdower 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.