Automating IE

Internet Explorer 编程简述(十三)调用IE隐藏的命令(续)    关键字:CGID_ShellDocView 1、概述在本系列五《调用IE隐藏的命令》中我们曾经从MSDN的一篇文章给出的ShowContextMenu范例入手,深入shdoclc.dll找到了藏于其中的浏览器上下文菜单资源,并以SendMessage发送WM_COMMAND消息到"Internet Explorer_Server"窗口以及其父窗口"Shell DocObjec 阅读详情

Automating IE
   
  Connect   to   a   running   instance   of   Internet   Explorer  
   
     
   
  1.   Using   ObjectFromLResult.  
   
  You   can   use   function   ObjectFromLResult   to   obtain   an   interface   to   IHtmlDocument2   or   IWebbrowser2   from   a   running   instance   of   IE,   if   you   have   a   "Internet   Explorer_Server"   HWND.  
   
  The   following   shows   a   Spyxx-picture   of   the   structure   of   a   running   instance   of   IE.    
   
     
   
  To   reach   Internet   Explorer_Server   we   need   to   go   from  
   
  IEFrame   ->   Shell   DocObject   View   ->   Internet   Explorer_server.  
   
  In   this   example   there   is   also   another   instance   you   can   connect   to:  
   
  IEFrame   ->   BaseBar   ->   RebarWindow32   ->   OCHost   ->   Shell   Embeddeding   ->   Shell   DocObject   View   ->   Internet   Explorer_server.  
   
  It   is   because   the   Search   Explorer   is   opened   and   contain   a   Webbrowser   document.  
   
  The   following   sample   will   do   the   following:  
   
  If   a   instance   of   Internet   Explorer   is   running,   we   will   connct   to   it   -   using   the   ObjectFromLResult   function   -   and   direct   the   browser   to   IE   &   Delphi   Homepage.    
   
  Then   we   will   open   the   Search   Explorer   Bar   in   the   browser   and   replace   the   normal   content   with   a   different   content   -   using   the   same   function.  
   
  ObjectFromLResult   is   a   MSAA   function   (Microsoft   Active   Accessibility)   and   is   located   in   oleacc.dll.   In   Windows   2000   and   Windows   NT   with   Service   Pack   6   MSAA   is   part   of   the   operating   system,   but   on   older   version   you   might   need   to   install   MSAA   runtime   components:  
   
  MSAA   Runtime   Components   (RDK)  
   
     
   
                                   
  type  
      TObjectFromLResult   =   function(LRESULT:   lResult;   const   IID:   TIID;   WPARAM:   wParam;   out   pObject):   HRESULT;   stdcall;  
   
   
  function   GetIEFromHWND(WHandle:   HWND;   var   IE:   IWebbrowser2):   HRESULT;  
  var  
      hInst:   HWND;  
      lRes:   Cardinal;  
      MSG:   Integer;  
      pDoc:   IHTMLDocument2;  
      ObjectFromLresult:   TObjectFromLresult;  
  begin  
      hInst   :=   LoadLibrary('Oleacc.dll');  
      @ObjectFromLresult   :=   GetProcAddress(hInst,   'ObjectFromLresult');  
      if   @ObjectFromLresult   <>   nil   then   begin  
          try  
              MSG   :=   RegisterWindowMessage('WM_HTML_GETOBJECT');  
              SendMessageTimeOut(WHandle,   MSG,   0,   0,   SMTO_ABORTIFHUNG,   1000,   lRes);  
              Result   :=   ObjectFromLresult(lRes,   IHTMLDocument2,   0,   pDoc);  
              if   Result   =   S_OK   then  
                  (pDoc.parentWindow   as   IServiceprovider).QueryService(IWebbrowserApp,   IWebbrowser2,   IE);  
          finally  
              FreeLibrary(hInst);  
          end;  
      end;  
  end;  
   
   
  procedure   TForm1.Button1Click(Sender:   TObject);  
  var  
      Wnd:   HWND;  
      WndChild:   HWND;  
      x:   Olevariant;  
      vaClsID,   vaEnabled,   vaDummy:   Olevariant;  
      BarIE,   IE:   iwebbrowser2;  
  begin  
      Wnd   :=   FindWindow('IEFrame',   nil);  
      if   Wnd   =   0   then   //No   running   instance   of   Internet   Explorer   so   stop!  
      begin  
          showmessage('No   Running   instance   of   Internet   Explorer');  
          exit;  
      end;  
  //   walk   Shell   DocObject   View->Internet   Explorer_Server  
      WndChild   :=   FindWindowEX(Wnd,   0,   'Shell   DocObject   View',   nil);  
      if   WndChild   <>   0   then   begin  
          WndChild   :=   FindWindowEX(WndChild,   0,   'Internet   Explorer_Server',   nil);  
          if   WndChild   <>   0   then  
          begin  
              GetIEFromHWnd(WndChild,   IE);   //Get   Iwebbrowser2   from   Handle  
              //Navigate   to   IE   &   Delphi  
              IE.Navigate('http://www.euromind.com/iedelphi',   x,   x,   x,   x);  
              vaCLSID   :=   '{30D02401-6A81-11D0-8274-00C04FD5AE38}';  
              vaEnabled   :=   True;  
              vaDummy   :=   0;  
  //   open   Search   Explorer   Bar  
              IE.ShowBrowserBar(vaCLSID,   vaEnabled,   vaDummy);    
  //     find   Internet   Explorer_Server   for   Search   Explorer   Bar  
              WndChild   :=   FindWindowEX(Wnd,   0,   'Basebar',   nil);  
              if   WndChild   <>   0   then   begin  
                  WndChild   :=   FindWindowEX(WndChild,   0,   'RebarWindow32',   nil);  
                  if   WndChild   <>   0   then   begin  
                      WndChild   :=   FindWindowEX(WndChild,   0,   'OCHost',   nil);  
                      if   WndChild   <>   0   then   begin  
                          WndChild   :=   FindWindowEX(WndChild,   0,   'Shell   Embedding',   nil);  
                          if   WndChild   <>   0   then   begin  
                              WndChild   :=   FindWindowEX(WndChild,   0,   'Shell   DocObject   View',   nil);  
                              if   WndChild   <>   0   then   begin  
                                  WndChild   :=   FindWindowEX(WndChild,   0,   'Internet   Explorer_Server',   nil);  
                                  if   WndChild   <>   0   then  
                                  begin  
                                      GetIEFromHWnd(WndChild,   BarIE);   //Get   Iwebbrowser2   from   Handle  
                                    BarIE.Navigate('www.euromind.com/iedelphi/ie5tools/automate.htm',   x,   x,   x,   x);    
  //Navigate   Search   Explorer   Bar  
                                  end;  
                              end;  
                          end;  
                      end;  
                  end;  
              end;  
          end;  
      end;  
  end;  
                                       
     
   
     
   
  2.   Using   IShellWindows  
   
  Click   Button1   to   have   the   locationurls   from   all   running   instances   of   Internet   Explorer   -   including   open   folders   and   Windows   Explorer   -   shown   in   a   listbox.  
   
  uses  
      shdocvw_tlb;  
   
  procedure   TForm1.Button1Click(Sender:   TObject);  
  var  
      x:   Integer;  
      Sw:   IShellWindows;  
  begin  
      sw   :=   CoShellWindows.Create;  
      for   x   :=   0   to   SW.Count   -   1   do  
          Listbox1.Items.Add((Sw.Item(x)   as   IWebbrowser2).LocationUrl);  
  end;    
   
   
  Sinking   events   from   IShellWindows.  
   
  DShellWindowsEvent   has   two   events   OnWindowRegistered   (called   when   a   new   instance   of   IE   is   created)   and   OnWindowRevoked   (called   whel   an   instance   of   IE   is   closed).  
   
  Drop   a   DShellWindowEvent-component   on   your   form   and   connect   it   to   your   instance   of   IShellwindows:  
   
  var  
    sw   :   Ishellwindows;  
   
  begin  
      sw   :=   CoShellWindows.Create;  
      DshellwindowsEvents1.Connect(sw);  
  end;  
     
   
   
  The   following   code   will   keep   track   of   running   instances   of   Internet   Explorer   -   add   or   remove   them   from   a   listbox   based   on   information   from   OnWindowRegistered   and   OnWindowRevoked    
   
  uses  
  shdocvw_tlb;  
   
   
  procedure   TForm1.DShellWindowsEvents1WindowRegistered(Sender:   TObject;lCookie:   Integer);  
  begin  
  Listbox1.Items.Add('Instance   with   Cookie   no:   '+InttoStr(lCookie));  
  end;  
   
  procedure   TForm1.DShellWindowsEvents1WindowRevoked(Sender:       TObject;lCookie:   Integer);  
  begin  
    Listbox1.Items.Delete(Listbox1.Items.IndexOf('Instance   with   Cookie   no:   '+InttoStr(lCookie)));  
  end;  
   
  procedure   TForm1.FormCreate(Sender:   TObject);  
  var  
    sw   :   Ishellwindows;  
  begin  
    FormStyle:=fsStayOnTop;    
    sw   :=   CoShellWindows.Create;  
    DshellwindowsEvents1.Connect(sw);  
  end;  
     
   
     
   
  Sending   commands   to   a   running   instance   of   IE  
   
  You   can   obtain   an   IWebbrowser2-interface   from   each   of   the   running   instances   listed   in   IShellwindows   by   simple   typecasting   if    
   
  WB:=Shellwindows.Items(x)   as   IWebbrowser2;    
   
   
  The   following   code   will   close   all   running   instances   of   IE   when   Button1   is   clicked:  
   
   
  procedure   TForm1.Button1Click(Sender:   TObject);  
  var  
      x   :   Integer;  
      sw:   Ishellwindows;  
      wb:   IWebbrowser2;  
  begin  
      sw   :=   CoShellWindows.Create;  
      for   x   :=   0   to   sw.count   do  
          begin  
              WB   :=   Sw.Item(x)   as   IWebbrowser2;  
              if   wb<>nil   then   WB.Quit;  
        end;  
  end;  
     
   
     
   
  Sinking   Events   from   a   running   instance   of   IE.  
   
  Drop   a   DWebbrowserEvents2-component   on   your   form   and   connect   it   to   an   instance   of   IE   by   using  
   
      DWebbrowserEvents21.Connect(IE);  
   
   
  var  
      ShellWin   :   shdocvw_tlb.IShellWindows;  
      IE   :   IWebbrowser2;  
   
  begin  
      IE:=shellwin.Item(Shellwin.Count-1)   as   IWebbrowser2;  
      DWebbrowserEvents21.Connect(IE);  
  end;  
     
   
   
  The   following   code   opens   a   new   instance   of   IE,   lets   it   navigate   and   captures   the   statustext-change   in   a   listbox:  
   
  uses  
  shdocvw_tlb;  
   
  procedure   TForm1.Button1Click(Sender:   TObject);  
  var  
  x:   Olevariant;  
  sw:   Ishellwindows;  
  wb:   IWebbrowser2;  
  begin  
      WB   :=   CoInternetExplorer.Create;  
      WB.Visible   :=   True;  
      DWebbrowserEvents21.Connect(WB);  
      WB.Navigate('http://www.euromind.com/iedelphi',   x,   x,   x,   x);  
  end;  
   
  procedure   TForm1.DWebBrowserEvents21StatusTextChange(Sender:   TObject;const   Text:   WideString);  
  begin  
      listbox1.items.add(text);  
  end;  
   
  procedure   TForm1.DWebBrowserEvents21Quit(Sender:   TObject);  
  begin  
      DWebbrowserEvents21.DisConnect;  
  end;  
     
   
     
   
  The   demo   LogView   demonstrates   how   to   log   events   from   all   running   instances   of   IE   to   a   common   log-listbox.   The   demo   uses   DWebbrowserEvents2   and   ShellWindowEvents:  

