sinAshish/Multi-Scale-Attention

Questions about output segmentation

Legendsevl opened this issue · 2 comments

Thanks for your creative work! But I want to know how to make the L0,L1,L2,L3 to be the segmention?and L0,L1,L2,L3 are same?
Best wishes!
image

Hi, these segmentations come from the attentive feature maps at different levels. You basically need to add a convolution to change the number of channels of your feature maps (from n_channels to number of classes -in this case 5-), and then resample to the original resolution.

This is the piece of code that does this:

predict4_2 = self.predict4_2(refine4)
predict3_2 = self.predict3_2(refine3)
predict2_2 = self.predict2_2(refine2)
predict1_2 = self.predict1_2(refine1)
predict1 = F.upsample(predict1, size=x.size()[2:], mode='bilinear')
predict2 = F.upsample(predict2, size=x.size()[2:], mode='bilinear')
predict3 = F.upsample(predict3, size=x.size()[2:], mode='bilinear')
predict4 = F.upsample(predict4, size=x.size()[2:], mode='bilinear')
predict1_2 = F.upsample(predict1_2, size=x.size()[2:], mode='bilinear')
predict2_2 = F.upsample(predict2_2, size=x.size()[2:], mode='bilinear')
predict3_2 = F.upsample(predict3_2, size=x.size()[2:], mode='bilinear')
predict4_2 = F.upsample(predict4_2, size=x.size()[2:], mode='bilinear')

ok,thanks a lot.