tensorflow
rrr2
这个作者很懒,什么都没留下…
展开
-
合并BN层到卷积层的原理及实验
https://blog.csdn.net/IEEE_FELLOW/article/details/116174302?utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromMachineLearnPai2%7Edefault-1.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCo原创 2021-05-28 09:02:47 · 176 阅读 · 0 评论 -
Tensorflow中的数据对象Dataset.shuffle()、repeat()、batch() 等用法
Dataset数据对象Dataset可以用来表示输入管道元素集合(张量的嵌套结构)和“逻辑计划“对这些元素的转换操作。在Dataset中元素可以是向量,元组或字典等形式。另外,Dataset需要配合另外一个类Iterator进行使用,Iterator对象是一个迭代器,可以对Dataset中的元素进行迭代提取。Dataset方法2.1 .from_tensor_slicesfrom_tensor_slices 用于创建dataset,其元素是给定张量的切片的元素。函数形式:from_tensor原创 2021-05-02 10:23:06 · 4848 阅读 · 2 评论 -
ModelCheckpoint参数说明
ModelCheckpoint参数说明keras.callbacks.ModelCheckpoint(filepath,monitor=‘val_loss’,verbose=0,save_best_only=False, save_weights_only=False, mode=‘auto’, period=1)filename:字符串,保存模型的路径monitor:需要监视的值verbose:信息展示模式,0或1(checkpoint的保存信息,类似Epoch 00001: saving mod原创 2021-04-27 17:22:59 · 2836 阅读 · 0 评论 -
AttributeError: ‘ModelCheckpoint’ object has no attribute ‘on_train_batch_begin’
在运行的时候报错:AttributeError: ‘ModelCheckpoint’ object has no attribute ‘on_train_batch_begin’应该将from keras.callbacks import Modelcheckpoint改为从tensorflow中导入,即from tensorflow.python.keras.callbacks import ModelCheckpoint...原创 2021-04-26 12:03:26 · 2021 阅读 · 0 评论 -
【tensorflow/keras】 model.fit_generator
fit_generator(generator, steps_per_epoch=None, epochs=1, verbose=1, callbacks=None, validation_data=None, validation_steps=None, class_weight=None, max_queue_size=10, workers=1, use_multiprocessing=False, shuffle=True, initial_epoch=0)参数:ge原创 2021-04-19 17:53:52 · 619 阅读 · 0 评论 -
ValueError: You are trying to load a weight file containing 2 layers into a
loadweights 参数中加上by_name=Truemodel.load_weights('mobilenet_top.h5', by_name=True)原创 2021-04-19 10:18:58 · 1206 阅读 · 1 评论 -
tensorflow.python.framework.errors_impl.UnknownError: Failed to get convolution algorithm. This is p
报错tensorflow.python.framework.errors_impl.UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize问题分析cudnn 原因是安装tensorflow时候下载的cudnn版本和电脑自带的cudnn不一致解决cudnn 问题找到anaconda 下载的包说明是7.6.5这时候按照配置cudnn的方法复制到原创 2021-04-18 10:54:50 · 194 阅读 · 0 评论 -
str‘ object has no attribute ‘decode‘解决办法
File "\tensorflow_core\python\keras\saving\hdf5_format.py", llib/python3.6/site-packages/keras/engine/saving.py", line 1004, in load_weights_from_hdf5_group original_keras_version = f.attrs['keras_version'].decode('utf8')AttributeError: 'str' object原创 2021-04-18 10:40:12 · 3154 阅读 · 3 评论 -
多个版本cuda cuda10 cudnn 7.4 卸载重装anaconda tensorflow gpu1.14 numpy1.16配置
安装cuda10.0换一个目录安装,其他盘也可以。注意不需要选择vs编译那个,修改环境变量CUDA即可切换cudnn复制到对应位置就行anaconda 3-5.3卸载把c盘的相关文件夹手动删掉/之前版本重装发现不行,换了高版本python3.7的tensorflow-gpu1.14tensorflow-gpu1.15对应numpy 1.19/16都会报错ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'原创 2021-04-17 08:46:13 · 172 阅读 · 0 评论 -
tensorflow-gpu镜像
https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/tensorflow-gpu/原创 2020-05-12 21:43:58 · 1460 阅读 · 0 评论 -
sigmoid_cross_entropy_with_logits交叉熵损失简介及测试
def这个函数的作用是计算经sigmoid 函数激活之后的交叉熵。def sigmoid_cross_entropy_with_logits(_sentinel=None, labels=None, logits=None, name=None):计算公式:为了描述简洁,我们规定 x = logits(比如一张图),z = targets(分类结果)z * -log(sigmoid...原创 2018-11-08 17:23:10 · 5330 阅读 · 1 评论 -
anaconda 升级/安装最新包 tensorflow 1.5(eg)
用anaconda安装最新的TensorFlow版本问题: 如在anaconda搜索依旧是tensorflow1.2的版本,如何用conda下载最新版本(其他包相同) 解决方法: 1,打开anaconda-prompt2,查看tensorflow各个版本: anaconda search -t conda tensorflow4,找到自己pc环境对应的最新TensorFlo...原创 2018-03-13 19:37:45 · 11340 阅读 · 2 评论 -
tensorflow gpu使用说明
由于tensorflow默认抢占服务器所有GPU显存,只允许一个小内存的程序也会占用所有GPU资源。下面提出使用GPU运行tensorflow的几点建议:1.在运行之前先查看GPU的使用情况:$ nvidia-smi # 查看GPU此时的使用情况或者$ nvidia-smi -l # 实时返回GPU使用情况2.目前实验室服务器有0,1,2,3四个GPU,找到空闲的GPU号,可以原创 2018-01-26 10:14:34 · 2516 阅读 · 1 评论 -
tensorflow tf.train.SummaryWriter()
tensorflow 新版取消了tf.train.SummaryWriter(),换成使用tf.summary.FileWriter()原创 2017-12-25 21:13:56 · 4695 阅读 · 0 评论 -
tensorboard可视化操作过程及测试代码
在anaconda的spyder下生成logs文件后在chrome浏览器中打开tensorboard,可以看到自己搭建的框架。 总结一下过程与遇到的问题: 1,代码中python3.6原来函数改变为tf.summary.FileWriter、tf.global_variables_initializer()。不然报错无法生成logs文件 2.生成后,在logs文件那层,按住shift+右键,打原创 2017-12-25 22:43:34 · 2583 阅读 · 0 评论 -
tf.nn.conv2d卷积计算函数及variable(全连接)和get_variable(权值共享)区别
函数格式:tf.nn.conv2d(input, filter, strides, padding, use_cudnn_on_gpu=None, name=None)input: 指需要做卷积的输入图像(或者feature map),它要求是一个Tensor,具有[batch, in_height, in_width, in_channels]这样的shape,具体含义是[训练时原创 2018-01-12 00:16:08 · 1122 阅读 · 0 评论 -
tf.variable_scope()和tf.name_scope(),tf.Variable()和tf.get_variable()
创建变量的两种方式有 tf.get_variable() 和 tf.Variable() tf.Variable()会自动检测命名冲突并自行处理, tf.get_variable()则遇到重名的变量创建且变量名没有设置为共享变量时,则会报错。import tensorflow as tfwith tf.name_scope('name_scope_x'): var1 = tf.get_va原创 2018-01-24 16:37:04 · 138 阅读 · 0 评论 -
tensorboard 报错及解决方案
版本提高后改变Replace tf.scalar_summary, tf.histogram_summary, tf.audio_summary, tf.image_summary with tf.summary.scalar, tf.summary.histogram, respectively. The new summary ops take namemeaning summa原创 2018-01-25 14:47:26 · 2971 阅读 · 1 评论 -
tensorflow 正则化代码
# -*- coding: utf-8 -*-"""Created on Wed Jan 17 11:12:22 2018@author: Administrator"""# 《TensorFlow实战Google深度学习框架》04 深层神经网络# win10 Tensorflow1.0.1 python3.5.3# CUDA v8.0 cudnn-8.0-windows10-x原创 2018-01-18 13:14:32 · 2392 阅读 · 1 评论 -
InvalidArgumentError:failed to create a directory:E: f; Invalid argument
When I try this mnist=input_data.read_data_sets(“D:\pyprogram”,one_hot=True) on different computer It can pass on win7,but can’t on win10 My solution is: change “D:\pyprogram” to “D:\pyprogram\”原创 2018-01-26 10:10:02 · 2718 阅读 · 0 评论 -
Lenet-5 MNIST Tensorboard 参数可视化 直方图 tf.Summary.histogram,tf.Summary.scalar,tf.Summary.image
后边增加了Lenet-5实现MNIST识别的可视化代码先上出图:这里因为只训练了3000次,可能并没有达到最优,仅作示意。 上个代码,前提先下载MNIST数据集,MNIST四个 二注意改代码里两个目录,一个mnist数据存放目录,一个存放tensorboard文件目录# -*- coding: utf-8 -*-"""Created on Thu Jan 25原创 2018-01-25 21:22:25 · 7322 阅读 · 0 评论 -
tf.reshape和tf.Tensor.get_shape()
tf.reshape(tensor, shape, name=None) 第1个参数tensor为被调整维度的张量。第2个参数shape为要调整为的形状。返回一个shape形状的新tensor注意shape里最多有一个维度的值可以填写为-1,表示自动计算此维度。Reshapes a tensor. Given tensor, this operation returns a原创 2018-01-27 18:51:49 · 897 阅读 · 0 评论 -
tensorflow placeholder()
tf.placeholder(dtype, shape=None, name=None) 此函数可以理解为形参,用于定义过程,在执行的时候再赋具体的值。dtype:数据类型。一般要加上tf.float32,否则报错shape:数据形状。默认是None,就是一维值,也可以是多维,比如 [2,3], [None, 3]表示列是3,行不定name:名称。impo原创 2017-12-19 20:10:00 · 460 阅读 · 0 评论