2.8 KiB
We are currently refactoring the code, so expect small changes to be made to this.
GIMP3-ML directory structure
|-- gimpenv3 (Environment created with site-packages containing GIMP-ML folder when install.bat is run)
|-- GIMP-ML (Used for development.)
| |-- gimpml
| |-- __init__.py
| |-- plugins
| |-- .........
| |-- monodepth
| |-- monodepth.py
| |-- enlighten
| |-- enlighten.py
| |-- .........
| |-- tools
| |-- .........
| |-- MiDaS
| |-- monodepth.py
| |-- EnlightenGAN
| |-- enlighten.py
| |-- gimp_ml_config.pkl
| |-- .........
| |-- README.md
| |-- CONTRIBUTION.md
| |-- MANIFEST.in
| |-- setup.py
| |-- install.bat
Weights location and cache file
This folder is present in user home directory.
|-- GIMP-ML
| |-- weights
| |-- ........
| |-- colorize
| |-- caffemodel.pth
| |-- deepdehaze
| |-- dehazer.pth
| |-- ........
| |-- gimp_ml_run.pkl
Plugin workflow
1> GIMP points to gimpenv3\Lib\site-packages\gimpml\plugins folder.
2> Which we run a plugin, GIMP will call for example gimpenv3\Lib\site-packages\gimpml\plugins\monodepth\monodepth.py.
3> This file contains UI part and will save selected layers to home folder/ GIMP-ML, and start a subprocess which will run gimpenv3\Lib\site-packages\gimpml\tools\monodepth.py and save result in same folder.
4> When the subprocess is completed, the results are loaded back into GIMP.
Versions
GIMP-2.99.6, Python 3.8, Pytorch 1.8
Creating new plugins
1> Open Pycharm/Spyder and point to |-- GIMP-ML (Used for development.)
folder.
2> Put model code in a folder and corresponding inference function into a separate python file such as tools/MiDaS folder and tools/monodepth.py. (See these examples.)
3> Put these two in GIMP-ML/tools folder.
4> Create corresponding plugin file in GIMP-ML/plugins folder. Example: GIMP-ML/plugins/monodepth/monodepth.py.
5> Import corresponding inference function in gimpml/init.py so that the same function can be used in python package. Example:
import cv2
import gimpml
face = cv2.imread('sampleinput/face.png')
out = gimpml.depth(face[:, :, ::-1])
cv2.imwrite('output/tmp-depth.png', out[:, :, ::-1])
6> With current location as GIMP-ML (contains setup.py), run pip install .
. The newly added plugins should move into site-packages folder.
7> Restart GIMP to see the plugin in GIMP menu.
Issues
Join us on slack
and ask doubts in dev-setup-issues
channel.