Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This extension causes pictures to not be saved automatically. #108

Closed
player99963 opened this issue Jul 2, 2023 · 16 comments
Closed

This extension causes pictures to not be saved automatically. #108

player99963 opened this issue Jul 2, 2023 · 16 comments
Labels
enhancement New feature or request

Comments

@player99963
Copy link

I noticed that using the face-editor causes the SD to not save the pictures automatically often and only some of them are saved properly.
I still haven't figured out why, but this is seriously affecting my normal usage. This is a powerful extension and I hope it will continue to work properly. If you can fix this problem, I would be very grateful.

擷取

@ototadana
Copy link
Owner

@player99963
Can you give me some more information to help me solve that problem?

Are there any errors output to the terminal (console) when images are not saved? If so, can you paste it in as is? The more information you paste, as in #21, the better for the solution.

Thanks.

@xlinsite
Copy link

xlinsite commented Jul 2, 2023

@ototadana
I am experiencing the same issue and the glitch occurs when I turn on Hires. Fix function and author's sd-face-editor, turn off Hires. Fix saves automatically, but I need to use both! Does the author have a good workaround?

@player99963
Copy link
Author

I am experiencing the same issue and the glitch occurs when I turn on Hires. Fix function and author's sd-face-editor, turn off Hires. Fix saves automatically, but I need to use both! Does the author have a good workaround?

The console does not show any errors when the image is not automatically saved. Instead, it seems to not show the "prompt for the face: XXX" string.
Like this(with face-editor open the whole time):

