Closed SwordHolderSH closed 5 years ago
me too.
(tfgpu) ➜ APDrawingGAN git:(master) python test.py --dataroot dataset/data/test_single --name formal_author --model test --dataset_mode single --norm batch --use_local --which_epoch 300
----------------- Options ---------------
EYE_H: 40
EYE_W: 56
MOUTH_H: 40
MOUTH_W: 64
NOSE_H: 48
NOSE_W: 48
aspect_ratio: 1.0
auxiliary_root: auxiliary
batch_size: 1
bg_dir: dataset/mask/ALL
checkpoints_dir: ./checkpoints
comb_op: 1
dataroot: dataset/data/test_single [default: None]
dataset_mode: single
display_env: main
display_id: 1
display_port: 8097
display_server: http://localhost
display_winsize: 256
fineSize: 512
gpu_ids: 0
how_many: 70
init_gain: 0.02
init_type: normal
input_nc: 3
isTrain: False [default: None]
lm_dir: dataset/landmark/ALL
loadSize: 512
max_dataset_size: inf
model: test [default: apdrawing_gan]
n_layers_D: 3
name: formal_author [default: experiment_name]
ndf: 64
netD: basic
netG: unet_256
ngf: 64
nnG: 9
no_dropout: False
no_flip: False
norm: batch
ntest: inf
num_threads: 4
output_nc: 1
phase: test
resize_or_crop: resize_and_crop
results_dir: ./results/
save2: False
serial_batches: False
soft_border: 0
suffix:
use_local: True [default: False]
verbose: False
which_direction: AtoB
which_epoch: 300 [default: latest]
----------------- End -------------------
dataset [SingleImageDataset] was created
initialize network with normal
initialize network with normal
initialize network with normal
initialize network with normal
initialize network with normal
initialize network with normal
initialize network with normal
initialize network with normal
model [TestModel] was created
loading the model from ./checkpoints/formal_author/300_net_gen.pt
loading the model from ./checkpoints/formal_author/300_net_gen.pt
loading the model from ./checkpoints/formal_author/300_net_gen.pt
loading the model from ./checkpoints/formal_author/300_net_gen.pt
loading the model from ./checkpoints/formal_author/300_net_gen.pt
loading the model from ./checkpoints/formal_author/300_net_gen.pt
loading the model from ./checkpoints/formal_author/300_net_gen.pt
loading the model from ./checkpoints/formal_author/300_net_gen.pt
---------- Networks initialized -------------
[Network G] Total number of parameters : 54.410 M
[Network GLEyel] Total number of parameters : 1.448 M
[Network GLEyer] Total number of parameters : 1.448 M
[Network GLNose] Total number of parameters : 1.448 M
[Network GLMouth] Total number of parameters : 1.448 M
[Network GLHair] Total number of parameters : 1.710 M
[Network GLBG] Total number of parameters : 1.710 M
[Network GCombine] Total number of parameters : 0.158 M
-----------------------------------------------
Traceback (most recent call last):
File "test.py", line 24, in <module>
for i, data in enumerate(dataset):
File "/home/wuwei/projects/temp/APDrawingGAN/data/__init__.py", line 72, in __iter__
for i, data in enumerate(self.dataloader):
File "/home/wuwei/anaconda3/envs/tfgpu/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 637, in __next__
return self._process_next_batch(batch)
File "/home/wuwei/anaconda3/envs/tfgpu/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 658, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
TypeError: Traceback (most recent call last):
File "/home/wuwei/anaconda3/envs/tfgpu/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/wuwei/anaconda3/envs/tfgpu/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in <listcomp>
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/wuwei/projects/temp/APDrawingGAN/data/single_dataset.py", line 96, in __getitem__
item[regions[i]+'_A'] = A[:,center[i,1]-rhs[i]/2:center[i,1]+rhs[i]/2,center[i,0]-rws[i]/2:center[i,0]+rws[i]/2]
TypeError: only integer tensors of a single element can be converted to an index
@papercatnku Great job. Thank you.
Sorry about the problem. It may be caused by different pytorch version. I used pytorch 0.4.1. @papercatnku provided a good solution, thanks!! And I think you could also change the line 83 in data/single_dataset.py from "center = torch.tensor(..." to "center = torch.IntTensor(..."
Could you please tell me which causes that:
Traceback (most recent call last): File "/home/suhao/PycharmProjects/APGAN-master/test.py", line 24, in
for i, data in enumerate(dataset):
File "/home/suhao/PycharmProjects/APGAN-master/data/init.py", line 72, in iter
for i, data in enumerate(self.dataloader):
File "/home/suhao/anaconda3/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 336, in next
return self._process_next_batch(batch)
File "/home/suhao/anaconda3/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 357, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
RuntimeError: Traceback (most recent call last):
File "/home/suhao/anaconda3/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 106, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/suhao/anaconda3/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 106, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/suhao/PycharmProjects/APGAN-master/data/single_dataset.py", line 83, in getitem
center = torch.tensor([[feats[0,0],feats[0,1]-4ratio],[feats[1,0],feats[1,1]-4ratio],[feats[2,0],feats[2,1]-NOSE_H/2+16*ratio],[mouth_x,mouth_y]])
RuntimeError: Could not infer dtype of numpy.int64