Android perfetto 简介

VIPAndroid perfetto 简介
android linux 性能优化 原理及操作
开通可读全文 ·3.4k 人阅读
最低0.47元/天 解锁文章
  1. Android perfetto 简介

使用 perfetto 工具,您可以通过 Android 调试桥 (adb) 在 Android 设备上收集性能信息。使用 adb shell perfetto ... 命令调用 perfetto 工具。 perfetto 从您的设备上收集性能跟踪数据时会使用多种来源,例如:

  • 使用 ftrace 收集内核信息

  • 使用 atrace 收集服务和应用中的用户空间注释

  • 使用 heapprofd 收集服务和应用的本地内存使用情况信息

  1. Perfetto 系统框图介绍和运行原理

Perfetto 是一个高级的开源工具,专为性能监测和分析而设计。它配备了一整套服务和库,能够捕获和记录系统层面以及应用程序层面的活动数据。此外,Perfetto 还提供了内存分析工具,既适用于本地应用也适用于 Java 环境。它的一个强大功能是,可以通过 SQL 查询库来分析跟踪数据,让你能够深入理解性能数据背后的细节。为了更好地处理和理解大规模数据集,Perfetto 还提供了一个基于 Web 的用户界面,使你能够直观地可视化和探索多 GB 大小的跟踪文件。简而言之,Perfetto 是一个全面的解决方案,旨在帮助开发者和性能工程师以前所未有的深度和清晰度来分析和优化软件性能。

Perfetto 是完全兼容 Systrace 的。你之前抓的 Systrace 文件,可以直接扔到 Perfetto Viewer 网站里面直接打开。如果你还没有适应 Perfetto ,你也可以从 Perfetto Viewer 一键打开 Systrace。

下图是 Perfetto 的架构图,可以看到 Perfetto 包含了三大块:

  1. Record traces :即数据抓取模块,可以看到抓取的内容和来源非常丰富,Java、 Native 、Linux 都有涉及到,相比 Systrace 要丰富很多。

  2. Analyze traces :主要是 trace 分析模块,包括 Trace 解析、SQL 查询、Metrics 分析等,这部分有专门的命令行工具提供,方便大家直接调用或者在工具链里面去调用。

  3. Visualize Traces:Trace 的呈现、抓取等

Perfetto 工具就提供了这样的一个上帝视角,通过上帝视角我们可以看到 Android 系统在运行时的各个细节,比如

  1. Input 事件是怎么流转的

  2. 你正在使用的 App 的每一帧是怎么从 App 产生到上屏的

  3. CPU 的实时频率、负载、摆核、唤醒等

  4. 系统中的各个 App 是怎么运行的

  5. ....

App 开发者和 Android 系统开发者也都会在重要的代码逻辑处加上 Trace 点,打开部分 Debug 选项之后,更是可以得到非常详细的信息,甚至一个 Task 为什么摆在某个 cpu 上,都会有详细的记载。通过这些在 Perfetto 上所展示的信息,我们能初步分析到性能问题的原因,接下来继续分析就会有针对性

  1. perfetto 工具使用方法

3.1、使用perfetto抓取trace

 

atrace --list_categories 列出抓取的trace策略 示例: 1)perfetto抓trace文件 配置 atrace 类别列表。 adb shell perfetto gfx view wm am sm hal res rs ss -o /data/misc/perfetto-traces/trace -t 5s 或 adb shell perfetto gfx view wm am hal rs ss aidl power -o /data/misc/perfetto-traces/trace --app app包名 -t 5s 或 adb shell perfetto gfx input view wm am sm hal res rs ss aidl sched irq freq load workq binder_driver thermal -o /data/misc/perfetto-traces/trace -t 10s 2)导出trace文件 adb pull /data/misc/perfetto-traces/trace .

3.2、分析trace文件工具

 

Google Chrome浏览器打开https://ui.perfetto.dev 1)打开https://ui.perfetto.dev/网页后,点击open trace file,选择刚才抓取的trace文件。 2)搜索trace关键字 -> f -> shift + m标记 例如搜索:activityConfigChanged。 或者搜索自己添加的RootWindowContainer_onDisplayChanged等等等 示例: 1)在搜索框输入:RootWindowContainer_onDisplayChanged 点击左右箭头跳到上一处或下一处该关键字出现的地方。 2)点击f键会滚动并放大到刚才选择关键字的地方 3)点击m临时标记或者shift + m永久标记

