在文件过滤驱动中追踪文件状态

文件过滤驱动开发 文件过滤驱动 一、文件透明加解密 关键字:透明、文件过滤驱动、加密标识,缓存   文件过滤驱动最重要的两点是搞定加密标识和缓存管理 1、透明概念: 透明指的是用户在操作的时候,虽然后台在自动的进行加解密,但是用户根本就不知道加密的存在,就像中间隔了一层透明的玻璃一样。      透明的好处在于不改变用户的操作,一切都和加密之前一样,甚至在有些企业安装加密后都无需通知所有的员工,就像加 阅读详情
Tracking State and Context - Reference Counting for File System Filter Drivers
The NT Insider, Vol 9, Issue 2, Mar-Apr 2002 | Published: 15-Apr-02| Modified: 06-May-03



One of the challenges for a file systems filter driver in the Windows NT, 2000 or XP environment is knowing precisely when it is “OK” to discard per-file state information.  While it is customary for file system filter drivers to track such state based on the FsContext field of the FILE_OBJECT, the new file system filter driver writer may be frustrated to find that some I/O operations are missed.



Analyzing this problem, it is easy to observe that matching IRP_MJ_CLOSE operations against IRP_MJ_CREATE operations is not enough to properly determine when it is OK to discard the FsContext-related file state within the filter driver. We have previously described why this is the case (the use of stream file objects by the file systems) but in this article the emphasis is on describing an algorithm that allows the filter driver not to discard the state until the last reference to the file is truly gone.



First, it is worth reviewing the reason that reference counting is not a trivial exercise for file system filter drivers, then we’ll review the various cases that any algorithm must take into account, and finally propose our algorithm for tracking references to the per-file data normally maintained by a file system filter driver.



A file system has several mechanisms for creating file objects that it may use for its own internal processing.  These include IoCreateStreamFileObject, IoCreateStreamFileObjectLite, and IoCreateStreamFileObjectEx.  Not all of these are available in all versions, but even the Windows NT 4.0 IFS Kit contained the IoCreateStreamFileObject call.  Both IoCreateStreamFileObject and IoCreateStreamFileObjectLite are documented in the Windows XP IFS Kit and each provides similar functionality – they create file objects based upon either an existing file object or device object.  The IFS Kit documentation sums up the problem for file system filter drivers, in the page for IoCreateStreamFileObjectLite:



“Thus filter drivers should expect to receive IRP_MJ_CLOSE requests for previously unseen file objects.”



Of course, the fact that a file system filter driver receives an IRP_MJ_CLOSE operation for file objects which were never indicated to the filter driver does complicate reference counting.



In looking at the sequence of events, we note that we are concerned about the overlap of the IRP_MJ_CREATE and IRP_MJ_CLOSE of normal user access along with the IRP_MJ_CLOSE of file system access.  Thus, we might observe the following scenarios:



An application program opens the file and then closes it; the filter never observes any stream file objects used against the given file.
The filter only observes stream file objects and does not observe any application access to a file.
The application opens the file and the filter observes both application and stream file objects used to access the file in question.
The filter observes stream file object usage for a file, and then subsequently observes an application open the file.


Whatever algorithm used by the file system filter driver to track this context and state information, it must be able to account for all of these scenarios.



In analyzing the various algorithms available for tracking this information, we noted that there may be cases where the techniques used can be simplified.  And thus we describe two separate algorithms here – one that is useful for tracking state in the general case, and a second case that is useful when only data operations are of interest to the file system filter driver.



For a file system filter driver that must track all instances of a file object, this unfortunately results in the need to not only track reference counts, but also to track the specific file object for which it has observed and IRP_MJ_CREATE.  Such a filter must typically maintain both a reference count (for file objects seen via the IRP_MJ_CREATE mechanism) and an explicit list (or other data structure for tracking these file objects) of stream file objects seen by the filter.  Thus, on each I/O operation, the filter examines the FO_STREAM_FILE bit in the Flags field of the FILE_OBJECT.  If this bit is set, the filter verifies that the file object is in its list – if not, it allocates the necessary storage for its tracking information and inserts it into its list.  Then, when it observes an IRP_MJ_CLOSE operation, it will either decrement the reference count or remove it from the list, as appropriate.  Only when both the list is empty and the reference count is zero does the filter delete the tracking data structure.



