Tensorflow v1.10: store images as byte strings or per channel?

后端 未结 2 1884
既然无缘
既然无缘 2021-01-15 17:12

Context

It is known that, at the moment, TF\'s Record documentation leaves something to be desired.

My question is in regards to what is optimal for storing:

2条回答
  •  失恋的感觉
    2021-01-15 18:10

    This is an extension to my first answer which some may find useful.

    Rather than considering the encoding, I here consider the opposite, e.g. how one retrieves the data from a TFRecord.

    The colab can be found here.

    In essence I survey 10 ways of encoding an array / array of arrays.

    1. Example: Int64 feature (int array)
    2. Example: Float feature (float array)
    3. Example: Bytes feature (int array dumped to byte string)
    4. SequenceExample: Int64 feature list (array of int arrays)
    5. SequenceExample: Float feature list (array of float arrays)
    6. SequenceExample: Bytes feature list (array of int arrays dumped to byte strings)
    7. Example: Bytes feature (array of int arrays all of which is dumped to byte string)
    8. SequenceExample: Bytes feature list (array of int arrays dumped to byte strings)
    9. SequenceExample: Bytes feature list (array of int arrays all of which is dumped to byte string)
    10. SequenceExample: Bytes feature list (array of int arrays, where each int is dumped to byte string)

    There are more ways to do this.

    In short, with the exception of 8, I was able to 'recover' (write to tf.record and read back the data).

    However, it should be noted that for methods 7 and 10, the retrieved array is flattened.

提交回复
热议问题