Giter Site home page Giter Site logo

d-bohn / retouchml Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ju-leon/retouchml

0.0 0.0 0.0 81.9 MB

Enhances faces on images and automatically beautifies them using StyleGan2 and machine learning

License: Other

Jupyter Notebook 89.19% Dockerfile 0.01% Python 10.37% Cuda 0.42% Shell 0.02%

retouchml's Introduction

RetouchML — Beautify faces on images using StyleGan2

Python 3.6 TensorFlow 1.15 cuDNN 10.0 License CC BY-NC

Beautify images using StyleGan2.

Faces on images are recognized, normalised and converted into the corrensponding StyleGan2 Vector.

Afterwards, the vector will be optimized to "beautify" the face.

The face is then stiched back into the original image.

Before/After examples:

All after images were generated entirely without human input.

merkel-ba

© Raimond Spekking / CC BY-SA 4.0​

pexel-ba

couco-ba

© Gage Skidmore / CC BY-SA 3.0

Manual Editing

Latent space representations allow for manual changes to the output image.

manual

How does it work?

process

1. Latent space encoding

First, the image is encoded into latent space. A latent vector is found that closely represents out input image. The encoder used is based on StyleGan2 Encoder.

2. Latent vector optimisation

Now to the fun part. Using a neural network that judges attractiveness of latent vectors, that face is optimized by the neural network.

Using a gradient ascent approach, the latent vector is slightly changed in the direction of steepest ascent, meaning we "make our face pretty".

We'll get a new latent vector that generates a "prettier" version of the original face.

3. Generate output image

The new latent vector is now converted back into an image by StyleGan2. The generated image is then stiched back into the original image.

Want to try it for yourself?

Clone the Repo(it needs an Nvidia GPU with Cuda and Tensorflow) or use Google Colab. To get started follow Beautify.ipynb

retouchml's People

Contributors

ju-leon avatar tkarras avatar rolux avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.