sd-webui-controlnet
sd-webui-controlnet copied to clipboard
add option not to run img2img when using initial image of img2img tab
In the img2img tab, added an option not to process img2img when obtaining the input image of ControlNet from the initial image of img2img. This enables ControlNet batch processing.
#61 #74
Might just be me, but I'm getting an error testing this: Traceback (most recent call last): File "C:\stable-diffusion-webui\modules\call_queue.py", line 56, in f res = list(func(*args, **kwargs)) File "C:\stable-diffusion-webui\modules\call_queue.py", line 37, in f res = func(*args, **kwargs) File "C:\stable-diffusion-webui\modules\img2img.py", line 163, in img2img process_batch(p, img2img_batch_input_dir, img2img_batch_output_dir, img2img_batch_inpaint_mask_dir, args) File "C:\stable-diffusion-webui\modules\img2img.py", line 76, in process_batch processed_image.save(os.path.join(output_dir, filename)) AttributeError: 'numpy.ndarray' object has no attribute 'save'
I'm not seeing the option. Pulled to latest.
@greyphilosophy You have to enable "control_net_no_detectmap" in the settings tab.
@FizzleDorf It is displayed only in the img2img tab. Also, since this is a pull request, the latest version of this repository does not reflect this change.
@greyphilosophy You have to enable "control_net_no_detectmap" in the settings tab.
Thanks, that was the problem. Is it possible for the script to set it for me and then revert it when it is finished? Or validate that I have the setting correct? Or give me an error message when it fails informing me of the missing setting? Or worst case, a tooltip on the checkbox that tells me it needs that setting enabled? Because right now it's both critical and hard to discover, which isn't a good combination.
@greyphilosophy Yes, I wish I could, but unfortunately I couldn't figure out how to tell if it's batch processing or not. I'll think of another way.
@ddPn08 I just retested on a different computer using the main branch and the problem exists there too, so it's not your issue. I've conducted manual testing, and this PR, in my opinion, is working as designed and improves the quality of the extension.
Unfortunately I don't know python so I can't do a code review as well
@ddPn08 Yes, I wish I could, but unfortunately I couldn't figure out how to tell if it's batch processing or not. I'll think of another way.
Just letting you know that HEAD
of main should contain code that allows to detect whether img2img batch tab was last selected. You can use this variable to test whether the batch tab was last active in img2img.
Edit: ah nevermind, does not look related to this PR.
@ljleb understood. It certainly seems unnecessary in this PR. But I didn't know this method. I learned a lot.
Looks good but maybe we should consider put this checkbox to batch tab only - for specific use (batch txt2img process).
@Mikubill understood. But I can't think of a way to update the UI on tab change. . . (due to my lack of skill;) Instead, how about adding items such as "Do not execute img2img during Batch process" on the "Settings" tab?
At the risk of saying something irrelevant again: you could update the checkbox so that it disappears in other tabs than img2img batch by setting the visible
attribute to True or False, depending on whether the tab is active or not. See the Img2ImgTabTracker
class for img2img tab creation/selection hooks.
Another approach could be to just add the checkbox directly inside the img2img batch tab.
Just a couple ideas, wonder if there's a better way to do this.
Doesn't the checkbox work in other img2img modes too though? I'm not sure it needs to be restricted to just batch mode