TensorFlow2.3.1对Fashion MNIST数据集相关训练

【深度学习】基于tensorflow的服装图像分类训练(数据集:Fashion-MNIST)_服装数据集(2) 关于环境这里不再赘述,与【深度学习】从LeNet-5识别手写数字入门深度学习一文的环境一致。 阅读详情
import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt

#Fashion MNIST 数据集包含10个类别的70000个灰度图像,这些图像以低分辨率(28*28像素)展示了单件衣物
#使用 60,000 个图像来训练网络,使用 10,000 个图像来评估网络学习对图像分类的准确率
(train_images,train_labels),(test_images,test_labels) = keras.datasets.fashion_mnist.load_data()
#train_images 和 train_labels 数组是训练集,即模型用于学习的数据。
#测试集、test_images 和 test_labels 数组会被用来对模型进行测试。
#图像是 28x28 的 NumPy 数组,像素值介于 0 到 255 之间。标签是整数数组,介于 0 到 9 之间。
#0:T恤 1:裤子 2:套头衫 3:连衣裙 4:外套 5:凉鞋 6:衬衫 7:运动鞋 8:包 9:短靴
class_names = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat',
               'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle boot']

# print(train_images.shape)
# print(len(train_labels))
# plt.figure()
# plt.imshow(train_images[0])
# plt.colorbar()
# plt.grid(False)
# plt.show()
#在训练网络之前,必须对数据进行预处理。如果您检查训练集中的第一个图像,您会看到像素值处于 0 到 255 之间
#将这些值缩小至 0 到 1 之间,将这些值除以 255,然后将其馈送到神经网络模型。
train_images = train_images/255.0
test_images = test_images/255.0

# plt.figure(figsize=(10,10))
# for i in range(25):
#     plt.subplot(5,5,i+1)
#     plt.xticks([])
#     plt.yticks([])
#     plt.grid(False)
#     plt.imshow(train_images[i],cmap=plt.cm.binary)
#     plt.xlabel(class_names[train_labels[i]])
# plt.show()

#设置层
model = keras.Sequential([
    keras.layers.Flatten(input_shape=(28,28)),
    keras.layers.Dense(128, activation='relu'),
    keras.layers.Dense(10)
])
# 该网络的第一层 tf.keras.layers.Flatten 将图像格式从二维数组(28 x 28 像素)转换成一维数组(28 x 28 = 784 像素)。
# 将该层视为图像中未堆叠的像素行并将其排列起来。该层没有要学习的参数,它只会重新格式化数据。
# 展平像素后,网络会包括两个 tf.keras.layers.Dense 层的序列。它们是密集连接或全连接神经层。
# 第一个 Dense 层有 128 个节点(或神经元)。第二个(也是最后一个)层会返回一个长度为 10 的 logits 数组。
# 每个节点都包含一个得分,用来表示当前图像属于 10 个类中的哪一类。

#编译模型
model.compile(
    optimizer='adam',
    loss= keras.losses.SparseCategoricalCrossentropy(from_logits=True),
    metrics=['accuracy']
)

#训练模型
# 将训练数据馈送给模型。在本例中,训练数据位于 train_images 和 train_labels 数组中。
# 模型学习将图像和标签关联起来。
# 要求模型对测试集(在本例中为 test_images 数组)进行预测。
# 验证预测是否与 test_labels 数组中的标签相匹配。
model.fit(train_images,train_labels,epochs=5)
#
# test_loss, test_acc = model.evaluate(test_images, test_labels, verbose=2)
# print('\nTest accuracy:', test_acc)
probability_model = keras.Sequential([model, keras.layers.Softmax()])
predictions = probability_model.predict(test_images)
# print(predictions[0])
# print(np.argmax(predictions[0]))
# print(test_labels[0])

def plot_image(i, prediction_array, true_label, img):
    prediction_array, true_label, img = prediction_array, true_label[i], img[i]
    plt.grid(False)
    plt.xticks([])
    plt.yticks([])
    plt.imshow(img, cmap=plt.cm.binary)
    prediction_label = np.argmax(prediction_array)
    if prediction_label == true_label:
        color = 'blue'
    else:
        color = 'red'
    plt.xlabel("{} {:2.0f}% ({})".format(class_names[prediction_label],
                                         100*np.max(prediction_array),
                                         class_names[true_label]),
               color=color)

