0

I have a sets of input images (rgb) and image targets (grayscale) in float32 data type by tif format. Is it possible to decode them into float32 tensor in tensorflow?

Timbus Calin
  • 13,809
  • 5
  • 41
  • 59
Sam
  • 59
  • 11

1 Answers1

1

At the time of writing this comment tfio.experimental.image.decode_tiff(). Nevertheless the output format is uint8 rather than float32.

I suggest that you read the image with OpenCV or Pillow.

E.g with OpenCV:

import cv2
import tensorflow as tf
image = cv2.imread('image.tif')
tf_tensor = tf.convert_to_tensor(image, dtype=float32)
Timbus Calin
  • 13,809
  • 5
  • 41
  • 59
  • Timbus Calin thanks for your reply. does "tf.convert_to_tensor" also support a list of images as input? – Sam Apr 14 '21 at 17:24