Draft: Add Fast Sketch Cleanup plugin
Note: it requires Pillow and openvino modules available in the system or the dependencies to work.
Still to do:
-
Make sure the training runs in a different thread/process (can block the user, just be responsive during that) -
That should fix the issue of it not running the first time (trying to make it made the code a mess)
-
-
Cut the image in parts, run them all through the model and merge it to return to the user, so the static models will work on all images -
Find out the model size in the plugin and act accordingly -
Add GPU as option -
Only show the devices that are actually available for the user - I mean grey out the unavailable ones -
Add invert as option? -
Add a yaml file with stuff like whether it needs inverting, and minimum divisions and context -
Eventually, include the model in the plugin itself -
Ask users: should it work differently (right now it takes the canvas as input, and adds another layer on top as output) -
Clean code -
T.b.d.
Test Plan
Prerequisites:
- Build Krita, or download the plugin.
- Have both required packages:
Pillow
andopenvino
(in imports as:PIL
andopenvino
):- either available in your system:
pip3 install openvino Pillow
- or build a version of Krita that contains them, using dependencies from this MR: dkazakov/krita-deps-management!40 (merged)
- either available in your system:
- Download a model, for example from here (TSC model): https://drive.google.com/file/d/1hensU0_zjwTZTnKo9M0qb_Jfbukl68eH/view?usp=drive_link or here (exp 06 model): https://drive.google.com/file/d/1IrxErCbrvHJMPIaPoSw2NHbq40RnHZSR/view?usp=drive_link
- Use an input image, for example this one: fish_scaled
Test:
- Go to Tools -> Scripts -> Fast Sketch Cleanup.
- Select CPU (most likely) as backend
- Click on the Run button (currently you might need to do it twice)
- Wait
- Look at the effect.
Formalities Checklist
-
I confirmed this builds. -
I confirmed Krita ran and the relevant functions work. -
I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!) -
I made sure my commits build individually and have good descriptions as per KDE guidelines. -
I made sure my code conforms to the standards set in the HACKING file. -
I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy. -
Does the patch add a user-visible feature? If yes, is there a documentation MR ready for it at Krita Documentation Repository?
Reminder: the reviewer is responsible for merging the patch, this is to ensure at the least two people can build the patch. In case a patch breaks the build, both the author and the reviewer should be contacted to fix the build. If this is not possible, the commits shall be reverted, and a notification with the reasoning and any relevant logs shall be sent to the mailing list, kimageshop@kde.org.
Edited by Agata Cacko