Dev.to AI 🤖 Ai 👁 0 📖 3 min read

Moles, freckles and scars: the identity marks a face swap quietly deletes

Most face-swap checks look at the big geometry: jaw width, eye spacing, whether the head angle matches. Those are the things a model is good at. The things it is worst at are the smallest ones — the mole under the left e

Most face-swap checks look at the big geometry: jaw width, eye spacing, whether the head angle matches. Those are the things a model is good at. The things it is worst at are the smallest ones — the mole under the left eye, the freckles across the nose, the thin scar on the cheek.

Those marks are the fastest tell for anyone who knows the face. A stranger sees a plausible face. A friend sees a face without the mole.

Why they disappear

A swap model is not reconstructing this face. It is reconstructing a face that looks like it belongs in this photo, at this angle, under this light. Small high-frequency blobs read to the model as noise, and noise is exactly what a generator is trained to remove. Then the blend step at the boundary softens whatever survived.

So you get one of four outcomes:

  1. The mole is gone.
  2. The mole is still there but moved a few pixels, because the warp shifted the region.
  3. The freckles became a uniform tint — the density is right, the individual dots are not.
  4. The scar turned into a soft shadow, which reads as lighting rather than skin.

Outcomes 2 to 4 are worse than 1, because they look almost right.

A 20-line check

Compare a fixed patch in the source and the output. You are counting small dark blobs, not measuring sharpness.

import numpy as np
from scipy import ndimage

def mark_count(patch, k=3.0, min_area=2, max_area=400):
    g = patch.mean(axis=2)
    hp = g - ndimage.gaussian_filter(g, 1.5)   # high-pass: keep dots, drop shading
    dark = hp < -k * hp.std()
    lab, n = ndimage.label(dark)
    areas = ndimage.sum(dark, lab, range(1, n + 1))
    return int(((areas >= min_area) & (areas <= max_area)).sum())

src = mark_count(source_patch)
out = mark_count(swapped_patch)
print(src, out, out / max(src, 1))

If the ratio drops below about 0.5, the swap deleted the identity marks. If the count is similar but the centroids moved more than a couple of pixels, the warp moved them. Both are fixable; neither shows up in a sharpness score.

Run it on the same patch coordinates and the same resolution. A mole that is 2 px in a 512 crop is 0.5 px in a 2048 export, and the count collapses for reasons that have nothing to do with the swap.

What actually fixes it

  • Put the marks back after the swap. Take the source's high-pass layer over the mark region, paste it at 30–60% opacity with a soft mask. Do not paste the whole face back — just the marks.
  • Do not sharpen. Sharpening invents edges along existing contours. It does not restore isolated dots, and it makes the boundary halo worse.
  • Keep source and output at the same scale. A resized source loses the marks before the model ever sees them.
  • In video, follow the warp, not the coordinates. A fixed pixel position drifts off the mole as soon as the head turns; sample the mark from the tracked position each frame, or it will flicker in and out.

Identity is not the average of a face. It is the irregularities. A swap that keeps them reads as the person; one that removes them reads as a model of the person — which is exactly what it is.

Try it on faceswapai.com — photos, videos and GIFs, up to 10 faces in a group shot, HD, no watermark.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.