def plot_value_array(i, prediction_array, true_label):
    prediction_array,true_label = prediction_array,true_label[i]
    plt.grid(False)
    plt.xticks(range(10))
    plt.yticks([])
    thisplot = plt.bar(range(10), prediction_array, color="#777777")
    plt.ylim([0,1])
    prediction_label = np.argmax(prediction_array)

    thisplot[prediction_label].set_color('red')
    thisplot[true_label].set_color('blue')

# i = 0
# plt.figure(figsize=(6,3))
# plt.subplot(1,2,1)
# plot_image(i, predictions[i], test_labels, test_images)
# plt.subplot(1,2,2)
# plot_value_array(i, predictions[i], test_labels)
# plt.show()
# i = 12
# plt.figure(figsize=(6,3))
# plt.subplot(1,2,1)
# plot_image(i, predictions[i], test_labels, test_images)
# plt.subplot(1,2,2)
# plot_value_array(i, predictions[i], test_labels)
# plt.show()
# num_rows = 5
# num_cols = 3
# num_images = num_rows*num_cols
# plt.figure(figsize=(2*2*num_cols,2*num_rows))
# for i in range(num_images):
#     plt.subplot(num_rows, 2*num_cols, 2*i+1)
#     plot_image(i, predictions[i], test_labels,test_images)
#     plt.subplot(num_rows, 2*num_cols, 2*i+2)
#     plot_value_array(i, predictions[i],test_labels)
# plt.tight_layout()
# plt.show()

#使用训练好的模型
plt.figure(figsize=(6,3))
img = test_images[1]
print(img.shape)
img = (np.expand_dims(img, 0))
print(img.shape)
#现在预测这个图像的正确标签
predictions_single = probability_model.predict(img)
print(predictions_single)
plot_value_array(1, predictions_single[0], test_labels)
_ = plt.xticks(range(10), class_names, rotation=45)
print(np.argmax(predictions_single[0]))
plt.show()

TensorFlow学习笔记——Fashion-MNIST数据集的下载及本地保存 Fashion-MNIST是Zalando文章图像的数据集——包括60,000个示例的训练集和10,000个示例的测试集。每个示例都是一个28x28灰度图像,与来自10个类的标签相关联。 Fashion-MNIST Here is the example how the data looks (each class takes three-rows): label description 0 T恤(T-shirt/top) 1 裤子(Trouser) 2 套头衫(Pullov 阅读详情

相关推荐

Ubuntu下Tensorflow加载MNIST数据集(数据下载和读取)

作为小白初入茅庐,根据tensorflow中文版的参考文档,以及自己平时学习的体会,总结了在ubuntu下进行深度学习的过程。作为每个学习深度学习的人来说,测试手写数字的训练应该是每个人都会经历的过程。

snailme的博客 2236

python获取matplotlib、tensorflow、pandas、numpy等的版本version

python获取matplotlib、tensorflow、pandas、numpy的版本version 使用__version__函数 module.__version__ 注意:前后都是两个下划线 (base) D:\python_toexe>python Python 3.7.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)] :: Anaconda, Inc. on win32 Type "help",

data+scenario+science+insight 3084

【ENVI初学】查看影像空间分辨率及重采样

