【发布时间】:2021-01-08 11:28:15
【问题描述】:
!python {'/generate_tfrecord.py'} -x {'/content/Training'} -l {'/label_map.pbtxt'} -o {ANNOTATION_PATH + '/train.record'}
!python {'/generate_tfrecord.py'} -x{'/content/Testing'} -l {'/label_map.pbtxt'} -o {ANNOTATION_PATH + '/test.record'}
正在运行,这给了我错误:
Traceback (most recent call last):
File "/generate_tfrecord.py", line 61, in <module>
label_map = label_map_util.load_labelmap(args.labels_path)
File "/usr/local/lib/python3.6/dist-packages/object_detection/utils/label_map_util.py", line 132, in load_labelmap
with tf.gfile.GFile(path, 'r') as fid:
AttributeError: module 'tensorflow' has no attribute 'gfile'
Traceback (most recent call last):
File "/generate_tfrecord.py", line 61, in <module>
label_map = label_map_util.load_labelmap(args.labels_path)
File "/usr/local/lib/python3.6/dist-packages/object_detection/utils/label_map_util.py", line 132, in load_labelmap
with tf.gfile.GFile(path, 'r') as fid:
AttributeError: module 'tensorflow' has no attribute 'gfile'
我已按照建议在第 111 行将 tf.gfile.* 更改为 tf.io.gfile.*,执行时出现上述错误。
MacOS Catalina 10.15.3。 Google 协作(在线)
感谢您的帮助!
【问题讨论】:
标签: python tensorflow tensorflow2.0 tfrecord