In weeks one and two all the images were rescaled to 1/255. How is this number chosen? I would assume we would rescale to the max pixel value in the training set. I am wondering what factor I should rescale on lab 3. I could compare the max pixel value in the human training set and that of the horse training set, and then choose the bigger of two and rescale everything to 1 over that value. but in lab 3 I am not importing the images I am reading directly from the directory, so not sure how to find that value without importing
You have posted in the “General Discussions” forum area, so we don’t know what course you are asking about.
Please use the “pencil” icon in the thread title, and move the thread to the correct forum area for that course.
Thanks for moving the thread. Hopefully a mentor for that course will reply here.
Thanks @Basira_Daqiq for the question and welcome to the community,
the number is chosen becasue of the highest value (i.e. the range is 0-255) and the process is also called normalization. Normalization happens when takeing the maximum value and dividing your data points with it to con vert it to a scale of 0-1. Many other options are availaanle too like 1-100 or -1-1.
In regrad of the pixel values, 255 for an 8-bit image, 4095 for a 12-bit image, 65 535 for a 16-bit image.
Although you can use Numpy for that too:
smallest_pixel_value = numpy.amin(image)
biggest_pixel_value = numpy.amax(image)
Please not that this code would work directly for greyscale images. Please consider color channels for RGB.
Please fee free to further discuss this,
Thanks and good luck,