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?

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

1 Answer 1


The component values are often stored as integer numbers in the range 0 to 255, the range that a single 8-bit byte can offer,

Yes, If you divide by 255 the range can be described with a 0.0-1.0 where 0.0 means 0 (0x00) and 1.0 means 255 (0xFF). Normalization will help you to remove distortions caused by lights and shadows in an image.

Refer to this Normalize RGB


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.