0

I am trying to perform CNN for regression using grayscale images with continues pixel value in float32 data types. The value ranges for predictors:

img1= 0 to 790.65
img2= -2.74174 to 2.4126
img3= 150.87 to 260.45

The value range for response image:

resp_img= -32.927 to 69.333

Is it appropriate to convert the pixel values between [0-255], and also if I convert the data type/data range to another format how should I scale back to original floating-point values?

Sam
  • 59
  • 11

1 Answers1

0

not sure what you are trying to do. pixel values are normally in the range 0 to 255. Typically the pixel values are rescale between 0 and 1 using img=img/255 this produce floats. To convert back to range 0 to 255 as floats just do img=img * 255 or if you want an integer value img=int(img*255)

Gerry P
  • 7,662
  • 3
  • 10
  • 20
  • @ Gerry P, similar to this link [https://stackoverflow.com/questions/58105563/how-to-make-keras-imagegenerator-load-16-bit-images-properly], when I use ImageDataGenerator, this returns error `io.BytesIO object` in reading rgb and grayscale images with float32 data type – Sam Apr 07 '21 at 19:57