Using string labels in Tensorflow

后端 未结 2 1387
野的像风
野的像风 2021-01-12 03:50

i\'am still trying to run Tensorflow with own image data. I was able to create a .tfrecords file with the conevert_to() function from this example link

Now i i\'d l

2条回答
  •  [愿得一人]
    2021-01-12 04:19

    The convert_to_records.py script creates a .tfrecords file in which each record is an Example protocol buffer. That protocol buffer supports string features using the bytes_list kind.

    The tf.decode_raw op is used to parse binary strings into image data; it is not designed to parse string (textual) labels. Assuming that features['label'] is a tf.string tensor, you can use the tf.string_to_number op to convert it to a number. There is limited other support for string processing inside your TensorFlow program, so if you need to perform some more complicated function to convert the string label to an integer, you should perform this conversion in Python in the modified version of convert_to_tensor.py.

提交回复
热议问题