thygate / stable-diffusion-webui-depthmap-script

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

Error: image has wrong mode #241

Closed Frewaran closed 1 year ago

Frewaran commented 1 year ago

I'm very new to stable diffusion and I don't understand quite a lot.. Can anyone help me fixing this problem? Or tell me, what I did wrong?

DepthMap v0.3.11 (22bcc7be) device: cuda Loading model weights from ./models/leres/res101.pth initialize network with normal loading the model from ./models/pix2pix\latest_net_G.pth Computing depthmap(s) .. 0%| | 0/1 [00:00<?, ?it/s]

wholeImage being processed in : 1568 Adjust factor is: 1.0 Selecting patches ... Target resolution: (3136, 2352, 3) Resulting depthmap resolution will be : (4032, 3024) patches to process: 21 processing patch 0 / 20 | [ 0 432 2880 2880] processing patch 1 / 20 | [ 0 864 2880 2880] processing patch 2 / 20 | [ 144 1440 2592 2592] processing patch 3 / 20 | [ 720 720 2304 2304] processing patch 4 / 20 | [ 720 1152 2304 2304] processing patch 5 / 20 | [ 720 1584 2304 2304] processing patch 6 / 20 | [ 823 391 2098 2098] processing patch 7 / 20 | [ 0 864 2016 2016] processing patch 8 / 20 | [ 0 1296 2016 2016] processing patch 9 / 20 | [ 0 1728 2016 2016] processing patch 10 / 20 | [ 144 2304 1728 1728] processing patch 11 / 20 | [ 576 2304 1728 1728] processing patch 12 / 20 | [1008 2304 1728 1728] processing patch 13 / 20 | [1584 1584 1440 1440] processing patch 14 / 20 | [1584 2016 1440 1440] processing patch 15 / 20 | [1584 2448 1440 1440] processing patch 16 / 20 | [ 802 802 1275 1275] processing patch 17 / 20 | [1666 370 1275 1275] processing patch 18 / 20 | [1666 802 1275 1275] processing patch 19 / 20 | [ 0 2160 1152 1152] processing patch 20 / 20 | [ 0 2592 1152 1152] 0%| | 0/1 [00:25<?, ?it/s] Error completing request Arguments: (0, <PIL.Image.Image image mode=RGB size=3024x4032 at 0x23175CB12D0>, None, '', '', 0, 0, 512, 512, False, True, False, False, 0, 1, False, 1, True, True, False, False, ['left-right', 'red-cyan-anaglyph'], 2.5, 'polylines_sharp', 0, False, False, False, False, False, 'u2net', False, 0, 2, False, None, True, False, True, False) {} Traceback (most recent call last): File "E:\stable-diffusion\stable-diffusion-webui\modules\call_queue.py", line 56, in f res = list(func(*args, *kwargs)) File "E:\stable-diffusion\stable-diffusion-webui\modules\call_queue.py", line 37, in f res = func(args, *kwargs) File "E:\stable-diffusion\stable-diffusion-webui\extensions\stable-diffusion-webui-depthmap-script\scripts\depthmap.py", line 1184, in run_generate outputs, mesh_fi, meshsimple_fi = run_depthmap( File "E:\stable-diffusion\stable-diffusion-webui\extensions\stable-diffusion-webui-depthmap-script\scripts\depthmap.py", line 666, in run_depthmap images.save_image(Image.fromarray(img_output), path=outpath, basename=basename, seed=None, prompt=None, extension=opts.samples_format, info=info, short_filename=True,no_prompt=True, grid=False, pnginfo_section_name="extras", existing_info=None, forced_filename=None) File "E:\stable-diffusion\stable-diffusion-webui\modules\images.py", line 595, in save_image image = image.resize((round(image.width opts.target_side_length / image.height), round(opts.target_side_length)), LANCZOS) File "E:\stable-diffusion\stable-diffusion-webui\venv\lib\site-packages\PIL\Image.py", line 2192, in resize return self._new(self.im.resize(size, resample, box)) ValueError: image has wrong mode

Traceback (most recent call last): File "E:\stable-diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 394, in run_predict output = await app.get_blocks().process_api( File "E:\stable-diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1078, in process_api data = self.postprocess_data(fn_index, result["prediction"], state) File "E:\stable-diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1012, in postprocess_data prediction_value = block.postprocess(prediction_value) File "E:\stable-diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\components.py", line 4307, in postprocess "name": self.make_temp_copy_if_needed(y), File "E:\stable-diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\processing_utils.py", line 362, in make_temp_copy_if_needed temp_dir = self.hash_file(file_path) File "E:\stable-diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\processing_utils.py", line 334, in hash_file with open(file_path, "rb") as f: OSError: [Errno 22] Invalid argument: "

ValueError: image has wrong mode

Time taken: 33.19s

Torch active/reserved: 4736/5920 MiB, Sys VRAM: 8192/8192 MiB (100.0%)

"

jamiejk commented 1 year ago

I have this same problem, also with a large (4k-ish) image.

thygate commented 1 year ago

there's an option in A1111 that saves an additional JPEG image next to the PNG when the image filesize or dimensions exceed a set value..

It's likely giving this error trying to save as JPEG, which does not support 16bit single channel.

So disable the A1111 option to save additional JPEG and it should work.

jamiejk commented 1 year ago

Many thanks, found it, will try. So far I was solving it by cropping my image but will text this next!

On Fri, 2 Jun 2023 at 11:51, Bob Thiry @.***> wrote:

there's an option in A1111 that saves an additional JPEG image next to a PNG when the image filesize or dimensions exceed a set value..

It's likely giving this error trying to save as JPEG, which does not support 16bit single channel.

So disable the A1111 option to save additional JPEG and it should work.

— Reply to this email directly, view it on GitHub https://github.com/thygate/stable-diffusion-webui-depthmap-script/issues/241#issuecomment-1574171475, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABW2YQG3PZ2LXGZBX3YKTN3XJIY3ZANCNFSM6AAAAAAYVMSRUM . You are receiving this because you commented.Message ID: <thygate/stable-diffusion-webui-depthmap-script/issues/241/1574171475@ github.com>

--


Jamie King @.***