Skip to content

The last three Neural Filters, and a network for one of them - #71

Merged
IAmJSD merged 1 commit into
mainfrom
t3code/portrait-filters
Aug 29, 2026
Merged

The last three Neural Filters, and a network for one of them#71
IAmJSD merged 1 commit into
mainfrom
t3code/portrait-filters

Conversation

@IAmJSD

@IAmJSD IAmJSD commented Aug 29, 2026

Copy link
Copy Markdown
Member

Smart Portrait, Makeup Transfer and Sketch to Portrait were the three Neural Filters left out, because Adobe's are generative and a generative model does not fit in a filter. None of them needed to be. All fifteen are now in the menu, twelve of them run a network, and none of those networks are Adobe's.

Smart Portrait

Warps and relights rather than redrawing. A smile is the corners of the mouth lifted, surprise is the brows raised, age is skin texture added or taken away, and the light comes off the surface MiDaS measures — with a guard at the silhouette, where a depth cliff would otherwise leave a halo. It opens with every expression neutral and the light where it already is, because the picture it was given is the picture the photographer took.

Makeup Transfer

Moves colour, not texture, from the face on the layer below: it matches the statistics of the lips, the eyes and the skin separately, so you get someone else's lipstick and eyeshadow and not their eyeliner. With no face in either picture it leaves the layer alone, which is what the new makeup_transfer_leaves_a_picture_with_no_face_in_it_alone pins.

Both find the face with UltraFace and then assume the features are where a face looking at the camera keeps them — so both work on a portrait and fall apart on a profile, which the README says out loud.

Sketch to Portrait

Runs a new 448k-parameter network, trained here rather than downloaded. It was fitted to invert this build's own Photo to Sketch, which is a far smaller question than inventing a photograph and is why it fits in the binary at all. Training data is sixteen thousand face crops, cut by the new tools/train/faces.py out of the CC BY 2.0 Open Images photographs tools/train/photos.py fetches, framed exactly the way the filter frames them at run time.

It comes back at 29% of the sketch's error against the original photograph, and the test that says so runs the same sketch operator the training script does — so the filter and the model cannot drift apart unnoticed. The Colour slider scales the chroma the network chose: fitted to absolute error it hedges, because a sketch genuinely does not say what colour anything was.

Give it a pencil drawing from a sketchbook and it does something in the same spirit and rather worse. The README says that too.

Also

  • schist_neural::run_framed, for models that want the whole picture at once rather than tiles at full resolution — filling in a drawing of a face means knowing it is a face.
  • tools/train/photos.py grew --label and --split, so the corpus fetcher can pull face-labelled photographs specifically.

Checks

cargo fmt, cargo clippy --workspace --all-targets and cargo test --workspace are all clean. The three filters were verified on real photographs and in the running application headlessly; the Filter ▸ Neural Filters menu lists all fifteen.

🤖 Generated with Claude Code

Smart Portrait, Makeup Transfer and Sketch to Portrait were the three
left out, because Adobe's are generative and a generative model does
not fit in a filter. None of them needed to be, and the README now
says exactly where each one stops.

Smart Portrait warps and relights rather than redrawing: a smile is
the corners of the mouth lifted, surprise the brows raised, age skin
texture added or taken away, and the light comes off the surface MiDaS
measures -- with a guard at the silhouette, where a depth cliff would
otherwise halo. Makeup Transfer moves colour and not texture from the
face on the layer below, matching the statistics of the lips, the eyes
and the skin separately. Both find the face with UltraFace and then
assume the features are where a face looking at the camera keeps them.

Sketch to Portrait runs a new 448k-parameter network, trained here to
invert *this build's own Photo to Sketch* -- a far smaller question
than inventing a photograph, and one that fits. Sixteen thousand face
crops, cut by tools/train/faces.py out of the CC BY 2.0 Open Images
photographs tools/train/photos.py fetches, framed exactly the way the
filter frames them at run time. It comes back at 29% of the sketch's
error against the original, and the test that says so runs the same
sketch operator the training script does, so the filter and the model
cannot drift apart unnoticed. Its Colour slider scales the chroma the
network chose: fitted to absolute error, it hedges, because a sketch
genuinely does not say what colour anything was.

Also adds run_framed for models that want the whole picture at once,
rather than tiles at full resolution: filling in a drawing of a face
means knowing it is a face.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@IAmJSD
IAmJSD merged commit ef0b21f into main Aug 29, 2026
3 checks passed
@IAmJSD
IAmJSD deleted the t3code/portrait-filters branch August 29, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant