FaceMorpher
FaceMorpher is an innovative project to get a unique face morph (or interpolation for geeks) on a website. Yes, this means you can see faces morphing into each other! These are created by the beautiful StyleGAN models, and DCGAN for comparison. Go ahead here.
Why Build It
Seems like a fun way to bring cool machine learning research to web development.
How it works
Machine Learning side
All these models are just GANs, which are basically just functions that take in a random vector and give an image (or in this case, a face.) So to see how the faces morph into each other, just see how the vector changes as you move it around the space. To see how two faces morph into each other, I choose two random vectors and see how as I move in the direction of the second vector from the first vector the faces generated change (make all the images a video.)
Web Development Side
screwed up unique software design.
FaceMorpher has a really All of the videos generated by the models are pre-generated (sorry, didn't want to keep you waiting for 2 minutes for a StyleGAN video on my CPU!) and hosted on an AWS S3 Bucket. When a video is requested from the frontend, an API I created (deployed on Heroku) will return the video link for a random video for it's "type" (stylegan(2), dcgan), to be used in the HTML to render the video. After the response, the API sends a request to my localtunnel to generate a new video (stylegan if a stylegan video url was returned, etc.) and upload that to the shared S3 Bucket. Talk about functional design!
Tech Stack
All platforms that I used:
- Heroku
- AWS S3 Bucket
- Localtunnel
- Svelte
- Smelte
- PyTorch
Acknowledgements
I did copy code to make the models and generate the videos. Stop pretending like you don't lmao
- DCGAN: PyTorch Official Documentation Tutorial
- StyleGAN: https://github.com/huangzh13/StyleGAN.pytorch
- StyleGAN2: https://github.com/NVlabs/stylegan2-ada-pytorch