openwrt

[转]如何编译OpenWrt 原文:http://blog.chinaunix.net/uid-25890465-id-2497754.html (!文末,附加人生如戏写的编译OPENWRT的TXT内容,可直接跳至末尾,有例子)   Openwrt 官方正式的发行版是已编译好了的映像文件(后缀名bin或trx、trx2),此映像文件可从Openwrt官方网站的下载页面中轻松获取到,连接地址为 OpenWrt 阅读详情

1 openwrt开发环境配置
http://forgotfun.org/2018/05/openwrt-lesson-03.html

2 查看当前系统所使用的的线程库:
getconf GNU_LIBPTHREAD_VERSION

3 多线程
https://www.cnblogs.com/thinkinglife/p/5153723.html
pthread_cond_wait用于等待某个特定的条件为真,pthread_cond_signal用于通知阻塞的线程某个特定的条件为真了。在调用者两个函数之前需要声明一个pthread_cond_t类型的变量,用于这两个函数的参数

pthread_join用于等待某个线程退出,成功返回0,否则返回Exxx(为正数)

./Documentation/scheduler/sched-deadline.txt: pthread_join(thread, NULL);
./tools/usb/ffs-test.c: int ret = pthread_join(t->id, NULL);
./tools/usb/testusb.c: if (pthread_join (entry->thread, &retval))
./tools/usb/testusb.c: perror (“pthread_join”);
./tools/perf/bench/numa.c: ret = pthread_join(pthreads[t], NULL);
./tools/perf/bench/futex-wake.c: ret = pthread_join(worker[i], NULL);
./tools/perf/bench/futex-wake.c: err(EXIT_FAILURE, “pthread_join”);
./tools/perf/bench/futex-lock-pi.c: ret = pthread_join(worker[i].thread, NULL);
./tools/perf/bench/futex-lock-pi.c: err(EXIT_FAILURE, “pthread_join”);
./tools/perf/bench/futex-wake-parallel.c: if (pthread_join(td[i].worker, NULL))
./tools/perf/bench/futex-wake-parallel.c: err(EXIT_FAILURE, “pthread_join”);
./tools/perf/bench/futex-wake-parallel.c: ret = pthread_join(blocked_worker[i], NULL);
./tools/perf/bench/futex-wake-parallel.c: err(EXIT_FAILURE, “pthread_join”);
./tools/perf/bench/sched-pipe.c: ret = pthread_join(td->pthread, NULL);
./tools/perf/bench/futex-hash.c: ret = pthread_join(worker[i].thread, NULL);
./tools/perf/bench/futex-hash.c: err(EXIT_FAILURE, “pthread_join”);
./tools/perf/bench/futex-requeue.c: ret = pthread_join(worker[i], NULL);
./tools/perf/bench/futex-requeue.c: err(EXIT_FAILURE, “pthread_join”);
./tools/perf/bench/sched-messaging.c: pthread_join(id, &thread_status);
./tools/perf/util/event.c: pthread_join(synthesize_threads[i], NULL);
./tools/perf/tests/mmap-thread-lookup.c: err = pthread_join(threads[i].pt, NULL);
./tools/perf/builtin-top.c: pthread_join(thread, NULL);
./tools/lib/lockdep/tests/ABBA_2threads.c: pthread_join(t, NULL);
./tools/virtio/ringtest/main.c: ret = pthread_join(guest, &tret);
./tools/virtio/ringtest/main.c: ret = pthread_join(host, &tret);
./tools/virtio/virtio-trace/trace-agent.c: ret = pthread_join(rw_thread_per_cpu[cpu], NULL);
./tools/virtio/virtio-trace/trace-agent.c: pr_err(“pthread_join() error:%d (cpu %d)\n”, ret, cpu);
./tools/testing/selftests/timers/threadtest.c: pthread_join(pth[i], &tret);
./tools/testing/selftests/futex/functional/futex_requeue_pi.c: pthread_join(waiter[i],
./tools/testing/selftests/futex/functional/futex_requeue_pi.c: pthread_join(blocker, NULL);
./tools/testing/selftests/futex/functional/futex_requeue_pi.c: pthread_join(waker, NULL);
./tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c: pthread_join(waiter, NULL);
./tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c: pthread_join(child, NULL);
./tools/testing/selftests/futex/functional/futex_wait_private_mapped_file.c: pthread_join(thr, NULL);
./tools/testing/selftests/rcutorture/formal/srcu-cbmc/tests/store_buffering/test.c: if (pthread_join(tu, NULL))
./tools/testing/selftests/rcutorture/formal/srcu-cbmc/tests/store_buffering/test.c: if (pthread_join(tpr, NULL))
./tools/testing/selftests/vm/userfaultfd.c: if (pthread_join(background_threads[cpu], NULL))
./tools/testing/selftests/vm/userfaultfd.c: if (pthread_join(uffd_threads[cpu], &_userfaults[cpu]))
./tools/testing/selftests/vm/userfaultfd.c: if (pthread_join(uffd_threads[cpu], NULL))
./tools/testing/selftests/vm/userfaultfd.c: if (pthread_join(locking_threads[cpu], NULL))
./tools/testing/selftests/vm/userfaultfd.c: if (pthread_join(uffd_mon, (void **)&userfaults))
./tools/testing/selftests/vm/userfaultfd.c: if (pthread_join(uffd_mon, (void **)&userfaults))
./tools/testing/selftests/powerpc/tm/tm-unavailable.c: rc = pthread_join(t0, &ret_value);
./tools/testing/selftests/powerpc/tm/tm-unavailable.c: pr_err(rc, “pthread_join”);
./tools/testing/selftests/powerpc/tm/tm-trap.c: rc = pthread_join(t0_ping, NULL);
./tools/testing/selftests/powerpc/tm/tm-trap.c: pr_error(rc, “pthread_join()”);
./tools/testing/selftests/powerpc/tm/tm-trap.c: rc = pthread_join(t1_pong, NULL);
./tools/testing/selftests/powerpc/tm/tm-trap.c: pr_error(rc, “pthread_join()”);
./tools/testing/selftests/powerpc/tm/tm-vmx-unavail.c: pthread_join(thread[i], NULL);
./tools/testing/selftests/powerpc/tm/tm-tmspr.c: if (pthread_join(thread, NULL) != 0)
./tools/testing/selftests/powerpc/tm/tm-tmspr.c: if (pthread_join(thread, NULL) != 0)
./tools/testing/selftests/powerpc/dscr/dscr_default_test.c: if (pthread_join(threads[i], (void **)&(status[i]))) {
./tools/testing/selftests/powerpc/dscr/dscr_default_test.c: perror(“pthread_join() failed”);
./tools/testing/selftests/powerpc/math/fpu_preempt.c: pthread_join(tids[i], &rc_p);
./tools/testing/selftests/powerpc/math/fpu_signal.c: pthread_join(tids[i], &rc_p);
./tools/testing/selftests/powerpc/math/vmx_signal.c: pthread_join(tids[i], &rc_p);
./tools/testing/selftests/powerpc/math/vsx_preempt.c: pthread_join(tids[i], &rc_p);
./tools/testing/selftests/powerpc/math/vmx_preempt.c: pthread_join(tids[i], &rc_p);
./tools/testing/selftests/powerpc/benchmarks/fork.c: rc = pthread_join(tid, NULL);
./tools/testing/selftests/powerpc/benchmarks/fork.c: perror(“pthread_join”);
./tools/testing/selftests/mqueue/mq_perf_tests.c: pthread_join(cpu_threads[i], NULL);
./tools/testing/selftests/mqueue/mq_perf_tests.c: pthread_join(cpu_threads[0], &retval);
./tools/testing/selftests/sync/sync_stress_consumer.c: pthread_join(threads[i], NULL);
./tools/testing/selftests/sync/sync_stress_parallelism.c: pthread_join(a, NULL);
./tools/testing/selftests/sync/sync_stress_parallelism.c: pthread_join(b, NULL);
./tools/testing/selftests/seccomp/seccomp_bpf.c: ASSERT_EQ(0, pthread_join(thread, &status));
./tools/testing/selftests/seccomp/seccomp_bpf.c: ASSERT_EQ(0, pthread_join(thread, &status));
./tools/testing/selftests/seccomp/seccomp_bpf.c: int _rc = pthread_join(tid, status); \
./tools/testing/selftests/seccomp/seccomp_bpf.c: TH_LOG(“pthread_join of tid %u failed: %d\n”, \
./tools/testing/selftests/seccomp/seccomp_bpf.c: /* Poll for actual task death. pthread_join doesn’t guarantee it. */
./tools/testing/selftests/seccomp/seccomp_bpf.c: /* Poll for actual task death. pthread_join doesn’t guarantee it. */
./tools/testing/selftests/x86/ldt_gdt.c: if (pthread_join(thread, NULL) != 0)
./tools/testing/selftests/x86/ldt_gdt.c: err(1, “pthread_join”);
./tools/testing/selftests/x86/fsgsbase.c: if (pthread_join(thread, NULL) != 0)
./tools/testing/selftests/x86/fsgsbase.c: err(1, “pthread_join”);
./tools/testing/selftests/bpf/test_lpm_map.c: assert(pthread_join(thread_id[i], &ret) == 0 && ret == (void *)&info[i]);
./tools/testing/radix-tree/iteration_check.c: if (pthread_join(threads[i], NULL)) {
./tools/testing/radix-tree/iteration_check.c: perror(“pthread_join”);
./tools/testing/radix-tree/multiorder.c: pthread_join(worker_thread[i], NULL);
./tools/testing/radix-tree/idr-test.c: pthread_join(threads[i], NULL);
./tools/testing/radix-tree/regression1.c: if (pthread_join(threads[i], NULL)) {
./tools/testing/radix-tree/regression1.c: perror(“pthread_join”);
guang@guang-net:~/develop/linux$

// mutex.c
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>

#define NUM_THREAD 100

void *thread_inc (void *arg);
void *thread_des (void *arg);

long long num = 0;
pthread_mutex_t mutex;

int main (int argc, char *argv)
{
    pthread_t thread_id[NUM_THREAD];
    int i;

    pthread_mutex_init (&mutex, NULL);

    for (i = 0; i < NUM_THREAD; i++)
    {
        if (i%2)
        {
            pthread_create (&(thread_id[i]), NULL, thread_inc, NULL);
        }
        else
        {
            pthread_create (&(thread_id[i]), NULL, thread_des, NULL);
        }
    }

    for (i = 0; i < NUM_THREAD; i++)
    {
        pthread_join (thread_id[i], NULL);
    }

    printf ("result: %lld \n", num);
    pthread_mutex_destroy (&mutex);
    return 0;
}

void *thread_inc (void *arg)
{
    int i;

    pthread_mutex_lock (&mutex);
    for (i = 0; i < 500; i++)
    {
        num += 1;
    }
    pthread_mutex_unlock (&mutex);
    return NULL;
}

void *thread_des (void *arg)
{
    int i;

    for (i = 0; i < 500; i++)
    {
        pthread_mutex_lock (&mutex);
        num -= 1;
        pthread_mutex_unlock (&mutex);
    }
    return NULL;
}
#include <stdio.h>

int main (void)
{
    int i;
    for (i = 0; i < 100; i ++)
    {
        printf ("%2d:%d ",i, i%2);
        if (!(i % 10))
        {
            printf ("\n");
        }

    }
    printf ("\n");

    return 0;
}
学习OpenWrt完美教程 http://zhidx.com/p/186.html从零开始学习OpenWrt完美教程Cisco/Linksys在2003年发布了WRT54G这款无线路由器,同年有人发现它的IOS是基于Linux的,然而Linux是基于GPL许可证发布的,按照该许可证Cisco应该把WRT54G 的IOS的源代码公开。2003年3月, Cisco迫于公众压力公开了WRT54G的源代码。此后就有了一些基于Cisc... 阅读详情

相关推荐

从编译openwrt到安装openwrt image到虚拟机

1. 创建一个Ubuntu 14.04 32位的虚拟机。(我是用的是VM) 请自行百度如何方法 2. 修改Ubuntu的源为清华的源(此步骤请使用root权限) cp/etc/apt/source.list/etc/apt/source.listbak #备份一份 echo "" >etc/apt/source.list #情况文件 ...

llanlianggui的博客 4409

Rockchip USB FFS Test Demo 使用说明

Rockchip USB FFS Test Demo 使用说明

Android framework 704

openwrt编译及第一个安装包教程

Date: 2017.03.14 Made:SuperDeverloper Email: na1206@live.com Target: For mt7688 based board说明:本人在学习过程中走了不少弯路,希望本文档能为后来者提供便利。欢迎复制和使用本文档。本文档记录了搭建openwrt编译环境以及快速创建ipk包(openwrt上的安装程序)。本文档在实际应用中做过几次修改,以帮

SuperDevloper的博客 1万+

USB协议介绍四 设备端

设备端 对于想要开发设备端 USB 功能的开发者而言,使用最广泛的要数树莓派 Zero了,毕竟这是树莓派系列中唯一支持 USB OTG 的型号。网上已经有很多资料教我们如何将树莓派 Zero 配置成 USB 键盘、打印机、网卡等 USB 设备的教程。当然使用其他硬件也是可以的,配置自定义的 USB 设备端可以让我们做很多有趣的事情,比如网卡中间人或者 Bad USB 这种近源渗透方式。后文中我们会使用 Zero 进行简单测试。 一些相关的配置资料可以参考: https://github.com/RoganD

weixin_43977912的博客 1543

openwrt 安装ngrok 穿透内网

本人所写的博客都为开发之中遇到问题记录的随笔,主要是给自己积累些问题。免日后无印象,如有不当之处敬请指正; 使用NGROK-C穿透内网,需要执行三步 第一步:将ngrok-c编译进OPENWRT; 第二步:构建ngrokd 服务器; 第三步:访问穿透域名; 以下分别介绍调试过程 第一步:将ngrok-c编译进OPENWRT; 一.1 下载ngrok-c源代码,并将它放到用户包文件夹内...

一座明亮的小塔 4307

基于OpenWrt的性能检测工具unit_perf.zip

目前工作是基于 OpenWrt 开发,经常要改善代码性能,但是OpenWrt又不支持perf。所以查找性能瓶颈时,就比较麻烦。于是利用业余时间写了个小工具,用于定位性能瓶颈的。编码,测试,加文档(README)大概花了3个小时左右,后面会根据自己的需求(或者大家的需求)进行改善。 标签:unitperf

Linux usb 6. HC/UDC 测试

文章目录1. 背景介绍2. Device (gadget zero)2.1 `gadget zero` 创建2.2 SourceSink Function2.3 Loopback Function3. Host (usbtest.ko)3.1 testcase3.2 ioctl4. App (testusb)参考资料 1. 背景介绍 在测试 USB 时,普通的做法是找一些 U 盘、鼠标、键盘 等外设来做一些测试,但是这些测试还是偏上层偏功能的。相比较 HC (USB Host Controller) 和 U

pwl999的博客 5591

AI Agent + 大数据 + RAG:电商用户行为分析的低成本落地

本文探讨了AIAgent与大数据技术在电商用户行为分析中的应用。通过构建"数据采集-实时分析-智能决策"的全自治链路,解决了传统大数据分析的三大痛点:人工建模周期长、实时性不足和决策闭环断裂。系统采用Flink+Spark处理实时数据,结合基于DeepSeek-V3.1的AIAgent实现智能分析,并通过飞书RAG模块动态获取业务知识。落地效果显示,分析响应时间从2-3天缩短至30秒,推荐转化率提升134%,验证了该方案在提升电商数据决策效率方面的显著价值。

想~ai抽 1623

source\FatFs\fftest.h.c__测试FAT文件系统

/****测试FAT文件系统****/ /***************************************************************************************** 文件:fftest.h 函数功能:测试FAT文件系统 /*********************************************************

zyhui65的专栏 1122

SiC MOSFET驱动设计实战:从特性解析到电路优化

本文深入解析SiC MOSFET的核心特性及其驱动电路设计要点,涵盖高温稳定性、快速开关能力等关键特性,并提供驱动电压配置、电流能力计算、布局优化等实用方案。特别针对第三代电力电子半导体SiC MOSFET的驱动要求,分享STGAP1AS等典型驱动方案的应用技巧,助力工程师解决高频应用中的EMI和热管理挑战。

weixin_29230865的博客 366

NDVI空间分布变化Slope趋势分析与F检验(自用)

1.NDVI数据预处理2.一元线性回归分析3.Slope趋势分析与F检验

什么都学亿点点的博客 9019

linux usb驱动 主机测 设备测,linux usb_gadget:设备控制器驱动测试(包含更新主机内核的方法)...

一、简介目前正在做的项目的那部分是将SOC作为一个USB从设备,插到电脑上能被识别为U盘。当在SOC上安装好设备控制器的驱动之后,你需要检测你做的驱动是否符合规范。测试的原理是这样的,在主机端有usbtest内核模块,他是一个专用于测试的usb主机上的设备驱动,该模块通过ioctl接口提供了各种测试类型,比如Simple non-queued bulk I/O tests,Queued bulk ...

weixin_35235724的博客 565

下载igv报错:Error loading genome hg38raw.githubusercontent.com...如何解决?

🏆本文收录于 《全栈 Bug 调优(实战版)》 专栏。专栏聚焦真实项目中的各类疑难 Bug,从成因剖析 → 排查路径 → 解决方案 → 预防优化全链路拆解,形成一套可复用、可沉淀的实战知识体系。无论你是初入职场的开发者,还是负责复杂项目的资深工程师,都可以在这里构建一套属于自己的「问题诊断与性能调优」方法论,助你稳步进阶、放大技术价值 。

**My Coding Family** 992

openwrt+linux编译,OpenWRT编译过程

转自:摘要:本篇通过分析Makefile,了解Openwrt编译过程,包括(1)Openwrt目录结构(2)主Makefile的解析过程,各子目录的目标生成。(3)kernel编译过程(4)firmware的生成过程(5)软件包的编译过程从github上clone了openwrt的代码仓库。git clone https://github.com/openwrt-mirror/openwrt.gi...

weixin_36004568的博客 2541

压缩包密码破解工具ZIP Cracker2.0.1.2 正式版

一款多功能文件密码破解工具,支持ZIP、RAR、Office等主流加密格式,提供CPU/GPU双模式破解。该软件采用黑客风格界面,具备环境自检修复功能,支持实时监控硬件使用率。内置hashcat等专业破解工具,通过拖拽文件即可快速破解,GPU模式速度可达CPU的10-100倍。最新版本优化了中文路径支持,并提升了启动速度。

bfq05234214的博客 483

Android 12.0 系统开机设置默认横屏显示

在12.0的系统产品开发中,对于产品需求来说,由于是宽屏设备所以产品需要开机默认横屏显示,开机横屏显示这就需要从两部分来实现,一部分是开机动画横屏显示,另一部分是系统显示横屏显示,从这两方面就可以做到开机默认横屏显示了。

安卓兼职framework和app工程师的博客 3744

openwrt顶层Makefile分析

openwrt 这里主要介绍openwrt的主Makefile,并未对各个目录下的Makefile和相关文件进行介绍。   在Makefile里是两个主要的分支,由if语句根据OPENWRT_BUILD的值进行不同的处理。第一个部分主要是执行编译前的准备,第二个部分是执行编译。 打开Makefile文件,可以看到默认的make目标world,这个目标没有依赖文件和执行命令。   执行m

lj627889343的专栏 1万+

2025.06.16【转录组】|Ribo-seq数据流程详解(二 基因组比对)

本文详细介绍了Ribo-seq数据分析中的比对流程,包括环境准备、STAR索引构建、比对参数设置及结果统计可视化。通过samtools和R脚本实现比对质量评估,提供常见问题解决方案和关键指标解读。该流程强调比对参数优化和质量控制,为后续翻译组学分析奠定基础。

1980

openwrt: Makefile 框架分析

本篇的主要目的是想通过分析Makefile,了解openwrt编译过程。着重关注以下几点: openwrt目录结构 主Makefile的解析过程,各子目录的目标生成。 kernel编译过程 firmware的生成过程 软件包的编译过程 openwrt目录结构 官方源下载速度太度,我从github上clone了openwrt的代码仓库。 git clone https://githu...

JK198310的专栏 4557

基于Python的全卷积网络(FCN)实现路径损耗预测

本文提出一种基于全卷积网络(FCN)的无线信道路径损耗预测方法。通过合成数据生成模块构建包含房间布局和发射点坐标的训练数据集,采用双分支FCN架构融合空间特征与坐标信息,引入空间注意力机制增强关键区域提取。实验表明,该方法相比传统模型能更准确地预测复杂环境下的路径损耗,平均绝对误差降低约35%。系统支持端到端训练,可扩展融合多模态数据,为5G网络规划等应用提供高效预测工具。

huanghm88的专栏 578

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

OPenWrt编译文件解读makefile

当执行make V=99时调用得时MakeFile。那么MakeFile的作用是什么呢?1.简化程序的编译过程,尽量少做重复劳动2.组织管理源代码。

keep on going 1957

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

Openwrt(IstoreOS)安装iventoy

在Openwrt(IstoreOS)中安装iventoy;docker安装Iventoy;iventoy配合第三方dhcp服务器

TT成成的博客 6526

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

在 PVE 中安装 OpenWrt

最近在捣腾 x86 软路由,入门方案一般是底层采用 ESXi 或 PVE,虚拟层使用 iKuai + OpenWrt 的形式。由于我更喜欢开源软件,所以我选择了 PVE,在这里记录一下 PVE 安装 OpenWrt 的步骤。

LucienShui 1万+

openwrt 框架分析

转:openwrt 框架分析link. 阅读目录 openwrt目录结构 main Makefile 第一个逻辑 第二逻辑 目录变量 kernel 编译: 生成firmware 处理vmlinux: Image/BuildKernel 制作squashfs,生成.bin: $(call Image/mkfs/squashfs) OpenWrt是一个典型的嵌入式Linux工程,了解OpenWrt的M...

hxb_pop的博客 1262

openwrt目录结构(转载)

博客 ...

kuangzuxiaoN的博客 3372

openwrt makefile

openwrt 这里主要介绍openwrt的主Makefile,并未对各个目录下的Makefile和相关文件进行介绍。   在Makefile里是两个主要的分支,由if语句根据OPENWRT_BUILD的值进行不同的处理。第一个部分主要是执行编译前的准备,第二个部分是执行编译。 打开Makefile文件,可以看到默认的make目标world,这个目标没有依赖文件和执行命令。   执行m

laiqun_ai的专栏 1359
上一篇: TCP IP网络编程 问题定位记录
下一篇: vim配置
skyleemon
博客等级 码龄11年 5粉丝 32原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值