关于cityscapes数据集生成tfrecord格式的一些心得

关于cityscapes数据集生成tfrecord格式的一些心得

  1. xx.sh文件是linux系统下的脚本文件,可在Linux系统下通过 sh xx.sh运行,其实它在这里的作用就是依次运行多个.py文件,创建文件夹,如果在windows系统下可以在pycharm中手动运行,不过要事先创建好需要的文件夹。
  2. tf.app.flags.DEFINE_string(‘cityscapes_root’, ‘./cityscapes’, ‘Cityscapes dataset root folder.’)
    该函数用来解析命令行参数,只能在tensorflow1.8及以上版本上才能正常运行,要不然会报错。
  3. 要想在1.8版本以下运行,就必须替换 用argparse替换 tf.app.flags函数
    FLAGS = tf.app.flags.FLAGS
    tf.app.flags.DEFINE_enum(‘image_format’, ‘png’, [‘jpg’, ‘jpeg’, ‘png’], ‘Image format.’)
    tf.app.flags.DEFINE_enum(‘label_format’, ‘png’, [‘png’], ‘Segmentation label format.’)
    调用参数时,使用 FLAGS.image_format
    FLAGS.label_format

替换成
import argparse
def get_arguments():
parser = argparse.ArgumentParser()
parser.add_argument("–image_format", default=“png”,choices=[“jpg”, “jpeg”, “png”],
help=“Image format”)
parser.add_argument("–label_format", default=“png”,
help=“Segmentation label format.”)
return parser.parse_args()
调用参数时使用
args = get_arguments()
args.image_format
4. parser.add_argument("–cityscapes_root", type=str, default=“xxx/cityscapes”)
default很重要,要填对地址,要不然会报错

你可能感兴趣的:(关于cityscapes数据集生成tfrecord格式的一些心得)