0.tensorflow——常用说明

1.tf

tf.placeholder(tf.float32,shape=[None,inputSize])#类似于一个float32的声明
tf.reduce_mean()#求均值,可以是不同维度
tf.cast()#
tf.argmax()#返回最大的那个数值所在的下标https://blog.csdn.net/qq575379110/article/details/70538051/
tf.truncated_normal([size_in, size_out], stddev=0.1)//如果生成的值大于平均值2个标准偏差的值则丢弃重新选择。https://www.jianshu.com/p/e18fdc7b633a

2.nn

tf.nn.softmax()#Softmax函数,将张量的每个元素缩放到(0,1)区间且和为1。
tf.nn.relu()#计算激活函数 relu,即 max(features, 0)。将大于0的保持不变,小于0的数置为0。
tf.nn.conv2d()#2D卷积https://blog.csdn.net/SHU15121856/article/details/88956545
"""2维的卷积层,用于图片的卷积"""
# 输入图像的通道数=1(灰度图像),卷积核的种类数=3
# 卷积核的shape是3乘3的,扫描步长为1,不加padding
layer = nn.Conv2d(1, 3, kernel_size=3, stride=1, padding=0)

3.tf.summary

tf.summary.scalar()
tf.summary.image()
tf.summary.histogram()
tf.summary.merge_all()

4.常用处理

  • keep prob
  • soft max

资料

1.图像识别http://rodrigob.github.io/are_we_there_yet/build/classification_datasets_results.html

2.TF教程http://www.tensorfly.cn/tfdoc/tutorials/mnist_beginners.html

原文地址:https://www.cnblogs.com/yrm1160029237/p/11869058.html