About MaxPool and MaxUnpool
Hi all, I have got a problem about the pooling function, the code were shown below: <SCODE>input = Variable(torch.rand(1,1,64,64))
pool1 = nn.MaxPool2d(2, stride=2, padding=1, return_indices=True)
pool2 = nn.MaxPool2d(2, stride=2, return_indices=True)
unpool1= nn.MaxUnpool2d(2, stride=2)
unpool2= nn.MaxUnpool2d(2, stride=2, padding=1)

output1, indices1 = pool1(input)
output2, indices2 = pool2(output1)

output3 = unpool1(output2,indices2)
output4 = unpool2(output3, indices1)
<ECODE> How to solve this problem, I want to used the pooling function to get the ouput4 which with the same dimension as input. Thanks a lot!
KwuJohn
<SCODE>output3 = unpool1(output2, indices2, output_size=output1.size())
output4 = unpool2(output3, indices1, output_size=input.size())
<ECODE>
fmassa
Hello, even when I’ve specified the size I want, I still got this error…QAQ
Yilin_Liu
Works well for me.Thanks a lot
coya
I was playing around with max_pooling unpooling and the results I found are somewhat weird. Please let me know whether this is the desired behavior of unpooling or am I doing something wrong. These are the results of input size 320

 These are the results of input size 128


kshitijpatil09
Assuming the kernel size for the pooling operations is 2x2 with stride=(2,2) I guess the output of the MaxPool layer isn’t that confusing if you know how maxpooling works. The positions of the pixels from the Maxpool layer’s output are being placed according to the indices that are being outputted by the MaxPool layer. So it’s quite likely that you won’t get a chessboad like picture back. (That’s what I’ve thought at the beginning.)
DezzardHD