Should I substract imagenet pretrained inception_v3 model mean value at inception_v3.py keras?
Asked Answered
N

1

3
def preprocess_input(x):
x /= 255.
x -= 0.5
x *= 2.
return x

 I am using keras inception_v3 imagenet pretrained model(inception_v3.py) to finetune on my own dataset.
 When I want to subtract the imagenet mean value [123.68, 116.779, 103.939] and reverse axis RGB to BGR as we often do, I find that the author provided a _preprocess_input()_ function at the end.I am confused about this.

  Should I use the provided function preprocess_input() or subtract mean value and reverse axis as usual?
  Thanks lot.

Northampton answered 16/2, 2017 at 13:49 Comment(0)
D
3

Actually in a original Inception paper the autors mention as a data preprocessor the function you provided (one which is zero-centering all channels and resizes it to [-1, 1] interval). As in InceptionV3 paper no new data transformation is provided I think that you may assume that you should use the following function:

def preprocess_input(x):
    x /= 255.
    x -= 0.5
    x *= 2.
    return x
Dumfries answered 16/2, 2017 at 14:14 Comment(2)
I have read Inception paper "Going Deeper with Convolutions", but I didn't see such preprocessor function, can you give me more details?Northampton
Actually - it's not mentioned directly. But it's written in a part where they mentioned about zero-centered RGB channels. Squashing your input to [-1, 1] is an often transformation in this case.Sathrum

© 2022 - 2024 — McMap. All rights reserved.