参考官方仓库:https://github.com/tensorflow/models/tree/master/official/utils/flags

测试Demo代码如下:

from absl import app as absl_app
from absl import flags from official.utils.flags import core as flags_core flags.DEFINE_string(name="my_flag_a", default="aaa", help="an example flag")
flags.DEFINE_string(name="my_flag_b", default="bbb", help="an other example flag") def main(_):
flags_obj = flags.FLAGS
print(flags_obj)
print(flags_obj.my_flag_a)
print(flags_obj.my_flag_b) if __name__ == "__main__":
absl_app.run(main)

Terminal运行执行如下脚本:

python tensorflow_example/test_absl_flags.py --log_dir "./logs"  --my_flag_a "flag_aaa"

输出结果:

tensorflow_example/test_absl_flags.py:
--my_flag_a: an example flag
(default: 'aaa')
--my_flag_b: an other example flag
(default: 'bbb') absl.app:
-?,--[no]help: show this help
(default: 'false')
--[no]helpfull: show full help
(default: 'false')
-h,--[no]helpshort: show this help
(default: 'false')
...... absl.logging:
--[no]alsologtostderr: also log to stderr?
(default: 'false')
--log_dir: directory to write logfiles into
...... absl.flags:
--flagfile: Insert flag definitions from the given file into the command line.
(default: '')
--undefok: comma-separated list of flag names that it is okay to specify on the command line even if the program does not define a flag with that name. IMPORTANT: flags in this
list that have arguments MUST use the --flag=value format.
(default: '')
flag_aaa
bbb

其中最后两行,表示flags_obj.my_flag_a为设置后的值,flags_obj.my_flag_b为默认值

tensorflow models flags 初步使用的更多相关文章

  1. Debugging TensorFlow models 调试 TensorFlow 模型

    Debugging TensorFlow models Symbolic nature of TensorFlow makes it relatively more difficult to debu ...

  2. tensorflow models api:ValueError: Tensor conversion requested dtype string for Tensor with dtype float32: 'Tensor("arg0:0", shape=(), dtype=float32, device=/device:CPU:0)'

    tensorflow models api:ValueError: Tensor conversion requested dtype string for Tensor with dtype flo ...

  3. Ubuntu18.04下安装、测试tensorflow/models Tensorflow Object Detection API 笔记

    参考:https://www.jianshu.com/p/1ed2d9ce6a88 安装 安装conda+tensorflow库 下载protoc linux x64版,https://github. ...

  4. 自学tensorflow——1.框架初步了解以及构建简单的计算图计算

    1.初步了解 tensorflow是谷歌的一款开源深度学习框架.运行前,需要先定义好计算图,最后通过会话启动计算图,这么做的目的是为了防止数据在python和c++(tensorflow底层)传输的时 ...

  5. https://github.com/tensorflow/models/blob/master/research/slim/datasets/preprocess_imagenet_validation_data.py 改编版

    #!/usr/bin/env python # Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apach ...

  6. windows下执行tensorflow/models的代码显示No module named 'object_detection'

    Traceback (most recent call last): File "object_detection/builders/model_builder_test.py", ...

  7. tensorflow/models 下面的data_augment_options的random_image_scale

    这个random_image_scale应该是改变整个图片的大小,而不是“box”图片的大小

  8. tensorflow 提示没有models库

    在tensorflow文件夹里进行鼠标右键 点击 选择 Git Bash here(注意:这里的tensorflow路径可以这样来查看,在cmd命令行激活tensorflow环境activate te ...

  9. tensorflow中models的安装

    tensorflow中models的安装参看网址: 1. Tensorflow Object Detection API Windows Install Guide http://www.insigh ...

随机推荐

  1. videojs文档翻译Guides-components

    components Components Video.js播放器的架构围绕组件. Player类和所有表示播放器控件和其他UI元素的类都继承自Component类. 这种架构使得可以轻松地以反映DO ...

  2. Pytorch指定GPU的方法总结

    Pytorch指定GPU的方法 改变系统变量 改变系统环境变量仅使目标显卡,编辑 .bashrc文件,添加系统变量 export CUDA_VISIBLE_DEVICES=0 #这里是要使用的GPU编 ...

  3. 35岁Android程序员被阿里辞退,生活压力太大痛哭,中年危机如何自救?

    多数人都喜欢安逸的生活,尤其是随着年龄的增长,很多人都希望工作和生活趋于稳定,不愿意再让生活有很大的变动.可是,当达到一定的年龄时,危机还是存在的. 之前有一位阿里员工在脉脉上,晒出了自己被辞退的经历 ...

  4. Markdown 学习(语法)

    标题 井号加空格(# ) 几个#就是几级标题 字体 粗体 (两边两个*) 斜体 (两边一个*) 斜体加粗 (两边三个*) 中间斜线 (两个波浪号~) 引用 选择引用,一个箭头 > 加空格 分割线 ...

  5. 使用脚本下载Gmail邮件附件

    以下脚本连接上我的Gmail帐号,将收件箱中2013年1月份的新语丝邮件的附件保存在当前目录的xys文件夹中. import imaplib import email import os dir_na ...

  6. 【笔记】主成分分析法PCA的原理及计算

    主成分分析法PCA的原理及计算 主成分分析法 主成分分析法(Principal Component Analysis),简称PCA,其是一种统计方法,是数据降维,简化数据集的一种常用的方法 它本身是一 ...

  7. Jackson格式化时间和科学计数法问题

    1. 首先如果有自定义   WebMvcConfigurer 或者 WebMvcConfigurationSupport 的,一定不要在上面加 @EnableWebMvc 注解,因为这个注解会覆盖掉s ...

  8. CleanArchitecture Application代码生成插件-让程序员告别CURD Ctrl+C Ctrl+V

    这是一个根据Domain项目中定义的实体对象(Entity)生成符合Clean Architecture原则的Application项目所需要的功能代码,包括常用的Commands,Queries,V ...

  9. innodb是如何存数据的?yyds

    前言 如果你使用过mysql数据库,对它的存储引擎:innodb,一定不会感到陌生. 众所周知,在mysql8以前,默认的存储引擎是:myslam.但mysql8之后,默认的存储引擎已经变成了:inn ...

  10. Linux搭建Snmp服务

    1:安装snmp yum install net-snmp net-snmp-devel net-snmp-libs net-snmp-utils php-snmp 上面的程序首先会校验需要升级的文件 ...