Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tensorflow: How to use Tensorflow's Dataset API to use TIFF images?

I'm currently using Tensorflow's Dataset API to load and preprocess images for training and testing. Here's a snipped of the code I'm using to do so:

 image_string = tf.read_file(self._data_conf.image_dir + in_image)
 label_string = tf.read_file(self._data_conf.label_dir + in_label)
 image = tf.image.decode_png(image_string, channels=self._num_channels)
 label = tf.image.decode_png(label_string, channels=self._num_channels)

The problem is, that Tensorflow doesn't support TIFF containers. Here, only the functions tf.image.decode_image, tf.image.decode_jpeg and tf.image.decode_png are supported. Now, I've implemented a class which extracts specific pages from a TIFF container as Numpy array. Is there a way to use this API (static graph) with a custom image loader, such as the class?

like image 963
Bastian Avatar asked Nov 23 '25 08:11

Bastian


1 Answers

A simple way would be directly using the python imageio and then use tf.py_func to package it.

like image 120
Panfeng Li Avatar answered Nov 25 '25 21:11

Panfeng Li



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!