GITHUB:https://github.com/NVIDIA/pix2pixHD
Install PyTorch http://pytorch.org/
pip3 install dominate pip3 install sklearn pip3 install sets
sets 要安装好久。。。。 请耐心等待。。
git clone https://github.com/NVIDIA/pix2pixHD
cd pix2pixHD
下载训练好的权重集到 ./checkpoints/label2city_1024p/ 目录
https://drive.google.com/file/d/1h9SykUnuZul7J3Nbms2QGH1wa85nbN2-/view?usp=sharing
698M ,漫长的等待。。。
报错
TypeError: cuda() got an unexpected keyword argument 'device_id'
~/models/networks.py 文件49,59行 改为
netG.cuda(gpu_ids[0])
test run , 成功
python3 test.py --name label2city_1024p --netG local --ngf 32 --resize_or_crop none
运行结果 :
http://kaishixue.com/test_latest/index.html
运行另外一个 test ./scripts/test_1024p_feat.sh
python3 encode_features.py --name label2city_1024p_feat --netG local --ngf 32 --resize_or_crop none;
报错
TypeError: eq received an invalid combination of arguments - got (numpy.int64), but expected one of: * (int value) didn't match because some of the arguments have invalid types: (numpy.int64) * (torch.cuda.IntTensor other) didn't match because some of the arguments have invalid types: (numpy.int64)
models/networks.py 286 行 torch.Tensor 操作时的错。
indices = (inst == i).nonzero() # n x 4
修改为
indices = (inst == i.item()).nonzero()
models/pix2pixHD_model.py 220 行 修改为
idx = (inst == i.item()).nonzero()
继续执行命令 ,源码中的 –netG 多了一个 –
python3 test.py --name label2city_1024p_feat --netG local --ngf 32 --resize_or_crop none --instance_feat
将权重集复制到 ./checkpoints/label2city_1024p_feat/
修改 models/base_model.py 73行 (python3.5)
#from sets import Set not_initialized = set()
models/pix2pixHD_model.py 203行 i 修改为
i.item()