zhangqianhui / progressive_growing_of_gans_tensorflow

Tensorflow implementation of PROGRESSIVE GROWING OF GANS FOR IMPROVED QUALITY, STABILITY, AND VARIATION
MIT License
149 stars 71 forks source link

TypeError: 'float' object cannot be interpreted as an integer #18

Open codeforhuangjie opened 5 years ago

codeforhuangjie commented 5 years ago

Hi, I clone your code and has many prombles while running The error info is:

Traceback (most recent call last): File "main.py", line 58, in pggan.train() File "D:\code_hj\progressive_growing_of_gans_tensorflow-master\progressive_gro wing_of_gans_tensorflow-master\PGGAN.py", line 194, in train '{}/{:02d}_real.jpg'.format(self.sample_path, step)) File "D:\code_hj\progressive_growing_of_gans_tensorflow-master\progressive_gro wing_of_gans_tensorflow-master\utils.py", line 115, in save_images return imsave(inverse_transform(images), size, image_path) File "D:\code_hj\progressive_growing_of_gans_tensorflow-master\progressive_gro wing_of_gans_tensorflow-master\utils.py", line 128, in imsave return scipy.misc.imsave(path, merge(images, size)) File "D:\code_hj\progressive_growing_of_gans_tensorflow-master\progressive_gro wing_of_gans_tensorflow-master\utils.py", line 132, in merge img = np.zeros((h size[0], w size[1], 3),dtype=int) TypeError: 'float' object cannot be interpreted as an integer

So, please help me solve the problem Thanksssss!

djjandXMU commented 5 years ago

hi,I add the function size = np.int32(size),and the problem is solved perfectly.

size = np.int32(size) h, w = images.shape[1], images.shape[2] img = np.zeros((h size[0], w size[1], 3)) for idx, image in enumerate(images): i = idx % size[1] j = idx // size[1] img[j h:j h + h, i w: i w + w, :] = image return img

codeforhuangjie commented 5 years ago

THX!!!!!!!!!!!!!!!!!!!!!!!!!!I solved this problem!!!!!!!! But, I don't know if I finish the train how to use the pre-trained model. Please give me some advise. Thanks!!!

------------------ 原始邮件 ------------------ 发件人: "DJJandU"notifications@github.com; 发送时间: 2019年3月27日(星期三) 晚上8:48 收件人: "zhangqianhui/progressive_growing_of_gans_tensorflow"progressive_growing_of_gans_tensorflow@noreply.github.com; 抄送: "黄婕"769248909@qq.com; "Author"author@noreply.github.com; 主题: Re: [zhangqianhui/progressive_growing_of_gans_tensorflow] TypeError:'float' object cannot be interpreted as an integer (#18)

hi,I add the function size = np.int32(size),and the problem is solved perfectly.

size = np.int32(size) h, w = images.shape[1], images.shape[2] img = np.zeros((h size[0], w size[1], 3)) for idx, image in enumerate(images): i = idx % size[1] j = idx // size[1] img[j h:j h + h, i w: i w + w, :] = image return img

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.