资源算法portrain-gan

portrain-gan

2019-10-12 | |  171 |   0 |   0

Portrait-GAN

five_samples.png

Usage:

python download.py # downlaod the modelpython decode.py   # randomly sample model, files saves to outfile.pngpython decode.py --latent latent1.txt --outfile latent1.png # generate from saved

Bonus: non-working image encoder

I attempted to build a GAN encoder that would go from image to latent using torch.optim.LBFGS and gradient information.

As a warmup I did implement reverse_from_latent.py, which will read an input image (eg: belamy128.png) and then change that image to match a prexisting latent via LBFGS.

From that version I made reverse_from_image.py. The only change is that disabled gradients back to the image and instead tried to enable graidents through the model which (I thought) would optimize the latent to match the image. But each time I run that version I get:

RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn

I'm not sure if the lua model does not have the gradient information I need or if I am doing something else wrong. If anyone wants to take a crack at fixing this, it would be great to have this as a reference version of a simple GAN image to latent encoder.

上一篇:torch-light

下一篇:mri-analysis-pytorch

用户评价
全部评价

热门资源

  • Keras-ResNeXt

    Keras ResNeXt Implementation of ResNeXt models...

  • seetafaceJNI

    项目介绍 基于中科院seetaface2进行封装的JAVA...

  • spark-corenlp

    This package wraps Stanford CoreNLP annotators ...

  • capsnet-with-caps...

    CapsNet with capsule-wise convolution Project ...

  • inferno-boilerplate

    This is a very basic boilerplate example for pe...