Skip to content

darkushin/Style-GAN-Prior

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Style-GAN-Prior

This project is an extension to the article Style Generator Inversion for Image Enhancement and Animation by Aviv Gabbay and Yedid Hoshen (GitHub). Two additional applications are introduced to this method: Image deblurring using a known blur kernel and image recoloring of gray images to RGB images.

Deblurring

In this task, images are deblurred using the style-GAN-prior and a known blur kernel.

Input image:

image

Gaussian Blur Uniform Blur Motion Blur
image image image
Gaussian Reconstruction Uniform Reconstruction Motion Reconstruction
image image image

Input image:

image

Gaussian Blur Uniform Blur Motion Blur
image image image
Gaussian Reconstruction Uniform Reconstruction Motion Reconstruction
image image image

Recoloring

In this task, gray images are recolored using the style-GAN-prior. The conversion of an RGB image to a gray image was performed using the formula: Y = 0.2126R + 0.7152G + 0.0722B

RGB Image Gray Image Recolored Image
image image image
image image image

Usage

Getting started

  1. Clone the official StyleGAN repository.
  2. Add the local StyleGAN project to PYTHONPATH.

Style Image Prior for Deblurring

Deblurring blurry images using a known blur kernel:

deblurring.py --blurred-imgs-dir <blurred-input-dir> --deblurred-imgs-dir <deblurred-output-dir>
    --latents-dir <output-latents-dir> --blur-kernel <blur-method>
    [--original-imgs-dir <originl-imgs-dir>]
    [--blurred-img-size BLURRED_IMG_HEIGHT BLURRED_IMG_WIDTH]
    [--learning-rate LEARNING_RATE]
    [--total-iterations TOTAL_ITERATIONS]

Notes:

  1. The optional values for the blur-kernel flag are: gaussian/uniform/motion-vertical/motion-horizontal.
  2. If the original-imgs-dir is specified, the chosen blur-kernel will be first applied to all images in this dir and the blurred images will be saved in the blurred-imgs-dir.
  3. The default input image size is 256X256X3. This can be changed using the --blurred-img-size flag.

Style Image Prior for Image Recoloring:

Given a gray face image, reconstruct an RGB image:

coloring.py --gray-imgs-dir <gray-input-dir> --colored-imgs-dir <colored-output-dir>
    --latents-dir <output-latents-dir>
    [--original-imgs-dir <originl-imgs-dir>]
    [--img-size GRAY_IMG_HEIGHT GRAY_IMG_WIDTH]
    [--learning-rate LEARNING_RATE]
    [--total-iterations TOTAL_ITERATIONS]

Notes:

  1. If the original-imgs-dir is specified, all images in this dir will be first converted to gray images using the formula Y = 0.2126R + 0.7152G + 0.0722B and saved in the gray-imgs-dir.
  2. The default input image size is 256X256X3. This can be changed using the --img-size flag.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages