thygate / stable-diffusion-webui-depthmap-script

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

PLS HELP: Using stereoimage_generation.py, Crashing #406

Closed wcapes closed 9 months ago

wcapes commented 9 months ago

Hi

I'm using only stereoimage_generation.py in my personal project, that won't be published, and I get the following error when I run the create_stereoimages function

I'm not 100% useless at coding, just new to Python :)

It's crashing on this line col_d = col + int((normalized_depth[row][col] * stereo_offset_exponent) divergence_px + separation_px) and I'm pretty sure it's the way I'm passing the depthmap image

On disk it's IMAGE001.PNG

ERROR: image

Here's my includes image

Here's my code calling the function image

semjon00 commented 9 months ago

Python and Numba versions are not compatible with the project. Please try with Python 3.10 and Numba 0.57.0. If this does not help, try uninstalling Numba to see if it help - but keep in mind that in this case generation will be really slow.

wcapes commented 9 months ago

@semjon00 Thank you for the fast reply, will try tonight and update this post

wcapes commented 9 months ago

EDIT I did drop numba to 0.57.0 as well :)

Update: I uninstall python 3.11 and installed "python-3.10.9-amd64.exe"

Still getting the same error.

I checked the version and confirmed

image

I then ran pip -install -r requirements.txt and have the following after pip list C:\Users\MainPC>pip list Package Version


aiofiles 23.2.1 altair 5.2.0 annotated-types 0.6.0 anyio 4.2.0 attrs 23.2.0 certifi 2024.2.2 charset-normalizer 3.3.2 click 8.1.7 colorama 0.4.6 coloredlogs 15.0.1 contourpy 1.2.0 cycler 0.12.1 decorator 4.4.2 exceptiongroup 1.2.0 fastapi 0.109.2 ffmpy 0.3.1 filelock 3.13.1 flatbuffers 23.5.26 fonttools 4.48.1 freetype-py 2.4.0 fsspec 2024.2.0 gradio 3.50.2 gradio_client 0.6.1 h11 0.14.0 hsluv 5.0.4 httpcore 1.0.2 httpx 0.26.0 huggingface-hub 0.20.3 humanfriendly 10.0 idna 3.6 imageio 2.33.1 imageio-ffmpeg 0.4.9 importlib-resources 6.1.1 Jinja2 3.1.3 jsonschema 4.21.1 jsonschema-specifications 2023.12.1 kiwisolver 1.4.5 lazy_loader 0.3 llvmlite 0.42.0 MarkupSafe 2.1.5 matplotlib 3.8.2 moviepy 1.0.3 mpmath 1.3.0 networkx 3.2.1 numba 0.59.0 numpy 1.26.4 onnxruntime 1.17.0 opencv-python-headless 4.9.0.80 orjson 3.9.13 packaging 23.2 pandas 2.2.0 pillow 10.2.0 pip 22.3.1 platformdirs 4.2.0 pooch 1.8.0 proglog 0.1.10 protobuf 4.25.2 pydantic 2.6.1 pydantic_core 2.16.2 pydub 0.25.1 PyMatting 1.1.12 pyparsing 3.1.1 PyQt6 6.6.1 PyQt6-Qt6 6.6.1 PyQt6-sip 13.6.0 pyreadline3 3.4.1 python-dateutil 2.8.2 python-multipart 0.0.7 pytz 2024.1 PyYAML 6.0.1 referencing 0.33.0 rembg 2.0.54 requests 2.31.0 rpds-py 0.17.1 safetensors 0.4.2 scikit-image 0.22.0 scipy 1.12.0 semantic-version 2.10.0 setuptools 65.5.0 six 1.16.0 sniffio 1.3.0 starlette 0.36.3 sympy 1.12 tifffile 2024.1.30 timm 0.9.12 toolz 0.12.1 torch 2.2.0 torchvision 0.17.0 tqdm 4.66.1 transforms3d 0.4.1 trimesh 4.1.3 typing_extensions 4.9.0 tzdata 2023.4 urllib3 2.2.0 uvicorn 0.27.0.post1 vispy 0.14.1 websockets 11.0.3

semjon00 commented 9 months ago

Try using webui as usual (you probably will prefer the standalone mode) and see if it works this way. Then try to debug it and see how it works and what are the arguments that are passed to the function. If it works, this may signal that there is still something odd about the pip installed packages (venv probably?)

Also try specifically reinstalling numba=0.58.1

Please let me know if any of this works.

wcapes commented 9 months ago

WebUI works perfectly up to 2000 files.

I added my prints to WebUI and my functions to make sure they 100% identifical

I've spent most of the day doing that :) I even added print(type(variables)) to make sure that WEBUI and my little function are passing the same types, and even went as far to make sure I was passing 2 as the WEBUI instead of 2.0 :) My only other course is to reformat and install Python 3.10 and then use PIP on requirements.txt to try again :)

I will try 0.58.1 quick (EDIT: Sadly didn't help, thinking the reformat is my best shot :) )

*Edit 2 I install WinPython 3.10 and tried in that as well. Same error, but yet WebUI works. Is there something special that WebUI is doing with the depth map file once loaded for the sbs gen? As I managed to track it to that point, its the depthmap parameter on the function

wcapes commented 9 months ago

Good morning

Further update

Re-installed windows (I had to anyway) Installed Python 3.10.6 Installed all requirements using requirements.txt and guides

WebUI works perfectly fine Using the script in mine, still doesn't

I'm sure it's got to do with the way I pass the DepthMap PNG image through to your function

EDIT 2 I know I'm going on and on, Seems there is an overwrite for INT(array(float64, 1d, C)) somewhere in the code that I need to implement in my code, just can't find it

semjon00 commented 9 months ago

Well, I would advice debugging code from this repository to understand what are the inputs (be very careful with how inputs are formatted - float vs int, etc) and then debug your code to see if they are correct. It is best to use standalone mode for debugging, when webui is not required.

wcapes commented 9 months ago

UPDATE Just adding this here for anyone in the future

I changed this line raw_depth_map_numpy = np.asarray(raw_depth_map) to raw_depth_map_numpy = np.array(raw_depth_map.getdata())

And now it's working :)

Thank you @semjon00 for your patience with me - I think this can be marked as closed now