thygate / stable-diffusion-webui-depthmap-script

High Resolution Depth Maps for Stable Diffusion WebUI
MIT License
1.72k stars 159 forks source link

No module named 'inpaint'. Some issue with generating inpainted mesh #453 [proposed fix] #473

Open themanyone opened 1 month ago

themanyone commented 1 month ago

Steps to reproduce go to 'inpaint' tab and Generate 3D inpainted mesh

$ sysinfo 
CPU: quad core Intel Core i7-2860QM (-MT MCP-) speed/min/max: 968/800/3600 MHz
Kernel: 6.10.12-100.fc39.x86_64 x86_64 Up: 2d 18h 56m
Mem: 15.85/31.28 GiB (50.7%) Storage: 1.86 TiB (26.8% used) Procs: 403
Shell: Bash inxi: 3.3.34
  File "/home/k/Downloads/src/stable-diffusion-webui/extensions/stable-diffusion-webui-depthmap-script/src/core.py", line 355, in run_3dphoto
    from inpaint.mesh import write_mesh
ModuleNotFoundError: No module named 'inpaint'

$ g "issue with" * -r
extensions/stable-diffusion-webui-depthmap-script/src/core.py:334:            print(f'{str(e)}, some issue with generating inpainted mesh')
# TODO: This should not be here
if inp[go.GEN_INPAINTED_MESH]:
    try:
        mesh_fi = run_3dphoto(device, inpaint_imgs, inpaint_depths, inputnames, outpath,
                              inp[go.GEN_INPAINTED_MESH_DEMOS],
                              1, "mp4")
        yield 0, 'inpainted_mesh', mesh_fi
    except Exception as e:
        print(f'{str(e)}, some issue with generating inpainted mesh')

backbone.reload_sd_model()
print("All done.\n")

def run_3dphoto(device, img_rgb, img_depth, inputnames, outpath, gen_inpainted_mesh_demos, vid_ssaa, vid_format):
    from inpaint.mesh import write_mesh
    from inpaint.networks import Inpaint_Color_Net, Inpaint_Depth_Net, Inpaint_Edge_Net
    from inpaint.bilateral_filtering import sparse_bilateral_filtering
$ where inpaint
./extensions/stable-diffusion-webui-depthmap-script/inpaint
n extensions/stable-diffusion-webui-depthmap-script/src/core.py:334:

FIX#1. Path issue

$ cd ./extensions/stable-diffusion-webui-depthmap-script
$ ln -s $(pwd)/inpaint ../../

hmm So I run python and try stepping through

>>>   from inpaint.mesh import write_mesh
>>>    from inpaint.networks import Inpaint_Color_Net, Inpaint_Depth_Net, Inpaint_Edge_Net
SyntaxError: trailing comma not allowed without surrounding parentheses

Fix#2. Put parenthesis around imports around line ~355 from inpaint.networks import (Inpaint_Color_Net, Inpaint_Depth_Net, Inpaint_Edge_Net)

I also removed the try...catch block. It doesn't really do anything but hide errors.