llSourcell / Pokemon_GAN

This is the code for "Generating Pokemon with a Generative Adversarial Network" by Siraj Raval on Youtube
433 stars 208 forks source link

could not broadcast input array from shape (128,128,3) into shape (0,128,3) #15

Closed AaronWard closed 1 year ago

AaronWard commented 6 years ago

Hi Does anyone have any idea why i am getting this error. Here is the error log.

2018-06-04 10:46:48 PSTTraceback (most recent call last):
2018-06-04 10:46:48 PSTFile "gan.py", line 296, in <module>
2018-06-04 10:46:48 PSTtrain_network()
2018-06-04 10:46:48 PSTFile "gan.py", line 267, in train_network
2018-06-04 10:46:48 PSTsave_images(imgtest, [8,8] ,new_image_path + '/epoch' + str(i) + '.jpg')
2018-06-04 10:46:48 PSTFile "/code/utils.py", line 34, in save_images
2018-06-04 10:46:48 PSTreturn imsave(inverse_transform(images), size, image_path)
2018-06-04 10:46:48 PSTFile "/code/utils.py", line 67, in imsave
2018-06-04 10:46:48 PSTimage = np.squeeze(merge(images, size))
2018-06-04 10:46:48 PSTFile "/code/utils.py", line 53, in merge
2018-06-04 10:46:48 PSTimg[j * h:j * h + h, i * w:i * w + w, :] = image
2018-06-04 10:46:48 PSTValueError: could not broadcast input array from shape (128,128,3) into shape (0,128,3)

As soon as finish the first epoch this occurs.

        if i%50 == 0:
            # save images
            if not os.path.exists(new_image_path):
                os.makedirs(new_image_path)
            sample_noise = np.random.uniform(-1.0, 1.0, size=[batch_size, random_dim]).astype(np.float32)
            imgtest = sess.run(fake_image, feed_dict={random_input: sample_noise, is_train: False})
            # imgtest = imgtest * 255.0
            # imgtest.astype(np.uint8)
            save_images(imgtest, [8,8] ,new_image_path + '/epoch' + str(i) + '.png')  # <<<< HERE