C3W3 Lab1 - map_filename_to_image_and_mask()

Hello,

I have a question about the image normalization in the map_filename_to_image_and_mask() function that is passed to the Dataset.map() method in C3W3 Lab1.

Here, the pixel normalization is done by:
image = image/127.5
image -= 1
My understanding is that by doing this, we normalize the pixels to [-1,1].

Would it be worse to normalize by
image = image / 255.0
instead, i.e., normalize the pixels to [0,1], and if so, why?

As far as I remember, the latter was done in all other examples I have seen so far.

Kind regards,
Istvan

Your understanding of the resulting range is correct. Normalizing to [0,1] is indeed more frequently observed than to [-1, 1], and both are valid transformations. I am not aware of any particular reason why one would be better than the other.