Thus, the filter must create the per-file tracking information whenever it observes an IRP_MJ_CREATE or a stream file object for a file for which it does not have tracking information, as a file object may be created entirely internal to the filter driver or because of an application program’s request to open the file.  The filter driver must still attempt to determine the appropriate action with respect to tracking such files, which can be difficult.  In the “simplified” algorithm that we describe later, we will suggest a technique for keeping the context even longer to allow the filter to avoid re-evaluating the need to track the given file.



There are four distinct scenarios we described earlier for consideration with this algorithm:



If the application program first opens the file and then closes it, with no intervening stream file object usage, this algorithm works because we will delete the file context when the reference count drops to zero.  There is no stream context, so the list will be empty.
If only stream file objects are observed, the filter driver might potentially only see an IRP_MJ_CLOSE operation for this file object, in which case the file was not of much interest.  Otherwise, on observing the first I/O operation using the stream file object the filter would create a context record and insert tracking information for the given file object.  When it observes the subsequent IRP_MJ_CLOSE operation, it will remove the entry from the list and delete the file context block.
If an application opens the file initially, the filter driver would create the per-stream file context information at that point. If it then subsequently observes an I/O using a stream file object, it will not find it in its list, and will create a new entry.  Then, regardless of the order in which the IRP_MJ_CLOSE operations arrive within the filter driver, it will not delete the per-file context until they have both been processed – the reference count will then be zero and the list of stream file objects will be empty.
If the stream file object is first observed, the filter driver will create its per-file context information at that point and insert a tracking block for the stream file object into the list. A subsequent application open of the file will cause the filter to increment the reference count.  Again, until both the stream file object list is empty and the reference count is zero, the per-file context information will be maintained.


Of course, there are numerous variations on these basic scenarios, involving multiple stream file objects and multiple application opens.  However, we have focused on the boundary cases because we maintain that additional stream file objects or application opens will work in a comparable fashion, albeit with additional entries or references.

 



Figure 1 — Section Object/File Object Relationship



Many filter drivers can use a simpler (and less costly) algorithm because they only care about data operations for user files.  In this case, we note that the only issue is when stream file objects are used to back a section object for the memory manager.



This is because any paging I/O operations that the memory manager performs will be based upon the file object referenced by the given section object.  The risk (for the filter driver) is that it will observe the following sequence:



(1)    The application opens the file;

(2)    The file system creates a stream file object and that object is then used as the file object to back the section (i.e. a call to CcInitializeCacheMap is made using that stream file object).

(3)    The application closes the file.  Because there are no outstanding references (other than the application handle) both IRP_MJ_CLEANUP and IRP_MJ_CLOSE are sent to the file system (and hence through the filter).  The filter deletes its per-file context information.

(4)    The Memory Manager flushes any changes to the data (perhaps through the section, as might be the case for memory mapped file access) back to the file system using paging I/O operations.



The problem with this scenario is that because the filter has deleted its per-file context information, the subsequent write operations are missed by the filter because they do not appear to be relevant.  Of course, using the previous algorithm we described, upon observing the new paging I/O operation the filter would create the per-file context information (again) and then ascertain if the file should have been tracked in the first place.  While this will work, we can simplify the process by adding an additional check for this case – specifically, before deleting the per-file context, the section object pointers from the file object must both be NULL.  Otherwise, we know that there is some file object backing the section and it has not yet been observed by our filter driver.



Thus, for a filter driver that is concerned about all I/O operations and tracking all file state, this can be added to the previous algorithm to keep state information when it still might be useful.



For a filter driver that is only concerned about data operations (read and write) this suggests a simpler algorithm:



For each IRP_MJ_CREATE, the filter driver increments the reference count on the per-file context structure.
For each IRP_MJ_CLOSE the filter driver decrements the reference count on the per-file context structure if the FO_STREAM_FILE bit is not set for the file object and if CcGetFileObjectFromSectionPtrs does not return this file object.
If the reference count for the per-file context structure reaches zero and both the ImageSectionObject and DataSectionObject of the SectionObjectPointers field from the FILE_OBJECT is zero, the filter driver may then delete the per-file context data.


This algorithm avoids the need to track individual file objects.  It deals with stream file objects by ignoring any of them that are not involved in paging I/O.  For many filter drivers, this solution will be sufficient for them to track their per-file state.



This works because the reference count represents the user-level opens against the file.  The reference count is decremented only when a user-level file object is closed (as evidenced by the FO_STREAM_FILE bit’s absence in the file object) and thus there are no user references to the file when the reference count is zero.  Similarly, the section objects represent the VM state for the file.  If these two section object pointers are NULL there are no VM references against the file – hence, no memory mappings of the file, whether by applications or the cache manager.  Since the filter is only interested in data operations, this is sufficient.  Any new data operations will require that the file be re-opened.  Do note that this algorithm only works if your filter observes all operations against this file - if you dynamically load your filter driver and the file has already been opened prior to that, this algorithm will not suffice.



