stable-diffusion-webui
stable-diffusion-webui copied to clipboard
[Bug]: Textual Inversion image preprocessor crashes unexpectedly when using auto focal point crop
Is there an existing issue for this?
- [X] I have searched the existing issues and checked the recent builds/commits
What happened?
The image processor for training embeds and hypernetworks crashes when processing images using auto focal crop.
Steps to reproduce the problem
- Go to the WebUI
- Click on the Train tab
- Navigate to "Preprocess images"
- Input both directories, choose any image resolution
- Check "auto focal point crop"
- Wait for the processor to crash.
- Uncheck "auto focal point crop"
- Restart the processor and watch it complete all images.
What should have happened?
The images should've been processed and cropped to target resolution.
Commit where the problem happens
865af20
What platforms do you use to access UI ?
Windows
What browsers do you use to access the UI ?
Mozilla Firefox
Command Line Arguments
--xformers --opt-split-attention --opt-channelslast --no-half-vae --enable-insecure-extension-access --autolaunch --listen
Additional information, context and logs
The crash log (processor crashes when processing image 3)
Preprocessing [Image 3/31]: 10%|█████▎ | 3/31 [00:16<02:35, 5.56s/it] Error completing request Arguments: ('task(ntca3qagsimwm00)', 'G:\NovelAI\stable-diffusion-webui\training_images\input', 'G:\NovelAI\stable-diffusion-webui\training_images\output', 1280, 1280, 'ignore', False, False, False, False, 0.5, 0.2, True, 1, 0.15, 0.5, False, False, 384, 768, 4096, 409600, 'Maximize area', 0.1) {} Traceback (most recent call last): File "G:\NovelAI\stable-diffusion-webui\modules\call_queue.py", line 56, in f res = list(func(*args, **kwargs)) File "G:\NovelAI\stable-diffusion-webui\modules\call_queue.py", line 37, in f res = func(*args, **kwargs) File "G:\NovelAI\stable-diffusion-webui\modules\textual_inversion\ui.py", line 19, in preprocess modules.textual_inversion.preprocess.preprocess(*args) File "G:\NovelAI\stable-diffusion-webui\modules\textual_inversion\preprocess.py", line 23, in preprocess preprocess_work(process_src, process_dst, process_width, process_height, preprocess_txt_action, process_flip, process_split, process_caption, process_caption_deepbooru, split_threshold, overlap_ratio, process_focal_crop, process_focal_crop_face_weight, process_focal_crop_entropy_weight, process_focal_crop_edges_weight, process_focal_crop_debug, process_multicrop, process_multicrop_mindim, process_multicrop_maxdim, process_multicrop_minarea, process_multicrop_maxarea, process_multicrop_objective, process_multicrop_threshold) File "G:\NovelAI\stable-diffusion-webui\modules\textual_inversion\preprocess.py", line 216, in preprocess_work save_pic(focal, index, params, existing_caption=existing_caption) File "G:\NovelAI\stable-diffusion-webui\modules\textual_inversion\preprocess.py", line 83, in save_pic save_pic_with_caption(image, index, params, existing_caption=existing_caption) File "G:\NovelAI\stable-diffusion-webui\modules\textual_inversion\preprocess.py", line 64, in save_pic_with_caption image.save(os.path.join(params.dstdir, f"{basename}.png")) File "G:\NovelAI\stable-diffusion-webui\venv\lib\site-packages\PIL\Image.py", line 2431, in save save_handler(self, fp, filename) File "G:\NovelAI\stable-diffusion-webui\venv\lib\site-packages\PIL\PngImagePlugin.py", line 1331, in _save data = name + b"\0\0" + zlib.compress(icc) TypeError: a bytes-like object is required, not 'str'
I recently also found the "TypeError: a bytes-like object is required, not 'str'" when I try t upscale an image on Extra. Don't know if it is a bug or something on my side. Is anyone having this issue? Thanks
I recently also found the "TypeError: a bytes-like object is required, not 'str'" when I try t upscale an image on Extra. Don't know if it is a bug or something on my side. Is anyone having this issue? Thanks
Same
same here
This happens on several PNG files in my dataset. I converted these files into BMP and the problem was solved.