3.3、添加自己的trace方法

 

1,framework层: import android.os.Trace; Trace.traceBegin(long traceTag, String methodName) Trace.traceEnd(long traceTag) 在代码中必须成对出现,一般将traceEnd放入到finally语句块,另外,必须在同一个线程。 例如: Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "broadcastReceiveReg"); ... Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); 2,app层 import android.os.Trace; android.os.Trace.beginSection("lqy111"); Log.d("systrace_log_for_app_lqy111"); android.os.Trace.endSection(); 3,native framework层 #define ATRACE_TAG xxx // xxx和当前相关代码有关 #define ATRACE_TAG ATRACE_TAG_GRAPHICS #include<utils/Trace.h> ATRACE_CALL(); ATRACE_NAME("lqy111"); //#define ATRACE_CALL() ATRACE_NAME(__FUNCTION__) 或 ATRACE_BEGIN("lqy111"); ... ATRACE_END(); 或 #include <gui/TraceUtils.h> ATRACE_FORMAT("onMessageInvalidate %s", "hahaha"); 示例:AOSP在SurfaceFlinger.cpp添加的trace http://aospxref.com/android-12.0.0_r3/xref/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp #define ATRACE_TAG ATRACE_TAG_GRAPHICS ATRACE_FORMAT("onMessageInvalidate %" PRId64 " vsyncIn %.2fms%s", vsyncId, vsyncIn, mExpectedPresentTime == expectedVSyncTime ? "" : " (adjusted)"); 示例:AOSP在ActivityConfigurationChangeItem.java添加的trace http://aospxref.com/android-12.0.0_r3/xref/frameworks/base/core/java/android/app/servertransaction/ActivityConfigurationChangeItem.java public void execute(ClientTransactionHandler client, ActivityClientRecord r, PendingTransactionActions pendingActions) { // TODO(lifecycler): detect if PIP or multi-window mode changed and report it here. Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "activityConfigChanged"); client.handleActivityConfigurationChanged(r, mConfiguration, INVALID_DISPLAY); Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER); }

3.4、命令参数解析

下表列出了在 perfetto 的两种模式下都可使用的选项:

表 1. 可用的常规 perfetto 工具选项列表。

选项 说明
--background |
-d
perfetto 立即退出命令行界面,并继续在后台记录您的跟踪数据。
--background-wait | -D 与 --background 类似,但会在退出前等待(最多 30 秒)所有数据源启动。如果收到成功的确认,则退出代码为零,否则为非零(错误或超时)。
--alert-id 触发此跟踪记录的警报的 ID。
--config-id 触发配置的 ID。
--config-uid 已注册配置的应用的 UID。
--subscription-id 触发此跟踪记录的订阅的 ID。
--out OUT_FILE |
-o OUT_FILE
为输出跟踪文件或 stdout 的 - 指定所需的路径。 perfetto 将输出写入上述标志中所述的文件。输出格式将用 AOSP trace.proto 中定义的格式编译。注意:您必须指定输出文件的完整路径名。通常应将这些文件写入 /data/misc/perfetto-traces 文件夹。
--upload 完成后,将轨迹传递给 proto 轨迹配置中的 IncidentReportConfig 消息指定的软件包。
--no-guardrails 在测试中启用 --upload 标志时,停用防止过多使用资源的保护措施。
--reset-guardrails 重置 guardrails 的持久状态并退出(用于测试)。
--rsave-for-bugreport 如果正在运行 bugreport_score 大于 0 的跟踪记录,则系统会将跟踪记录保存到文件中。完成后输出路径。
--query 查询服务状态,并将其输出为用户可读的文本。
--query-raw 与 --query 类似,但会输出 tracing_service_state.proto. 的原始 proto 编码字节。
--help | -h 输出 perfetto 工具的帮助文本。

在轻量模式下使用 perfetto 的一般语法如下:

 

