4_Tensorflow框架的使用(20181217-)

版权声明:本文为博主原创文章,转载而不修改内容请留言告知,转载并修改内容请与我联系 https://blog.csdn.net/weixin_41010198/article/details/85047904

1、Tensorflow的基础使用

2、Tensorflow中的高级使用

3、Tensorflow中一些使用技巧

1、tf.flags.FLAGS 在 tensorflow中定义可选参数

定义参数的类型(类似python中的argparse模块的使用):

FLAGS = tf.flags.FLAGS 是定义调用参数的对象


定义参数的类型和默认值 ,参数:参数名称,默认参数(无论什么类型,在定义的时候都先写成字符串的形式),参数解释说明

  • tf.flags.DEFINE_integer()
  • tf.flags.DEFINE_float()
  • tf.flags.DEFINE_string()
  • tf.flags.DEFINE_bool()
FLAGS = tf.flags.FLAGS
tf.flags.DEFINE_integer("batch_size", "2", "batch size for training")
tf.flags.DEFINE_string("logs_dir", "logs/", "path to logs directory")         # 下面填写参数的时候是 FALGS.log_dir   即可
tf.flags.DEFINE_string("data_dir", "Data_zoo/MIT_SceneParsing/", "path to dataset")
tf.flags.DEFINE_float("learning_rate", "1e-4", "Learning rate for Adam Optimizer")
tf.flags.DEFINE_string("model_dir", "Model_zoo/", "Path to vgg model mat")
tf.flags.DEFINE_bool('debug', "False", "Debug mode: True/ False")
tf.flags.DEFINE_string('mode', "train", "Mode train/ test/ visualize")

猜你喜欢

转载自blog.csdn.net/weixin_41010198/article/details/85047904