按照网上的教程,在进行csv_to_tfrecord这一步的时候,会报错:TypeError: None has type NoneType, but expected one of: int, long,检查时发现,tfrecord文件的大小为0kb,其中一个原因是因为这个文件:“generate_tfrecord.py”文件忘记修改了。
这个文件中本来有多处是注释掉的,下面代码块中的两处汉语注释就是出现问题的原因之一。
flags = tf.app.flags
flags.DEFINE_string('csv_input', '', 'Path to the CSV input')
flags.DEFINE_string('output_path', '', 'Path to output TFRecord')
flags.DEFINE_string('label', '', 'Name of class label')
# if your image has more labels input them as
flags.DEFINE_string('label0', '', 'Name of class[0] label')//默认状态下,此下都是注释掉的
#flags.DEFINE_string('label1', '', 'Name of class[1] label')
# flags.DEFINE_string('label2', '', 'Name of class[2] label')
# flags.DEFINE_string('label3', '', 'Name of class[3] label')
# flags.DEFINE_string('label4', '', 'Name of class[4] label')
# flags.DEFINE_string('label5', '', 'Name of class[5] label')
# flags.DEFINE_string('label6', '', 'Name of class[6] label')
# and so on.
flags.DEFINE_string('img_path', '', 'Path to images')
FLAGS = flags.FLAGS
# TO-DO replace this with label map
# for multiple labels add more else if statements
def class_text_to_int(row_label):
if row_label == FLAGS.label0://此处的label后的数字和上边的要对应上
return 1



