How can I create a tensorflow record from a list?
From the documentation here it seems possible. There's also this example where they convert a numpy array into a byte array using the .tostring()
from numpy. However when I try to pass in:
labels = np.asarray([[1,2,3],[4,5,6]])
...
example = tf.train.Example(features=tf.train.Features(feature={
'height': _int64_feature(rows),
'width': _int64_feature(cols),
'depth': _int64_feature(depth),
'label': _int64_feature(labels[index]),
'image_raw': _bytes_feature(image_raw)}))
writer.write(example.SerializeToString())
I get the error:
TypeError: array([1, 2, 3]) has type type 'numpy.ndarray', but expected one of: (type 'int', type 'long')
Which doesn't help me to figure out how to store a list of integers into the tfrecord. I've tried looking through the docs.