Skip to content

mmorsi4/face-generation-diffusion-model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Conditioned U-Net for Face Generation

Generating faces using a U-Net based Diffusion Model trained on CelebA dataset (~100K images) conditioned on 40 distinct categories.

diffusion demo

How to Run

Using your existing emvironment:

pip install -r requirements.txt

Download the model from here and throw it in /resources, or train your own!:

python scripts/train.py

Generate a GIF from a model provided in /resources by first modifying the c tensor in make_gif.py:

c = torch.tensor([
    0,  # 5_o_Clock_Shadow
    0,  # Arched_Eyebrows
    0,  # Attractive
    0,  # Bags_Under_Eyes
    0,  # Bald
    1,  # Bangs
    1,  # Big_Lips
    0,  # Big_Nose
    0,  # Black_Hair
    0,  # Blond_Hair
    0,  # Blurry
    1,  # Brown_Hair
    0,  # Bushy_Eyebrows
    0,  # Chubby
    0,  # Double_Chin
    1,  # Eyeglasses
    0,  # Goatee
    0,  # Gray_Hair
    1,  # Heavy_Makeup
    0,  # High_Cheekbones
    0,  # Male
    0,  # Mouth_Slightly_Open
    0,  # Mustache
    1,  # Narrow_Eyes
    0,  # No_Beard
    0,  # Oval_Face
    0,  # Pale_Skin
    0,  # Pointy_Nose
    0,  # Receding_Hairline
    1,  # Rosy_Cheeks
    0,  # Sideburns
    0,  # Smiling
    0,  # Straight_Hair
    0,  # Wavy_Hair
    0,  # Wearing_Earrings
    0,  # Wearing_Hat
    0,  # Wearing_Lipstick
    0,  # Wearing_Necklace
    0,  # Wearing_Necktie
    1,  # Young
], dtype=torch.float32)

then run the script: python scripts/make_gif.py

Outputs are written under /output/samples/.

About

A modified implementation of the "Denoising Diffusion Probabilistic Models" paper by Jonathan Ho, Ajay Jain, Pieter Abbeel.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors