把图象文件转换成XML格式文件

把图象文件转换成XML格式文件

作者: 孟宪会 出自: 【孟宪会之精彩世界】 发布日期: 2003-8-31 2:10:12


 

利用.NET 框架下的FromBase64String和ToBase64String方法可以很容易地实现图象文件和XML文件的互换。这样可以轻易解决以XML格式保存图片的问题。代码如下:

Public   Class  Form1
            
Inherits  System.Windows.Forms.Form
            
#Region  " Windows 窗体设计器生成的代码 "
            
Public   Sub   New ()
            
MyBase .New()
            InitializeComponent()
            
' 在 InitializeComponent() 调用之后添加任何初始化
             End Sub
            
' 窗体重写处置以清理组件列表。
             Protected   Overloads   Overrides   Sub  Dispose( ByVal  disposing  As   Boolean )
            
If  disposing  Then
            
If   Not  (components  Is   Nothing )  Then
            components.Dispose()
            
End   If
            
End   If
            
MyBase .Dispose(disposing)
            
End Sub
            
' Windows 窗体设计器所必需的
             Private  components  As  System.ComponentModel.IContainer
            
' 注意:以下过程是 Windows 窗体设计器所必需的
             ' 可以使用 Windows 窗体设计器修改此过程。
             ' 不要使用代码编辑器修改它。
             Friend   WithEvents  Button1  As  System.Windows.Forms.Button
            
Friend   WithEvents  Button2  As  System.Windows.Forms.Button
            
Friend   WithEvents  PictureBox1  As  System.Windows.Forms.PictureBox
            
Friend   WithEvents  Button3  As  System.Windows.Forms.Button
            
Friend   WithEvents  Label1  As  System.Windows.Forms.Label
            
Friend   WithEvents  Label2  As  System.Windows.Forms.Label
            
& lt;System.Diagnostics.DebuggerStepThrough() & gt;  Private   Sub  InitializeComponent()
            
Me .Button1  =   New  System.Windows.Forms.Button()
            
Me .Button2  =   New  System.Windows.Forms.Button()
            
Me .PictureBox1  =   New  System.Windows.Forms.PictureBox()
            
Me .Button3  =   New  System.Windows.Forms.Button()
            
Me .Label1  =   New  System.Windows.Forms.Label()
            
Me .Label2  =   New  System.Windows.Forms.Label()
            
Me .SuspendLayout()
            
'
             ' Button1
             '
             Me .Button1.Location  =   New  System.Drawing.Point( 365 ,  63 )
            
Me .Button1.Name  =   & quot;Button1 & quot;
            
Me .Button1.Size  =   New  System.Drawing.Size( 115 ,  23 )
            
Me .Button1.TabIndex  =   0
            
Me .Button1.Text  =   & quot;将图象保存成XML & quot;
            
'
             ' Button2
             '
             Me .Button2.Location  =   New  System.Drawing.Point( 365 ,  98 )
            
Me .Button2.Name  =   & quot;Button2 & quot;
            
Me .Button2.Size  =   New  System.Drawing.Size( 115 ,  23 )
            
Me .Button2.TabIndex  =   1
            
Me .Button2.Text  =   & quot;从XML中得到图象 & quot;
            
'
             ' PictureBox1
             '
             Me .PictureBox1.Location  =   New  System.Drawing.Point( 18 ,  6 )
            
Me .PictureBox1.Name  =   & quot;PictureBox1 & quot;
            
Me .PictureBox1.Size  =   New  System.Drawing.Size( 320 ,  460 )
            
Me .PictureBox1.TabIndex  =   2
            
Me .PictureBox1.TabStop  =   False
            
'
             ' Button3
             '
             Me .Button3.Location  =   New  System.Drawing.Point( 365 ,  28 )
            
Me .Button3.Name  =   & quot;Button3 & quot;
            
Me .Button3.Size  =   New  System.Drawing.Size( 115 ,  23 )
            
