Skip to content
This repository was archived by the owner on Nov 3, 2022. It is now read-only.
This repository was archived by the owner on Nov 3, 2022. It is now read-only.

Keras MobileNetv2 image normalization #209

Open
@xellDart

Description

@xellDart

Hi, I train my model using keras, and I load data using this function

Resize the images to a fixed input size, and rescale the input channels to a range of [-1,1]

IMG_SIZE = 320 # All images will be resized to 160x160

def format_example(pair):
  image, label = pair['image'], pair['label']
  image = tf.cast(image, tf.float32)
  image = (image/127.5) - 1
  image = tf.image.resize(image, (IMG_SIZE, IMG_SIZE))
  return image, label

But i cant understand what norm mean values apply when I transform my model to other framework, for example, ncnn, Pytorch use

  • loaded in to a range of [0, 1] and then normalized using mean = [0.485, 0.456, 0.406] and std = [0.229, 0.224, 0.225].

But what value I need to apply in keras mobilenetv2 model?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions