Spaces:
Running

aditya-rAj19 commited on
Commit
0ab4ea6
·
1 Parent(s): b1cd367

Stop the seam blend from erasing the head swap

Browse files

With the Head Swap toggle on, the output was indistinguishable from an ordinary
face swap. The head transplant ran, but step 3b then blended the swapped face
against `target` — the ORIGINAL scene — rather than against `base`, the image
the head swap had just produced. Everywhere outside the face mask, which is
exactly where the transplanted head shape and hair live, the result was pulled
back to the untouched target.

Measured on the Library target: full_head_swap changes the frame by mean 0.90,
but only 0.29 survived the blend — roughly two thirds of the effect discarded.
Blending against `base` retains 0.90, and end to end the toggle now changes
1.69% of pixels by more than 15 levels instead of producing the same picture.

`base` is `target` whenever the head swap is off, so nothing changes there. The
file's own comment already warned about this trap for the hair step; the same
one was left open for the head swap.

Also drops the composite feather from 0.025 to 0.012, which measured slightly
crisper at the hairline (1531 -> 1578 on a Laplacian-variance check).

The remaining softness is a property of the source photo, not the blend: the
head is warped by whatever scale maps the source's landmarks onto the target's,
so a smaller source head is upscaled — 1.43x here — and lands softer than the
photograph around it. Documented on full_head_swap rather than papered over.

14 tests pass.

2 files changed +18 -4
Files changed (2)
core/head_swap.py+9-1
web_app.py+9-3