T型牌坊
tensorflow
飞行codes
资浅程序员,博士
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
张量乘规则与代码
系统学习tensor原创 2022-06-22 09:18:25 · 316 阅读 · 0 评论 -
tf.size()和tf.nn.l2_loss()例子
计算范数常用原创 2022-06-17 17:04:55 · 244 阅读 · 0 评论 -
速装jax
具有求导数的函数原创 2022-01-17 16:47:56 · 1965 阅读 · 2 评论 -
tf.math
函数包原创 2021-11-29 18:13:38 · 494 阅读 · 0 评论 -
解决tensorflow.org上不去的方法亲测有效
https://tensorflow.google.cn tensorflow2.5文单原创 2021-06-01 17:33:46 · 982 阅读 · 0 评论 -
keras CategoricalAccuracy速查
argmax of logits and probabilities are same原创 2021-05-28 18:08:43 · 652 阅读 · 0 评论 -
from_logits=True
logit和概率的区别原创 2021-05-28 09:58:42 · 2079 阅读 · 0 评论 -
keras.callbacks.Callback()回调函数ModelCheckpoint
可以仅仅训练不验证原创 2021-05-21 10:39:02 · 1247 阅读 · 1 评论 -
tensorflow_examples.models.pix2pix.upsample()函数
get rid of tensorflow 1.X batch_norm bug原创 2021-04-28 16:59:52 · 837 阅读 · 0 评论 -
速装tensorflow2.1GPU
没什么是重装解决不了的原创 2021-04-27 18:05:53 · 313 阅读 · 0 评论 -
云端安装神经网络环境(cuda10.1&ppc64)
服务器版操作系统原创 2020-12-29 17:19:09 · 513 阅读 · 0 评论 -
Dice系数公式与代码(keras)
Dice coefficient原创 2019-05-05 11:08:55 · 9771 阅读 · 6 评论 -
tensorflow从python2.7升级至python3
conda create --name tensorflow python=3.7 conda update -n base -c defaults conda 升级spyder sudo apt install spyder3 或 source activate tensorflow conda install spyder source activate tensorfl...原创 2019-04-15 11:11:17 · 1038 阅读 · 0 评论 -
类脑计算——tensorflow框架的tf.dropout()函数
With probability keep_prob, outputs the input element scaled up by 1 / keep_prob, otherwise outputs 0. The scaling is so that the expected sum is unchanged. dropout操作目的是降低过拟合的发生率,其原理受到人脑神经网络启发。 那么...原创 2018-11-08 17:31:28 · 1090 阅读 · 0 评论 -
混淆矩阵与tf.metrics.mean_iou()函数使用举例
IOU = true_positive / (true_positive + false_positive + false_negative) Calculate per-step mean Intersection-Over-Union tf.contrib.metrics.streaming_mean_iou tf.metrics.mean_iou 方法1 im...原创 2019-02-18 11:04:56 · 6246 阅读 · 14 评论 -
ubuntu18.04+CUDA10+CUDNN+tensorflow_gpu installation guide医疗神经网络工作站搭建
重装系统蔑视原创 2018-12-17 17:54:47 · 1054 阅读 · 1 评论 -
l1和l2正则化
L1 regularization encourages sparsity. L2 penalizes the optimization steps.原创 2019-06-13 16:00:08 · 370 阅读 · 0 评论 -
python yield用法
generator,字面翻译即引擎。可以源源不断批量生成数据。 看看keras经典例子 def generate_arrays_from_file(path): while True: with open(path) as f: for line in f: # create numpy arrays of in...原创 2019-05-30 13:03:24 · 1089 阅读 · 0 评论 -
tensorflow的Data API
例1 import tensorflow as tf import numpy as np BATCH_SIZE = 2 train_x = np.array([1.0, 2.0, 3.0, 4.0, 5.0]) train_y = np.sin(train_x) ds = tf.data.Dataset.from_tensor_slices((train_x, train_y...原创 2019-08-19 16:43:44 · 288 阅读 · 0 评论 -
tf.tile()其实就是贴瓷砖
tf.tile( input, multiples, name=None ) Args: input: ATensor. 1-D or higher. multiples: ATensor. Must be one of the following types:int32,int64. 1-D. Length must be the same as the ...原创 2019-07-29 10:38:17 · 484 阅读 · 0 评论 -
循环神经网络的关键库函数(tensorflow)
tf.nn.rnn_cell.BasicLSTMCell __init__( num_units, forget_bias=1.0, state_is_tuple=True, activation=None, reuse=None, name=None, dtype=None, **kwargs ) Args: num_uni...原创 2019-08-15 14:29:40 · 528 阅读 · 0 评论 -
如何载入tensorflow官网下载的模型
以VGG net为例 import os import sys sys.path.append("/***/models-master/research/slim") from nets import vgg原创 2019-01-26 14:10:31 · 567 阅读 · 0 评论 -
tensorflow框架的tf.group()函数
Create an op that groups multiple operations. When this op finishes, all ops in inputs have finished. This op has no output. 有点像批处理,法术定序。 import tensorflow as tf a = tf.constant([5.0]) b = tf.con...原创 2018-11-08 16:50:45 · 1957 阅读 · 0 评论 -
tf.clip_by_value()防止梯度爆炸
y_pred = tf.clip_by_value(y_pred, 10e-8, 1.-10e-8) 后接log防止出现log0。 import tensorflow as tf v=tf.constant(([1.0,2.0,3.0],[4.0,5.0,6.0])) with tf.Session() as sess: print(tf.clip_by_value(v,2.5,...原创 2019-06-04 13:45:01 · 1067 阅读 · 0 评论 -
tf.stack() 自带升一维
Stacks a list of rank-Rtensors into one rank-(R+1)tensor. import tensorflow as tf a = tf.constant([[1,2,3],[4,5,6]]) b = tf.constant([[7,8,9],[10,11,12]]) ab1 = tf.stack([a,b],axis=0) ab2 = tf.st...原创 2019-06-13 17:57:24 · 305 阅读 · 0 评论 -
Tensorflow框架两种cost函数:MSE和Multi-class
import tensorflow as tf def MSE_cost(out,Y): cost = tf.reduce_mean(tf.square(out-Y)) return cost def multiclass_cost(out,Y): cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logit...原创 2018-11-22 17:08:03 · 1547 阅读 · 1 评论 -
tf.argmax(array, 1)函数用法
除了知道返回是坐标,还须记得: tf.argmax(array, 1) 指的是 axis=1 tf.argmax(array)默认axis=0 import numpy as np import tensorflow as tf c = np.array([[1,8,3],[4,5,6]]) d = np.array([[-1,2,0],[7,8,-9]]) f1 = t...原创 2018-11-22 15:41:48 · 2017 阅读 · 1 评论 -
关于tf.one_hot()需知其所以然
该命令一般用于cost function import tensorflow as tf N_CLASSES = 5 labels = [1,4,0,2,3,0,1,1] with tf.Session() as sess: sess.run(tf.global_variables_initializer()) a = sess.run(tf.one_hot(label...原创 2018-11-16 17:02:17 · 997 阅读 · 0 评论 -
tensorflow scope()函数大型指导
目录 get_model_varibales()和get_variables() tf.valuable_scope() tf.name_scope()名称覆盖机制 slim升级至tf.contrib.framework.arg_scope()/tf.contrib.layers get_model_varibales()和get_variables() ...原创 2018-11-20 16:45:36 · 657 阅读 · 0 评论 -
分形可视化tensorflow实现
In mathematics, a fractal is a detailed, recursive, and infinitely self-similar mathematical set. import tensorflow as tf import numpy as np # 导入可视化库 import PIL.Image from cStringIO import Strin...转载 2018-11-08 10:35:41 · 529 阅读 · 1 评论 -
tf.argmax(), tf.maximum(a, b) , np.amax() , numpy.maximum(),np.argmax()系列最大最小值函数用法速查
numpy.ndarray.max() 和 numpy.amax() 一样。 numpy,amax() Return the maximum of an array or maximum along an axis. 关于axis, 请看https://blog.csdn.net/Arctic_Beacon/article/details/83307785 numpy.maximum(...原创 2018-11-01 13:47:43 · 1281 阅读 · 0 评论 -
怎样知道tensorflow计算用的是CPU还是GPU
sess.run()这行命令前面,加上如下: sess = tf.Session(config=tf.ConfigProto(allow_soft_placement=True, log_device_placement=True)) 终端的device mapping Device mapping: /job:localhost/replica:0/task:0/device:GP...原创 2018-10-30 09:06:45 · 5950 阅读 · 0 评论 -
Tensor flow实现FCN和linear regression: Y=XW+b
全连接实现其实就是矩阵乘原创 2018-10-23 10:33:07 · 561 阅读 · 0 评论 -
机器学习准确率accuracy的几种代码结构参考
首先,牢记几个函数,tf.equal(),tf.argmax(array, 1),tf.reduce_mean() import tensorflow as tf import numpy as np A = [1,3,4,5,6] B = [1,3,4,3,2] with tf.Session() as sess: print(sess.run(tf.equal(A, B...原创 2018-11-23 15:25:07 · 4760 阅读 · 0 评论 -
Tensor flow.contrib.slim例子之slim.getvariables()
import tensorflow as tf import tensorflow.contrib.slim as slim # Model Variables weights = slim.model_variable('weights', shape=[5, 5, 3 , 3], ...原创 2018-11-30 10:02:16 · 1681 阅读 · 0 评论 -
高端索引tf.gather_nd(params, indices)
import tensorflow as tf import numpy as np params = np.arange(23) a = tf.gather(params,1) with tf.Session() as sess: print(sess.run(a)) params = np.arange(24).reshape(2,-1) a = tf.gather(pa...原创 2019-06-13 17:36:26 · 464 阅读 · 0 评论 -
tensorflow的axis——降维tf.argmax() tf.reduce_mean()
目录 tf.argmax() tf.reduce_mean() tf.argmax(), 自带降低一维 import tensorflow as tf import numpy as np x = np.ones((2,3,3,1)) z = tf.argmax(x,axis = 3) print(z.get_shape()) with tf.Session() as sess: ...原创 2019-06-13 17:20:57 · 337 阅读 · 0 评论 -
tf.name_scope()名称覆盖机制
import tensorflow as tf tf.reset_default_graph() name = 'a1' x = tf.Variable(tf.random_normal(shape=[5,5], mean=0, stddev=1), name='a2') x = tf.reshape(x,[1,5,5,1]) with tf.name_scope(name): ...原创 2019-03-12 09:56:28 · 521 阅读 · 0 评论 -
python lambda函数举例
例1 >>>p = lambda x,y:x+y >>>p(3,4) 7 例2 import tensorflow as tf tf.reset_default_graph() x = tf.constant(10) y = tf.constant(5) a=2 b=3 z = tf.multiply(a, b) result = tf.cond...原创 2019-02-18 16:07:57 · 371 阅读 · 0 评论 -
keras np_utils()函数
from keras.utils import np_utils N_CLASSES = 3 label = [0,0,0,1,1,1,2,2,2] train_label = np_utils.to_categorical(label, N_CLASSES) train_label Out[21]: array([[1., 0., 0.], [1., 0., 0.], ...原创 2018-12-27 17:20:48 · 9526 阅读 · 0 评论
分享