bodokaiser / piwise

Pixel-wise segmentation on VOC2012 dataset using pytorch.
BSD 3-Clause "New" or "Revised" License
383 stars 86 forks source link

It's different with the standard SegNet #24

Open deeptoby opened 6 years ago

deeptoby commented 6 years ago

I think the most contribution in segnet is the idx-maxpooling. you can use the F.max_unpool2d(idx, x) to replace the nn.upsample(). The original upsample can't fit the loss of location information.

bodokaiser commented 6 years ago

Hey, yes that makes sense! Would you mind to send a PR?

On 21. Nov 2018, at 11:07, toby notifications@github.com wrote:

I think the most contribution in segnet is the idx-maxpooling. you can use the F.max_unpool2d(idx, x) to replace the nn.upsample(). The original upsample can't fit the loss of location information.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

deeptoby commented 5 years ago

yes, i'd like to do that. i have rewrited segnet.i will send it by my pull.

Viarow commented 5 years ago
    self.dec1 = features[0: 4]    #[0,3]
    self.dec2 = features[5: 9]    #[5,8]
    self.dec3 = features[10: 16]  #[10,15]
    self.dec4 = features[17: 23]  #[17,22]
    self.dec5 = features[24: -1]  #[24,29]

while there's also a maxpool2d layer after each decoder block in the forward function, I wonder why the pooling operation is implemented twice before unpooling? I haven't run the code just quite confused.

bodokaiser commented 5 years ago

@Viarow I guess this is a mistake then. Would you mind trying the correct version?

Viarow commented 5 years ago

I'm actually a novice at deep learning, still trying to understand the codes. I guess it will work right only if the range of pretrained layers are set correct (as shown in the annotations above). I will tell you the results after I try the corrections.

deeptoby commented 5 years ago

Hi,there just one pooling at each dec. could you tell me the your found on detail.

bodokaiser commented 5 years ago

If I understood correctly the problem can be found with the index selectors here: self.dec1 = features[0: 4] #[0,3] self.dec2 = features[5: 9] #[5,8] self.dec3 = features[10: 16] #[10,15] self.dec4 = features[17: 23] #[17,22] self.dec5 = features[24: -1] #[24,29]

So for example [0:4] will return [features[0], features[1], features[3]].

As the next layer starts with features[5] the features[4] layer is not used at all.

On 4. Feb 2019, at 10:11, toby notifications@github.com wrote:

Hi,there just one pooling at each dec. could you tell me the your found on detail.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bodokaiser/piwise/issues/24#issuecomment-460175873, or mute the thread https://github.com/notifications/unsubscribe-auth/ABsq8mP9fvms4uP3e0u5GZhuwdrDC8Tfks5vJ_k6gaJpZM4YsyhR.

deeptoby commented 5 years ago

layer4 is maxpool, it is used later in code in order to get max-index.

Viarow commented 5 years ago

Oh I see the point. in the FCN8 model, self.feats = nn.Sequential(feats[0:9]) self.feat3 = nn.Sequential(feats[10:16]) self.feat4 = nn.Sequential(feats[17:23]) self.feat5 = nn.Sequential(feats[24:30]) are called later in feats = self.feats(x) feat3 = self.feat3(feats) feat4 = self.feat4(feat3) feat5 = self.feat5(feat4) fconn = self.fconn(feat5) which means that some maxpooling layers are also left out in this model?