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.