Me .Button3.TabIndex  =   3
            
Me .Button3.Text  =   & quot;浏览图片 & amp;# 8230 ; & quot;
            
'
             ' Label1
             '
             Me .Label1.Location  =   New  System.Drawing.Point( 369 ,  135 )
            
Me .Label1.Name  =   & quot;Label1 & quot;
            
Me .Label1.Size  =   New  System.Drawing.Size( 105 ,  95 )
            
Me .Label1.TabIndex  =   4
            
'
             ' Label2
             '
             Me .Label2.Location  =   New  System.Drawing.Point( 367 ,  437 )
            
Me .Label2.Name  =   & quot;Label2 & quot;
            
Me .Label2.Size  =   New  System.Drawing.Size( 130 ,  16 )
            
Me .Label2.TabIndex  =   5
            
Me .Label2.Text  =   & quot;【孟宪会之精彩世界】 & quot;
            
'
             ' Form1
             '
             Me .AutoScaleBaseSize  =   New  System.Drawing.Size( 5 ,  13 )
            
Me .ClientSize  =   New  System.Drawing.Size( 500 ,  480 )
            
Me .Controls.AddRange( New  System.Windows.Forms.Control() { Me .Label2,  Me .Label1, _
            
Me .Button3,  Me .PictureBox1,  Me .Button2,  Me .Button1})
            
Me .Name  =   & quot;Form1 & quot;
            
Me .Text  =   & quot;图象文件和XML格式文件互换例子 & quot;
            
Me .ResumeLayout( False )
            
End Sub
            
#End Region
            
Private  MyFile  As   String   =   & quot; & quot;
            
Private  MyFileExt  As   String   =   & quot; & quot;
            
Private   Sub  Button2_Click( ByVal  sender  As  System.Object,  ByVal  e  As  System.EventArgs) _
            
Handles  Button2.Click
            
Dim  pic  As   String
            
Dim  MyXml  As  System.Xml.XmlDocument  =   New  System.Xml.XmlDocument()
            MyXml.Load(
& quot;c: MyPhoto.xml & quot;)
            
Dim  picNode  As  System.Xml.XmlNode
            picNode 
=  MyXml.SelectSingleNode( & quot; / pic / photo & quot;)
            pic 
=  picNode.InnerText
            
Dim  memoryStream  As  System.IO.MemoryStream
            memoryStream 
=   New  System.IO.MemoryStream(Convert.FromBase64String(pic))
            
Me .PictureBox1.Image  =   New  System.Drawing.Bitmap(memoryStream)
            memoryStream.Close()
            
End Sub
            
Private   Sub  Button1_Click( ByVal  sender  As  System.Object,  ByVal  e  As  System.EventArgs) _
            
Handles  Button1.Click
            
If  MyFile  =   & quot; & quot;  Then
            MessageBox.Show(
& quot;请选择一个图片! & quot;,  & quot;错误 & quot;, MessageBoxButtons.OK, MessageBoxIcon.Warning)
            
Exit Sub
            
End   If
            
Dim  MyImg  As  System.Drawing.Image  =  MyImg.FromFile(MyFile)
            
Dim  memoryStream  As  System.IO.MemoryStream  =   New  System.IO.MemoryStream()
            MyImg.Save(memoryStream, GetImageType(MyFileExt))
            
Dim  b()  As   Byte
            b 
=  memoryStream.GetBuffer()
            
Dim  pic  As   String   =  Convert.ToBase64String(b)
            memoryStream.Close()
            
Dim  MyXml  As  System.Xml.XmlDocument  =   New  System.Xml.XmlDocument()
            MyXml.LoadXml(
& quot; & lt;pic & gt; & lt;name & gt;孟宪会 & lt; / name & gt; & lt;photo & gt; & quot;  +  pic  +   & quot; & lt; / photo & gt; & lt; / pic & gt; & quot;)
            MyXml.Save(
& quot;c: MyPhoto.xml & quot;)
            Label1.Text 
=   & quot;文件被保存到了: & quot;  +  Microsoft.VisualBasic.ChrW( 13 )  +   & quot;c: MyPhoto.xml & quot;
            
End Sub
            
Private   Sub  Button3_Click( ByVal  sender  As  System.Object,  ByVal  e  As  System.EventArgs) _
            
Handles  Button3.Click
            
Dim  openFileDialog1  As   New  OpenFileDialog()
            openFileDialog1.InitialDirectory 
=   & quot;c: & quot;
            openFileDialog1.Filter 
=   & quot;PNG( * .png)| * .png|Gif( * .gif)| * .gif|Jpg( * .jpg)| * .jpg|所有图象文件( * . * )| * . *& quot;
            openFileDialog1.FilterIndex 
=   2
            openFileDialog1.RestoreDirectory 
=   True
            
If  openFileDialog1.ShowDialog()  =  DialogResult.OK  Then
            MyFile 
=  openFileDialog1.FileName()
            MyFileExt 
=  MyFile.Substring(MyFile.LastIndexOf( & quot;. & quot;)  +   1 )
            
End   If
            
End Sub
            
Public   Function  GetImageType( ByVal   str   As   String )  As  System.Drawing.Imaging.ImageFormat
            
Select   Case   str .ToLower()
            
Case   & quot;jpg & quot;
            
Return  System.Drawing.Imaging.ImageFormat.Jpeg
            
Case   & quot;gif & quot;
            
Return  System.Drawing.Imaging.ImageFormat.Gif
            
Case   & quot;tiff & quot;
            
Return  System.Drawing.Imaging.ImageFormat.Tiff()
            
Case   & quot;icon & quot;
            
Return  System.Drawing.Imaging.ImageFormat.Icon
            
Case   & quot;image / png & quot;
            
Return  System.Drawing.Imaging.ImageFormat.Png
            
Case   Else
            
Return  System.Drawing.Imaging.ImageFormat.MemoryBmp
            
End   Select
            
End Function
            
Private   Sub  Form1_Closing( ByVal  sender  As   Object ,  ByVal  e  As  System.ComponentModel.CancelEventArgs) _
            
Handles   MyBase .Closing
            System.Diagnostics.Process.Start(
& quot;IExplore.exe & quot;,  & quot;http: // xml.sz.luohuedu.net /& quot;)
            
End Sub
            
End Class

结果如下:

Qt绘制各种图形并且保存为XML Qt绘制各种图形并且保存为XML Qt绘制各种图形并且保存为XML Qt绘制各种图形并且保存为XML 立即下载

相关推荐

手把手教你用X-AnyLabeling实现医学图像标注:从SAM模型选择到多边形优化全流程

本文详细介绍了如何使用X-AnyLabeling平台结合Med-SAM等专业模型实现医学图像的高效标注。从环境配置、模型部署到实战工作流,涵盖智能辅助标注、低对比度解决方案及团队协作方案,帮助医疗从业者大幅提升标注效率与质量。特别适合处理CT/MRI等医学影像的复杂标注需求。

weixin_29251131的博客 459

生成XML文件的步骤 & 解析XML文件

##生成XML文件的步骤 1.初始化一个xml的序列化器 XmlSerializerserializer=Xml.newSerializer();2.设置序列化器的参数 serializer.setOutput(os,"utf-8");3.写数据 serializer.startDocument("utf-8",true);//写文档头 ser...

weixin_34054931的博客 236

win10下Miracast无线投屏使用教程及异常解决方案(超详细)

文章目录一、什么是Miracast?二、主流的无线投屏技术有哪些特点?三、如何查看自己的win10电脑是否支持Miracast无线投屏功能?四、win10电脑如何使用Miracast无线投屏功能? 一、什么是Miracast? Miracast是由Wi-Fi联盟于2012年所制定,以Wi-Fi直连(Wi-Fi Direct)为基础的无线显示标准。支持此标准的3C设备(如智能手机、电视、投影、电脑等...

帅气的小白的博客 44万+

常见的几种GIS格式

几种比较常见的GIS文件格式的简单介绍,以及其相互之间关系。

CaiJin6a的博客 1万+

倍加福(P+F)R2000修改雷达IP

在调试车子的时候,用到了倍加福R2000的一款雷达,设备启动建图时发现建不了图,于是查看/scan发现话题无数据,尝试ping雷达接口发现ping不通,应该是IP地址与上位机端口的IP地址不对。首先查看雷达的IP地址,这个在雷达上有两个按键,按下后可以显示IP: 按两下右边的键再按一下左边的键雷达上会显示出IP号,这里拍的不是很清楚。查看到开始时雷达IP地址为192.168.111.10,而上位机ping的IP地址为192.168.188.50.与实际不同,所以需要对雷达进行配置。一台windows笔记本

YiYeZhiNian的博客 5904

从零构建C++ Gerber解析器:以PCB缺陷检测为目标的实战指南

本文是一份面向PCB缺陷检测项目的实战指南,详细介绍了如何从零开始使用C++构建高性能的Gerber文件解析器。文章深入剖析了Gerber RS-274X格式,并提供了完整的开发环境搭建、核心数据结构设计、解析步骤实现以及为缺陷检测优化的具体方案,旨在帮助开发者获得对PCB制造数据的深度控制与极致性能。

weixin_29291185的博客 189

Qt将图片保存为XML文件或者变为QSting

软件实现只能打开用这个软件生成的xml文件,因为标签不一样有可能导致错误mainwindow.h#ifndef MAINWINDOW_H #define MAINWINDOW_H#include <QMainWindow>namespace Ui { class MainWindow; }class MainWindow : public QMainWindow { Q_OBJECTpubl

小识的博客 2361

从虚拟机到双系统:手把手教你为Gromacs搭建最强Linux环境(含WSL2、Ubuntu22.04配置)

本文详细指导如何在Windows系统下为Gromacs分子动力学模拟搭建高性能Linux环境,涵盖WSL2和Ubuntu22.04双系统配置。通过对比虚拟机、WSL2和原生Linux的性能数据,提供GPU加速、内存优化等实用技巧,帮助科研人员提升计算效率。

weixin_30861797的博客 275

把图象文件转换成XML格式文件 (转)

把图象文件转换成XML格式文件 (转)[@more@]把图象文件转换成XML格式文件 作者: 孟宪会出自: .NET/">【孟宪会之精彩世界】发布日期: 2003-8-31 2:10:12 利用.NET 框...

csd3176的博客 844

TMS320F28377D双核开发例程 - DSP开发

首先,我们需要创建一个新的工程来进行开发。然后,选择适当的目标设备为TMS320F28377D,并设置工程的名称和存储位置。在上面的代码中,我们定义了一个128个元素的输入数组和输出数组。然后,我们使用一个简单的数字信号处理算法,将输入数组中的每个元素平方,并将结果存储到输出数组中。这个芯片的双核架构提供了更高的计算能力和灵活性,使得数字信号处理的开发更加高效和可靠。希望本文对您有所帮助!当应用程序在TMS320F28377D芯片上运行时,它将对输入数组中的每个元素进行平方运算,并将结果打印出来。

IfllUnity的博客 2523

一文速览:大模型语料构建与基础训练全流程实战指南

因为模型只有看到足够丰富、高质量的数据,才能真正学到“真本事”,展现出更强大的泛化能力,也就是能够在全新的场景和任务下,做出准确的推理和判断。我们日常做饭的时候,通常会先把买回来的菜仔细清洗干净,把坏掉的叶子、泥土、杂质等去除掉。同理,训练大模型的数据就像我们的食材,如果不干净,就会影响模型的学习效果,甚至训练出逻辑紊乱的模型。在大模型的世界里,有一句名言:“Garbage in, Garbage out”,翻译过来就是“垃圾输入,垃圾输出”,说白了,就是给模型喂的是什么数据,它学到的就是什么知识。

master_hunter的博客 1684

把图象文件转换成XML格式文件(二进制转字符)

把图象文件转换成XML格式文件 利用.NET 框架下的FromBase64String和ToBase64String方法可以很容易地实现图象文件和XML文件的互换。这样可以轻易解决以XML格式保存图片的问题。代码如下: Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows 窗体设计器生成的代码 " Public Sub New() MyBase.New() InitializeCompon

vdvvsvxvcvcxvx的专栏 1863

樽海鞘优化算法详解:原理、实现与应用

本文详细介绍了樽海鞘优化算法(SSA)的原理、实现与应用。该算法模拟樽海鞘链式群体行为,将优化问题解空间映射为群体移动空间,通过领导者引导和追随者跟随的协作机制寻找最优解。文章从生物特性、数学模型到Python代码实现进行了系统阐述,包括种群初始化、位置更新公式和收敛因子等核心要素,并展示了算法在函数优化等领域的应用潜力。该算法具有结构简单、参数少、实现容易等特点,在多种优化问题上表现良好。

qq_42212808的博客 647

[导入]把图象文件转换成XML格式文件

把图象文件转换成XML格式文件。文章来源:http://blog.csdn.net/net_lover/archive/2003/09/02/6945.aspx 转载于:https://www.cnblogs.com/zhaoxiaoyang2/archive/2003/09/03/816120.html

weixin_30924087的博客 358

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

【VB.NET】把图象文件转换成XML格式文件

利用.net 框架下的FromBase64String和ToBase64String方法可以很容易地实现图象文件和XML文件的互换。这样可以轻易解决以XML格式保存图片的问题。代码如下: Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows 窗体设计器生成的代码 " Public Sub Ne

312

深度学习工具包 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'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('DeepLearnToolbox'));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('state',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'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',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 = 'sigm';%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, 'Too big error');```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('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';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)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';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, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% 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'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 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, 'Too big error');```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('state',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, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',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, 'Too big error');%% ex3 neural net with dropoutrand('state',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, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % 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, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % 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, 'Too big error');%% 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('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % 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, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

第四十五讲 ASP.NET实例编程(四)

* 摘要。ASP.NET下的Excel操作。网络相册的实现。文件转换 * ASP.NET下Excel操作 * 网络相册的实现 * 文件转换。把图象文件转换成XML格式文件。将Word文档转化为HTML格式的方档 具体代码看例子! 转载于:https://www.cnblogs.com/iceberg2008/archive/2009/04/22/1441003.html...

weixin_30784945的博客 71

全球国家地区城市数据

MySQL全球国家地区城市数据报。。。。。。。。。。。。

iTextSharp 使用详解(转)

iTextSharp 使用详解(转) PDF文件是目前比较流行的电子文档格式,在办公自动化(OA)等软件的开发中,经常要用到该格式,但介绍如何制作PDF格式文件的资料非常少,在网上搜来搜去,都转贴的是同一段“暴力”破解的方法,代码片断如下: StreamWriter pPDF=new StreamWriter(filePath); ArrayList xRefs=new Array...

devgis 226

图片转为xml,图片小一些较好

图片转为xml,图片小一些较好

sflsgfs的专栏 2326

借助Aspose.SVG图像控件,在线将 PNG 转换为 XML

今天,我们将学习如何免费在线轻松地将 PNG 转换为 XML 。

励志做最业余的专业博主,控件产品可以私我~ 3289

【Android】图片转xml文件

图片转换为xml文件

m0_65041204的博客 4017
上一篇: 在.NET应用程序中添加拼写和语法检查功能
下一篇: 创建可拖动列的DataGrid
java2000_test
博客等级 码龄19年 10粉丝 320原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值
⌂ 换网址