Question about Course 1 Week 2 programming assignment cell 11

When creating a post, please add:

  • Week 2 must be added in the tags option of the post.
  • Link to the classroom item you are referring to: Coursera | Online Courses & Credentials From Top Educators. Join for Free | Coursera
  • Description (include relevant info but please do not post solution code or your entire notebook)
    I am reading the description, I know we need to “standardized” the RGB data, but the training_set_x also contains the image size data. Why this won’t affect the result ? Is divided by 255 here equivalent to “shrinking” the image ?

They are just talking about the pixel values themselves. Those are color values which are unsigned 8 bit integers meaning that they range from 0 to 255 in value. Dividing them by 255. gives you floating point values between 0 and 1. The shape of the images is not affected.

so…you mean, after the reshaping (width * height * 3, 1), the content inside is the RGB value ?

Yes, the values are still the individual RGB color values for the pixels, even after you change the shape. You can do the division by 255. to rescale them either before or after the “flatten” operation.

Thanks for explaining, now it make sense.