Closed lagejoao closed 2 years ago
@tanzhenyu looks like tests dont pass with the cntk
backend.
Any thoughts why?
@tanzhenyu @fchollet I trust keras will drop support for backends other than tf, but is it worthy to look into this meanwhile?
What's the nature of the fix here?
What's the nature of the fix here?
@fchollet
Casting the mean_tensor
to be uint8
is not the intended behaviour since we will be losing the floating point precision.
Instead, we want to cast x
(image tensor) to be float (floatx) so we can subtract the correct mean_tensor
values.
Everyone working with explicit Tensor(dtype="uint8")
and preprocessing images using preprocess_input
will face a buggy channel mean subtraction.
@fchollet the PR title was a bit misleading. Added some comments and better description.
It is curious why cntk
backend still fails with 66% assertion mismatch while other backends are OK 🤔
Related with https://github.com/keras-team/keras-applications/issues/128
When input tensor is
dtype='uint8'
we are casting themean_tensor
to beuint8
and this is not the intended behaviour since we will be losing the floating point precision. Instead, we want to cast x (image tensor) to be float (floatx) so we can subtract the correct mean_tensor values.Everyone working with explicit
Tensor(dtype='uint8')
and preprocessing images using preprocess_input will face a buggy channel mean subtraction.