91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 11.06MB
    文件類型: .zip
    金幣: 1
    下載: 0 次
    發布日期: 2023-06-20
  • 語言: 其他
  • 標簽: 數據集??fashion??mnis??

資源簡介

最近看了一些博客發現原來下載這個數據集的鏈接都進不去了,于是找別人要了這個數據集發上來,有需要的同學可以下載。這個fashion mnist數據集是mnist數據集的升級版,里面是各種服裝的圖片。

資源截圖

代碼片段和文件信息

import?tensorflow?as?tf
from?tensorflow.examples.tutorials.mnist?import?input_data

mnist?=?input_data.read_data_sets(‘MNIST_data/‘?one_hot=True)??#讀取數據
#x為訓練圖像占位符,y為圖片標簽
x?=?tf.placeholder(tf.float32?[None?784])
y_label?=?tf.placeholder(tf.float32?[None?10])
#將單張圖片從784維向量重新還原成28*28的矩陣圖片-1表示形狀第一維的大小是由x自動確定的
x_image?=?tf.reshape(x?[-1?28?28?1])

#第一層卷積
def?weight_variable(shape):
????initial?=?tf.truncated_normal(shape?stddev=0.1)
????return?tf.Variable(initial)

def?bias_variable(shape):
????initial?=?tf.constant(0.1?shape=shape)
????return?tf.Variable(initial)

def?conv2d(x?W):
????return?tf.nn.conv2d(x?W?strides=[1?1?1?1]padding=‘SAME‘)

def?max_pool_2X2(x):
????return?tf.nn.max_pool(x?ksize=[1?2?2?1]?strides=[1?2?2?1]
??????????????????????????padding=‘SAME‘)
W_conv1?=?weight_variable([5?5?1?32])
b_conv1?=?bias_variable([32])
h_conv1?=?tf.nn.relu(conv2d(x_image?W_conv1)?+?b_conv1)
h_pool1?=?max_pool_2X2(h_conv1)
#第二層卷積
W_conv2?=?weight_variable([5?5?32?64])
b_conv2?=?bias_variable([64])
h_conv2?=?tf.nn.relu(conv2d(h_pool1?W_conv2)?+?b_conv2)
h_pool2?=?max_pool_2X2(h_conv2)

#全連接層
W_fc1?=?weight_variable([7*7*64?1024])
b_fc1?=?bias_variable([1024])
h_pool2_flat?=?tf.reshape(h_pool2?[-1?7*7*64])
h_fc1?=?tf.nn.relu(tf.matmul(h_pool2_flat?W_fc1)?+?b_fc1)
#使用dropoutkeep_prop是一個占位符,訓練時為0.5,測試時為1
keep_prop?=?tf.placeholder(tf.float32)
h_fc1_drop?=?tf.nn.dropout(h_fc1?keep_prop)

W_fc2?=?weight_variable([1024?10])
b_fc2?=?bias_variable([10])
y_conv?=?tf.matmul(h_fc1?W_fc2)?+?b_fc2

#不采用softmax計算交叉熵的方法
#采用
cross_entropy?=?tf.reduce_mean(
????tf.nn.softmax_cross_entropy_with_logits(labels=y_label?logits=y_conv))
#定義train_step
train_step?=?tf.train.AdamOptimizer(1e-4).minimize(cross_entropy)

#定義測試的準確率
correct_prediction?=?tf.equal(tf.argmax(y_conv?1)?tf.argmax(y_label?1))
accuracy?=?tf.reduce_mean(tf.cast(correct_prediction?tf.float32))

#創建session對變量初始化
sess?=?tf.InteractiveSession()
sess.run(tf.global_variables_initializer())

#訓練2000步
for?i?in?range(1500):
????batch?=?mnist.train.next_batch(50)
????#每100步報告一次準確率
????if?i%100?==?0:
????????train_accuracy?=?accuracy.eval(feed_dict={
????????????x:?batch[0]?y_label:?batch[1]?keep_prop:?1.0})
????????print(‘step?%d??training?accuracy?%.2f‘%(i?train_accuracy))
????train_step.run(feed_dict={
????????????x:?batch[0]?y_label:?batch[1]?keep_prop:?0.2})
#print(‘test?accuracy?%.3f‘%accuracy.eval(feed_dict={
#????x:?mnist.test.images?y_label:?mnist.test.labels?keep_prop:?1.0}))
print(‘test?accuracy?%.2f‘%accuracy.eval(feed_dict={
????x:?mnist.test.images[0:?2000]?y_label:?mnist.test.labels[0:?2000]?keep_prop:?1.0}))




?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-11-06?21:31??TF_MNIST_CONV\
?????目錄???????????0??2019-01-24?21:11??TF_MNIST_CONV\.idea\
?????文件?????????576??2018-11-05?12:53??TF_MNIST_CONV\.idea\TF_MNIST_CONV.iml
?????目錄???????????0??2018-10-31?19:57??TF_MNIST_CONV\.idea\libraries\
?????文件?????????128??2018-10-31?19:57??TF_MNIST_CONV\.idea\libraries\R_User_Library.xml
?????文件?????????185??2018-11-05?12:53??TF_MNIST_CONV\.idea\misc.xml
?????文件?????????278??2018-10-31?19:46??TF_MNIST_CONV\.idea\modules.xml
?????文件???????22661??2019-01-24?21:11??TF_MNIST_CONV\.idea\workspace.xml
?????目錄???????????0??2018-11-09?20:12??TF_MNIST_CONV\MNIST_data\
?????文件?????1648877??2018-10-30?18:24??TF_MNIST_CONV\MNIST_data\t10k-images-idx3-ubyte.gz
?????文件????????4542??2018-10-30?18:24??TF_MNIST_CONV\MNIST_data\t10k-labels-idx1-ubyte.gz
?????文件?????????165??2018-11-09?20:12??TF_MNIST_CONV\MNIST_data\tensor.py
?????文件?????9912422??2018-10-30?18:24??TF_MNIST_CONV\MNIST_data\train-images-idx3-ubyte.gz
?????文件???????28881??2018-10-30?18:24??TF_MNIST_CONV\MNIST_data\train-labels-idx1-ubyte.gz
?????文件????????2998??2018-11-06?21:31??TF_MNIST_CONV\conv.py

評論

共有 條評論