Ugness / PiCANet-Implementation

Pytorch Implementation of PiCANet: Learning Pixel-wise Contextual Attention for Saliency Detection
MIT License
180 stars 40 forks source link

size of input tensor and input format are different #12

Closed li-pengcheng closed 5 years ago

li-pengcheng commented 5 years ago

@Ugness good work! I met some trouble when i use train.py in the pytorch/. It say: Traceback (most recent call last): File "train.py", line 106, in writer.add_image('{}'.format(masked.size()[2]), masked, global_step=iterate) File "/data/lipengcheng/programs/anaconda3/envs/pytorch/lib/python3.5/site-packages/tensorboardX/writer.py", line 427, in add_image image(tag, img_tensor, dataformats=dataformats), global_step, walltime) File "/data/lipengcheng/programs/anaconda3/envs/pytorch/lib/python3.5/site-packages/tensorboardX/summary.py", line 211, in image tensor = convert_to_HWC(tensor, dataformats) File "/data/lipengcheng/programs/anaconda3/envs/pytorch/lib/python3.5/site-packages/tensorboardX/utils.py", line 98, in convert_to_HWC assert(len(tensor.shape) == len(input_format)), "size of input tensor and input format are different" AssertionError: size of input tensor and input format are different

It seems the input size is [1,1,28,28] but the input_format just need [1,28,28] without batch_size? but i don't know how to modify it, could U give me a hand?

li-pengcheng commented 5 years ago

oooops! Things sounds like my tensorboardX version is too high, when I down it to 1.1, the problem has been solved!