当前位置: 首页 > news >正文

枣庄定制网站建设公司seo优化一般多少钱

枣庄定制网站建设公司,seo优化一般多少钱,给朋友做的相册网站没有了,建房城乡建设部网站卷积神经网络比神经网络稍微复杂一些#xff0c;因为其多了一个卷积层(convolutional layer)和池化层(pooling layer)。 使用mnist数据集#xff0c;n个数据#xff0c;每个数据的像素为28*28*1784。先让这些数据通过第一个卷积层#xff0c;在这个卷积上指定一个3*3*1的fe…卷积神经网络比神经网络稍微复杂一些因为其多了一个卷积层(convolutional layer)和池化层(pooling layer)。 使用mnist数据集n个数据每个数据的像素为28*28*1784。先让这些数据通过第一个卷积层在这个卷积上指定一个3*3*1的feature这个feature的个数设为64。接着经过一个池化层让这个池化层的窗口为2*2。然后在经过一个卷积层在这个卷积上指定一个3*3*64的feature这个featurn的个数设置为128,。接着经过一个池化层让这个池化层的窗口为2*2。让结果经过一个全连接层这个全连接层大小设置为1024在经过第二个全连接层大小设置为10进行分类。 import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.examples.tutorials.mnist import input_data mnist input_data.read_data_sets(data/, one_hotTrue) trainimg mnist.train.images trainlabel mnist.train.labels testimg mnist.test.images testlabel mnist.test.labels print (MNIST ready) #像素点为784 n_input 784 #十分类 n_output 10 #wc1第一个卷积层参数3*3*1共有64个 #wc2第二个卷积层参数3*3*64共有128个 #wd1第一个全连接层参数经过两个池化层被压缩到7*7 #wd2第二个全连接层参数 weights {wc1: tf.Variable(tf.random_normal([3, 3, 1, 64], stddev0.1)),wc2: tf.Variable(tf.random_normal([3, 3, 64, 128], stddev0.1)),wd1: tf.Variable(tf.random_normal([7*7*128, 1024], stddev0.1)),wd2: tf.Variable(tf.random_normal([1024, n_output], stddev0.1))} biases {bc1: tf.Variable(tf.random_normal([64], stddev0.1)),bc2: tf.Variable(tf.random_normal([128], stddev0.1)),bd1: tf.Variable(tf.random_normal([1024], stddev0.1)),bd2: tf.Variable(tf.random_normal([n_output], stddev0.1))} 定义前向传播函数。先将输入数据预处理变成tensorflow支持的四维图像进行第一层的卷积层处理调用conv2d函数将卷积结果用激活函数进行处理relu函数将结果进行池化层处理ksize代表窗口大小将池化层的结果进行随机删除节点进行第二层卷积和池化...进行全连接层先将数据进行reshape此处为7*7*128进行激活函数处理得出结果。前向传播结束。 def conv_basic(_input, _w, _b, _keepratio):# INPUT_input_r tf.reshape(_input, shape[-1, 28, 28, 1])# CONV LAYER 1_conv1 tf.nn.conv2d(_input_r, _w[wc1], strides[1, 1, 1, 1], paddingSAME)_conv1 tf.nn.relu(tf.nn.bias_add(_conv1, _b[bc1]))_pool1 tf.nn.max_pool(_conv1, ksize[1, 2, 2, 1], strides[1, 2, 2, 1], paddingSAME)_pool_dr1 tf.nn.dropout(_pool1, _keepratio)# CONV LAYER 2_conv2 tf.nn.conv2d(_pool_dr1, _w[wc2], strides[1, 1, 1, 1], paddingSAME)_conv2 tf.nn.relu(tf.nn.bias_add(_conv2, _b[bc2]))_pool2 tf.nn.max_pool(_conv2, ksize[1, 2, 2, 1], strides[1, 2, 2, 1], paddingSAME)_pool_dr2 tf.nn.dropout(_pool2, _keepratio)# VECTORIZE_dense1 tf.reshape(_pool_dr2, [-1, _w[wd1].get_shape().as_list()[0]])# FULLY CONNECTED LAYER 1_fc1 tf.nn.relu(tf.add(tf.matmul(_dense1, _w[wd1]), _b[bd1]))_fc_dr1 tf.nn.dropout(_fc1, _keepratio)# FULLY CONNECTED LAYER 2_out tf.add(tf.matmul(_fc_dr1, _w[wd2]), _b[bd2])# RETURNout { input_r: _input_r, conv1: _conv1, pool1: _pool1, pool1_dr1: _pool_dr1,conv2: _conv2, pool2: _pool2, pool_dr2: _pool_dr2, dense1: _dense1,fc1: _fc1, fc_dr1: _fc_dr1, out: _out}return out print (CNN READY) 定义损失函数定义优化器 x tf.placeholder(tf.float32, [None, n_input]) y tf.placeholder(tf.float32, [None, n_output]) keepratio tf.placeholder(tf.float32)# FUNCTIONS_pred conv_basic(x, weights, biases, keepratio)[out] cost tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(_pred, y)) optm tf.train.AdamOptimizer(learning_rate0.001).minimize(cost) _corr tf.equal(tf.argmax(_pred,1), tf.argmax(y,1)) accr tf.reduce_mean(tf.cast(_corr, tf.float32)) init tf.global_variables_initializer()# SAVER save_step 1 saver tf.train.Saver(max_to_keep3) print (GRAPH READY) 进行迭代 do_train 1 sess tf.Session() sess.run(init)training_epochs 15 batch_size 16 display_step 1 if do_train 1:for epoch in range(training_epochs):avg_cost 0.total_batch int(mnist.train.num_examples/batch_size)# Loop over all batchesfor i in range(total_batch):batch_xs, batch_ys mnist.train.next_batch(batch_size)# Fit training using batch datasess.run(optm, feed_dict{x: batch_xs, y: batch_ys, keepratio:0.7})# Compute average lossavg_cost sess.run(cost, feed_dict{x: batch_xs, y: batch_ys, keepratio:1.})/total_batch# Display logs per epoch stepif epoch % display_step 0: print (Epoch: %03d/%03d cost: %.9f % (epoch, training_epochs, avg_cost))train_acc sess.run(accr, feed_dict{x: batch_xs, y: batch_ys, keepratio:1.})print ( Training accuracy: %.3f % (train_acc))#test_acc sess.run(accr, feed_dict{x: testimg, y: testlabel, keepratio:1.})#print ( Test accuracy: %.3f % (test_acc))print (OPTIMIZATION FINISHED)  转载于:https://www.cnblogs.com/xxp17457741/p/9480521.html
http://www.yutouwan.com/news/174659/