27、Automating Deployment and Going Serverless on Azure 本文探讨了如何在Azure上实现自动化部署并转向无服务器架构。首先,介绍了使用Terraform和GitHub Action自动化部署容器到Azure Container Registry和Kubernetes的过程。接着,讨论了Söze Enterprises团队如何转向Azure Functions和Azure Storage以实现无服务器计算,详细描述了前后端的架构设计和部署流程。最后,通过成本对比,展示了无服务器架构在成本节约方面的显著优势,并总结了转向无服务器架构的挑战和收益。 阅读详情

相关推荐

8、API Linting: Automating API Consistency (上)

本文详细介绍了 API Linting 的概念及其在 API 设计阶段的重要性,帮助开发者确保 API 设计符合既定的风格指南。文章涵盖了 API 风格指南的基本内容、常用的 API Linting 工具,以及如何使用 Spectral CLI 和 VS Code 扩展进行合规性检查。此外,还演示了如何创建自定义的 Spectral 规则以满足组织的特定需求。通过 API Linting,团队可以提高 API 的一致性、可用性和安全性,并将其集成到开发流程中,如持续集成构建。文章最后总结了 API Lint

kafka6courier的博客 64

vb.net 教程 20-3 控制Ie浏览器 5

四、获得Ie窗口 Internet Explorer_Server 句柄 IEFrame->Frame Tab->TabWindowClass->shell DocObject View->Internet Explorer_Server 上一小节获得了 Frame Tab 的句柄,本节继续获得 Internet Explorer_Server 句柄 需要注意的是,从Frame Tab之后,从TabWindowClass 到 Internet Explorer_Server 获得

