I want to convert a .csv file to a TF Record. My problem now, python_io doesn't exists in Tensorflow 2.0.
     writer=tf.python_io.TFRecordWriter(FLAGS.output_path)
     path = os.path.join(FLAGS.image_dir)
     examples = pd.read_csv(FLAGS.csv_input)
     grouped = split(examples, 'filename')
     for group in grouped:
        tf_example = create_tf_example(group, path)
        writer.write(tf_example.SerializeToString())
     writer.close()
     output_path = os.path.join(os.getcwd(), FLAGS.output_path)
I get this error:
File "generate_tfrecord.py", line 102, in <module>
main()
File "generate_tfrecord.py", line 89, in main
writer = tf.python_io.TFRecordWriter(FLAGS.output_path)
AttributeError: module 'tensorflow' has no attribute 'python_io'
What do i have to use instead?
According to the official documentation, the python.io package has been moved to a new one called io. Just swap them and it works.
writer = tf.io.TFRecordWriter(FLAGS.output_path)
# ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With