the result was not as expected

#1
by aiplayman - opened
LiteRT Community (FKA TFLite) org

Follow your instructions,but the result was different from yours. Below is hero.png which apply this model on mine devices(android):

hero

LiteRT Community (FKA TFLite) org

This is a misunderstanding. I use NHWC shape to handle NCHW so get the wrong result.I changed to NCHW and the result not the same as yours
hero

LiteRT Community (FKA TFLite) org

Hi @aiplayman

Thanks for sharing the screenshot! Based on the faint/washed-out look of your output sketch (and the missing hair details), it looks like the input pixels are not ImageNet-normalized. While you fixed the tensor shape to NCHW, could you please double-check your preprocessing code? Specifically, for every pixel, your math should look like this before writing to the input buffer:

  1. Divide the RGB values by 255.0 to scale them to [0.0, 1.0].
  2. Subtract the ImageNet mean: [0.485, 0.456, 0.406].
  3. Divide by the ImageNet standard deviation: [0.229, 0.224, 0.225].

If you only divide by 255 and skip the mean/std math, the model receives strictly positive numbers instead of values centered around zero. This causes the neural network to perceive the image as overly bright, which washes out all the dark shading and hair!

Please give that math a try! If you are still getting the same result after applying the ImageNet normalization, could you please share the reproduction steps so we can take a closer look? Thank you!

LiteRT Community (FKA TFLite) org

@hvt4 Thanks you for your help,i got the right result😊

aiplayman changed discussion status to closed
aiplayman changed discussion status to open
aiplayman changed discussion status to closed

Sign up or log in to comment