tensorflow models flags 初步使用
参考官方仓库: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 初步使用的更多相关文章
- Debugging TensorFlow models 调试 TensorFlow 模型
Debugging TensorFlow models Symbolic nature of TensorFlow makes it relatively more difficult to debu ...
- 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 ...
- Ubuntu18.04下安装、测试tensorflow/models Tensorflow Object Detection API 笔记
参考:https://www.jianshu.com/p/1ed2d9ce6a88 安装 安装conda+tensorflow库 下载protoc linux x64版,https://github. ...
- 自学tensorflow——1.框架初步了解以及构建简单的计算图计算
1.初步了解 tensorflow是谷歌的一款开源深度学习框架.运行前,需要先定义好计算图,最后通过会话启动计算图,这么做的目的是为了防止数据在python和c++(tensorflow底层)传输的时 ...
- 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 ...
- windows下执行tensorflow/models的代码显示No module named 'object_detection'
Traceback (most recent call last): File "object_detection/builders/model_builder_test.py", ...
- tensorflow/models 下面的data_augment_options的random_image_scale
这个random_image_scale应该是改变整个图片的大小,而不是“box”图片的大小
- tensorflow 提示没有models库
在tensorflow文件夹里进行鼠标右键 点击 选择 Git Bash here(注意:这里的tensorflow路径可以这样来查看,在cmd命令行激活tensorflow环境activate te ...
- tensorflow中models的安装
tensorflow中models的安装参看网址: 1. Tensorflow Object Detection API Windows Install Guide http://www.insigh ...
随机推荐
- POJ1723,1050,HDU4864题解(贪心)
POJ1723 Soldiers 思维题. 考虑y坐标,简单的货舱选址问题,选择中位数即可. 再考虑x坐标,由于直接研究布置方法非常困难,可以倒着想:不管如何移动,最后的坐标总是相邻的,且根据贪心的思 ...
- 基于小熊派Hi3861鸿蒙开发的IoT物联网学习【一】
基于小熊派鸿蒙季BearPi-HM_Nano HarmonyOS 鸿蒙系统Hi3861开发板NFC 开发步骤:1.购买开发板:某宝上购买就行 2.安装开发环境 3.下载源码 4.编写案例并执行 开发 ...
- python解析excel
import xlrd, base64excel_obj = xlrd.open_workbook(file_contents=base64.decodestring(filename)).#打开要解 ...
- 通过Xlib枚举指定进程下所有窗体
在windows系统下如果想要枚举指定进程的窗体,我们可以通过EnumWindows加上自己实现的回调函数进行实现,那么在linux下该如何做呢? 其实也很简单,在linux下,我们可以通过xlib中 ...
- 浏览器不支持promise的finally
IE浏览器以及edge浏览器的不支持es6里面promise的finally 解决方法: 1.npm install axios promise.prototype.finally --save 2. ...
- videojs文档翻译-EventTarget
EventTarget new EventTarget() EventTarget是一个可以与DOM EventTarget具有相同API的类. 它增加了包含冗长功能的缩写功能. 例如:on函数是 ...
- 为MySQL的source命令导入SQL文件配置参数
为MySQL的source命令导入SQL文件配置参数 执行 mysql -uroot -p 输入密码后进入 MySQL 命令提示符 set charset utf8; source /root/xxx ...
- Android 自定义属性(attrs)、样式(Style)、主题(Theme)
Android 自定义属性(attrs).样式(Style).主题(Theme) https://www.cnblogs.com/dandre/p/4507024.html https://blog. ...
- java中sort方法的自定义比较器写法(转载)
java中sort方法的自定义比较器写法 摘要 在做一些算法题时常常会需要对数组.自定义对象.集合进行排序. 在java中对数组排序提供了Arrays.sort()方法,对集合排序提供Collecti ...
- netty系列之:自定义编码解码器
目录 简介 自定义编码器 自定义解码器 添加编码解码器到pipeline 计算2的N次方 总结 简介 在之前的netty系列文章中,我们讲到了如何将对象或者String转换成为ByteBuf,通过使用 ...