NVlabs / SPADE

Semantic Image Synthesis with SPADE
https://nvlabs.github.io/SPADE/
Other
7.61k stars 980 forks source link

Expected object of scalar type Byte but got scalar type Bool for argument #107

Open atopheim opened 4 years ago

atopheim commented 4 years ago

Ran: python test.py --name coco_pretrained --dataset_mode coco --dataroot datasets/coco_stuff/ --gpu_ids -1

dataset [CocoDataset] of size 8 was created Network [SPADEGenerator] was created. Total number of parameters: 97.5 million. To see the architecture, do print(network). Traceback (most recent call last): File "test.py", line 36, in generated = model(data_i, mode='inference') File "/home/torbjoern/anaconda3/envs/ml/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, **kwargs) File "/mnt/c/Users/torbjorn/Projects/Github/SPADE-master/models/pix2pix_model.py", line 42, in forward input_semantics, real_image = self.preprocess_input(data) File "/mnt/c/Users/torbjorn/Projects/Github/SPADE-master/models/pix2pix_model.py", line 128, in preprocess_input instance_edge_map = self.get_edges(inst_map) File "/mnt/c/Users/torbjorn/Projects/Github/SPADE-master/models/pix2pix_model.py", line 240, in get_edges edge[:, :, :, 1:] = edge[:, :, :, 1:] | (t[:, :, :, 1:] != t[:, :, :, :-1]) RuntimeError: Expected object of scalar type Byte but got scalar type Bool for argument #2 'other' in call to _th_or

Using torch 1.4.0

freealise commented 4 years ago

Same with COCO (even the sample content) and Cityscapes datasets, but not ADE20k.

xietao0306 commented 4 years ago

me too!

lmxyy commented 4 years ago

Me too! I've fixed this issue. I think this is the version issue of Pytorch 1.4. In pytorch 1.4, you could not conduct or operation between a ByteTensor and a BoolTensor. You need to cast the BoolTensor to ByteTensor like this

edge[:, :, :, 1:] = edge[:, :, :, 1:] | ((t[:, :, :, 1:] != t[:, :, :, :-1]).byte())
atopheim commented 4 years ago

Indeed, works for me as well now, great that you figured it out :)