-
Notifications
You must be signed in to change notification settings - Fork 159
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
Enhancements: Added GPEN 1024 & 2048 support, added "immediate restore" toggle that restores BEFORE swapping, and more! #321
Conversation
@@ -66,6 +75,90 @@ | |||
TARGET_FACES_LIST = [] | |||
TARGET_IMAGE_LIST_HASH = [] | |||
|
|||
def get_restored_face(cropped_face, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Get rid of the copypasta here
Thanks for this PR, I will take a closer look this week! |
scripts/reactor_swapper.py
Outdated
|
||
# Note the use of Lanczos here; this is functionally the only change from the source code | ||
bgr_fake = cv2.warpAffine(bgr_fake, IM, (target_img.shape[1], target_img.shape[0]), borderValue=0.0, | ||
flags=cv2.INTER_LANCZOS4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not sure which is better between bicubic or Lanczos here; thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lanczos eats more resources and have a bit more sharpness in details (but can oversharp sometimes), but bicubic eats less and have more "stable" sharpness
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I just pushed a commit switching to bicubic; feel free to test & compare against Lanczos.
IME they are close to indistinguishable for this use case, so IMO we can go with bicubic for being a bit more lightweight.
Hi @not-ski trying to understand the face booster node better.
Thanks |
Hope this helps :) |
Thanks @not-ski. How do I restore before pasting it back into the image? As you described above: "Adds a toggle to the main node to enable restoration on the 128px swapped face before it gets pasted back into the target image" I only see the option to restore after pasting, not before |
@ckao10301 the Face Booster node restores before pasting |
@not-ski Face boost is messing up the eyes. Do you have advice on how to prevent this? Another problem is, if I boost with GPEN instead of GFPGAN, the result looks overcooked in addition to eyes being messed up. How do I prevent the overcooking? When should I use GPEN instead of GFPGAN? Workflow: |
@ckao10301 you can try to reduce |
I've been messing around with my local install of Reactor for awhile now, and I've finally landed on a subset of changes that I think would be highly beneficial to merge into the public release:
half_det_size()
if no faces are found when attempting to swapThat last change is the biggest one; the way Reactor currently handles swapping -> restoration involves multiple steps of upscaling/downscaling the cropped face (and affine transformations). This produces a lot of artifacting and detail loss that is especially palpable when using the larger 1024/2048px restoration models.
By performing restoration on the original 128px swapped face, we can ensure maximal detail/likeness preservation, and the final result is often noticeably better. I will follow up with some examples showcasing this in the thread below.