-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
feat: add inpaint mask generation functionality #2032
feat: add inpaint mask generation functionality #2032
Conversation
Where should I place these mask generation models? |
@diaolulu1 the models should automatically be downloaded when selecting the model and using it the first time (see screenshot below, default mask generation model is |
Yes, segment map models will return segments (duh) and not one map, so sadly i'll have to remove them later today. |
Gravacao.de.Tela.2024-01-24.as.20.39.32.mp4 |
PR mashb1t#5 |
…ration Add options to u2net_cloth_seg, add u2net_human_seg again
@mashb1t, how about SAM with prompt? Gravacao.de.Tela.2024-01-25.as.15.49.54.mp4 |
@rayronvictor sure, looks really good! I'd propose to put the advanced settings in developer debug mode inpainting, but don't see why we shouldn't use this! Feel free to provide your code in an additional PR to the fork branch (like last time), so we can merge it here. |
…ation' into feature/add-inpaint-mask-generation # Conflicts: # webui.py
PR created mashb1t#6 |
automatically unload model when not needed anymore
…-inpaint-mask-generation
this is overridden anyways
When I start, it prompts and when I use the inpaint mask generation, just error Traceback (most recent call last): |
As you can see rembg is in the requirements_versions.txt, see https://github.com/lllyasviel/Fooocus/pull/2032/files#diff-2284b86f286dc7e0ea4bd09a0ec20c78fbb17d6724d7f0053e78428d0715bbb1R19 Please make sure to manually install the dependencies if you're not using the automated way. Is there a specific error in the install? |
I just followed the instructions in this link to manually modify and add them. rembg is sure in the requirements_versions.txt |
[System ARGV] ['FooocusNov\entry_with_update.py'] stderr: error: subprocess-exited-with-error python setup.py egg_info did not run successfully. |
Why does the seg models are saved to a different folder?
This is really inconvenient for Fooocus running in Docker or remote server. Is it possible move the models to |
@thiner it seems like we can set and override the env var |
@ChineseNorris i've double checked, gradio does either allow
OR
To keep the mask upload functionality is IMHO mandatory and there currently is nobody working on the Gradio 3.x => 4.x upgrade, so this feature won't be available anytime soon. |
@mashb1t I see, I agree with you that this functionality is mandatory and we should move the "correction" of the mask in another thread, I'll see what I can do but it's going to take some time since I'm not familiar with Gradio at all lol |
could you please add add inpaint mask generationto other branches where the waiting time to start are faster compare to Main branch. ty so much. also is it hard to implement it if id like the add inpaint mask generation to have it on my personal branch? |
I've found a solution for that but I can't push the commit to the repository, maybe you can help me out? @mashb1t |
@ChineseNorris sure, you can make a fork of my fork, commit and make a PR to this branch on my fork: mashb1t:feature/add-inpaint-mask-generation |
I'm trying to PR but it keeps saying that I don't have access to this repository |
@ChineseNorris you can't directly push to my repository, please make a fork of it. Alternatively you can also upload the changed files as a zip |
I've made a PR on your fork, please check it when you have time. I also noticed another "issue" with the automatic mask generation, where the elements inside the mask are changed in the borders, mostly parts where the mask end. Is it possible to tweak this setting in order to alter more or less the part that is unmasked? |
@ChineseNorris this can be modified, check out the dilate or erode slider in developer debug mode right above the checkboxes for enabling the mask. |
I've updated to the latest version but it seems that I'm having issues with the last commit, what am I missing? I got assertion error
|
@ChineseNorris somehow you're not using an inpaint engine in the array of modules.flags.inpaint_engine_versions, please change accordingly or reset the input to the available values. |
C:\Fooocus\Fooocus_win64_2-1-831>.\python_embeded\python.exe -s Fooocus\entry_with_update.py --preset realistic --theme dark stderr: error: subprocess-exited-with-error python setup.py egg_info did not run successfully. [6 lines of output] note: This error originates from a subprocess, and is likely not a problem with pip. Encountered error while generating package metadata. See above for output. note: This is an issue with the package mentioned above, not pip. CMD Failed requirements: install -r "requirements_versions.txt"@mashb1t No matter what I do to fix this issue, I am getting the above messages, and inpain rembg does not work on my fooocus. Could youd help me fix this issue please? I have installed your latest file from this Git and paste those files into my fooocus directory. |
User |
you need to check line 41 of file C:\Users\RYAN\AppData\Local\Temp\pip-install-69exdztx\groundingdino-py_06a57fcdf63d4f4db884246e025736f4\setup.py, see what kind of special character is there which is not compatible with |
Thank you for your advice. I actually tried to find 'setup.py' in the temp folder on my Windows 10 computer. However, since it is a temporary folder, I couldn't find that file. I tried converting every related file to UTF-8, but I failed to fix the issue. Is there any way I can find setup.py in any other places in the Fooocus folder? |
from the path, it seems like the temporary file generated by pip while installing the dependency Just checked the file changes in the PR, there is a new requirement added |
Thank you very much. After I changed the computer's region setting to the U.S. and English, it works pretty well. Again, I really appreciate your help. |
@mashb1t is it possible to merge this PR first and we keep up with the modifications? Otherwise this function is going to take forever |
true, when it's going to be merged? |
@ChineseNorris @aolko i originally planned to include this feature in 2.3.0, but decided against it so we could have a package update only release, which is also why the milestone for said updates has been created: https://github.com/lllyasviel/Fooocus/milestone/4 I currently have little time to push development of Fooocus further but will try my best in the time i have. |
part of v2.5.0-rc1 |
Implements #1987
Uses rembg, see https://github.com/danielgatis/rembg
EDIT: Shopify just announced this exact same feature in https://www.shopify.com/magic, see also https://www.theverge.com/24056980/shopify-generative-ai-image-editing-search
This feature allows users to upload an inpaint image and automatically generate the mask for it based on rembg models, so they don't need to switch tools for this.
Process:
Possible extension (in general, not necessarily regarding this feature): add mask handling for image mask gradio canvas, so users can add an additive mask to the mask image OR disable mask canvas for this image.