还好终于解决了,我决定,以后我写代码一定要注意复用性!
使用python2.7 tensorflow 1.7做stackGan的实验,最终错误,无法解决。
你得把该下载的下载好,StackGan-master
然后unzip StackGAN-master.zip
里面有一个文件夹是Data,在这个文件里下载文本嵌入,bird的 链接 ,flower的 链接
下载位置在Data里奥
解压鸟数据集unzip birds.zip
解压花数据集unzip flowers.zip
这样Data下面就有用birds和flowers的文件夹了
然后下载birds和flowers的图片和相应数据
bird的 链接 ,将其下载至Data下的birds文件夹下,解压tar zxvf CUB_200_2011.tgz
,然后就出现了在birds文件夹下的CUB_200_2011文件夹。
flower的 链接下载至Data的flowers文件夹下tar zxvf 102flowers.tgz
,然后就出现了jpg文件夹。
然后执行python misc/preprocess_birds.py
然后执行python misc/preprocess_flowers.py
然后接下来训练模型,python stageI/run_exp.py --cfg stageI/cfg/flowers.yml --gpu 0
执行时出现了
但出现了另一个错误,如后面的图
看他哪里出错了,algo.train(), trainer.py中的第280行,好我们下面看看怎么错了 接下来找trainer.py中的第101行 这错了!怎么错的
按照https://github.com/google/prettytensor/issues/48中提到的针对TypeError: Expected int32, got <prettytensor.pretty_tensor_class.Layer > of type 'Layer' instead.
解决方案,correctly you just swap the 1 with [c,z],就是把101行中的1和[c,z]换个位置。然而, 我成功的把这个错误变成了另一个错误,尴尬
继续解决,按照https://github.com/hanzhanggit/StackGAN/issues/30教程继续改了之后,
依然有问题,把我急的!还是乖乖改成python 2.7,tensorflow0.12了。接下来我要改环境执行了!
接下来程序运行请看为stackGan创建新的虚拟环境,后续的实验也在这篇文章里。
网友评论