chinaherolts2008的博客 374

Automating IE using VB6

Automating IE HTML DOM Automating Web Pages Question and Answers

Internet Explorer 编程简述(五)调用IE隐藏的命令(中文版)

关键字:Add To Favorite, Import/Export Wizard, Shell DocObject View, Internet Explorer_Server1、概述除了“整理收藏夹”和“添加到收藏夹”对话框外,还有其它一些对话框是我们希望直接通过WebBrowser调用的,比如“导入/导出”对话框,用一般的方法很难调用。IShellUIHelper尽管提供了ImportE

eagleboost's blog 1万+

从零构建工业级SPI-CAN网关:CH347与CH9431的软硬件协同设计实战

本文详细介绍了基于CH347和CH9431芯片构建工业级SPI-CAN网关的完整方案。通过硬件架构设计、Linux驱动定制、并发处理优化和EMC抗干扰测试,实现高可靠性通信网关,适用于工业自动化和汽车电子等严苛环境。

spark7igniter的博客 632

NXP实战笔记(五):S32K3xx基于RTD-SDK在S32DS上配置ADC的硬件触发同步采样与软件采样过程

恩智浦 S32K3xx 系列汽车微控制器器件具有 15 位分辨率逐次逼近模数转换器(SAR ADC),可用于模拟输入信号的采集和数字化。-15 位的分辨率。转换数据总是15 位宽,与所选转换分辨率无关(每转换数据 14、12、10、8 个有效位,减少这个数字会加快数据转换,因为 SAR 算法的执行步骤会更少)。-每个输入通道捕获的转换数据放在单独寄存器中。-可使用“ 平均法” 提高精度,即通过计算最高 32 次转换数据的平均数来提供最终结果。-正常转换触发转换多个。

