simoninithomas / CatDCGAN

A DCGAN that generate Cat pictures 🐱‍💻
https://simoninithomas.github.io/CatDCGAN/
202 stars 69 forks source link

Crashes 1st time when loss output is reached and cannot restore from last model #2

Open hofpcp opened 5 years ago

hofpcp commented 5 years ago

Hi Thomas,

Great work with this, was trying myself to change the Udacity DCGAN to accept new data with no luck, was happy too see someone had cracked it :-)

But have run into a few problems:

  1. First time def train reaches i=1500 program crashes with the following error:

NameError Traceback (most recent call last)

in () 4 with tf.Graph().as_default(): 5 losses, samples = train(epochs, batch_size, z_dim, learning_rate_D, learning_rate_G, beta1, dataset.get_batches, ----> 6 dataset.shape, dataset.image_mode, alpha) in train(epoch_count, batch_size, z_dim, learning_rate_D, learning_rate_G, beta1, get_batches, data_shape, data_image_mode, alpha) 80 81 ---> 82 return losses, samples NameError: name 'losses' is not defined 2. Set from_checkpoint = True and received following error when running tf.graph(): INFO:tensorflow:Restoring parameters from ./models/model.ckpt --------------------------------------------------------------------------- UnboundLocalError Traceback (most recent call last) in () 4 with tf.Graph().as_default(): 5 losses, samples = train(epochs, batch_size, z_dim, learning_rate_D, learning_rate_G, beta1, dataset.get_batches, ----> 6 dataset.shape, dataset.image_mode, alpha) in train(epoch_count, batch_size, z_dim, learning_rate_D, learning_rate_G, beta1, get_batches, data_shape, data_image_mode, alpha) 35 36 ---> 37 show_generator_output(sess, 4, input_z, data_shape[3], data_image_mode, image_path, True, False) 38 39 else: UnboundLocalError: local variable 'image_path' referenced before assignment I am running on a local machine with GPU and Tensorflow version 1.8.0
bubblewr-ap commented 5 years ago

Hi I found a way to succesfully restore a model from a checkpoint by including a global_step in the graph, but I have the same problem with the losses, the error message is right, they were never defined, same as the samples. Since I'm relatively new to ML and Tensorflow I'm actually not sure what format they should be, and when and how they should be updated

ereish64 commented 5 years ago

Sorry to be practicing my necromancy on dead issues, but in case your still interested in getting this code running, check out my pull request. It fixes the load model issue and the losses issue. please let me know if there is something i can help with. This repository is a little outdated so I submitted a PR to the repository maintainer with the correct fixes. Lets hope he still pays attention to this repository. ¯_(ツ)_/¯

@bubblewr-ap @hofpcp