# When inputting image rgb values to MLP, should I divide by 255?

I have an MLP with 3072 input nodes which are for 1024 rgb pixels. My datasets is in an array with each row representing one image and looking like this:

[red_pix1, red_pix2, ..., red_pix1024, green_pix1, green_pix2, ..., green_pix1024, blue_pix1, blue_pix2, ..., blue_pix1024]


Each array value is an integer between 0 and 255.

My question is, before training the network, should I "normalize" my dataset by dividing each element by 255? That way, each input element would have values between 0 and 1. Is this better than having values between 0 and 255?

• Yes, typically. You might want to center it too. This is to make it easier to initialize the network.
– Emre
Apr 5, 2018 at 18:39