参考官方仓库: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. hash表/哈希表

    https://blog.csdn.net/duan19920101/article/details/51579136 简单理解就是一个通过映射直接查找的表(散列表),用哈希函数将数据按照其存储特点进 ...

  2. 【洛谷P1795 无穷的序列_NOI导刊2010提高(05)】模拟

    分析 map搞一下 AC代码 #include <bits/stdc++.h> using namespace std; map<int,int> mp; inline int ...

  3. python开发包之pyecharts

    一.python包国内源网址有: 阿里云 http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.ustc.edu.cn/ ...

  4. 用Pygal画一个英雄能力的图

    效果图: 这是在google浏览器下打开的html. play.py #!/usr/bin/env python # _*_ coding: UTF-8 _*_ """= ...

  5. Vue__npm run build npm run dev

    npm run build npm run dev 一.以前一直错的做法 以前,git完项目之后就,执行1.npm install 2.npm run build 3.npm run dev.今天ma ...

  6. CSS 格式 设置标签间距 和 input slot

    作者:张艳涛 日期:2020-07-29 CSS设置俩个标签的间距 及 Input Slots <div> <div class="m-b-20 ovf-hd"& ...

  7. OpenFaaS实战之六:of-watchdog(为性能而生)

    欢迎访问我的GitHub https://github.com/zq2599/blog_demos 内容:所有原创文章分类汇总及配套源码,涉及Java.Docker.Kubernetes.DevOPS ...

  8. SpringCloud升级之路2020.0.x版-8.理解 NamedContextFactory

    本系列为之前系列的整理重启版,随着项目的发展以及项目中的使用,之前系列里面很多东西发生了变化,并且还有一些东西之前系列并没有提到,所以重启这个系列重新整理下,欢迎各位留言交流,谢谢!~ spring- ...

  9. SQL--查询JSON、时间、字符串的高级用法

    SQL--查询JSON.时间.字符串的高级用法 本文章总结SQL的JSON.时间格式.字符串判断转换的使用.核心点还是在于Json字段的提取(1.5).时间的比较(2.2,2.3)以及字符串的查询(3 ...

  10. MIT Scheme Development on Ubuntu

    sudo apt-get mit-scheme; run "scheme" then you enter the command line scheme repl; sudo ap ...