Project Real Images with StyleGAN2

Project Real Images with StyleGAN2

This will be a quick post sharing some resources that I created to help generate StyleGAN2 images for a given source image. My specific use case was synthetic image / deep fake detection, but you may use it for other tasks.

Cat from COCO dataset

Real Image

COCO cat synthesized with StyleGAN2

Synthesized Image

Resynthesize your own images with StyleGAN2

The first notebook below will assist in resynthesizing your own images. You will need:

  1. A StyleGAN2 model, pretrained on images of the class you wish to generate.
  2. A set of real images (ideally, but not necessarily) of your class which you wish to resynthesize.

Resynthesize COCO images with StyleGAN2

The second notebook generates COCO images for the classes: cat, horse, or car. One thing to note is that often times the source image has just a sliver of your target class. In these cases, the model will try to do its best, but don’t expect very accurate results.

You won’t need any additional items to run this notebook.

Final Thoughts

I hope this was helpful to anyone. You can find loads of StyleGAN2 models created for different tasks here. Feel free to reach out if you run into any issues.

If you would like to see more similar posts, head over to the Projects section of my blog. Thanks for reading!