Python/PyTorch 공부

[Pytorch] nn.Unsample에서 align_corners=False? True?

AI 꿈나무 2021. 11. 18. 18:08
반응형

https://discuss.pytorch.org/t/what-we-should-use-align-corners-false/22663

 

What we should use align_corners = False

I am very confused with this parameter in pytroch document. According to wiki https://en.wikipedia.org/wiki/Bilinear_interpolation, the bilinear interpolation formula result is consistent with align_corners =True. which is defatult before pytorch 0.4.0. I

discuss.pytorch.org

 

 

align_corners=True로 설정하면 코너 픽셀값이 고정된다.

 

예를 들어 [0,1]를 [?,?,?,?]로 upsample 하고 싶은데. align_corners=True로 설정하면 다음과 같이 출력한다.

[0,1/3,2/3,1]

 

반면에 align_corners=False로 설정하면 다음과 같다.

[-0.25, 0.25, 0.75, 1.25]

 

 

반응형