相关文章:

  • 干网站建设销售怎么样个人网站作品下载
  • 高端网站模板哈尔滨制作企业网站
  • 网站制作学费多少钱网站优化seo教程
  • 怎么在网站注册账号wap网页设计模板
  • 做网站前需要准备什么软件架设仿冒网站挂马
  • 购物网站排名2018wordpress怎么装插件
  • 个体户做盈利网站成都青羊建设厅官方网站
  • 建网站系统青岛网站建设市场
  • 小型公司建网站yw最新域名备案查询
  • 刚做的网站 为啥搜不到零代码平台
  • 用四字成语做网站域名好吗成都发布最新消息
  • 制作一个网站流程wordpress服务器出错
  • 网站建设需要步骤营销型网站制作价格
  • 网站个性化设计山西制作网站
  • h5页面网站模板用科讯cms做网站的步骤
  • 做宠物商品的网站网站制作公司网站建设公司
  • 深圳网站优化哪家好怎么搭建app
  • 网站开发毕业设计说明书范文品牌推广方案范文
  • nanopi neo做网站网站数据库怎么配置
  • 自贡网站开发杭州最好的工业设计公司
  • 网站友情链接检测使用dw设计个人简历网页模板
  • 国外网站如何做推广个人建设网站需要什么证件吗
  • 泰州网站建设优化网站怎么备案在哪里
  • 东莞网站制作公司是什么好听好记的域名
  • net大规模网站开发视频网页和网站区别
  • 已备案网站更换域名重庆网站推广什么
  • 河北省住房城乡建设局网站网站建设需求调研计划表
  • 如何做免费的网站微信小程序上线流程
  • wordpress制作官方网站网站建设怎么收费
  • 网站制作包括数据库吗免费学高中课程的软件