I am trying to train a neural network using my own tiff pictures with tensorflow pipline. Here is the problem: tensorflow only has 4 kinds of pictures which can be decoded(decode_jpeg, decode_bmp, decode_gif, decode_png), there is no way to decode tiff pictures. So, how can i decode my tiff pictures to use tensorflow pipline to input my own data? or how can i decode my tiff pictures to use batch?
Asked
Active
Viewed 3,143 times
3
-
or how can i input my tiff pictures to train? It is also fine using tf.placeholder or tf.variables. – CQ is not hot Jul 07 '17 at 12:45
-
Welcome to stack overflow. To get the best results, it is helpful to read through the hints on how to ask a good question: https://stackoverflow.com/help/how-to-ask. As is, your question is relatively broad and is not ideal for the question and answer format of this site. – Conor Mancone Jul 07 '17 at 15:11
-
You could use the freely available **ImageMagick** to convert your TIFFs to PNG or JPEG images. So, if you wanted to convert a whole directory of TIFFs into JPEGs, you could run `mogrify -format PNG *.TIFF` – Mark Setchell Jul 08 '17 at 15:23
-
See also https://stackoverflow.com/questions/41985509/tensorflow-machine-learning-no-decoder-for-tiff-images – Jonas Adler Jul 08 '17 at 17:56
-
Thanks a lot!! I will try it. – CQ is not hot Jul 11 '17 at 10:42
-
I convert my tiff pictures to bin file, then, use nummpy.array to convert it to array. so tensorflow could use the array to train in TFrecords. And it`s worked. But here comes a new question, the loss function is not convergent. I don`t know the problem is out of the initializers of weights and biases, or out of the local minima? – CQ is not hot Jul 11 '17 at 10:46
1 Answers
0
Try this: tfio.experimental.image.decode_tiff.
tfio.experimental.image.decode_tiff(
contents, index=0, name=None
)
contents: A Tensor of type string. 0-D. The TIFF-encoded image.
index: A Tensor of type int64. 0-D. The 0-based index of the frame inside TIFF-encoded image.
name: A name for the operation (optional).

Nicolas Gervais
- 33,817
- 13
- 115
- 143