carpedm20 / DCGAN-tensorflow

A tensorflow implementation of "Deep Convolutional Generative Adversarial Networks"
http://carpedm20.github.io/faces/
MIT License
7.14k stars 2.63k forks source link

to_json doesn't work #278

Closed sandy2008 closed 4 years ago

sandy2008 commented 6 years ago

When I deleted the # mark of the to_json, the python code failed to proceed.

to_json("./web/js/layers.js", [dcgan.h0_w, dcgan.h0_b, dcgan.g_bn0],
                 [dcgan.h1_w, dcgan.h1_b, dcgan.g_bn1],
                 [dcgan.h2_w, dcgan.h2_b, dcgan.g_bn2],
                 [dcgan.h3_w, dcgan.h3_b, dcgan.g_bn3],
                 [dcgan.h4_w, dcgan.h4_b, None])

error:

 [*] Success to read DCGAN.model-502
Traceback (most recent call last):
  File "main.py", line 100, in <module>
    tf.app.run()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "main.py", line 93, in main
    [dcgan.h4_w, dcgan.h4_b, None])
  File "/Users/pineapple0106/Anime/utils.py", line 96, in to_json
    layer_idx = w.name.split('/')[0].split('h')[1]

IndexError: list index out of range

sandy2008 commented 6 years ago

It seems that the code in utils.js should be: layer_idx = w.name.split('/')[1].split('h')[1] but there is another error: Traceback (most recent call last):

  File "main.py", line 100, in <module>
    tf.app.run()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "main.py", line 93, in main
    [dcgan.h4_w, dcgan.h4_b, None])
  File "/Users/pineapple0106/Anime/utils.py", line 110, in to_json
    gamma = bn.gamma.eval()
AttributeError: 'batch_norm' object has no attribute 'gamma'
TsumugiWenders commented 4 years ago

hi i have the same problem, any solution please!

sandy2008 commented 4 years ago

hi i have the same problem, any solution please!

You should use the exact module version the repo provided.