1. 普通神经网络在处理图像时遇到的问题图像的每个像素,都可以看作是特征值。1000x1000的图片,就有100万个特征值。如果把100万个特征值输入到全连接神经网络,参数过多就会导致计算量过大、内存爆炸 输入层神经元 [None, 10^6] 全连接层 [10^6, 10^6],大小10^12 ...
TensorFlow 手写数字图片识别
1. 手写数字数据集1.1. 下载数据集下载地址:http://yann.lecun.com/exdb/mnist/ 下载这4个数据集,放到工程的 ./data/mnist/input_data/ 目录下,后面程序中要读取这些数据train-images-idx3-ubyte.gz: 训练集图片tr ...
DeepLearning 神经网络基础
参考资料 神经网络浅讲:从神经元到深度学习 AI学习笔记:[1]神经元与神经网络 1. 神经元神经元是神经网络的基本结构,是最小的神经网络。神经元有多个输入和一个输出 输入x:代表样本特征值,如 [房屋面积,房屋价格,社区评分] 连接(Connection)是图中的边。每一个连接上都有一个权 ...
TensorFlow 队列
1. 队列基本操作import tensorflow as tfimport osos.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'# 创建队列,第1个参数capacity代表队列容量,第2个参数dtypes代表元素类型q = tf.FIFOQueue(3, tf.fl ...
TensorFlow 线性回归
1. TensorFlow 实现线性回归import tensorflow as tfimport osos.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'def linear_regression(): """ 自实现一个线性回归预测 :return: ...
TensorFlow TensorBoard可视化
1. 实现可视化TensorBoard通过读取TensorFlow的事件文件来运行,所以首先将图序列化到文件中,生成的文件就是事件文件a = tf.constant(4, name="input_a")b = tf.constant(2, name="input_b")c = tf.multiply ...
TensorFlow 变量
1. 什么是变量变量也是一种OP,是一种特殊的张量,能够进行存储持久化,它的值就是张量 2. 创建变量var = tf.Variable(tf.random_normal([2, 3], mean=0.0, stddev=1.0)) # 创建变量with tf.Session() as sess: ...
TensorFlow 张量元素类型转换
tf.string_to_number(string_tensor, out_type=_dtypes.float32, name=None) tf.to_double(x, name=’ToDouble’) tf.to_float(x, name=’ToFloat’) tf.to_int32(x, ...
TensorFlow 张量初始化
tf.ones(shape, dtype=dtypes.float32, name=None) 初始化元素为1 tf.zeros(shape, dtype=dtypes.float32, name=None) 初始化元素为0 tf.ones_like(tensor, dtype=None, name ...
TensorFlow 张量
1. Tensor三要素Tensor包括三部分:名字、形状、数据类型,直接用 print就可以查看a = tf.constant(1)b = tf.constant([1, 2])c = tf.constant([[1, 2], [3, 4], [5, 6]])print(a) # Tensor( ...