For file system filter drivers that will run only on Windows XP or more recent versions, there is no need for tracking the per-file context information in this fashion.  Instead, the routines FsRtlInsertPerStreamContext and FsRtlRemovePerStreamContext can be used by a file system filter driver to allow the file system runtime library package to manage the per-stream file contexts.  For filter drivers that support both Windows XP as well as earlier versions, these two techniques can be used to implement one common mechanism that works for all platforms.

Unity 面试篇|(四)Unity性能优化篇 【全面总结 | 持续更新】 Unity中,CPU准备好需要绘制的元素,对底层图形程序接口进行调用的过程,每次引擎准备数据并通知GPU的过程称为一次Draw Call。DrawCall越高对显卡的消耗就越大。降低DrawCall的方法:动态合批静态合批降低shader的等级特性场景优化策略——遮挡技术。rectMask2D替代Mask。 阅读详情

相关推荐

将AAL图谱对应到Yeo7大网络中【原理,代码分析】

本文介绍了将AAL2图谱映射到Yeo7大功能网络的方法。通过整合皮层(Yeo2011)、小脑(Buckner2011)和纹状体(Choi2012)三个区域的功能网络图谱,采用投票机制确定每个AAL区域的网络归属。具体步骤包括:1)统计每个AAL区域体素在各网络图谱中的分布;2)选择体素数量最多的网络作为该区域的最终标签。该方法实现了从解剖结构到功能网络的映射,可获得120个AAL区域对应的7大功能网络标签。

yes666666的博客 2206

sfilter开源驱动分析(一)--文件过滤的基本步骤

NT的I/O管理器支持分层的驱动程序模式。         当应用层的CreateFile() (R3层)  --> || NtCreateFile() [I/O管理器在这一层,ntdll.dll]  -->|| 内核驱动层(R0层) ,这里讨论的主要是针对最后的内核驱动层的处理。          当每个IRP被处理的时候,它会经过驱动层中的各个驱动程序,直到最终被某个驱动程序调用IoCo

jimk1983的专栏 2697

保姆级教程:在Ubuntu 22.04上用Conda搞定nuPlan数据集环境(Python 3.9 + PyTorch)

本文提供了一份详细的Ubuntu 22.04环境下使用Conda配置nuPlan自动驾驶数据集的保姆级教程,涵盖Python 3.9安装、Conda环境管理、PyTorch配置及数据集可视化验证等关键步骤,帮助开发者高效搭建开发环境。

weixin_29061997的博客 255

聊下最近出的一些wannacry勒索病毒防御工具

1. 瑞星之剑. 只能怪自己消息太过闭塞, 这工具出了两三天了, 好像瑞星还在大肆宣传其防御效果。于是好奇下载下来分析下。界面如下: 就是一个简单的EXE文件, 运行会释放一个dll和两个驱动文件.然后将驱动文件拖入IDA分析. 实现如下: 使用minifilter过滤文件io操作.IRP_MJ_CRATE,IRP_MJ_WRITE, IRP_MJ_SET_INFORMATION. 当有...

weixin_30384217的博客 269

MultiOTP Credential Provider避坑指南:从安装到RDP双因素认证的全流程解析

本文详细解析了MultiOTP Credential Provider从安装到实现RDP双因素认证(MFA)的全流程,重点分享了Docker部署、Active Directory集成及网络级认证(NLA)兼容性等环节的实战避坑经验,旨在帮助运维人员高效、稳定地部署离线双因素认证方案,提升Windows远程桌面安全性。

weixin_29255731的博客 642

SoIC、CoWoS、InFO一次讲透:从2D/2.5D/3D看懂先进封装

先进封装是后摩尔时代提升芯片性能的关键路径,但面对SoIC、CoWoS、InFO这些名词,很多人容易混淆。理解它们,需从最基本的2D、2.5D、3D封装概念入手:2D是传统平房,2.5D通过硅中介层实现高密度互连,3D则让芯片直接堆叠。CoWoS作为2.5D中介层封装,已成为AI芯片与HBM高带宽存储集成的行业标准;SoIC通过铜-铜混合键合实现真正的3D堆叠,为逻辑与缓存提供极致带宽;InFO以扇出型封装兼顾成本与集成度,广泛用于移动SoC。在系统级封装(SiP)和CPO共封装光学等前沿趋势中,这些技术往

