java icon indicating copy to clipboard operation
java copied to clipboard

Result of tf.image.resizeBilinear in Java is different from tf.image.resize In python

Open mimilewis opened this issue 4 years ago • 5 comments

tf version in python:2.5.0 tf version in java :2.4.1 Result of tf.image.resizeBilinear in Java is different from tf.image.resize In python tf.image.cropAndResize can get the same result

mimilewis avatar Jun 06 '21 06:06 mimilewis

Are you specifying halfPixelCenters = true when you run that op in Java? It's set to true by Python's resize.

Craigacp avatar Jun 07 '21 01:06 Craigacp

Are you specifying halfPixelCenters = true when you run that op in Java? It's set to true by Python's resize.

After using it, the result is closer. python:[ 212.21364,222.1122,211.72565 ] java: [212.25,222.25,211.81567]

mimilewis avatar Jun 07 '21 02:06 mimilewis

Are you running it on the same hardware (i.e. CPU or GPU) for both languages? Also can you check the behaviour of tf python 2.4.1?

Craigacp avatar Jun 07 '21 02:06 Craigacp

Just to let you know that I've just merge this PR to upgrade the current 0.4.0 snapshots to TensorFlow 2.5.

It should be ready to be tested out in about 8 hours from now and it could be interesting to see if that fixes the slight delta you are observing in the pixel values between Java and Python scaling (I have doubts but we never know).

karllessard avatar Jun 10 '21 13:06 karllessard

Ok, we had some trouble building the new snapshots with TF2.5 but it is ready now to be used for testing.

karllessard avatar Jun 11 '21 19:06 karllessard