vahidk/tfrecord

Error while making tfrecords

samra-irshad opened this issue · 2 comments

Hi , Thanks for sharing this repo with us. I am trying to create tfrecords but I get this error:

OverflowError: Python int too large to convert to C long

I am passing images in form of raw bytes for creation. any hint why is this happening?

I miss the same error. Would you please tell me if you resolve this error. Thank you very much.

For writing you need crc32 package:

pip3 install crc32c

Example:

import numpy as np
import tfrecord

datum = {
    "image": (np.random.bytes(20), "byte"),
    "label": ([7.687], "float"),
    "index": ((9,), "int"),
    "i": (9, "int")
}
writer = tfrecord.TFRecordWriter("test.tfrecord")
writer.write(datum)
writer.close()