梦想技术家 3845

IEC(IE表单拦截器)的实现原理--屌丝也来玩逆袭

  在HTTP代理实现请求报文的拦截与篡改(后面简称HTTP代理)系列的开篇里,我们提到了一个IEC(IE表单拦截器)的软件,并猜想了他的实现原理是BHO或者异步可插入协议,后来想想,完全不靠谱。同时又因为VB的P-CODE模式下编译的代码确实太难在汇编层面进行分析,所以就没有再继续去分析它的实现方式,而是另辟蹊径使用了HTTP代理来实现了它的功能,这才有了HTTP代理系列。   虽...

weixin_30709061的博客 215

STM32F407标准库下ADC多通道DMA采集的配置与优化

本文详细介绍了STM32F407标准库下ADC多通道DMA采集的配置与优化方法。通过GPIO模拟输入配置、ADC时钟和模式设置、DMA传输参数配置等关键步骤,实现高效的多通道数据采集。文章还提供了性能优化技巧和常见问题排查指南,帮助开发者提升采样速率和稳定性。

weixin_29192141的博客 434

如何得到webbrowser的句柄

webbrowser不能通过webbrowser.hwnd 来获得句柄,上网查询之后在microsoft网站中看到了应该用遍历所以控件并查看其classname是否是shell embedding的方法来获得,而实际装载网页的并不是它本身。webbrowswer的下一层子窗口是Shell DocObject View,再下一层是Internet Explorer_Server,Internet...

weixin_34320724的博客 552

物联网 Mixly-智能楼道灯

一、实验目的及要求 熟悉声音及人体红外传感器用法。 二、实验原理与内容 1.使用声音传感器实现声控灯功能。 2.使用人体红外传感器实现人体检测控制灯功能。 三、实验软硬件环境 硬件:Arduino、LED灯、声音传感器、人体红外传感器 软件:Mixly IDE 四、实验过程(实验步骤、记录、数据、分析) 核心代码截图 声控灯: 人体红外检测灯: 3.实验效果图: (1)、声控灯总线连接: (1)、声控灯声音大于一某个值时灯亮,经过2秒后灯灭: (3)、人体红外检测灯连接总线: (4)、人体红外

qq_43430810的博客 1917

Python自动化监控:实时捕捉LOF基金溢价套利机会并微信预警

本文详细介绍了如何使用Python构建一个自动化监控系统,实时捕捉LOF基金的溢价套利机会。通过AKShare获取基金数据,结合雪球API计算实时溢价率,并利用企业微信API实现微信推送预警,帮助投资者高效、自动地发现并抓住转瞬即逝的套利机会。

weixin_28327051的博客 524

Automating for Internet Explorer

