参考官方仓库: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. 流畅的python-2

    一.python数据结构  ----------------> ()      []          {} List 列表[] 可变的 lst = [1,2,3,4] #改 lst[(元素下标 ...

  2. odoo源生打印【web report】

    https://www.odoo.com/documentation/12.0/reference/reports.html     具体的看官方文档 一.纸张格式设置: <record id= ...

  3. CFS靶机

    nmap扫描 nmap -sV -p1-65535 192.168.1.135 thinkphp5.0版本 找到poc进行测试 http://192.168.1.135/index.php?s=ind ...

  4. DS1515+

    DS1515+ 2021年05月02日 0 2.4k aahk   DS1515+ 2021年05月02日 这篇文章用于记录.改进.提高.分享我在使用群晖DS1515+网络存储服务器过程中的具体操作. ...

  5. C语言复习(一)

    类型为void*的指针代表对象的地址,而不是类型 如果需要使用另一个源文件中定义的变量,那么只需要在定义变量前加上extern关键字 ex: extern int x;//x在其他文件中定义 左值表达 ...

  6. JUC学习笔记(三)

    JUC学习笔记(一)https://www.cnblogs.com/lm66/p/15118407.html JUC学习笔记(二)https://www.cnblogs.com/lm66/p/1511 ...

  7. Mysql的分区表

    概论: 分区表一般用作Mysql库表的水平切割(也就是常说的mysql性能优化的几种通用手法"读写分离.分库分表"中的一种),适用于单表的数据量可能很大的场景.因为分区表可以将一个 ...

  8. Django推导 安装等

    HTTP协议补充 四大特性: 基于请求响应 基于TCP/IP协议之上的应用层协议 无状态 不能保存用户信息(cookie,session,token) 短链接 请求数据格式: 请求首行(请求方式,ht ...

  9. DAY04 与用户交 互格式化输出与运算符

    与用户交互 输入: input # python2与python3的区别 # python3 res = input('please in put your username>>>& ...

  10. 基于Vue2和Node.js的反欺诈系统设计与实现

    最近包工头喊农民工小郑搬砖,小郑搬完砖后沉思片刻,决定写篇小作文分享下,作为一个初学者的全栈项目,去学习它的搭建,到落地,再到部署维护,是非常好的. ​ ------题记 写在前面 通过本文的学习,你 ...