Hi,
This part is not compulsory. However, I have a bit of difficulty to understand the comment from the code - The last cell in 4.1:
# Divide by 255 so that all values are in the range 0 - 1
original_img = original_img / 255
However, the original_img all has value in the range from 0-1 (1 for black and 0 for white) already. Not sure why this step is necessary.
I hope someone could help to clarify this if I am missing any point.
Thank you,
Hi!
The original images should be size 128 x 128 with RGB channels.
Each of the cells in the 128 x 128 matrix will have 3 values 0 - 255 representing RGB light intensity
Hope this clears things up!
Hi @luongtd, I think the step is not absolutely necessary, but it’s also not problematic when handled well. However, we did make a suggestion regarding this to the team already.
Raymond
I think you have misunderstood my point. I know that the RGB is 8-bit mentioned in the example which is equivalent to values from 0-255.
If you check the values of the tensor original_img , however, the intensity has already been scaled to [0,1].
For me, it is a minor issue but as a suggestion, I hope the staffs could improve the comments for smoother learning experience.
Cheers,
Hi!
Yes, sorry, I misunderstood your question.
You are correct, the values don’t need to be scaled.
We will inform the lab maintainers.
The reason the image has values between 0 - 1 is because matplotlib handles PNG files as a special case and returns floats in the range of 0 - 1 by default.
https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.imread.html