<br />Automating for Internet Explorer<br />In this article, I’ll describe some techniques to wrap an Internet Explorer window in order to facilitate the automation for verifying the behavior of web applications. In fact, unit testing (part of extreme prog

xinke453的专栏 1079

MIKE水动力笔记18_如何将dfsu流场模拟结果的数据导出成txt文件

MIKE的模拟结果dfsu文件的数据是可以导出的,导出格式为xyz,我们也可以将其改后缀改为txt文本格式,其中包含了某一时刻下所有网格坐标点的数据。

晏长街的博客 4410

Automating Parallelism

Parallel query, the essence of the “divide and conquer” technique in query processing, has been part of Oracle Database for quite a while. In general, parallel query works by creating several paralle...

czmmiao的专栏 212

MinerU 本地部署完整指南:从零构建你的私有文档智能处理系统

摘要: MinerU是一款开源本地化文档解析工具,可将PDF、Word等文件智能转换为结构化Markdown,保留表格、公式、图片等元素。其核心优势包括: 隐私安全:完全离线处理,避免云端数据泄露风险; 高精度解析:基于深度学习还原文档逻辑结构,支持多格式输入; 易集成:提供RESTful API,适合金融、医疗等敏感场景。部署需Python 3.9+环境,支持CPU/GPU运行,推荐配置16GB内存及NVIDIA显卡。通过命令行或Docker即可快速启动,适用于知识库构建、RAG系统预处理等。

reset2021的博客 752

芒果YOLO11改进59:分类损失函数Loss篇FocalLoss:即插即用|最新改进FocalLoss损失函数,提高处理不平衡数据分类场景下的任务性能,提升YOLO11检测精度

即插即用|最新改进FocalLoss损失函数,提高处理不平衡数据分类场景下的任务性能,提升YOLO11检测精度

包括YOLOv5、YOLOv7、YOLOv8等模型改进 550

Automating web tests with FitNesse and Selenium

以下转自 UPDATE: My thinking on this has changed significantly in the years following this post, but according to Google it’s still quite popular. If you’re interested in combining FitNesse and Selenium,

songsean的专栏 1064

深度学习工具包 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")

Automating the tests

Automating the tests Introduction Deqp test modules can be integrated to automated test systems in multiple ways. The best approach depends on the existing test infrastructure and target environme...

weixin_34184561的博客 149

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

Automating CSS Regression Testing

The following is a guest post by Garris Shipon . We've touched on the four types of CSS testing here before. Regression testing is the hardest. It's the type where you're trying to test if a change yo...

weixin_33698823的博客 177

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

MSDN文章纠错-Automating Microsoft SharePoint 2010 with Windows PowerShell 2.0 (book excerpt)

笔者经过实践, 发现文章Automating Microsoft SharePoint 2010 with Windows PowerShell 2.0 (book excerpt)中的Power Shell有错误.   第一个错误 ======================================= 文章错误部分截图:   错误信息: PS C:\Users...

weixin_33984032的博客 118

Automating loadUI Tests with Hudson

Let’s have a look at how to automate the execution of your loadUI Test scenarios with a Continuous Integration tool; we will use Hudson in this example but any other CI-tool supporting comm...

weixin_33695082的博客 112

Automating a 20 TB file server migration

All right, good afternoon, everybody. My name is Dave Stacher and I'm a Chief Platform Engineer at Direct Supply in Milwaukee, Wisconsin and I'm also an AWS Hero. Earlier this year, we wrapped up a project migrating a corporate monolith file server with ab

just2gooo的博客 198

Automating Daily Checks with Powershell

Automating Daily Checks with Powershell By Warren Campbell, 2011/12/19 At my company, I am required to produce evidence that I have checked every database backup on every server to ensure that

Burgess_Liu的专栏 1697

Automated Testing for LLMOps 02:Automating Model-Graded Evals

自动化基于模型打分的评估

阿正的梦工坊 1528

Automating Timesheets and Payroll Workflows Inside Perfex CRM

Running a growing agency on fragmented software is an expensive disaster. Your project managers track client deliverables in Perfex, your department heads approve vacation days in random Slack threads, and your accountant manages payroll on an outdated spr

2601_96579847的博客 156

Alpa: Automating Inter- and Intra-Operator Parallelism for Distributed Deep Learning阅读笔记

Alpa阅读笔记——参考油管报告

weixin_45745854的博客 2830
上一篇: save all TWebbrowser Frame Sources
下一篇: Invoke Hidden Commands in the TWebBrowser
iseekcode
博客等级 码龄18年 36粉丝 14原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值