【问题标题】:Tensorflow Object Detection, error while generating tfrecord [TypeError: None has type NoneType, but expected one of: int, long]Tensorflow 对象检测,生成 tfrecord 时出错 [TypeError:None 的类型为 NoneType,但预期为以下之一:int、long]
【发布时间】:2018-01-19 14:35:31
【问题描述】:

在检查网络上可用的不同解决方案时,大多数人(包括 datitran)指出,这可能是 train csv 文件中某个类的缺失或拼写错误。我无法弄清楚,因为标签是使用 labelImg 完成的,它将这些类保存为 xml,xml_to_csv.py 将其转换为 csv。不确定在什么情况下我可能有机会错过或拼错任何课程。

这是正在处理的错误:

(OT) 
nisxxxxx@xxxxxxxx:~/Desktop/OD/models/research/object_detection$ 
python generate_tfrecord.py --csv_input=data/train_labels.csv  --
output_path=data/train.record
Traceback (most recent call last):
  File "generate_tfrecord.py", line 192, in <module>
    tf.app.run()
  File "/home/nisxxxxx/Desktop/test_OD/OT/lib/python2.7/site-
packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "generate_tfrecord.py", line 184, in main
tf_example = create_tf_example(group, path)
  File "generate_tfrecord.py", line 173, in create_tf_example
    'image/object/class/label': 
dataset_util.int64_list_feature(classes),
File"/home/nishanth/Desktop/test_OD/models/research/object_detection/utils/dat
aset_util.py", line 26, in int64_list_feature
    return 
tf.train.Feature(int64_list=tf.train.Int64List(value=value))
TypeError: None has type NoneType, but expected one of: int, long

有人能解决这个问题吗?

【问题讨论】:

  • 关闭此请求。

标签: tensorflow object-detection tfrecord


【解决方案1】:

我不确定你使用了多少个类...在最后 else 尝试“返回 0 而不是无”...示例

if row_label == 'red':
    return 1
elif row_label == 'orange':
    return 2
elif row_label == 'blue':
    return 3
else:
    return 0

【讨论】:

    【解决方案2】:

    在通过 labelImg 工具裁剪图像期间,只需更改标签名称即可。

    def class_text_to_int(row_label):
        if row_label == 'raccon':
            return 1
        else:
            None
    

    代替“raccon”,将标签名称替换为前:-“汽车”。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-16
      • 2017-12-31
      • 2021-12-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多