junyanz / iGAN

Interactive Image Generation via Generative Adversarial Networks
MIT License
3.97k stars 587 forks source link

train_dcgan.py error : Population must be a sequence or set. #15

Closed PierreMarTich closed 6 years ago

PierreMarTich commented 7 years ago

I am trying to create my own dataset. I created the hdf5 file using the given script on the Readme, and now I want to launch the train_dcgan.py file on the hdf5 file. I also defined the model parameters in train_dcgan_config.py.

This is what I get after computing (hdf5 file's name is mickey_64) :

[model_name] = mickey_64 [ext] = [data_file] = ../datasets/mickey_64.hdf5 [cache_dir] = ./cache/mickey_64/ [batch_size] = 128 [update_k] = 2 [save_freq] = 1 [lr] = 0.0002 [weight_decay] = 1e-05 [b1] = 0.5 ./cache/mickey_64/web_dcgan/images LOADING DATASET... name = ../datasets/mickey_64.hdf5, ntrain = 884, ntest = 46 0.01 secs to load data Traceback (most recent call last): File "train_dcgan.py", line 66, in vis_idxs = py_rng.sample(np.arange(len(test_x)), n_vis) File "/home/aeon7/anaconda3/lib/python3.6/random.py", line 313, in sample raise TypeError("Population must be a sequence or set. For dicts, use list(d).") TypeError: Population must be a sequence or set. For dicts, use list(d).

I don't understand where this error comes from.

mojganaz commented 6 years ago

replace vis_idxs = py_rng.sample(np.arange(len(test_x)), n_vis) in train_dcgan.py with this: vis_idxs = py_rng.sample(list(np.arange(len(test_x))), n_vis)