Giter VIP home page Giter VIP logo

began-tensorflow's Introduction

BEGAN: Boundary Equilibrium Generative Adversarial Networks

Implementation of Google Brain's BEGAN: Boundary Equilibrium Generative Adversarial Networks in Tensorflow.
BEGAN is the state of the art when it comes to generate realistic faces.

Figure1a. 128x128 img and 64x64 img. 128x128 img is very impressive. You can see SET OF TEETH

Figure1b. This is random result from my train model. From gamma 0.3 to 0.5. No cherry picking. gamma 0.3, nice but bias to women's face. gamma 0.4, Best. gamma 0.5, good texture but hole problem.

Figure1c. From scratch to 200k iter

Implementation detail

This train model is 64x64. 128x128 will be update. Different with original paper is train loss update method, learning rate decay. First, paper's loss update way is Loss_G and Loss_D simultaneously. But when I tried that way, models are mode collapse. So, This code use altenative way. Second, learning rate decay is 0.95 every 2000 iter. This parameter is just train experienc. You can change or see the paper.

Train progress

If you want to see the train progress download this dropbox folder and run "tensorboard --logdir='./'". I uploaded two trained model(64x64 and 128x128)

Figure2. Kt graph. When you train model, reference this result. It doesn't reach to 1.0. In my case, it's converge to 0.08

Figure3. Convergence measure(M_global). Similar with paper's graph

Figure4. Compare with Generator output and Decoder output.

Usage

Recommend to download trained model this dropbox folder.

Make Train Data

  1. Download celebA dataset (img_align_celeba.zip) and unzip to 'Data/celeba/raw'
  2. Run ' python ./Data/celeba/face_detect.py '

Train (refer the main.py began_cmd)

ex) 64x64 img | Nz,Nh 128 | gamma 0.4
python3 main.py -f 1 -p "began" -trd "celeba" -tro "crop" -trs 64  -z 128 -em 128 -fn 64  -b 16 -lr 1e-4 -gm 0.4 -g "0"

ex) 128x128 img | Nz,Nh 64 | gamma 0.7
python3 main.py -f 1 -p "began" -trd "celeba" -tro "crop" -trs 128 -z 64  -em 64  -fn 128 -b 16 -lr 1e-4 -gm 0.7 -g "0"

Test (refer the main.py and began_cmd)

ex) 64x64 img | Nz,Nh 128 | gamma 0.4
python3 main.py -f 0 -p "began" -trd "celeba" -tro "crop" -trs 64  -z 128 -em 128 -fn 64  -b 16 -lr 1e-4 -gm 0.4 -g "0"

ex) 128x128 img | Nz,Nh 64 | gamma 0.7
python3 main.py -f 0 -p "began" -trd "celeba" -tro "crop" -trs 128 -z 64  -em 64  -fn 128 -b 16 -lr 1e-4 -gm 0.7 -g "0"

Requirements

  • Python 3.5, scipy 0.18.1, numpy 1.11.2
  • TensorFlow 1.1.0

Author

Heumi / [email protected]

began-tensorflow's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

began-tensorflow's Issues

Minor corrections to the code

Line 158 in op_BEGAN is:
nowDatetime = now.strftime('%Y-%m-%d_%H:%M:%S')

Change it to:
nowDatetime = now.strftime('%Y-%m-%d_%H_%M_%S')

Line 38 in op_base.py is:

    self.project_dir = 'assets/{0}_{1}_{2}_{3}/'.format(self.project, self.dataset, self.data_opt, self.data_size)

Change it to:

    self.project_dir = 'assets/{0}_{1}_{2}_{3}'.format(self.project, self.dataset, self.data_opt, self.data_size)

Forgot src folder?

Hey! Thank you for uploading your implementation and opening a discussion on Github. Unfortunately, the code won't run without the src folder ;)

cant't load your model!

firstly , thanks for your code ! as a tf beginner, i learned a lot from you code, but in this code ,i can't load your model file which named 'began_gm0.4.model-429439.data-00000-of-00001', it is not a ckpt file , how can i load it ,please help me ,thanks for your time

Not running properly

Hello, When I run this code with:
python3 main.py -f 1 -p "began" -trd "celeba" -tro "crop" -trs 64 -z 128 -em 128 -fn 64 -b 16 -lr 1e-4 -gm 0.4 -g "0"
or any other configurations, it works till shuffle done and it stops!
any suggestion? did anyone else got same error?

UnboundLocalError;What can I do?

File "main.py", line 56, in
main()
File "main.py", line 51, in main
model.train(args.flag)
UnboundLocalError: local variable 'model' referenced before assignment

Missing link to the training progress

I think you might accidentally give the wrong link to the dropbox when you gave away the link used to visualise the training progress with tensorboard.

Practical Application?

Hi! I'm very interested in your project, I'm currently working on an open source project that should be able to interpolate the face (with expression) in video frames of person a into something that looks more like person b.

What I have so far:

Dataset Generation

  • Extracting frames from many youtube videos of person a or person b
  • Running facial recognition and alignment to save every training usable region of interest with the correct people into personA and personB folders

Translation Utility

  • Provide low fps video of person a, for each frame extract the region of interest (face)
  • Run it through some kind of image translation (I would like to use your project for that)
  • Then save the result back into the original region of interest. (possibly add color correction, etc of modified roi with pix2pix)

What I want to use your project for:

Image Translation
personA->personB conversion (or at least a high similarity, like in the male->female projects) of regions of interest in individual videoframes

What I don't understand

How to use your project for this purpose ;) Can you point me in a direction, so that I can set up your project for this specific application?

glob 'module' object is not callable

On 55-th line in op_base.py,
data = sorted(glob(os.path.join(data_path, "*.*")))
I get the following error,

Traceback (most recent call last):
  File "/home/jay/pycharm-2017.1.1/helpers/pydev/_pydevd_bundle/pydevd_exec.py", line 3, in Exec
    exec exp in global_vars, local_vars
  File "<string>", line 1, in <module>
TypeError: 'module' object is not callable

I followed your instructions correctly.

Is it because I'm using Ubuntu or Pycharm?

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.