Tensorflow框架的使用(20181217-)
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")
♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