Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Different result between Python and Android

Hi everyone,

I am trying to use a Pytorch model on Android and to do so, I am using OpenCv to do the pre processing.

My pre processing is composed of 3 steps: - greyscaling - resizing - normalize images [-1,1] (not with OpenCv)

However when I do the resizing on Android, i got different values compared to Python. I have checked that the input data are exactly the same. I have tried the official version and javacv one. They give exactly the same output (different from python). The images have the same dimension in both languages.

First values in python 122 121 125 125 124 129 125 126 130 132 130 131 131 130 127 127 130 129

First values in java 120 124 128 127 133 131 131 128 132 131 130 138 131

Python snippet : https://pastebin.com/vd7NWD4P Android snippet: https://pastebin.com/zgqsW4SV

Different result between Python and Android

Hi everyone,

I am trying to use a Pytorch model on Android and to do so, I am using OpenCv to do the pre processing.

My pre processing is composed of 3 steps: - greyscaling - resizing - normalize images [-1,1] (not with OpenCv)

However when I do the resizing on Android, i got different values compared to Python. I have checked that the input data are exactly the same. I have tried the official version and javacv one. They give exactly the same output (different from python). The images have the same dimension in both languages.

First values in python 122 121 125 125 124 129 125 126 130 132 130 131 131 130 127 127 130 129

First values in java 120 124 128 127 133 131 131 128 132 131 130 138 131

Python snippet : https://pastebin.com/vd7NWD4P Android snippet: https://pastebin.com/zgqsW4SV