JaveyWang / Pyramid-Attention-Networks-pytorch

Implementation of Pyramid Attention Networks for Semantic Segmentation.
GNU General Public License v3.0
235 stars 55 forks source link

predict mask only 1/4 of original image #11

Open sparkfax opened 4 years ago

sparkfax commented 4 years ago

image size(3,512,512) mask_pred = self.mask_classifier(out_ss)
print(mask_pred.shape) #torch.Size([16, 5, 128, 128]) target mask 512, predict mask ony 128

self.gau_block1 = GAU(channels_blocks[0], channels_blocks[1], upsample=False) self.gau_block2 = GAU(channels_blocks[1], channels_blocks[2]) self.gau_block3 = GAU(channels_blocks[2], channels_blocks[3])

torch.Size([16, 2048, 32, 32]) False True torch.Size([16, 512, 64, 64]) True torch.Size([16, 256, 128, 128]) torch.Size([16, 5, 128, 128])

/opt/conda/lib/python3.6/site-packages/catalyst/dl/utils/criterion/dice.py in dice(outputs, targets, eps, threshold, activation) 30 outputs = (outputs > threshold).float() 31 ---> 32 intersection = torch.sum(targets outputs) 33 union = torch.sum(targets) + torch.sum(outputs) 34 dice = 2 intersection / (union + eps)

RuntimeError: The size of tensor a (512) must match the size of tensor b (128) at non-singleton dimension 3