xinsir6 / ControlNetPlus

ControlNet++: All-in-one ControlNet for image generations and editing!
Apache License 2.0
1.76k stars 43 forks source link

Blur function #59

Open K3nt3L opened 3 months ago

K3nt3L commented 3 months ago

I don't see how to use ControlNet (Blur) with ComfyUI. Would it be possible to have an example workflow? Thanks in advance.

bonlime commented 2 months ago

You can see how to apply blur to your image here:

https://github.com/xinsir6/ControlNetPlus/blob/main/promax/controlnet_union_test_tile_deblur.py

TheOnlyHolyMoly commented 2 months ago

my two cents... it is an incredible pain getting this to run in a windows machine. Here are my learnings -clone the repo -create subfolder in .\promax and name it controlnet-union-sdxl-1.0-promax (copy the config promax json here and rename it to config.json) -open cmd prompt as administrator -make and activate venv -install requirements (pip install -r requirements.txt.) if you should happen to have a windows machine like me this is where the fun starts... some packages will have difficulties to install (deepspeed is difficult but solvable with some effort, triton will not install on windows machines since they only want to support linux, the script works without triton so, so just delete that from the requirements.txt if you should run into errors. once you have installed all requirements more or less go to the script, and find the "path" sections, you will need to customize the script open in editor an find the following sections (with my settings as example input)

prompt = "woman eating cheese" negative_prompt = 'longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality' controlnet_img = cv2.imread(r"F:\promax\Input.jpg") controlnet_img.save("controlnet_deblur.webp") images[0].save(r"F:\promax\output.jpg")

save, run script from commandline. In spite of having performed all install-requirements it gave me some errors where some pip packages were implicitly expected but missing in my venv yet. if you follow the line remarks in the traceback it'll tell you quickly what packages you need to ammend (look at the top of the traceback where it breaks, usually it'll tell you that a function is missing and then you can look up in the script in the line that is referred to from which package that function comes then just pip install that package and try again) and then it'll run beautifully.

Oh quick catch, it will download the promax model into the promax folder but you will have to rename it accordingly (scratching out the promax part)

I still have not yet figured out how the controlonet works on its input. I had it run on blurry images and it did very little unblurring and I had it run on strongly pixelized faces and it create a plausible face (not the one of my reference test, but yet impressive)

It is absolutely worth the pain!! great cudos to @xinsir6 for making this!! amazing!

K3nt3L commented 2 months ago

It's very kind of you to respond. Unfortunately, what I want is to be able to use it with Comfy. Unfortunately, the parameter (SetUnionType) does not exist for the Blur function. Moreover, as you say, we don't really know how to handle the input image. If we look in the script, there is no number for the Blur function. It's the same in ComfyUI, but there is an auto function. I use CN without any problem, except for "Blur" whose usage remains mysterious. Do we use a blurred image to make it sharp ?

TheOnlyHolyMoly commented 2 months ago

I pushed in a blurry image and it returned a sharper version to me.