Website: https://cursedprograms.github.io/Changeling-Tonsor/
Anyone's hairstyle on you, and your beard. A tonsor was a Roman barber (a tonstrina was his shop). Give Tonsor a photo of you and a photo of anyone whose hair you want: their cut, length and parting, and its colour (or another photo's colour), on your own face. Every face here is an AI-generated person who doesn't exist.
Part of the Changeling family, all together in Changeling Studio: Imago · Imago Realtime · Tiresias (gender) · Chronos (age) · Natio (where in the world) · Cosmeta (makeup, hair, beards) · Echo (voices) · Tonsor (hairstyles) · realtime: Tiresias · Chronos · Natio · Cosmeta.
The barber does beards too (they moved here from Changeling Cosmeta):
- Beard colour (black to white, ginger, blonde), Stubble (painted in: a shadow of a beard) and Shave (the face's own skin back over stubble or a short beard), each with its strength. They work on the new hairstyle or on your photo as it is, and answer at once.
- AI hairstyle: describe any hairstyle ("a pink pixie cut with an undercut") and AetherCanvas AI draws it on you, keeping your face. For the styles HairFastGAN can't carry (braids, beads, pigtails), this is the way.
- AI beards (a full beard, a goatee, a moustache, clean shaven) through AetherCanvas AI when it's running; Undo the AI beard.
How: dlib's 68 face points give the beard area (the jaw from cheek to cheek and a little past it, up to the nostrils, without the lips), and BiSeNet keeps it off the background and clothes. Inside it, the beard is whatever is clearly darker than the face's skin, or lighter and greyer (a white beard on darker skin). The colour is blended in LAB, so each hair's light and shade stay. Both models come with HairFastGAN's, so the beard needs nothing extra.
HairFastGAN (AIRI Institute, NeurIPS 2024, MIT) does the work. Each photo is found, aligned and cropped to the face as StyleGAN2's FFHQ faces are. It encodes the faces in StyleGAN2's FS space, moves the hair's shape from one photo and its colour from the other onto yours, and blends. Nothing is learned per photo: about 20 seconds a hairstyle on a 6 GB card, after about a minute of loading. The result is the face frame, 1024 x 1024, as Changeling Tiresias's and Chronos's are.
What Tonsor adds:
- the window, in Changeling's look;
tonsor/patch_hairfast.py, which makes HairFastGAN run anywhere. Its StyleGAN2 ops become plain PyTorch, so it needs no Visual Studio compiler or CUDA toolkit. CLIP goes inF:\AIModels\clip, and the models are read from wheretonsor/models.pykeeps them;tonsor/models.py, which fetches only the files hairstyle transfer needs (about 6 GB), intoF:\AIModels\HairFastGANwhen that drive is there. e4e is copied from Changeling Tiresias, Chronos or Natio rather than downloaded again.
- Python 3.9 - 3.12 and an NVIDIA GPU (6 GB works).
- Start
run.bat(orrun.ps1,run.sh). The first time it clones HairFastGAN, makes its environment and fetches the models. - Open photo of you, then the hairstyle: Pick a photo of someone with it (face to the camera, the hair in
view), or one from
hairstyles/(put favourites there). The colour: the hairstyle's own, or Another photo's. Then Cut (Enter) and Save.
On the command line: run.bat you.jpg hairstyle.jpg -o out.png (--colour other.jpg for the colour).
- It knows the hair StyleGAN2 learned from FFHQ's photos. Long, short, wavy, straight, bobs and colours work well. Braids, beads, pigtails and other elaborate styles don't carry over: a goth's red braided pigtails came out as loose pinkish blonde hair, and short twists on a woman came out as short dark hair without the twists.
- The result is the face frame, not the whole photo.
- Shave suits stubble and short beards; on a full beard it leaves a smudge: use the AI Clean shaven for that.
- Use it on yourself, on generated people, or on people who agreed.
Tonsor is MIT. HairFastGAN is MIT. Its StyleGAN2 FFHQ weights are under NVIDIA's non-commercial license, so this is for personal and research use.




