Body: <p>I am working with four grayscale images of float32 data type to perform regression using Keras. Three images are stacked using <code>np.dstack</code> to form a RGB data-set. The last grayscale image is used as label. The grayscale images contains different variations, including [0 , 790.65], [ 150.87 , 260.45], [ -2.74174 , 2.4126 ], [-32.927 , 69.333].</p>
  <p>If I convert the images to unit8, the maximum values for the first and second image will be 255 and the decimal values for all images will be lost.  I am having difficulty and struggling to find the solution for using the image in the original data type (float32) when I try to use <code>ImageDataGenerator</code> and <code>flow_from_directory</code>. Can anyone suggest way for that?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-07T17:16:04.410Z
Comments.Text: Data size is too low. And the loss of information of casting from float to int won't be that high.
Comments.UserDisplayName: Abhishek Verma
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-07T22:58:02.147Z
Comments.Text: Your images should be normalized. You can choose any range (e.g. [-1, 0] or [0, 1]), but the main condition is that it must represent the intensities of the pixels and has to  be able to be scaled back to the original range [0, 255]. btw `matplolib` can plot normalized images in range [0, 1]
Comments.UserDisplayName: Aray Karjauv
Tags: <neural-networks><convolutional-neural-networks><tensorflow><python><regression>
Title: Is it possible to use RGB image with decimal values when feeding training data to CNN?
UserDisplayName: Sam
ThreadText: # Is it possible to use RGB image with decimal values when feeding training data to CNN?
  
  (Asked by: username_0 on 2021-04-07)
  
  I am working with four grayscale images of float32 data type to perform regression using Keras. Three images are stacked using `np.dstack` to form a RGB data-set. The last grayscale image is used as label. The grayscale images contains different variations, including [0 , 790.65], [ 150.87 , 260.45], [ -2.74174 , 2.4126 ], [-32.927 , 69.333].
  
  If I convert the images to unit8, the maximum values for the first and second image will be 255 and the decimal values for all images will be lost. I am having difficulty and struggling to find the solution for using the image in the original data type (float32) when I try to use `ImageDataGenerator` and `flow_from_directory`. Can anyone suggest way for that?
  
  **Tags:** neural-networks, convolutional-neural-networks, tensorflow, python, regression
  > **Comments:**
  > **username_1**: Data size is too low. And the loss of information of casting from float to int won't be that high.  
  > **username_2**: Your images should be normalized. You can choose any range (e.g. [-1, 0] or [0, 1]), but the main condition is that it must represent the intensities of the pixels and has to  be able to be scaled back to the original range [0, 255]. btw `matplolib` can plot normalized images in range [0, 1]  
  
  ---
  
  ## 0 answers
  
  