
tensorflow
hzhj
写作不只为了传播,更重要的是思考和学习。
展开
-
tensorflow导出冻结图模型
导出推理图python export_inference_graph.py \ --alsologtostderr \ --dataset_name=autohome \ #自定义数据集的名称 --model_name=mobilenet_v2_140 \ #模型名字 --image_size=224 \ --output_file=angle/mobilenet_v2_140_224_inference.pb #待输出的推理图冻结模型文件python -m tenso原创 2020-06-03 20:54:53 · 1126 阅读 · 0 评论 -
ImportError: No module named model_utils
Q:问题如下from tensorflow.python.saved_model.model_utils import build_all_signature_defsImportError: No module named model_utilsA: 重装tensorflow_estimatorpip uninstall tensorflow_estimatorpip in...原创 2019-11-27 14:47:55 · 1615 阅读 · 0 评论 -
tf.variable_scope VS tf.name_scope
本文以tf1.13版本中tf.variable_scope类和tf.name_scope为例,介绍相应类的初始化。tf.variable_scope类的初始化 def __init__(self, name_or_scope, #名称或VariableScope,用作当前范围内op函数的name前缀 default_...原创 2019-09-26 20:19:21 · 386 阅读 · 0 评论 -
tf.nn.pool
本文以tf1.13版本中的tf.nn.pool函数为例,介绍N-D输入的池化操作,函数输入参数如下。tf.nn.pool( input, #N+2维的tensor,若date_format格式不以NC开头,则input形状[batch_size]+ N-D_input_shape + [num_channels],以NC开头时,形状为[batch_size...原创 2019-09-24 20:00:46 · 356 阅读 · 0 评论 -
tf.nn.conv2d函数
本文以tf1.13版本为例,介绍tensorflow二维卷积conv2d,该函数的输入参数如下:tf.nn.conv2d( input, #shape为(*,*,*,*),4-D的tensor,每个维度的意义与data_fromat对应 filter=None, #shape为(*,*,*,*),同input的...原创 2019-09-23 20:17:00 · 454 阅读 · 0 评论 -
tensorflow加载多graph
使用tf加载不同网络结构的模型时,由于默认图的设置导致后边加载时可能出现节点不存在的错误提示,如下为先加载resnet的一个网络,然后加载vgg网络时提示的错误信息。tensorflow.python.framework.errors_impl.NotFoundError: Restoring from checkpoint failed. This is most likely due t...原创 2019-09-19 10:41:06 · 501 阅读 · 0 评论 -
TF-TRT的使用
TF-TRT通过对基于tensorflow提供服务的模型进行优化后用于inference。使用方式详见examples。本文主要展示其用途及tensorrt与tensorflow间的版本对应关系。基于saved_model.pb工作流程如下。图片来自这里基于freeze_graph.pb的工作流程如下。图片来自这里nvidia官方提供了封装好的镜像,nvcr.io/nvid...原创 2019-08-10 15:32:16 · 5105 阅读 · 0 评论 -
tensorflow gpu 测试
Acceptable feed values include Python scalars, strings, lists, numpy ndarrays, or TensorHandles.Tensoris simply asymbolicobject,feed_dict shoud betheactualvaluesimport tensorflow as tf s...原创 2019-07-30 11:36:08 · 214 阅读 · 0 评论 -
tensorflow cuda cudnn
tf版本问题问题: tensorflow==1.12.0 提供非阻塞服务时,报错tensorflow/core/common_runtime/bfc_allocator.cc:380] Check failed: h != kInvalidChunkHandle;另一方面,阻塞服务时运行正常 解决方法: 替换为1.13rc0后运行正常gpu model及其编译结构gpu model ...原创 2019-07-24 11:13:01 · 531 阅读 · 0 评论 -
CUDNN_STATUS_INTERNAL_ERROR解决方法
tf调试中出现CUDNN_STATUS_INTERNAL_ERROR等错误E tensorflow/stream_executor/cuda/cuda_dnn.cc:359] could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERRORE tensorflow/stream_executor/cuda/cuda_dnn.cc:326...原创 2019-07-23 18:55:11 · 12575 阅读 · 2 评论 -
tf镜像制作
cudnn环境查看dpkg -l |grep cudnntensorflow-gpu==1.13.1apt-get install apt-transport-https -y apt-get install libcudnn7=7.4.1.5-1+cuda10.0 --allow-downgrades -y参考文献: Ubuntu 18.04 安裝 NVID...原创 2019-07-04 14:37:05 · 615 阅读 · 0 评论 -
tf.nn.convolution中关于padding的"VALID" or "SAME"操作
tf.nn.convolution(input, filter, padding, strides=None, dilation_rate=None, name=None, data_format=None)函数参数的解释详见该地址。本文仅对关注的padding和dilation_rate进行说明。padding:填充算法,仅支持"VALID" or "SAME";dilation_...原创 2018-08-08 12:22:46 · 1839 阅读 · 0 评论 -
深度学习中的batch normalization
论文提出了batch normalization,用于减少Internal Covariate Shift,防止梯度弥散,还可加速模型的训练。本文就tensorflow中的实现过程和训练测试时的使用差异进行说明。 图1 算法说明 tf实现函数体如下: with ops.name_scope(name, "batchnorm", [x, mean, variance, scale,...原创 2018-05-25 19:52:07 · 593 阅读 · 0 评论