wuhuikai / FastFCN

FastFCN: Rethinking Dilated Convolution in the Backbone for Semantic Segmentation.
http://wuhuikai.me/FastFCNProject
Other
838 stars 148 forks source link

Need your suggestions #105

Closed haideralimughal closed 3 years ago

haideralimughal commented 3 years ago

Hi, i have designed this SPP module for my network. But i am also interested in your work to replace my his module with JPU. Would you like to give me any suggestions? here is my implementation

class SPP(nn.Module): def init(self, pool_sizes): super(SPP, self).init() self.pool_sizes = pool_sizes

def forward(self, x):
    h, w = x.shape[2:]
    k_sizes = []
    strides = []
    for pool_size in self.pool_sizes:
        k_sizes.append((int(h / pool_size), int(w / pool_size)))
        strides.append((int(h / pool_size), int(w / pool_size)))

    spp_sum = x

    for i in range(len(self.pool_sizes)):
        out = F.avg_pool2d(x, k_sizes[i], stride=strides[i], padding=0)
        out = F.upsample(out, size=(h, w), mode="bilinear")
        spp_sum = spp_sum + out

    return spp_sum  
wuhuikai commented 3 years ago

I do not understand your question indeed. Do you mean insert JPU into PSPNet ?

haideralimughal commented 3 years ago

Basically i have used this SPP module after my encoder part of the network so i mean that how can i modify your JPU module such as i modified SPP module for my network?

wuhuikai commented 3 years ago

It's similar, except that JPU requires multiple feature maps as inputs.

haideralimughal commented 3 years ago

Would you please give me a practical example?

wuhuikai commented 3 years ago

See this.