number of faces: 00%|██████████████████████████████████████████████████████████████████| 25/25 [00:04<00:00, 4.85it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 25/25 [00:04<00:00, 5.23it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 14.27it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 15/15 [00:03<00:00, 4.83it/s]
number of faces: 00%|██████████████████████████████████████████████████████████████████| 25/25 [00:04<00:00, 4.88it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 25/25 [00:04<00:00, 5.39it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 15.55it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 15/15 [00:03<00:00, 4.80it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 25/25 [00:04<00:00, 5.19it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 14.51it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 15/15 [00:03<00:00, 4.79it/s]
number of faces: 00%|██████████████████████████████████████████████████████████████████| 25/25 [00:04<00:00, 4.85it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 25/25 [00:04<00:00, 5.32it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 14.06it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 15/15 [00:03<00:00, 4.78it/s]
number of faces: 00%|██████████████████████████████████████████████████████████████████| 25/25 [00:04<00:00, 4.83it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 25/25 [00:04<00:00, 5.32it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 15.67it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 15/15 [00:03<00:00, 4.78it/s]
number of faces: 00%|██████████████████████████████████████████████████████████████████| 25/25 [00:04<00:00, 4.84it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 25/25 [00:04<00:00, 5.36it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 15.14it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 15/15 [00:03<00:00, 4.76it/s]
number of faces: 00%|██████████████████████████████████████████████████████████████████| 25/25 [00:04<00:00, 4.85it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 25/25 [00:05<00:00, 4.94it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 15.91it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 15/15 [00:03<00:00, 4.74it/s]
number of faces: 20%|██████████████████████████████████████████████████████████████████| 25/25 [00:04<00:00, 4.79it/s]
prompt for the face: serious expression
100%|████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 8.51it/s]
prompt for the face: serious expression
100%|████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 9.52it/s]
Total progress: 35it [00:07, 4.53it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 16.05it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 15/15 [00:03<00:00, 4.76it/s]
number of faces: 10%|██████████████████████████████████████████████████████████████████| 25/25 [00:04<00:00, 4.85it/s]
prompt for the face: serious expression
100%|████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 9.42it/s]
Total progress: 30it [00:06, 4.83it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 14.27it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 15/15 [00:03<00:00, 4.80it/s]
number of faces: 10%|██████████████████████████████████████████████████████████████████| 25/25 [00:04<00:00, 4.84it/s]
prompt for the face: serious expression
100%|████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 8.76it/s]
Total progress: 30it [00:06, 4.73it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 14.62it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 15/15 [00:03<00:00, 4.80it/s]
number of faces: 00%|██████████████████████████████████████████████████████████████████| 25/25 [00:04<00:00, 4.87it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 25/25 [00:04<00:00, 5.45it/s]

@player99963
Copy link
Author

I tend to use Hires. fix at the same time, and I'm not sure if this is relevant, because even if I close it, it still appears to not save.

Save original image
Show original image
Show intermediate steps
I've wondered if these three options might have an effect, but the failure to save automatically still occurs in different combinations, the rate of occurrence just seems to vary.

@ototadana
Copy link
Owner

@player99963 @xlinsite
Thank you for the detailed report.

In the case where the file is not saved, it seems that the face is not detected.

The fact that you are using "Hires. fix" may be generating a very large face image. If so, the following two options in "Advanced Options - (2) Crop and Resize the Faces" are likely to be affected.

  • Size of the face when recreating
  • Ignore faces larger than specified size

image

It is very likely that one of the following operations can improve the problem

  • Disable "Size of the face when recreating".
  • Set "Ignore faces larger than specified size" to a large number.

The former is the most likely to improve the situation, so please try the former first.

@player99963
Copy link
Author

@player99963 @xlinsite Thank you for the detailed report.

In the case where the file is not saved, it seems that the face is not detected.

The fact that you are using "Hires. fix" may be generating a very large face image. If so, the following two options in "Advanced Options - (2) Crop and Resize the Faces" are likely to be affected.

  • Size of the face when recreating
  • Ignore faces larger than specified size

image

It is very likely that one of the following operations can improve the problem

  • Disable "Size of the face when recreating".
  • Set "Ignore faces larger than specified size" to a large number.

The former is the most likely to improve the situation, so please try the former first.

I tried the method you described.
It seems to have improved the situation, but there are still many images that are not saved.

The image size I used for my test was 344 wide * 512 high, and I used Hires. fix to enlarge it twice. The pictures are half-body pictures from the head to the waist or legs.

@ototadana
Copy link
Owner

@player99963
If you disable "Size of the face when recreating" and it still does not work as expected, there may be another cause. Specifically, the faces in the generated images may not be recognized as faces.

Is the style of the image you are creating now realistic or anime style? If it is an anime style, the default face detection feature often does not work well.

The following ticket may help you resolve this problem: #94 (comment)

@player99963
Copy link
Author

@player99963 If you disable "Size of the face when recreating" and it still does not work as expected, there may be another cause. Specifically, the faces in the generated images may not be recognized as faces.

Is the style of the image you are creating now realistic or anime style? If it is an anime style, the default face detection feature often does not work well.

The following ticket may help you resolve this problem: #94 (comment)

Yes, I use anime style.
I enabled "Search workflows in subdirectories" and selected "yolo", and then Workflow came up with a few more options. After a little testing, I found that lbpcascade_animeface was the most effective, and nothing else seemed to work.

In addition, I found that when "Show intermediate steps" is turned on, the generated image is often not displayed in the right area, but remains as a preview of the original image. Also, the sound effect of the picture generation does not play.
This only seems to happen when the face is successfully detected.

@player99963
Copy link
Author

Now it seems that the face detection problem is largely solved.
However, sometimes the AI still generates faces that are difficult to recognize, such as when part of the head or face is outside the frame. In order to avoid losing the picture, I have to save it manually in such cases or turn on auto save for the original picture, but these methods are not ideal after all.
So I was wondering if I could implement a feature like "automatically save the original picture when face detection fails".

@ototadana
Copy link
Owner

@player99963
Thanks for the suggestion.

I have added a "Save original image if face detection fails" option on the Settings tab.

Please give it a try!

@iamrohitanshu
Copy link
Contributor

iamrohitanshu commented Jul 5, 2023

Hey @ototadana , thanks for the extension.
Started using this yesterday, really liking this.
But this issue got me losing good some generations.
I'm not complaining now as you have solved this, but this is not an enhancement issue as this is tagged, this is definitely a bug.

Also, this should be the default behavior. A person who has marked the setting to save all the images, wants that to be done always.
So, please make it the default behavior, so that newcomers don't lose their generations.
Again, thank you for your hard work.

EDIT:
I actually went ahead and made the change in this pull request which changes the default behavior to True.
#124

@ototadana
Copy link
Owner

@iamrohitanshu
Thanks for your valuable input!
I could see that this was a desired feature.

@player99963
Copy link
Author

In addition, I found that when "Show intermediate steps" is turned on, the generated image is often not displayed in the right area, but remains as a preview of the original image. Also, the sound effect of the picture generation does not play.
This only seems to happen when the face is successfully detected.

Is there a solution to this problem?

@ototadana
Copy link
Owner

@player99963

Is there a solution to this problem?

This may be a different issue.

Are you getting any errors in the console when this problem occurs?

If so, could you share the error message and traceback? That will help us solve the problem.

@player99963
Copy link
Author

@player99963

Is there a solution to this problem?

This may be a different issue.

Are you getting any errors in the console when this problem occurs?

If so, could you share the error message and traceback? That will help us solve the problem.

My bad, I forgot to prepare this information for you. It is here:

100%|████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 8.75it/s]
Total progress: 30it [00:06, 4.48it/s]
Traceback (most recent call last):it/s]
File "E:\A1111 Web UI Autoinstaller\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 422, in run_predict
output = await app.get_blocks().process_api(
File "E:\A1111 Web UI Autoinstaller\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1326, in process_api
data = self.postprocess_data(fn_index, result["prediction"], state)
File "E:\A1111 Web UI Autoinstaller\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1260, in postprocess_data
prediction_value = block.postprocess(prediction_value)
File "E:\A1111 Web UI Autoinstaller\stable-diffusion-webui\venv\lib\site-packages\gradio\components.py", line 4457, in postprocess
file = self.img_array_to_temp_file(img, dir=self.DEFAULT_TEMP_DIR)
File "E:\A1111 Web UI Autoinstaller\stable-diffusion-webui\venv\lib\site-packages\gradio\components.py", line 355, in img_array_to_temp_file
return self.pil_to_temp_file(pil_image, dir, format="png")
TypeError: save_pil_to_file() got an unexpected keyword argument 'format'

@ototadana
Copy link
Owner

@player99963
Thanks for sharing the information.

This seems to be the same issue as #120, so let's move there and have a conversation.

I will check the internet a bit to see if there is any useful information on this issue, as I cannot reproduce it in my environment. I will report back in Issue #120 as soon as I find something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants