diff --git a/README.md b/README.md index 447d838..8fbcf6c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # OpenVINO™ AI Plugins for GIMP -This branch is currently under development.
Dedicated for GIMP 3, Python 3 and OpenVino.
:star: :star: :star: :star: are welcome.
+
Dedicated for GIMP 3, Python 3 and OpenVINO™.
:star: :star: :star: :star: are welcome.
## Current list of plugins: [1] Super-Resolution
@@ -12,7 +12,7 @@ This branch is currently under development.
Dedicated for GIMP 3, Python 3 a [5] Stable-Diffusion (Suppports - SD 1.4, SD 1.5 (landscape, portrait, and Latent Consistency Model), SD 1.5 Inpainting, SD 1.5 Controlnet-OpenPose, SD 1.5 Controlnet-CannyEdge, SD 1.5 Controlnet-Scribble)
# Objectives -[1] Provides a set of OpenVino based plugins that add AI features to GIMP.
+[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.
@@ -25,30 +25,50 @@ Please raise a PR for any new features, modifactions or bug fixes. ## Installation Steps +### Install OpenVINO™ +- Download and install [OpenVINO™](https://github.com/openvinotoolkit/openvino/releases) for your operating system. +- Note that these plugins have been tested with 2023.1.0 and 2023.2.0 +- For Intel® Core™ Ultra support, you need to download and install OpenVINO™ from the archive. Do not use pypi for installation. + + ### 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
+- Download a Python installer from python.org. Choose Python 3.9 or 3.10 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](https://git-scm.com/) #### 3. Install the GIMP Plugin -1. Install [GIMP 2.99.10 (revision 2)](https://download.gimp.org/gimp/v2.99/windows/gimp-2.99.10-setup-2.exe) or Install [GIMP 2.99.14](https://download.gimp.org/gimp/v2.99/windows/gimp-2.99.14-setup.exe)
-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```
+1. Install [GIMP 2.99.14](https://download.gimp.org/gimp/v2.99/windows/gimp-2.99.14-setup.exe)
+2. Clone this repository:
+ ``` + git clone https://github.com/intel/openvino-ai-plugins-gimp.git + ``` +3. Setup OpenVINO™ Environment + Note that you will need to do these steps everytime you start GIMP + ``` + C:\Path\to\where\you\installed\OpenVINO\setupvars.bat + ``` +4. 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 will be prompted to setup the AI models used with OpenVINO™. Choose the models that you would like to setup, keeping in mind that choosing to download all of them may take time and considerable disk space. *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 : \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
+ Example: ```C:\User\\GIMP\gimpenv3\lib\site-packages\gimpopenvino\plugins``` + +5. Restart GIMP, and you should see 'OpenVINO-AI-Plugins' show up in 'Layer' menu
+ ``` + call "C:\Path\to\where\you\installed\OpenVINO\setupvars.bat" + cd "C:\Program Files\GIMP 2.99\bin" + .\gimp-2.99.exe + ``` + Note that you need to run setupvars.bat everytime you start GIMP. Creating a .bat file to do these steps may be helpful. ### Linux This plugin is tested on Ubuntu 22.04. @@ -89,21 +109,31 @@ ninja -C _build sudo ninja -C _build install ``` #### 5. Install Plugins -1. Clone, run install script, and download models. The following steps will create the virtual environment "gimpenv3", install all required packages and will also walk you through models setup. - +1. Clone this repo ``` git clone https://github.com/intel/openvino-ai-plugins-gimp.git + ``` +2. Setup the environment Note that you will need to do these steps everytime you start GIMP + ``` + source /opt/intel/openvino/setupvars.sh + export GI_TYPELIB_PATH=/usr/lib/x86_64-linux-gnu/girepository-1.0:/usr/local/lib/x86_64-linux-gnu/girepository-1.0 + ``` +3. Run install script, and download models. The following steps will create the virtual environment "gimpenv3", install all required packages and will also walk you through models setup. + ``` chmod +x openvino-ai-plugins-gimp/install.sh + source /opt/intel/openvino/setupvars.sh ./openvino-ai-plugins-gimp/install.sh ``` + You will be prompted to setup the AI models used with OpenVINO™. Choose the models that you would like to setup, keeping in mind that choosing to download all of them may take time and considerable disk space.
*You can re-run "run install script" step later again to install & setup models that you may have missed.*
-2. Setup the environment Note that you will need to do these steps everytime you start GIMP + +5. Start the GIMP application (```gimp-2.99```), and add the gimpenv3 path that was printed when running the above step to the list of plugin folders [Edit-> Preferences-> Folders-> Plugins].
+6. Restart GIMP, and you should see 'OpenVINO-AI-Plugins' show up in 'Layer' menu
``` source /opt/intel/openvino/setupvars.sh export GI_TYPELIB_PATH=/usr/lib/x86_64-linux-gnu/girepository-1.0:/usr/local/lib/x86_64-linux-gnu/girepository-1.0 + gimp-2.99 ``` -4. Start the GIMP application (```gimp-2.99```), and add the gimpenv3 path that was printed when running the above step to the list of plugin folders [Edit-> Preferences-> Folders-> Plugins].
-5. Restart GIMP, and you should see 'OpenVINO-AI-Plugins' show up in 'Layer' menu
# OpenVINO™ Image Generator Plugin with Stable Diffusion #### A. Prompt to Image diff --git a/gimpopenvino/tools/complete_install.py b/gimpopenvino/tools/complete_install.py index 594627e..79448f0 100644 --- a/gimpopenvino/tools/complete_install.py +++ b/gimpopenvino/tools/complete_install.py @@ -29,22 +29,7 @@ def setup_python_weights(install_location=None): os.mkdir(weight_path) step = 1 - print("\n##########") - print( - "{}>> Reference Models present in weights folder. You can also download them from open model zoo.".format( - step - ) - ) - step += 1 - print( - "{}>> Please move the weights folder from the cloned repository: \n" - "openvino-ai-plugins-gimp".format( - step - ) - ) - print("and place in: " + weight_path) - step += 1 - + print("\n##########\n") plugin_loc = os.path.dirname(gimpopenvino.__file__) ie = Core() supported_devices = ie.available_devices @@ -66,10 +51,10 @@ def setup_python_weights(install_location=None): print( - "{}>> Please add this path to Preferences --> Plug-ins in GIMP : ".format(step), + "NOTE ! >> Please add this path to Preferences --> Plug-ins in GIMP : ", os.path.join(plugin_loc, "plugins"), ) - print("##########\n") + print("\n##########\n") if __name__ == "__main__": diff --git a/gimpopenvino/tools/openvino_common/models_ov/stable_diffusion_engine.py b/gimpopenvino/tools/openvino_common/models_ov/stable_diffusion_engine.py index c562d7e..a0c34d4 100644 --- a/gimpopenvino/tools/openvino_common/models_ov/stable_diffusion_engine.py +++ b/gimpopenvino/tools/openvino_common/models_ov/stable_diffusion_engine.py @@ -140,7 +140,7 @@ def __init__( else: if "NPU" in device[2]: with open(os.path.join(model, blob_name), "rb") as f: - self.unet_neg = self.core.import_model(f.read(), device[1]) + self.unet_neg = self.core.import_model(f.read(), device[2]) else: self.unet_neg = self.core.compile_model(os.path.join(model, unet_int8_model), device[2]) else: diff --git a/model_setup.py b/model_setup.py index 8c0c600..42eadd1 100644 --- a/model_setup.py +++ b/model_setup.py @@ -179,7 +179,7 @@ def dl_all(): print("5 - SD-1.5 Controlnet-Openpose") print("6 - SD-1.5 Controlnet-CannyEdge") print("7 - SD-1.5 Controlnet-Scribble") - print("8 - LCM ") + print("8 - SD-1.5 LCM ") print("12 - All the above models") print("0 - Exit SD-1.5 Model setup")