例如,如果线段长度为900米,对应的像素数量为30个,那么影像的空间分辨率为30米。通过计算长度与像素数量的比值,即可得到影像的空间分辨率。,在弹出的对话框中,输入重采样后输出文件的xy分辨率大小。在测量结果窗口中,可以看到该线段的长度以及角度。在影像上点击并拖动鼠标,绘制一条直线段。工具,选择要重采样的影像后点击ok。,避免了插值过程中光谱信息的改变。:最近邻插值法通过选择原始影像中。在ENVI中打开影像后右键选择。指示了每个像素的地理跨度(聚合为一个新像素,通常通过。方法一:查看影像的元数据。

weixin_41619112的博客 5574

在tensorflow环境下安装matplotlib

在tensorflow环境下安装matplotlib 在运行程序时,报错ImportError: No module named ‘matplotlib‘,如图。经网上查询发现是没有安装matplotlib 因此记录一下在tensorflow环境下安装matplotlib的过程: 1.打开anaconda prompt,进入tensorflow的环境:activate tensorflow 2.安装matplotlib:conda install matplotlib 3.Proc..

希望能对学习C语言的朋友有帮助 2234

国内优秀MES开源框架

一套springboot 开源框架 代码标准规范化。 界面展示 演示地址 http://wangziyangmes.pzzd.xyz 用户名admin 密码123 系统管理 工艺管理 计划管理 物料管理 *用户管理* *工艺路线管理* 工单下达...

q707231019的博客 2万+

PCB线路板的制作工艺流程分享!2021-08-21

Pcb板制作工艺流程:开料-钻孔-沉铜-压膜-曝光-显影-电铜-电锡-退膜-蚀刻-退锡-光学检测-印阻焊油-阻焊曝光、显影-字符-表面处理-成型-电测-终检-抽测-包装。具体如下:1、开料(CUT) 将原始的覆铜板切割成可以用在生产线上制作的板子过程2、钻孔 使PCB板层间产生通孔,以达到连通层间的目的。 3、沉铜 经过钻孔后的线路板在沉铜缸内会发生氧化还原反应,形成铜层对孔进行孔金属化,使原来绝缘的基材表面沉积上铜,达到层间电性相通。 4、压膜 压膜后的PCB板上面压了一层蓝色的干膜, 干膜是一个载体

jdbpcb88的博客 3251

Tensorflow 2.3.0(比最新版本第一版) Numpy Matplotlib Scipy

标题利用python进行科学计算、数据处理基本上离不开 Numpy Scipy Matplotllib三个库 比如利用numpy的mat()方法建立一个数据矩阵,python3的循环语句 import numpy as np # 可以理解为数据库的数据,也可以理解为一个矩阵的运算 data = np.mat([[1,200,105,3,False],[2,165,80,2,False],[3,184,120,2,False]]) # 将numpy引入重命名为np并使用mat()方法建立数据矩阵 row=0

wanna__ac的博客 3598

英雄联盟(MOBA)完整制作教程

这是一份从零到上线、可落地的 LOL 风格 MOBA 游戏开发全流程教程,覆盖策划、美术、程序、测试、运营全环节,适合独立团队或学习参考。

qq_35779316的博客 545

python 与tensorflow及各版本包对应问题

1.tensorflow与keras 来源https://docs.floydhub.com/guides/environments/ 2.pytorch与python 3.其余 4.与tensorflow1.8相关配置 Python packages: absl-py==0.4.1 annoy==1.12.0 args==0.1.0 astor==0.7.1 atari-py==0...

qq_26896611的博客 2万+

YOLO26涨点改进 | 独家创新,注意力改进篇 | AAAI 2025 | YOLO26引入 DRM 防御优化模块,进行特征优化/特征增强,助力目标检测、图像分类、图像分割有效涨点

本文提出了一种基于DRM防御优化模块改进的YOLO26网络模型,显著提升了目标检测的鲁棒性和特征提取能力。DRM模块通过优化特征提取过程、增强抗噪声能力和补充细节信息,有效提高了模型在复杂场景下的检测精度和定位准确度。该模块可集成于UNet等主干网络,采用Transformer结构实现特征精炼,在对抗攻击环境下仍能保持稳定的融合效果。实验表明,改进后的模型在红外与可见光图像融合任务中表现出色,同时提升了下游任务性能。文章详细介绍了DRM模块的结构、作用机制及实现代码,并提供了两种YOLO26改进方案.

Ai缝合怪、助力小伙伴高效发论文 146

一条 POST 创建整棵业务对象树,SAP Gateway Deep Create 的运行机制与 ABAP 实现

SAPUI5 的 OData V2 Model 支持 Deep Create,可以为一个新建的 transient parent context 创建 Navigation Property 下的 subentity,并把这些子实体的数据合并进 Root Entity 对应的 OData 请求 Payload。销售组织是否合法,客户是否允许下单,物料是否存在,销售区域是否匹配,计量单位是否正确,项目类别如何确定,定价是否成功,合作伙伴如何派生,交货工厂如何确定,这些都可能在一次创建过程中被触发。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 149

Tensorflow 2.3.0(比最新版本低一版)对应插件(工具包)下载

Opencv下载 网址 注意这里的cp,cp应该是对应的python版本,我这里下的是opencv_python-4.4.0-cp37-cp37m-win_amd64.whl,因为我的python版本为3.7.4 下好后在anaconda prompt里用pip命令安装即可,见图,把whl文件放在那里就去哪里安装就行 安装好后去pycharm里试试能不能import cv2 图片就是与main.py同一文件夹下的一个照片 能跑起来,恭喜你 如果跑不起来,9成是版本不匹配问题,一定要匹配python版本

wanna__ac的博客 1597

在ABAQUS中使用VUMAT子程序实现Hashin失效准则的详细解析与实践:深入探讨复合材料模拟仿真的高级编程技巧

Hashin失效准则是由材料科学家Shlomo Hashin于1962年提出的一种基于能量方法的多向失效理论,主要用于预测复合材料的破坏行为。与传统的单向失效理论不同,Hashin准则考虑了材料内部的多种独立破坏机制,如基体断裂、界面脱粘、纤维断裂等,这些机制在不同应力状态下可能同时或分别发生。通过计算各个机制的能量释放率,Hashin失效准则能够更为准确地预测复合材料在复杂应力状态下的破坏行为。

qq_38334677的博客 1950

Dataset之Fashion-MNIST:Fashion-MNIST数据集简介、下载、使用方法之详细攻略

Dataset之Fashion-MNIST:Fashion-MNIST数据集简介、下载、使用方法之详细攻略 目录 Fashion-MNIST数据集简介 1、Why we made Fashion-MNIST Fashion-MNIST数据集下载 0、数据集及代码下载 1、基于python语言下载 2、基于Tensorflow下载 Fashion-MNIST数据集使用方...

头部AI社区如有邀博主AI主题演讲请私信—心比天高,仗剑走天涯,保持热爱,奔赴向梦想!低调,专注,谦虚,自律,反思,成长,还算比较正能量的博主,公益免费传播…内心特别想在AI界做出一些可以推进历史进程影响力的技术(兴趣使然,有点小情怀,也有点使命感呀 1万+

化工与制药软件:AVEVA E3D二次开发_(2).AVEVA E3D软件介绍

用户可以根据自己的需求创建自定义的设备模板,提高设备建模的效率。

kkchenjj的博客 1654

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

【深度学习】基于tensorflow的服装图像分类训练(数据集:Fashion-MNIST)

本文训练采用的模型与训练小型物体识别的一致。但是这里进行了归一化处理、数据升维、模型评估等操作。而且模型效果表现较为优秀,epochs=10的val_acc=91.64%。

林夕07 6670

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

【数据集】【图像分类数据集】【Fashion-MNIST 】

是一个包含 10 类时尚物品的灰度图像数据集。它由 Zalando 的研究部门创建并开源,旨在为机器学习提供一个更现代化、更具挑战性的数据集,以取代过于简单且被过度使用的原始 MNIST 手写数字数据集。核心目标: 直接替代 MNIST,成为新的“Hello World”数据集,用于验证计算机视觉和机器学习算法。数据格式: 它与原始 MNIST完全兼容。这意味着任何能够运行 MNIST 的代码,无需任何修改就可以直接在 Fashion-MNIST 上运行。图像大小: 28x28 像素颜色通道。

wq6qeg88的博客 1195

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain&#39;s apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath(&#39;DeepLearnToolbox&#39;));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand(&#39;state&#39;,0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = &#39;sigm&#39;;%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, &#39;Too big error&#39;);```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, &#39;Too big error&#39;);```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

使用TensorFlow构建神经网络:使用 TensorFlow 进行 Fashion-MNIST 服装分类

计算机视觉和深度学习的全新基准数据集是服装分类问题。Zalando提供的Fashion-MNIST数据集是时尚相关文章的照片集合。尽管数据集很简单,但它可用于学习和应用深度卷积神经网络开发、评估和应用图像分类。顺序 API函数式 API在该网络的顶层,当图层展平照片时,照片的格式从二维数组(28 x 28 像素)更改为一维数组(28 * 28 = 784 像素)。该层重构时尚MNIST数据。无需学习任何参数。考虑此图层在图像中排列和取消堆叠像素行。

新华编程特战队 1266

【TensorFlow学习笔记:神经网络八股】(实现MNIST数据集手写数字识别分类以及FASHION数据集衣裤识别分类)

课程来源:人工智能实践:Tensorflow笔记2 文章目录前言一、搭建网络八股sequential二、使用步骤1.引入库2.读入数据总结 前言 本讲目标:使用八股搭建神经网络 神经网络搭建八股 iris代码复现 MNIST数据集 训练MNIST数据集 Fashion数据集 一、搭建网络八股sequential 示例:使用六步法,使用TensorFlow的API;tf.keras搭建网络八股 1、import 导入相关模块 2、train、test 告知要喂入网络的训练集、测试集是什么,也就是要

hanhan的博客 1270

Fashion-MNIST 数据集使用教程

Fashion-MNIST 是一个用于机器学习算法基准测试的图像数据集,由 Zalando 研究中心提供。它作为原始 MNIST 数据集的手写数字识别的替代品,包含10个类别共70,000张28x28像素的灰度图像。 ## 1. 项目目录结构及介绍 在克隆 `https://github.com/zalandoresearch/fashion-mnist.git` 之后,你将得到以下基本目录结...

gitblog_00824的博客 786

TensorFlow + Keras 入门项目:Classifying Images of Clothing(基于Fashion-MNIST数据集)

OS:Win10 Interpreter: Python3.7 Environment: Anaconda3 + Tensorflow-gpu2.0.0 + Spyder Fashion-MNIST 数据集简介: https://github.com/zalandoresearch/fashion-mnist 'Fashion-MNIST is a dataset of Zalan...

Happy_hui520的博客 1212

基于华为开发者空间Notebook,Tensorflow + Fashion MNIST构建CNN实现智能衣柜服装分类系统

本案例基于开发者空间 - AI Notebook,使用Fashion-MNIST数据集,构建了一个智能衣柜服装分类系统,展示了深度学习技术在实际生活场景中的应用价值。系统采用卷积神经网络(CNN)架构,实现了对10类服装物品的精准识别,准确率达到93.75%。

华为云官方博客 1361

Ubuntu16.04下使用tensorflow2.1 对fashion_mnist进行分类处理

使用TensorFlow2.0对fashion_mnist进行分类处理 环境主要还是在Ubuntu16.04,安装tensorflow2.0版本,数据集调用的是keras中的数据集.但是,在数据集的获取中,如果是在编写代码的过程中获取数据集,我自己的网络是不支持的,需要访问谷歌网站.所以我会先事先下载好fashion_mnist数据集,在/home目录下使用Ctrl+H打开隐藏文件夹找到.keras文件中的datasets,将下载好的数据集存放到文件夹中,从而来解决获取数据集失败的坑~~ # 导入相关的包

bingbign0607的博客 460

训练您的第一个神经网络:基本分类Fashion MNIST(tensorflow2.0官方教程翻译)

最全tensorflow2.0学习路线 https://www.mashangxue123.com 最新版本:https://www.mashangxue123.com/tensorflow/tf2-tutorials-keras-basic_classification.html 英文版本:https://tensorflow.google.cn/alpha/tutorials/keras/b...

马上学人工智能 1108

【2019.09.13】基于TensorFlow2.0,使用Keras + fashion_mnist 数据集进行深度学习实战

基于TensorFlow2.0,使用Keras + fashion_mnist 数据集进行深度学习实战 人工智能、机器学习、深度学习 的关系 导入相关包 import pandas as pd import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.keras ...

ybsde博客 1135
上一篇: TensorFlow2.3.1和MNIST数据集相关操作
下一篇: TensorFlow相关教程:使用tf.data加载图片
Caoyy686868
博客等级 码龄8年 5742粉丝 57原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Caoyy686868

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值