eriklindernoren / PyTorch-GAN

PyTorch implementations of Generative Adversarial Networks.
MIT License
16.17k stars 4.05k forks source link

DCGAN 修改输入图片大小可能会报错 #164

Open 10961020 opened 2 years ago

10961020 commented 2 years ago

我最近在使用DCGAN.py时遇到的问题,当我修改输入图片大小时如果size不能被16整除,Discriminator.model最终的会使featuremap的size加一,但是python在计算整除时默认去掉小数,会造成矩阵不匹配无法计算。 解决方法:DCGAN.py修改91行 ‘ds_size = opt.img_size // 2 4’ ---> 'ds_size = int(np.ceil(opt.img_size / 2 4))' 这样可以解决这个问题。 I hope the author can attention to this bug. think : )