![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Tensorflow
小田同学tdx
这个作者很懒,什么都没留下…
展开
-
keras 自定义F1-score 保存最优模型
主要参考了Tensorflow与keras学习 (8)——实现f1_score(多分类、二分类)_AI小白龙的博客-CSDN博客在参考第一个的时候出现了self.validation is NoneType解决: class Metrics(Callback): def __init__(self, train_x, train_y, val_x, val_y, batch_size = 1024): super().__init__()原创 2022-04-01 16:49:43 · 1392 阅读 · 0 评论 -
linux cuda10.0使用pip安装pytorch
wget https://download.pytorch.org/whl/cu100/torch-1.3.0%2Bcu100-cp36-cp36m-linux_x86_64.whlwget https://download.pytorch.org/whl/cu100/torchvision-0.4.1%2Bcu100-cp36-cp36m-linux_x86_64.whl\下载上述文件,...原创 2019-11-08 10:15:40 · 3470 阅读 · 0 评论 -
ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory
安装完tensorflow后,使用python导入发现以下的错误百度之后发现很多网友说是 tensorflow安装的版本过高和cuda不匹配,这一有一个 tensorflow和cuda、cudnn的一个对应版本链接可以参考,https://blog.csdn.net/omodao1/article/details/83241074 查看本人环境下的cuda版本和cudnn的版本1、...原创 2019-02-13 13:57:08 · 934 阅读 · 0 评论 -
tensorflow 将ckpt中的参数存储为 npy 格式。
reader=pywrap_tensorflow.NewCheckpointReader(FILE_PATH) var_to_shape_map=reader.get_variable_to_shape_map() for key in var_to_shape_map: print(key) layers = ['conv1_1', 'conv1_2'...原创 2018-07-11 11:38:17 · 1991 阅读 · 2 评论 -
tensorflow ,卷积层梯度为 0
今天 在测试多GPU并行实验时,采用. tf.train.GradientDescentOptimizer优化器 卷积层的梯度都为 0, 模型保持不动 ,换成AdadeltaOptimizer就好了,原因 还不清楚。待补充atf.train.GradientDescentOptimizer...原创 2018-06-22 17:13:00 · 1651 阅读 · 0 评论 -
Tensorflow 查看模型训练过程中的参数变化
笔记:比如我想查看, 模型中最后一个全连接层的参数,在每一轮中是否发生了变化。with tf.variable_scope('w') as scope: w = tf.get_variable('weights',shape=[hidden_nums, self.__num_classes],dtype=tf.float32,initializer=tf.truncated_normal_...原创 2018-06-21 11:46:44 · 8169 阅读 · 0 评论 -
tf.FixedLenFeature 和tf.VarLenFeature 的区别
tf.FixedLenFeature 返回的是一个定长的tensortf.VarLenFeature 返回的是一个不定长的sparse tensor,用于处理可变长度的输入,在处理c t c 问题时,会用到tf.VallenFeature解析存储在tfrecord中的label。待补充...原创 2018-05-13 16:45:37 · 20410 阅读 · 0 评论 -
深度学习中的数据增强(data augmentation)
直接上代码:#encoding:utf-8'''tf 参考链接 :https://tensorflow.google.cn/api_guides/python/image增加数据量,减轻过拟合,增强模型的泛化能力在预测时也可以使用'''import numpy as npimport osimport mathimport tensorflow as tffrom skimag...原创 2018-04-27 11:22:26 · 6474 阅读 · 1 评论 -
tensorflow.contrib.slim
码:中文:https://www.2cto.com/kf/201706/649266.html原创 2018-04-26 16:59:10 · 1188 阅读 · 0 评论 -
详解CNN中的stride 和 padding 到底是怎么计算的
平时不注意的细节,别人一问的时候就会很懵逼,所以认真对待每一个参数。先看一下 tensorflow中自带的卷积操作是什么样子的呢?https://tensorflow.google.cn/api_docs/python/tf/nn/conv2dtf.nn.conv2d( input, filter, strides, padding, use_...原创 2018-05-10 18:34:19 · 28999 阅读 · 2 评论 -
tfrecord构建自己的数据集
根据tfrecord构建本地自己的数据集套话:TFRecord文件中的数据都是通过tf.train.Example Protocol Buffer的格式存储的。其中包含一个从属性名到取值的字典,属性的取值可以为字符串(BytesList),实数列表(FloatList)或整数列表(Int64List)。比如将,将一个图片存为字符串,其label值存为整数。message Feature{ ...原创 2018-04-10 09:53:46 · 354 阅读 · 0 评论 -
tensorflow 运行过程中loss出现 NaN
描述:在训练的是loss正常,测试的时候出现了NaN解决方法:通过打印softmax()之后的结果,发现出现了0值,导致后面出现log(0)=NaN的情况; 参考链接:http://stackoverflow.com/questions/33712178/tensorflow-nan-bughttp://blog.csdn.net/sinat_16823063/article/d原创 2017-10-26 21:13:33 · 4011 阅读 · 0 评论 -
tensorflow根据label图画出对应的热图 语义分割
在使用tensorflow对图像进行分割预测的时候,得到的值对应的是一个二维数组,如果直接将其保存为图片,就是一个黑色的图,区分不大,因此我要将其转成带颜色的图,每个类别对应一种颜色,对应的下图中的左道右。 def value_to_RGB(value): a=[None]*len(value) for i in range(len(value)):原创 2017-11-02 16:51:01 · 3231 阅读 · 0 评论 -
备注:tensorflow模型训练时同时进行测试,将结果可视化。
1、首先创建两个placeholder,用来存放测试数据集,和标签。x = tf.placeholder(tf.float32, shape = [BATCH_SIZE,256,256,3])y_ = tf.placeholder(tf.int16,shape = [BATCH_SIZE]) 2、创建一个FileWriter ,用于写入测试数据信息test_writer = tf.原创 2017-09-23 20:40:50 · 5483 阅读 · 4 评论