From c39e527d1ad2e1d967cfee9ceeb155d4c8dada4a Mon Sep 17 00:00:00 2001 From: p9n6cg2k8 Date: Thu, 5 May 2022 18:15:19 +0800 Subject: [PATCH] Update README.md --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index de770d9..4f888fe 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,23 @@ import numpy as np learning_rate = 0.001 #学习率 num_steps = 2000 # 训练步数 batch_size = 128 # 训练数据批的大小 +# Network Parameters,网络参数 +num_input = 784 # MNIST数据输入 (img shape: 28*28) +num_classes = 10 # MNIST所有类别 (0-9 digits) +dropout = 0.75 # Dropout, probability to keep units = (1-p),保留神经元相应的概率为(1-p)=(1-0.75)=0.25 + +# Create the neural network,创建深度神经网络 +def conv_net(x_dict, n_classes, dropout, reuse, is_training): + + # Define a scope for reusing the variables,确定命名空间 + with tf.variable_scope('ConvNet', reuse=reuse): + # TF Estimator类型的输入为像素 + x = x_dict['images'] + # MNIST数据输入格式为一位向量,包含784个特征 (28*28像素) + # 用reshape函数改变形状以匹配图像的尺寸 [高 x 宽 x 通道数] + # 输入张量的尺度为四维: [(每一)批数据的数目, 高,宽,通道数] + x = tf.reshape(x, shape=[-1, 28, 28, 1]) # 卷积层,32个卷积核,尺寸为5x5