weixin_42388898的博客 311

驱动入门科普:从WRK理解IRP IRP Stack之实践篇

网上找到一篇 AntBean写的 《驱动入门科普:从WRK理解IRP IRP Stack之实践篇》特别好,所以摘抄下来。         我把原文截取的图片源码替换成文字源码。 昨天通过WRK的代码对IRP和IRP Stack的概念作出了一个比较深的理解。但显然这样还不够。对程序员而言,没有比光说不练更坏的恶习了。这次,我们将通过一个文件过滤驱动来实现文件保护。 恩,是的,我们想写一个文件

sqqsongqiqi的专栏 822

少儿学编程系列--使用递归画出龙形曲线DragonCurve

龙形曲线(Dragon Curve) 龙形曲线(Dragon Curve)又叫分形龙,是一种自相似碎形曲线的统称,因形似龙的蜿蜒盘曲而得名 使用黄金比例画龙形曲线 根据黄金比例画一条龙曲线。每次递归,第一步向左转32.89度,移动0.74倍原距离;第二个递归步骤向右转46.99度,移动原来距离的0.55倍。请查看这个网页(https://larryriddle.agnesscott.org/ifs/heighway/goldenDragon.htm)了解关于龙形黄线数学的细节 龙形曲线效果 .

penriver的博客 2297

IM推送保障及网络优化详解(一):如何实现不影响用户体验的后台保活

对于移动 APP 来说,IM 功能正变得越来越重要,它能够创建起人与人之间的连接。社交类产品中,用户与用户之间的沟通可以产生出更好的用户粘性。在复杂的 Android 生态环境下,多种因素都会造成消息推送不能及时达到客户端。另外,不稳定的移动网络也给数据传输的速率和可靠性增加了障碍。本文详解了网易云信 IM SDK 在应对弱网环境、移动端硬件限制以及 Android 复杂的生态现状时的探索与心得....

netease_im的博客 848

先进封装类别分析与典型案例

当制程微缩逼近物理极限、单颗大芯片(reticle limit)面积受限于光罩尺寸,且逻辑、存储、射频、传感等功能无法用同一套工艺最经济地制造时,性能增益的来源从 "晶体管密度" 转向 "互连密度"。先进封装的本质,是在芯片外部用更短、更密、更宽的路径把多个裸 die(die)互连起来,换取更高带宽、更低延迟、更小体积和异构集成能力。行业通常按划分为 2D、2.5D、3D、扇出、SiP 五大谱系,Chiplet/UCIe 则是贯穿其上的设计方法论,玻璃基板、共封装光学(CPO)是正在成型的新分支。

0 32

深入YOLOv8内部核心:用RepNCSPELAN4深度重构主干网络,即插即用的高效涨点方案

本文提出了一种改进YOLOv8目标检测模型的方法,通过在YOLOv8中引入RepNCSPELAN模块来提高检测性能。该模块融合了RepVGG重参数化思想与CSP-ELAN结构,在保持推理速度的同时增强特征表达能力。实验结果表明,改进后的RepNCSPELAN-YOLOv8相比原模型在多项指标上均有提升:准确率从0.84提高到0.86,召回率从0.72提升至0.81,mAP50和mAP50-95也分别提高了0.06和0.04。文章详细介绍了模块设计原理和移植步骤,包括配置文件创建、代码修改等关键环节,为YOL

FJN110的博客 187

IM 推送保障及网络优化详解(一):如何实现不影响用户体验的后台保活

对于移动 App 来说,IM 功能正变得越来越重要,它能够创建起人与人之间的连接。社交类产品中,用户与用户之间的沟通可以产生出更好的用户粘性。在复杂的 Android 生态环境下,多种因素都会造成消息推送不能及时达到客户端。另外,不稳定的移动网络也给数据传输的速率和可靠性增加了障碍。本文详解了网易云信 IM SDK 在应对弱网环境、移动端...

weixin_34348805的博客 138

QT西游回合制源码+java后台管理系统

这是一套回合制游戏源码,很适合学习。

renkai721的专栏 2536

即时通讯推送保障及网络优化详解(一)

如何实现不影响用户体验的后台保活对于移动APP来说,IM功能正变得越来越重要,它能够创建起人与人之间的连接。社交类产品中,用户与用户之间的沟通可以产生出更好的用户粘性。在复杂的 Android 生态环境下,多种因素都会造成消息推送不能及时达到客户端。另外,不稳定的移动网络也给数据传输的速率和可靠性增加了障碍。本文详解了网易云信IM SDK在应对弱网环境、移动端硬件限制以及Android复杂的生态现...

jessicaiu的博客 672

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

IM推送保障及网络优化详解(二):如何做长连接加推送组合方案

因此在MIUI上,从长连接到推送通道的切换流程仍然和前面的一样,只是不再使用自己的推送连接,而是将消息转发到MIUI的推送服务器,然后转给MIUI系统的推送代理,然后传递给网易云信的APP。第二个是断,手机跟着人不停的移动,网络也不停的在切换,从wifi到移动网络,从一个基站到另一个基站,从有信号到没信号,都可能导致网络中断。所有APP的消息都经过代理中转,代理到服务器的连接是加密的,安全的,但到了代理这里,消息都被解开了,因此代理理论上可以看到其他所有APP的来往消息。连接成功,需要有一次握手。

qq_44005305的博客 405

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

MobileIMSDK移动端推送优化:减少电量消耗的7个最佳实践

MobileIMSDK是一个原创多端IM通信层框架,历经8年久经考验,可能是市面上唯一同时支持UDP+TCP+WebSocket三种协议的同类开源框架。对于移动端IM应用来说,电量消耗是一个关键的性能指标,直接影响用户体验和留存率。 ## 📱 为什么移动IM应用需要电量优化? 移动设备电量有限,IM应用作为常驻后台的服务,如果不进行优化,会持续消耗大量电力。研究表明,超过60%的用户会因为应

gitblog_00939的博客 1175

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

保障IM推送、优化移动网络 网易云信解决移动IM稳定难题

引用内容“IM本身是一个比较复杂和庞大的系统,在客户端开发时,也就会涉及到很多繁杂的业务需求。当绝大多数IM平台商都在朝向功能化的一站化大潮流迈进时,唯有云信不忘静下心来沉淀内功。云信针对移动网络所做的弱网络优化工作,为IM云服务的稳定垫定了技术基础。”——网易云信Android端高级技术架构师周江华 对于移动APP来说,除了简单的工具类APP外,IM功能正变得越来越重要,它能够创建起人与人...

well_2000_82的博客 1198

IM 推送保障及网络优化详解(三):如何在弱网环境下优化大数据传输?

对于移动 App 来说,IM 功能正变得越来越重要,它能够创建起人与人之间的连接。社交类产品中,用户与用户之间的沟通可以产生出更好的用户粘性。在复杂的 Android 生态环境下,多种因素都会造成消息推送不能及时达到客户端。另外,不稳定的移动网络也给数据传输的速率和可靠性增加了障碍。本文详解了网易云信 IM SDK 在应对弱网环境、移动端...

weixin_33898233的博客 875

网易云信即时通讯推送保障及网络优化详解(三):如何在弱网环境下优化大数据传输

如何在弱网环境下优化大数据传输对于移动 APP 来说,IM 功能正变得越来越重要,它能够创建起人与人之间的连接。社交类产品中,用户与用户之间的沟通可以产生出更好的用户粘性。在复杂的 Android 生态环境下,多种因素都会造成消息推送不能及时达到客户端。另外,不稳定的移动网络也给数据传输的速率和可靠性增加了障碍。本文详解了 网易云信IM SDK 在应对弱网环境、移动端硬件限制以及 Android ...

netease_im的博客 1227

周江华:网易云信IM推送保障及网络优化实践

周江华,网易资深Android开发工程师,先后主导参与了易信、网易云信、网易七鱼的客户端开发工作,拥有非常丰富的功能开发以及代码优化经验。2016年9月23日,MDCC 2016中国移动...

netease_im的博客 701

IM推送保障及网络优化详解(三):如何在弱网环境下优化大数据传输

对于移动APP来说,IM功能正变得越来越重要,它能够创建起人与人之间的连接。社交类产品中,用户与用户之间的沟通可以产生出更好的用户粘性。在复杂的 Android 生态环境下,多种因素都会造成消息推送不能及时达到客户端。另外,不稳定的移动网络也给数据传输的速率和可靠性增加了障碍。本文详解了网易云信IM SDK在应对弱网环境、移动端硬件限制以及Android复杂的生态现状时的探索与心得.如何实现不影响...

weixin_34253126的博客 834
上一篇: 发掘文件系统过滤驱动的应用
下一篇: 文件加密标识 -隐藏文件头的黑客代码
iiprogram
博客等级 码龄25年 1068粉丝 1515原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值