Pytorch - Linear Interpolation is DIFFERENT from PIL/OpenCV

image

This image shows us downsampling/applying linear interpolation from a 8x8 image to a 2x2 image.

The result in red is the result from using PIL. The result in black is from F.interpolate.

You can see that the results/ordering is completely different. Pytorch indexes from the top left while PIL and OpenCV index from bottom right.

This tiny bug has caused me some hell for the last 2 weeks and I have finally figured it out. Word of advice, don’t mix different tools for doing data processing.

I’m sorry to hear the painful debugging. :confused:
Feel free to ask about such issues, in case you suspect other differences, as we already discussed it here (which includes a link to the PIL issue).