adb shell perfetto [ --time TIMESPEC ] [ --buffer SIZE ] [ --size SIZE ] [ ATRACE_CAT | FTRACE_GROUP/FTRACE_NAME | FTRACE_GROUP/* ]... --out FILE adb shell perfetto [ --txt ] --config CONFIG_FILE --out FILE console:/data # perfetto -h [385.873] perfetto_cmd.cc:213 Usage: perfetto --background -d : Exits immediately and continues tracing in background --config -c : /path/to/trace/config/file or - for stdin --out -o : /path/to/out/trace/file or - for stdout --upload : Upload field trace (Android only) --dropbox TAG : DEPRECATED: Use --upload instead TAG should always be set to 'perfetto' --no-guardrails : Ignore guardrails triggered when using --upload (for testing). --txt : Parse config as pbtxt. Not for production use. Not a stable API. --reset-guardrails : Resets the state of the guardails and exits (for testing). --query : Queries the service state and prints it as human-readable text. --query-raw : Like --query, but prints raw proto-encoded bytes of tracing_service_state.proto. --save-for-bugreport : If a trace with bugreport_score > 0 is running, it saves it into a file. Outputs the path when done. --help -h light configuration flags: (only when NOT using -c/--config) --time -t : Trace duration N[s,m,h] (default: 10s) --buffer -b : Ring buffer size N[mb,gb] (default: 32mb) --size -s : Max file size N[mb,gb] (default: in-memory ring-buffer only) --app -a : Android (atrace) app name ATRACE_CAT : Record ATRACE_CAT (e.g. wm) FTRACE_GROUP/FTRACE_NAME : Record ftrace event (e.g. sched/sched_switch) statsd-specific flags: --alert-id : ID of the alert that triggered this trace. --con

VIP 【Android】Android 性能分析利器 - Perfetto 如果你需要追踪应用中的特定部分,可以使用 Perfetto SDK 来添加自定义追踪点。将 Perfetto SDK 添加到应用中通过在在代码中进行追踪添加 SDK 后,你可以使用TraceAPI 来创建追踪点。// 执行一些你想测量的操作这些追踪点会出现在 Perfetto 的追踪输出中,让你清楚地看到特定操作的执行时间。 开通可读全文·2.1k 阅读·20 点赞·18 收藏 阅读全文

相关推荐

Android perfetto memory开源工具分析

深入浅出Android perfetto memory分析工具

weixin_42136255的博客 2290

Android上如何使用perfetto分析systrace

可以编写 Python 脚本来解析和分析 Perfetto trace 数据。Perfetto 提供了 Python API 进行更深层次的数据处理。示例:使用 Perfetto 分析 Systrace 数据。

netwalk的专栏 2478

结合源码和Perfetto分析Android渲染机制

整体上介绍渲染流程上面已经提到过不止一次,不清楚可以再回看下.熟悉渲染流程对于App开发者有什么帮助, 可以从三个方面思考:1.输入层: 减少不必要的View#invalidate和View#requestLayout直接或间接的调用, 减少页面层级和使用更高效的控件2. 处理层: 解耦数据,逻辑和渲染,数据上采用异步获取组装或拆装,预加载或者懒加载;渲染上充分利用RenderThread和GPU,熟悉不同系统回调和复用机制;逻辑上有更多的时间和精力专注于业务逻辑和创新.

yabin的专栏 1429

android 如何分析应用的内存(十三)——perfetto

从2018年始,android开发者峰会正式推出perfetto工具。从此perfetto成为安卓最重要的工具之一。在2018年以前,android使用systrace工具,进行同样的工作。第零个工具xdd:只能查看任意内存第一个工具gdb:它可以查看:寄存器,和任意位置的内存,分析coredump,能查看栈情况,不能查看堆情况第二个工具lldb:它可以查看:寄存器,和任意位置的内存,分析coredump,能查看栈情况,不能查看堆情况。

安仔的博客 8415

Android Perfetto Trace性能分析之工具简介

Perfetto 是一套开源的系统级追踪(Tracing)SDK、守护进程及工具链,旨在帮助开发人员洞察复杂系统的底层行为,并精准定位客户端与嵌入式系统中功能及性能缺陷的根本原因。它主要由以下核心组件构成:高性能跟踪守护程序,可将单个机器上多个进程的跟踪信息捕获到统一的跟踪文件中,以便进行离线分析和可视化。低开销的跟踪 SDK ,可直接在用户空间到用户空间之间跟踪 C/C++ 代码的运行时间和状态变化。此外,还提供由社区维护的。

xiangzhihong8的专栏 454

Polyworks脚本开发学习笔记(一)-脚本开发环境

详细的总结和记录了利用Polyworks进行脚本开发的一些方法和心得

qq_43662503的博客 6838

ARM架构UOS实战:从源码编译Qt 5.15.2到定制Qt Creator的全流程解析

本文详细解析了在ARM架构统信UOS系统上,从源码编译Qt 5.15.2到定制Qt Creator开发环境的完整流程。内容涵盖环境准备、依赖部署、源码配置、编译优化、错误处理及IDE集成,旨在帮助开发者在国产化平台上构建自主可控的高性能Qt开发环境,解决特定ARM平台的兼容性与性能优化问题。

mango的博客 413

保姆级教程:用Jetson Orin Nano和ROS2 Humble搞定PIXhawk 4飞控通信(含配置文件详解)

本文提供了一份详细的Jetson Orin Nano与PIXhawk 4飞控通信配置指南,涵盖硬件连接、ROS2 Humble环境搭建、MAVROS2配置及通信调试全流程。通过实战案例和配置文件详解,帮助开发者快速实现无人机上位机与飞控的稳定通信,适用于无人机开发与自动化控制场景。

weixin_33670786的博客 481

Vivado 2023.1及更早版本永久License全功能解锁:HLS、System Generator等IP核使用详解

本文深入解析Vivado 2023.1及更早版本的全功能许可证,详细指导如何解锁HLS、System Generator等高级IP核。通过许可证类型对比、功能验证方法和实战应用指南,帮助FPGA开发者充分利用Vivado工具套件,提升复杂系统设计和算法加速的效率。

weixin_31286719的博客 388

【短距离通信】【WiFi】精讲802.11n/ac/ax mpdu和ampdu最大长度

在 Wi-Fi 标准(802.11n、802.11ac 和 802.11ax)中,和是数据传输的核心概念。理解它们各自的作用以及不同标准下的最大长度限制,有助于深入了解 Wi-Fi 的性能优化机制。以下是对802.11n802.11ac和802.11ax中MPDU和A-MPDU最大长度的详细技术分析和对比。1. MPDU 和 A-MPDU 的基本概念MPDU 是经过 MAC 层处理后的数据单元,主要由MAC层数据帧和物理层的传输头部(PHY headers)组成。

风云说通信 1112

FPGA工程师面试——FPGA基础知识24题

线与逻辑是两个输出信号相连可以实现与的功能。在硬件上,要用OC门(集电极开路与非门)来实现,由于不用OC门可能使灌电流过大,而烧坏逻辑门,因此在输出端口应加一个上拉电阻。

FPGA/MATLAB学习教程/源码/项目合作开发 1089

1. 迈进 SAP UI5 开发世界的第一步 - Hello World

SAP UI5 是一个用于开发企业级 Web 应用的前端框架,基于 HTML 和 JavaScript. 作为教程的第一步,我们需要了解最基础的 HTML 知识。 请大家在电脑上任意新建一个文件夹,将其命名,比如我取的名称为 Walkthrough. 进入 Walkthrough 文件夹,再新建一个文件夹名叫 01,代表本教程的第一个步骤。 进入 01 文件夹,新建一个 webapp 文件夹。这个名称是 web 应用约定俗成所使用的,大家都倾向于用这个名称,当然你要是想用其他名称也没有问题。......

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

CAPL诊断功能实现

UDS(Unified Diagnostic Services)是一种用于汽车电子系统诊断的标准协议。它定义了一系列诊断服务,用于读取和写入车辆电子控制单元(ECU)中的数据,以及处理诊断故障码(DTC)。UDS协议通常运行在CAN总线上,使用ISO 15765-2(ISO-TP)协议进行数据传输。通过本文的学习,读者应该对CAPL诊断功能实现有了初步的了解,并能够编写复杂的CAPL脚本。在实际项目中,CAPL的应用非常广泛,希望读者能够通过不断的学习和实践,掌握更多的CAPL技巧,提高自己的开发能力。

闲人编程的博客 1519

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

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

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

上一篇: smmu 知识架构学习
下一篇: kernel crash数据解析
junwua
博客等级 码龄17年 8357粉丝 172原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址