MrAhmes
MrAhmes

Reputation: 25

What do these different Normalisation value mean in this code? [TensorFlow] [Image Pre-Processing]

I am currently in the process of learning to utilise machine learning / tensorflow etc. I understand what Normalization means (thanks Google): Normalization is a process that changes the range of pixel intensity values. Applications include photographs with poor contrast due to glare, for example.

I came across someones code - below these are Normalization techniques someone used. But I am having trouble understanding what each Normalization Technique below do?

Would appreciate if someone could explain.

normalizers = [('x - 127.5',              lambda x: x - 127.5), 
               ('x/127.5 - 1.0',          lambda x: x/127.5 - 1.0), 
               ('x/255.0 - 0.5',          lambda x: x/255.0 - 0.5),
               ('x - x.mean()',           lambda x: x - x.mean()),
               ('(x - x.mean())/x.std()', lambda x: (x - x.mean())/x.std())]

Upvotes: 0

Views: 189

Answers (1)

Shrey Joshi
Shrey Joshi

Reputation: 1206

Try inputting endpoints for each one of them to find the range.

  • First one translates values in the range 0 --> 255 to -127.5 --> 127.5.
  • Second one translates to -1 --> 1
  • Third one translates to -0.5 to 0.5
  • Fourth one subtracts the mean, which results in a similar distribution centered at 0
  • Fifth one calculates something called the z-score in statistics

Upvotes: 2

Related Questions