Git Product home page Git Product logo

depthmap2mask's People

Contributors

474172261 avatar extraltodeus avatar jwvanderbeck avatar lewington-pitsos avatar tingtingin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

depthmap2mask's Issues

Missing file when loading the script

I installed through web UI, and restarted the UI multiple times. But I'm still getting the following exception:

Error loading script: depthmap_for_depth2img.py
Traceback (most recent call last):
  File "D:\WebUI\stable-diffusion-webui\modules\scripts.py", line 195, in load_scripts
    module = script_loading.load_module(scriptfile.path)
  File "D:\WebUI\stable-diffusion-webui\modules\script_loading.py", line 13, in load_module
    exec(compiled, module.__dict__)
  File "D:\WebUI\stable-diffusion-webui\extensions\depthmap2mask\scripts\depthmap_for_depth2img.py", line 11, in <module>
    from repositories.midas.midas.dpt_depth import DPTDepthModel
  File "D:\WebUI\stable-diffusion-webui\repositories\midas\midas\dpt_depth.py", line 5, in <module>
    from .blocks import (
  File "D:\WebUI\stable-diffusion-webui\repositories\midas\midas\blocks.py", line 21, in <module>
    from .backbones.next_vit import (
  File "D:\WebUI\stable-diffusion-webui\repositories\midas\midas\backbones\next_vit.py", line 8, in <module>
    file = open("./externals/Next_ViT/classification/nextvit.py", "r")
FileNotFoundError: [Errno 2] No such file or directory: './externals/Next_ViT/classification/nextvit.py'

TypeError: 'int' object is not iterable

I installed extension depthmap2mask via Web UI. Set the settings as shown in the picture. When trying to generate an image, this problem occurred. I set the model(dpt_large) to autoload but it didn't go. How can I solve the problem?

CMD:
Error completing request
Arguments: ('task(f98cgtod4q5r2jz)', 0, '', '', [], <PIL.Image.Image image mode=RGBA size=2560x2560 at 0x295F5E6F040>, None, None, None, None, None, None, 20, 0, 4, 0, 1, False, False, 1, 1, 7, 0, -1.0, -1.0, 0, 0, 0, False, 512, 512, 0, 0, 32, 0, '', '', '', [], 9, '

    \n
  • CFG Scale should be 2 or lower.
  • \n
\n', True, True, '', '', True, 50, True, 1, 0, False, 4, 1, '

Recommended settings: Sampling Steps: 80-100, Sampler: Euler a, Denoising strength: 0.8

', 128, 8, ['left', 'right', 'up', 'down'], 1, 0.05, 128, 4, 0, ['left', 'right', 'up', 'down'], False, False, 'positive', 'comma', 0, False, False, '', '

Will upscale the image by the selected scale factor; use width and height sliders to set tile size

', 64, 0, 2, 1, '', 0, '', 0, '', True, False, False, False, 0, False, 0, True, 384, 384, True, 0, True, True, False, False, 10.0, True, 30.0, True, 0.0, 'Lanczos', 1) {}
Traceback (most recent call last):
File "D:\allforai\artmaking\stable-diffusion-webui\modules\call_queue.py", line 56, in f
res = list(func(*args, **kwargs))
File "D:\allforai\artmaking\stable-diffusion-webui\modules\call_queue.py", line 37, in f
res = func(*args, **kwargs)
File "D:\allforai\artmaking\stable-diffusion-webui\modules\img2img.py", line 80, in img2img
override_settings = create_override_settings_dict(override_settings_texts)
File "D:\allforai\artmaking\stable-diffusion-webui\modules\generation_parameters_copypaste.py", line 315, in create_override_settings_dict
for pair in text_pairs:
TypeError: 'int' object is not iterable

photo_2023-02-07_12-54-46

Doubt about cpkt model

For 2.0, which cpkt model would be more ideal to use? I thought I should be using 512-depth-ema.ckpt, but I get the error that the midas_models folder doesn't exist.

RuntimeError: Error(s) in loading state_dict for DPTDepthModel: Missing key(s) in state_dict:

when we're loading a default model, that we're getting a next error:
"RuntimeError: Error(s) in loading state_dict for DPTDepthModel: Missing key(s) in state_dict: "pretrained.model.layers.3.downsample.reduction.weight", "pretrained.model.layers.3.downsample.norm.weight", "pretrained.model.layers.3.downsample.norm.bias", "pretrained.model.head.fc.weight", "pretrained.model.head.fc.bias". Unexpected key(s) in state_dict: "pretrained.model.layers.0.downsample.reduction.weight", "pretrained.model.layers.0.downsample.norm.weight", "pretrained.model.layers.0.downsample.norm.bias", "pretrained.model.layers.0.blocks.1.attn_mask", "pretrained.model.layers.1.blocks.1.attn_mask", "pretrained.model.head.weight", "pretrained.model.head.bias". size mismatch for pretrained.model.layers.1.downsample.reduction.weight: copying a param with shape torch.Size([512, 1024]) from checkpoint, the shape in current model is torch.Size([256, 512]). size mismatch for pretrained.model.layers.1.downsample.norm.weight: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([256]). size mismatch for pretrained.model.layers.1.downsample.norm.bias: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([256]). size mismatch for pretrained.model.layers.2.downsample.reduction.weight: copying a param with shape torch.Size([1024, 2048]) from checkpoint, the shape in current model is torch.Size([512, 1024]). size mismatch for pretrained.model.layers.2.downsample.norm.weight: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for pretrained.model.layers.2.downsample.norm.bias: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512])."

Add "Show Depth Map" Option

There should be a way to view the generated depth map within the web interface instead of having to save and view them from the img2img folder.

(Feature request) Integration with manual inpainting in Auto1111

As far as I can tell, this extension currently ignores the manual masking in Auto1111. Taking the intersection of the two masks (multiply in PIL? Not sure what the easiest solution is) would allow users to apply the benefits of this extension to specific areas for touchup, and would allow users to take advantage of the higher local resolution when using "inpaint at full resolution" with a small masked area.

All models except midas give a KeyError

I'm using the latest Stable Diffusion and depthmap2mask. I've tried using all the models, and they download fine but only the midas ones work. All others give an error 'Loading midas model weights'. Every model that starts with 'dpt' gives a KeyError.

Traceback (most recent call last):
File "C:\stable-diffusion\stable-diffusion-webui-master\modules\call_queue.py", line 57, in f
res = list(func(*args, **kwargs))
File "C:\stable-diffusion\stable-diffusion-webui-master\modules\call_queue.py", line 37, in f
res = func(*args, **kwargs)
File "C:\stable-diffusion\stable-diffusion-webui-master\modules\img2img.py", line 179, in img2img
processed = modules.scripts.scripts_img2img.run(p, *args)
File "C:\stable-diffusion\stable-diffusion-webui-master\modules\scripts.py", line 407, in run
processed = script.run(p, *script_args)
File "C:\stable-diffusion\stable-diffusion-webui-master\extensions\depthmap2mask\scripts\depth2image_depthmask.py", line 97, in run
d_m = sdmg.calculate_depth_maps(p.init_images[0],img_x,img_y,model_type,invert_depth)
File "C:\stable-diffusion\stable-diffusion-webui-master\extensions/depthmap2mask/scripts/depthmap_for_depth2img.py", line 294, in calculate_depth_maps
model, transform = load_model(device, model_path, models[model_type_index], (img_x, img_y))
File "C:\stable-diffusion\stable-diffusion-webui-master\extensions/depthmap2mask/scripts/depthmap_for_depth2img.py", line 41, in load_model
model = DPTDepthModel(
File "C:\stable-diffusion\stable-diffusion-webui-master\repositories\midas\midas\dpt_depth.py", line 102, in init
super().init(head, **kwargs)
File "C:\stable-diffusion\stable-diffusion-webui-master\repositories\midas\midas\dpt_depth.py", line 55, in init
hooks=hooks[backbone],
KeyError: 'beitl16_512'

launch depends on flowdas-meta

OS: Arch Linux

pip install launch
The conflict is caused by:
    launch 0.1.3 depends on flowdas-meta<1.1 and >=1.0.1
    launch 0.1.2 depends on flowdas-meta<1.1 and >=1.0.1
    launch 0.1.1 depends on flowdas-meta<1.1 and >=1.0.1
    launch 0.1.0 depends on flowdas-meta<1.1 and >=1.0.1

pip install flowdas-meta
ERROR: Could not find a version that satisfies the requirement flowdas-meta (from versions: none)
ERROR: No matching distribution found for flowdas-meta

https://libraries.io/pypi/flowdas-meta
https://pypi.org/search/?q=flowdas-meta

Feature Request: Integrate with X/Y Plot

What should the feature do?
When the user selects X/Y plot, there should be a checkbox that enables/disables depthmap2mask on every image generated.

How should that feature be controlled
The user should have control over the same options that are provided by the depthmap2mask script while also including a checkbox to enable/disable depthmap2mask.

What are the parameters we need to apply that control as a user
Enable/Disable through checkbox.

TypeError: argument of type 'NoneType' is not iterable

What's up guys. I'm having trouble using Depthmap2mask. I can install as instructed by github. When I go to img2img, enable Depthmap2mask and enable dpt_large, the following error appears in the CMD: File "C:\Users\bypau\Desktop\SD\stable-diffusion-webui\repositories\midas\midas\base_model.py", line 13, in load
if "optimizer" in parameters:
TypeError: argument of type 'NoneType' is not iterable

When I select another model other than dpt_large it works. The problem is only in dpt_large.

I am very grateful to everyone who can help me.

enable masked input only in inpaint mode so full resolution inpaint is possible

Can you enable this ? so depth2mask is processing only the part that was masked ? in full resolution inpaint mode it currently process the whole image and thats no good, its fine for regular img2img or non full res inpaint/
The thing is i just want to inpaint a hand on big image, or part of the chest armor, but currently its processing whole image.
You think thats possible to change so the pipeline will check if image was masked or not and then try to process it with depth models to get the proper depth mask ?

Gpu memory leak

Hey, As I constantly Generate Images. I see slow growth in GPU Memory, after generating around 10 images, GPU memory is 100% full. After that, It always Throws OOM Error..

I mainly use two models, one is MiDas_v21 and other is dpt_large. Doesn't matter which model it is.

Feature Request: 2 checkboxes to control the depth mask with your user mask

Thanks for the script!. Depth detection using an NN is very handy for Img2Img editing, and I wouldn't know how to set it up without this handy script.

However, I would request 2 check boxes to allow better control of the masking area:

  1. A checkbox to combine the depth mask with your user mask via an AND operation. If checked, the In-Painter will only change the areas of the picture in which you've hand drawn a mask AND the depth mask is on.

This allows you to messily draw an area and have the area be refined by the depth mask. Also, sometimes the depth mask will identify 2 objects as both being in the foreground, so this will let you easily specify only 1 of them which should be changed.

  1. A second checkbox to have the depth mask threshold automatically be set at [x%] of the average value of the area you've painted with your user mask. The hard part of using the threshold slider is you don't know what values to put in, and it takes a lot of trial and error to set.

If you check this checkbox, you don't have to guess at the threshold number for objects in the picture anymore. The first time you run it, just draw what you want to change, and the slider bar will be automatically set it for you after the run. Then uncheck the checkbox, or manually adjust the threshhold.

[x] can't be 100% or half the area would not be covered. I wish the [x] could be just hardwired in at say 75%, but I think that'll be too rigid. So I would suggest letting the user set it via a slider, e.g. starting at [x]=75%.

I think these checkboxes are also a solution to the problem identified by @AugmentedRealityCat in #3.

I think these should be both relatively easy to implement. I might try to mod a quick-and-dirty version of this myself, if I can figure out the code.

Error if file format for images is set to JPG

To reproduce:

In A1111 settings, set "File format for images" to jpg, then run the extension.

The issue:

By default, it is trying to save the image in RBGA format (with an alpha channel.) JPG doesn't have an alpha channel, so there is an error. I don't think this alpha channel is needed, so it may be beneficial to remove it before saving to reduce storage space.

RuntimeError: Input type (float) and bias type (struct c10::Half) should be the same

File "I:\SD\sd-webui-aki-v4\modules\img2img.py", line 170, in img2img
processed = modules.scripts.scripts_img2img.run(p, *args)
File "I:\SD\sd-webui-aki-v4\modules\scripts.py", line 407, in run
processed = script.run(p, *script_args)
File "I:\SD\sd-webui-aki-v4\extensions\depthmap2mask\scripts\depth2image_depthmask.py", line 97, in run
d_m = sdmg.calculate_depth_maps(p.init_images[0],img_x,img_y,model_type,invert_depth)
File "I:\SD\sd-webui-aki-v4\extensions/depthmap2mask/scripts/depthmap_for_depth2img.py", line 306, in calculate_depth_maps
prediction = model.forward(sample)
File "I:\SD\sd-webui-aki-v4\repositories\midas\midas\dpt_depth.py", line 166, in forward
return super().forward(x).squeeze(dim=1)
File "I:\SD\sd-webui-aki-v4\repositories\midas\midas\dpt_depth.py", line 114, in forward
layers = self.forward_transformer(self.pretrained, x)
File "I:\SD\sd-webui-aki-v4\repositories\midas\midas\backbones\swin_common.py", line 10, in forward_swin
return forward_default(pretrained, x)
File "I:\SD\sd-webui-aki-v4\repositories\midas\midas\backbones\utils.py", line 64, in forward_default
exec(f"pretrained.model.{function_name}(x)")
File "", line 1, in
File "I:\SD\sd-webui-aki-v4\py310\lib\site-packages\timm\models\swin_transformer_v2.py", line 598, in forward_features
x = self.patch_embed(x)
File "I:\SD\sd-webui-aki-v4\py310\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "I:\SD\sd-webui-aki-v4\py310\lib\site-packages\timm\models\layers\patch_embed.py", line 35, in forward
x = self.proj(x)
File "I:\SD\sd-webui-aki-v4\py310\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "I:\SD\sd-webui-aki-v4\extensions-builtin\Lora\lora.py", line 319, in lora_Conv2d_forward
return torch.nn.Conv2d_forward_before_lora(self, input)
File "I:\SD\sd-webui-aki-v4\py310\lib\site-packages\torch\nn\modules\conv.py", line 463, in forward
return self._conv_forward(input, self.weight, self.bias)
File "I:\SD\sd-webui-aki-v4\py310\lib\site-packages\torch\nn\modules\conv.py", line 459, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Input type (float) and bias type (struct c10::Half) should be the same

Exception on install from webui

Getting the following exception:

Error completing request
Arguments: ('', 'https://github.com/Extraltodeus/depthmap2mask') {}
Traceback (most recent call last):
  File "/home/user/stable-diffusion-webui/modules/ui.py", line 185, in f
    res = list(func(*args, **kwargs))
  File "/home/user/stable-diffusion-webui/modules/ui_extensions.py", line 111, in install_extension_from_url
    check_access()
  File "/home/user/stable-diffusion-webui/modules/ui_extensions.py", line 20, in check_access
    assert not shared.cmd_opts.disable_extension_access, "extension access disabed because of commandline flags"
AssertionError: extension access disabed because of commandline flags

I'm using the command lines arguments: --api --listen --xformers --force-enable-xformers

Any idea what's wrong?

Error with the script

Clicking generate puts an error that says " ModuleNotFoundError: No module named 'repositories.midas' ", not sure what to do

Using the dpt_large model kills my SD

I've been playing with this script and I'm quite liking it so far, but after trying out the other models included I ran into a problem with the dpt_large model. I've been inpainting with the default small model and was having trouble getting the mask to fully cover my subject in a particular picture, so I thought to try the other models and I got better results with the v21 model and even better results with the dpt_large model, so that's good to know. However, after trying the dpt_large model once I immediately became unable to do any further generating without getting a memory error, I couldn't even do txt2img and had to close the console before being able to generate images again. I usually use --xformers but I decided to try --medvram to see if that would help with running the large model but the issue persists. If it helps any I'm running a 2070 Super with 8 gigs of vram on Win11, with up to date drivers for everything. I don't know if it'd be more preferred for me to paste a wall of text or attach a text file, but I'll share the console output both ways just to be sure. Output follows from here, thanks for your work!

Memory Error - Console.txt

Traceback (most recent call last):
File "C:\SDWebUI\modules\call_queue.py", line 45, in f
res = list(func(*args, **kwargs))
File "C:\SDWebUI\modules\call_queue.py", line 28, in f
res = func(*args, **kwargs)
File "C:\SDWebUI\modules\img2img.py", line 137, in img2img
processed = modules.scripts.scripts_img2img.run(p, *args)
File "C:\SDWebUI\modules\scripts.py", line 317, in run
processed = script.run(p, *script_args)
File "C:\SDWebUI\extensions\depthmap2mask\scripts\depth2image_depthmask.py", line 92, in run
proc = process_images(p)
File "C:\SDWebUI\modules\processing.py", line 430, in process_images
res = process_images_inner(p)
File "C:\SDWebUI\modules\processing.py", line 496, in process_images_inner
p.init(p.all_prompts, p.all_seeds, p.all_subseeds)
File "C:\SDWebUI\modules\processing.py", line 841, in init
self.init_latent = self.sd_model.get_first_stage_encoding(self.sd_model.encode_first_stage(image))
File "C:\SDWebUI\venv\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "C:\SDWebUI\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 830, in encode_first_stage
return self.first_stage_model.encode(x)
File "C:\SDWebUI\modules\lowvram.py", line 48, in first_stage_model_encode_wrap
return first_stage_model_encode(x)
File "C:\SDWebUI\repositories\stable-diffusion-stability-ai\ldm\models\autoencoder.py", line 83, in encode
h = self.encoder(x)
File "C:\SDWebUI\venv\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "C:\SDWebUI\repositories\stable-diffusion-stability-ai\ldm\modules\diffusionmodules\model.py", line 526, in forward
h = self.down[i_level].block[i_block](hs[-1], temb)
File "C:\SDWebUI\venv\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "C:\SDWebUI\repositories\stable-diffusion-stability-ai\ldm\modules\diffusionmodules\model.py", line 138, in forward
h = self.norm2(h)
File "C:\SDWebUI\venv\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "C:\SDWebUI\venv\lib\site-packages\torch\nn\modules\normalization.py", line 272, in forward
return F.group_norm(
File "C:\SDWebUI\venv\lib\site-packages\torch\nn\functional.py", line 2516, in group_norm
return torch.group_norm(input, num_groups, weight, bias, eps, torch.backends.cudnn.enabled)
RuntimeError: CUDA out of memory. Tried to allocate 1.12 GiB (GPU 0; 8.00 GiB total capacity; 4.83 GiB already allocated; 0 bytes free; 6.02 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

FileNotFoundError: [Errno 2] No such file or directory: './externals/Next_ViT/classification/nextvit.py'

`
File "D:\stable-diffusion-webui\extensions\depthmap2mask\scripts\depth2image_depthmask.py", line 76, in run
sdmg = module_from_file("depthmap_for_depth2img",'extensions/depthmap2mask/scripts/depthmap_for_depth2img.py')

File "D:\stable-diffusion-webui\extensions\depthmap2mask\scripts\depth2image_depthmask.py", line 22, in module_from_file
spec.loader.exec_module(module)
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "extensions/depthmap2mask/scripts/depthmap_for_depth2img.py", line 11, in
from repositories.midas.midas.dpt_depth import DPTDepthModel
File "D:\stable-diffusion-webui\repositories\midas\midas\dpt_depth.py", line 5, in
from .blocks import (
File "D:\stable-diffusion-webui\repositories\midas\midas\blocks.py", line 21, in
from .backbones.next_vit import (
File "D:\stable-diffusion-webui\repositories\midas\midas\backbones\next_vit.py", line 15, in
file = open("./externals/Next_ViT/classification/nextvit.py", "r")
FileNotFoundError: [Errno 2] No such file or directory: './externals/Next_ViT/classification/nextvit.py'`

Ignore user defined mask feature.

Great work.

Any way to implement an ignore user defined masked feature on inpainting?

what it would do.

1-user manually in-paints an area of photo.
2-ignore user defined area checkbox ticked
3-depth img2img works it’s magic and generates a photo
4-all areas inpainted with the depth mask are generated and the user defined area is left unchanged.

could this be as simple as an a-b type equation where a=depthimg2img and b = user defined mask?

I know the script for detection retailer uses a similar process.

Error if midas_v21 or dpt_large are used

If I use midas_v21 or dpt_large on any image, I receive this error:

UnboundLocalError: local variable 'model' referenced before assignment

I have tried installing both manually and using the automatic install method.
midas_v21_small works fine.

ModuleNotFoundError: No module named 'repositories.midas'

Upon launch, I get this error: Error loading script: depthmap_for_depth2img.py

Traceback (most recent call last):
File "A:\Desktop\00 AI Images\stable-diffusion-webui\modules\scripts.py", line 184, in load_scripts
module = script_loading.load_module(scriptfile.path)
File "A:\Desktop\00 AI Images\stable-diffusion-webui\modules\script_loading.py", line 13, in load_module
exec(compiled, module.dict)
File "A:\Desktop\00 AI Images\stable-diffusion-webui\extensions\depthmap2mask\scripts\depthmap_for_depth2img.py", line 11, in
from repositories.midas.midas.dpt_depth import DPTDepthModel
ModuleNotFoundError: No module named 'repositories.midas'

And when I try to run your script, I get this error:

Error completing request
Arguments: (0, 'a mushroom like structure with a colorful sky in the background and plants and rocks in the foreground, and a few mushrooms in the foreground, by Paul Lehr', '', 'None', 'None', <PIL.Image.Image image mode=RGB size=1536x1536 at 0x6FD03640>, None, None, None, None, 0, 150, 0, 4, 0, 0, False, False, 1, 1, 7, 0.75, -1.0, -1.0, 0, 0, 0, False, 512, 512, 0, False, 32, 0, '', '', 10, '

\n

Combinations

\n\n Choose a number of terms from a list, in this case we choose two artists: \n {2$$artist1|artist2|artist3}
\n\n If $$ is not provided, then 1$$ is assumed.

\n\n If the chosen number of terms is greater than the available terms, then some terms will be duplicated, otherwise chosen terms will be unique. This is useful in the case of wildcards, e.g.\n {2$$artist} is equivalent to {2$$artist|artist}

\n\n A range can be provided:\n {1-3$$artist1|artist2|artist3}
\n In this case, a random number of artists between 1 and 3 is chosen.

\n\n Wildcards can be used and the joiner can also be specified:\n {{1-$$and$$adjective}}
\n\n Here, a random number between 1 and 3 words from adjective.txt will be chosen and joined together with the word 'and' instead of the default comma.\n\n

\n\n

Wildcards

\n \n\n
\n If the groups wont drop down click here to fix the issue.\n\n

\n\n WILDCARD_DIR: A:\Desktop\00 AI Images\stable-diffusion-webui\extensions\sd-dynamic-prompts\wildcards
\n You can add more wildcards by creating a text file with one term per line and name is mywildcards.txt. Place it in A:\Desktop\00 AI Images\stable-diffusion-webui\extensions\sd-dynamic-prompts\wildcards. <folder>/mywildcards will then become available.\n
\n\n', True, False, 1, False, False, False, 100, 0.7, False, False, False, False, False, False, '
    \n
  • CFG Scale should be 2 or lower.
  • \n
\n', True, True, '', '', True, 50, True, 1, 0, False, 4, 1, '

Recommended settings: Sampling Steps: 80-100, Sampler: Euler a, Denoising strength: 0.8

', 128, 8, ['left', 'right', 'up', 'down'], 1, 0.05, 128, 4, 0, ['left', 'right', 'up', 'down'], False, False, False, '', '

Will upscale the image to twice the dimensions; use width and height sliders to set tile size

', 64, 0, 1, '', 0, '', True, False, False, '

Deforum v0.5-webui-beta

', '

This script is deprecated. Please use the full Deforum extension instead.
\nUpdate instructions:

', '

github.com/deforum-art/deforum-for-automatic1111-webui/blob/automatic1111-webui/README.md

', '

discord.gg/deforum

', True, 0, True, 384, 384, False, 2, True, True, False, False, False, 4.0, '', 10.0, False, True, True, 30.0, True, False, False, 0, 0.0, 10.0, True, 30.0, True, '{inspiration}', None, 'linear', '30', 'grad_min', 0.01, 1, 'clip', 1.0, 1.0, 'mp4', 10.0, 0, 1, False, True) {}
Traceback (most recent call last):
File "A:\Desktop\00 AI Images\stable-diffusion-webui\modules\call_queue.py", line 45, in f
res = list(func(*args, **kwargs))
File "A:\Desktop\00 AI Images\stable-diffusion-webui\modules\call_queue.py", line 28, in f
res = func(*args, **kwargs)
File "A:\Desktop\00 AI Images\stable-diffusion-webui\modules\img2img.py", line 150, in img2img
processed = modules.scripts.scripts_img2img.run(p, *args)
File "A:\Desktop\00 AI Images\stable-diffusion-webui\modules\scripts.py", line 317, in run
processed = script.run(p, *script_args)
File "A:\Desktop\00 AI Images\stable-diffusion-webui\extensions\depthmap2mask\scripts\depth2image_depthmask.py", line 76, in run
sdmg = module_from_file("depthmap_for_depth2img",'extensions/depthmap2mask/scripts/depthmap_for_depth2img.py')
File "A:\Desktop\00 AI Images\stable-diffusion-webui\extensions\depthmap2mask\scripts\depth2image_depthmask.py", line 22, in module_from_file
spec.loader.exec_module(module)
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "A:\Desktop\00 AI Images\stable-diffusion-webui\extensions/depthmap2mask/scripts/depthmap_for_depth2img.py", line 11, in
from repositories.midas.midas.dpt_depth import DPTDepthModel
ModuleNotFoundError: No module named 'repositories.midas'

(Feature request) Use existing depthmaps

I would like to be able to use my own depthmap from a depth camera. As you can see the depth maps have much more detail for th AI to work with and would create some amazing results.
Could we have the input image be our own 512 depth map? Or folder of depth maps.
Please and thank you.
204748621-db256369-173c-40b5-b6b4-695d584fe069

Feature request: Mask depth control

  1. What should the feature do?

With this new feature it should be possible to determine at which depth the image should be masked, and at which depth it should be visible.

  1. How should that feature be controlled

We will call the portion of the image we want to keep visible a slice.
The user should have control over where to cut the scene to obtain the slice he wants to keep.

  1. What are the parameters we need to apply that control as a user

The first parameter would be the near cut distance. This would determine how far from the camera the image slice begins to be visible. Everything closer to the camera than the near cut distance would be cut out.
The second parameter would be the far cut distance. This would determine at which distance the visible slice of our image should be cut again, and everything further away simply becomes invisible.

  1. How should those parameters be presented to the user?

Since we already have a depthmap to deal with, it is logical to use it as a reference.
It uses a 8 bit channel (values of 0 to 255) to determine distance.
A distance of 0 should be the closest to the camera.
A distance of 255 should be infinity - basically everything further away than the furthest distance measured.
This means that for both near cut and far cut the user must provide a value between 0 and 255.
Logically, the far cut value should always be higher than the near cut.

  1. How should those parameters be used by the system to obtain the desired results?

We will transform the near cut and far cut parameters into control parameters for a color adjustments procedure
First we will invert the depthmap colors - This is just to make it easier to understand with black=0=close and white=255=far.
Then we will make all the pixels that are darker than the near cut distance value completely black. This cuts the near part.
Then we will make all the pixels that are brighter than the far cut distance value completely black as well. This cuts the far part.
Then we will make all the pixels that are brighter than the near cut value but lower than the far cut completely white. This makes the slice we have just cut out completely opaque.

  1. How can we make this even better

Feathered distance : this would soften the cut. It would act like a blurred mask, but blurred in z-space, all by adjusting the masks colors. The parameter would be controlled as a 0-255 distance, but would be limited to a certain maximal value that make sense.
Keep semi transparent : this checkbox would allow the user to keep the sliced portion in greyscale instead of forcing it to be opaque
Semi-transparency normalization : This checkbox sub-parameter would only be used if keep semi-transparent is selected. This would normalize the greyscale gradient that has remained visible after the slicing procedure by making the darkest grey almost black, and the lightest grey almost white, and spreading all other greyscale values in between evenly.

Let me know if you'd like examples based on pictures - I'm doing this process manually right now so I am very familiar with it.

KeyError: 'swin2b24_384'

File "/root/StableDiffusion/stable-diffusion-webui/repositories/midas/midas/dpt_depth.py", line 55, in init
hooks=hooks[backbone],
KeyError: 'swin2b24_384'

I manually downloaded midas models and placed them in models/midas, when i ran generate the error occured

OS:
linux

FileNotFoundError: [Errno 2] No such file or directory: 'extensions/depthmap2mask/scripts/depthmap_for_depth2img.py'

Hi i hope you are fine i have a problem with the extension

FileNotFoundError: [Errno 2] No such file or directory: 'extensions/depthmap2mask/scripts/depthmap_for_depth2img.py'

Connected
Error completing request
Arguments: (0, '', '', 'None', 'None', <PIL.Image.Image image mode=RGB size=512x512 at 0x7FD06CA987D0>, None, None, None, 0, 20, 0, 4, 1, False, False, 1, 1, 7, 0.75, -1.0, -1.0, 0, 0, 0, False, 512, 512, 0, False, 32, 0, '', '', 9, '

    \n
  • CFG Scale should be 2 or lower.
  • \n
\n', True, True, '', '', True, 50, True, 1, 0, False, 4, 1, '

Recommended settings: Sampling Steps: 80-100, Sampler: Euler a, Denoising strength: 0.8

', 128, 8, ['left', 'right', 'up', 'down'], 1, 0.05, 128, 4, 0, ['left', 'right', 'up', 'down'], False, False, False, '', '

Will upscale the image to twice the dimensions; use width and height sliders to set tile size

', 64, 0, 1, '', 0, '', True, False, False, False, 0, True, 384, 384, False, 2, True, True, False) {}
Traceback (most recent call last):

File "", line 724, in exec_module
File "", line 859, in get_code
File "", line 916, in get_data
FileNotFoundError: [Errno 2] No such file or directory: 'extensions/depthmap2mask/scripts/depthmap_for_depth2img.py'

Hello, is here option, combine this with CLIP

Sorry for my english,
This si great plugin, just have question

is here way, to add prompts to this plugin?

Like a masked image, with prompts?

like include or exlude some of parts of image from masking?

Thanx you

Error loading script: depthmap_for_depth2img.py

Im getting this error after installing this extension in Stable Diffusion, any1 know how to fix this?

Error loading script: depthmap_for_depth2img.py
Traceback (most recent call last):
File "C:\A1111 Web UI Autoinstaller\stable-diffusion-webui\modules\scripts.py", line 256, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "C:\A1111 Web UI Autoinstaller\stable-diffusion-webui\modules\script_loading.py", line 11, in load_module
module_spec.loader.exec_module(module)
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "C:\A1111 Web UI Autoinstaller\stable-diffusion-webui\extensions\depthmap2mask\scripts\depthmap_for_depth2img.py", line 13, in
from repositories.midas.midas.dpt_depth import DPTDepthModel
File "C:\A1111 Web UI Autoinstaller\stable-diffusion-webui\repositories\midas\midas\dpt_depth.py", line 5, in
from .blocks import (
File "C:\A1111 Web UI Autoinstaller\stable-diffusion-webui\repositories\midas\midas\blocks.py", line 4, in
from .backbones.beit import (
File "C:\A1111 Web UI Autoinstaller\stable-diffusion-webui\repositories\midas\midas\backbones\beit.py", line 9, in
from timm.models.beit import gen_relative_position_index
ModuleNotFoundError: No module named 'timm.models.beit'

Any chance to get this as a script and not extension?

Currently custom scripts can be run through the automatic1111 api but not extensions.
I would like to be able to use this through unity but my knowledge of phyton is too limited to convert this.
Can someone help me or point me to what exactly has to be changed to run this as a script?

Error loading script: No module named 'timm.models.beit'

I used the script a few days ago on colab pro with no problem. Today I can't get it to work.

Maybe it has something to do with this Midas update yesterday?

They added this file which references the now missing module as a dependency.

Thats at least as far as I got. Might be completely off.

Here is the full error message:

Error loading script: depthmap_for_depth2img.py
Traceback (most recent call last):
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 195, in load_scripts
    module = script_loading.load_module(scriptfile.path)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 13, in load_module
    exec(compiled, module.__dict__)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/depthmap2mask/scripts/depthmap_for_depth2img.py", line 11, in <module>
    from repositories.midas.midas.dpt_depth import DPTDepthModel
  File "/content/gdrive/MyDrive/sd/stablediffusion/repositories/midas/midas/dpt_depth.py", line 5, in <module>
    from .blocks import (
  File "/content/gdrive/MyDrive/sd/stablediffusion/repositories/midas/midas/blocks.py", line 4, in <module>
    from .backbones.beit import (
  File "/content/gdrive/MyDrive/sd/stablediffusion/repositories/midas/midas/backbones/beit.py", line 9, in <module>
    from timm.models.beit import gen_relative_position_index
ModuleNotFoundError: No module named 'timm.models.beit'

Thanks for the awesome script btw! :D

Batch img2img error

Been having this problem when trying to batch img2img

File "\stable-diffusion-webui\extensions/depthmap2mask/scripts/depthmap_for_depth2img.py", line 161, in calculate_depth_maps
img_output2[:,:,0] = img_output / 256.0
IndexError: too many indices for array: array is 2-dimensional, but 3 were indexed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.