Ubuntu 25.10 蓝牙Wifi不可用解决流程

【实战】联想拯救者MT7921网卡在Ubuntu下的WiFi/蓝牙兼容性终极解决方案 本文详细介绍了联想拯救者MT7921网卡在Ubuntu系统下的WiFi/蓝牙兼容性问题及解决方案。通过升级Ubuntu系统版本、更换Intel AX210网卡或使用USB无线网卡三种方法,有效解决了MT7921在Linux环境下的驱动兼容性问题,提升无线网络和蓝牙连接的稳定性。 阅读详情

前阵子把自己的古董笔记本安装上了Ubuntu 25.10,结果蓝牙和wifi无法正常启动。作为一个Linux新手,折腾现在才解决,记录一下我解决的流程。

蓝牙无法启动

        1)按照教程安装了bluez。

        sudo apt update

        sudo apt install bluez

        结果蓝牙还是无法启动

        2)通过命令查询蓝牙状态:

$ hciconfig -a
hci0:	Type: Primary  Bus: USB
	BD Address: XX:XX:XX:XX:XX  ACL MTU: 0:0  SCO MTU: 0:0
	DOWN 
	RX bytes:676 acl:0 sco:0 events:18 errors:0
	TX bytes:57 acl:0 sco:0 commands:19 errors:0
	Features: 0xxz 0xxx 0xxx 0xxx 0xxx 0xxx 0xxx 0xxx
	Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
	Link policy: 
	Link mode: PERIPHERAL ACCEPT

        可以看到蓝牙是DOWN的状态

        3)尝试启动蓝牙

$ sudo hciconfig hci0 up 
Can't init device hci0: Connection timed out (110)

        看到蓝牙启动异常

        4)打印启动日志

$ sudo dmesg | grep -i bluetooth
[    4.724382] Bluetooth: Core ver 2.22
[    4.724432] NET: Registered PF_BLUETOOTH protocol family
[    4.724436] Bluetooth: HCI device and connection manager initialized
[    4.724443] Bluetooth: HCI socket layer initialized
[    4.724447] Bluetooth: L2CAP socket layer initialized
[    4.724456] Bluetooth: SCO socket layer initialized
[    6.060376] Bluetooth: hci0: BCM: chip id 70
[    6.061375] Bluetooth: hci0: BCM: features 0x06
[    6.077294] Bluetooth: hci0: BCM43142A
[    6.077304] Bluetooth: hci0: BCM43142A0 (001.001.011) build 0000
[    6.143709] Bluetooth: hci0: BCM: firmware Patch file not found, tried:
[    6.143726] Bluetooth: hci0: BCM: 'brcm/BCM43142A0-04ca-2009.hcd'
[    6.143729] Bluetooth: hci0: BCM: 'brcm/BCM-04ca-2009.hcd'
[    8.210327] Bluetooth: hci0: command 0x1003 tx timeout
[    8.210329] Bluetooth: hci0: Opcode 0x1003 failed: -110
[    8.607318] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    8.607328] Bluetooth: BNEP filters: protocol multicast
[    8.607337] Bluetooth: BNEP socket layer initialized
[   75.241504] Bluetooth: hci0: unexpected event for opcode 0x1003
[   85.606015] Bluetooth: hci0: BCM: Reset failed (-110)
[  222.432794] Bluetooth: hci0: BCM: chip id 70
[  222.433875] Bluetooth: hci0: BCM: features 0x06
[  222.449797] Bluetooth: hci0: BCM43142A
[  222.449817] Bluetooth: hci0: BCM43142A0 (001.001.011) build 0000
[  222.451067] Bluetooth: hci0: BCM: firmware Patch file not found, tried:
[  222.451080] Bluetooth: hci0: BCM: 'brcm/BCM43142A0-04ca-2009.hcd'
[  222.451085] Bluetooth: hci0: BCM: 'brcm/BCM-04ca-2009.hcd'
[  224.519245] Bluetooth: hci0: command 0x1003 tx timeout
[  224.519259] Bluetooth: hci0: Opcode 0x1003 failed: -110
[  317.362894] Bluetooth: hci0: unexpected event for opcode 0x1003
[  327.766613] Bluetooth: hci0: BCM: Reset failed (-110)
[  330.423732] Bluetooth: hci0: BCM: chip id 70
[  330.424724] Bluetooth: hci0: BCM: features 0x06
[  330.440745] Bluetooth: hci0: BCM43142A
[  330.440751] Bluetooth: hci0: BCM43142A0 (001.001.011) build 0000
[  330.441774] Bluetooth: hci0: BCM: firmware Patch file not found, tried:
[  330.441778] Bluetooth: hci0: BCM: 'brcm/BCM43142A0-04ca-2009.hcd'
[  330.441779] Bluetooth: hci0: BCM: 'brcm/BCM-04ca-2009.hcd'
[  332.502288] Bluetooth: hci0: Opcode 0x1003 failed: -110
[  332.503731] Bluetooth: hci0: unexpected event for opcode 0x1003
[  342.613887] Bluetooth: hci0: BCM: Reset failed (-110)
[  478.173127] Bluetooth: hci0: BCM: chip id 70
[  478.174082] Bluetooth: hci0: BCM: features 0x06
[  478.190134] Bluetooth: hci0: BCM43142A
[  478.190151] Bluetooth: hci0: BCM43142A0 (001.001.011) build 0000
[  478.191239] Bluetooth: hci0: BCM: firmware Patch file not found, tried:
[  478.191254] Bluetooth: hci0: BCM: 'brcm/BCM43142A0-04ca-2009.hcd'
[  478.191260] Bluetooth: hci0: BCM: 'brcm/BCM-04ca-2009.hcd'
[  480.210701] Bluetooth: hci0: Opcode 0x1003 failed: -110

        可以看到,启动时缺少了BCM43142A0-04ca-2009.hcd这个固件

        5) 我们可以到github的winterheart/broadcom-bt-firmware项目仓库下载,并找到brcm目录下的BCM43142A0-04ca-2009.hcd

        6) 将下载的固件放到指定目录

sudo cp BCM43142A0-04ca-2009.hcd /lib/firmware/brcm/BCM43142A0-04ca-2009.hcd

       7) 移除并重新加载蓝牙驱动

sudo modprobe -r btusb
sudo modprobe btusb
sudo hciconfig hci0 up

      这样就可以看到蓝牙正常启动了。

Wifi无法启动

      1)查看网络硬件状态

sudo lshw -C network

  *-network UNCLAIMED       

       description: Ethernet controller

       product: RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet Controller

       vendor: Realtek Semiconductor Co., Ltd.

       physical id: 0.1

       bus info: pci@0000:07:00.1

       version: 12

       width: 64 bits

       clock: 33MHz

       capabilities: pm msi pciexpress msix vpd bus_master cap_list

       configuration: latency=0

       resources: ioport:3000(size=256) memory:d1504000-d1504fff memory:d1500000-d1503fff

  *-network UNCLAIMED

       description: Network controller

       product: BCM43142 802.11b/g/n

       vendor: Broadcom Inc. and subsidiaries

       physical id: 0

       bus info: pci@0000:08:00.0

       version: 01

       width: 64 bits

       clock: 33MHz

       capabilities: pm msi pciexpress cap_list

       configuration: latency=0

       resources: memory:d1400000-d1407fff

   可以看到,网卡处于UNCLAIMED状态,意味着没有驱动

      2)安装驱动

sudo apt install broadcom-sta-dkms

     3)手动加载驱动

sudo modprobe wl

modprobe: ERROR: could not insert 'wl': Key was rejected by service

根据控制台显示的结果,查询到这个问题是因为由于安全启动的保护机制,UEFI 安全启动(Secure Boot)功能阻止了驱动加载

     4)为驱动签名并注册MOK

     1.导入系统生成的密钥:

sudo mokutil --import /var/lib/shim-signed/mok/MOK.der

之后系统会要求你输入一个秘密,记住这个密码

     2. 重启电脑:

sudo reboot

     3. 电脑重启过程中,屏幕上会出现一个蓝色的 "Perform MOK management" 界面。需要按顺序执行以下步骤:

按任意键进入管理界面。

选择 "Enroll MOK"。

选择 "Continue"。

选择 "Yes"。

输入你在上一步设置的临时密码。

最后选择 "Reboot" 重启。

重启后Wifi正常可用

     

Ubuntu 20.04 英特尔 Wi-Fi 6 AX210 160MHz或没有wifi蓝牙解决方法 关于Ubuntu下无法识别Intel WIFI6 AX201 160MHz无线网卡蓝牙的解决方案 Linux* 对英特尔®无线适配器的支持 (intel.com)https://www.intel.com/content/www/us/en/support/articles/000005511/wireless.html以上链接可以下载英特尔的网卡驱动 ubuntu 老版本都是可以用的不过要更新内核有的 AX210 内核要求5.10 查看自己内核版本 uname -r uname.. 阅读详情

相关推荐

Ubuntu 22.04 “软件与更新”装了NVIDIA驱动,WiFi等设备不见了

在Win10装了Ubuntu22.04的双系统,台式机里面有NVIDIA 3080Ti的独立显卡,Ubuntu默认使用的nouveau驱动,需要更换成NVIDIA相应的驱动,在软件和更新里面一键安装了NVIDIA-driver-535-server之后,发现wifi、蓝牙等设备消失了。这个问题的根源据说跟这个nouveau驱动有关,希望linux社区可以解决这个问题。命令安装后 sudo reboot就可以重新看到WiFi以及蓝牙等设备图标了。然后用U盘拷贝到不能上网的Ubuntu22.04系统上,利用。

me_ysd的博客 5856

Ubuntu14.04 蓝牙适配器的连接

一,蓝牙设备  蓝牙适配器: ISSC芯片, USB接口(市面上还有其他的一些品牌,大多没有问题) 1,加载蓝牙适配器  插入USB口之后,可以使用lsusb命令(虚拟机也是可以的),看到:     这是,运行hciconfig可以看到(这里我插了两个蓝牙,但是一个是蓝牙适配器,一个是串口+蓝牙模块):       2,配置bluez   默认的配置文件放在/etc/bluetooth目

点云PCL 1万+

Ubuntu 20.04 英特尔 Wi-Fi 6 AX200 160MHz WIFI 或蓝牙无法打开的解决办法

今天把 NUC9 装成了 Ubuntu22.04,因为平时经常需要 Linux 环境,但是 WSL 有时候确实也不方便,所以直接装了,然后进入系统后,发现 WIFI 都可以正常工作,但是蓝牙却无法打开。看了很多博客,并且经过一系列的更新,设置,重启等操作,最后终于可以了,但是这种方法不能保证所有情况哦,顺便记录一下。注意:这个驱动是适用于 Llinux 内核大于 5.1 的版本,如果内核太老,而硬件太新,驱动也是没办法支持的。可以通过uname -r查看系统内核版本。

code_peak 1万+

csr8811蓝牙芯片porting总结

1.添加BT电源driver,提供给android接口,android文件目录是:system/Bluetooth/bluedroid、bluetooth.c文件 2.在drivers/bluetooth目录下查看是否有hci_bcsp.o hci_ldisc.o hci_uart.o,如果没有要查看时候是kconfig没有在driver/kconfig目录下添加。我们需要这三个.o文件 3.

lansefeiyang08的专栏 1万+

华为MateBook D14安装Ubuntu16必看:WiFi/蓝牙驱动问题终极解决方案(附内核升级指南)

本文详细介绍了华为MateBook D14在Ubuntu16系统下WiFi和蓝牙驱动问题的终极解决方案,包括内核升级的具体步骤和常见问题处理。通过升级到5.10内核,用户可以完美解决硬件兼容性问题,提升系统稳定性和性能。

weixin_30872337的博客 603

器:huawei matebook 14 安装ubuntu 16.04 无法使用wifi,有线,蓝牙,触摸板等问题记录(完成)

shit ,i cannot use chinese input yet... how to fix the bug of no wifi avalible: 先来说原因:内核版本太低导致的。想办法升级到4.20。(当然可能4.19也可以,我没试) 推测:如果安装ubuntu 系统出现无法使用wifi等,很可能是因为内核版本低导致的。看了很多网友教程,跟ubnutu wifi不可用相关的都可...

hunter 3657

hciconfig

<br />hciconfig - HCI device configuration utility<br /> Usage:<br />     hciconfig<br />     hciconfig [-a] hciX [command]<br /> Commands:<br />     up                     Open and initialize HCI device<br />     down                   Close HCI dev

Embeded system Development 7379

switchbotpy:用于SwitchBots的Python API,它可以控制操作,设置和计时器(也受密码保护)

Switchbot API 用于的Python API,该API可以控制操作,设置和计时器。 该设置已在带有Raspbian Buster OS的RaspberryPi 3上与运行固件4.4和4.5的Switchbots结合使用进行了测试 常问问题 请注意,如果您观察到以下错误: Can't init device hci0: Connection timed out (110)运行两个API时, Can't init device hci0: Connection timed out (110) 。 更新所有程序包,。 用法 示例文件夹包含有关如何扫描开关机器人,按开关机器人,读取和设置

Ubuntu系统安装wifi驱动、蓝牙驱动

将手机打开移动数据或者连接wifi网络,然后将手机和电脑通过USB接口的线连接(一般手机充电线就行),在手机上打开设置->移动网络->个人热点->更多共享设置->USB共享网络。购买COMFAST的免驱动USB的wifi蓝牙二合一(我买的是AX900双天线款),插在主板的USB接口上(不要插在机箱的USB接口)链接: https://pan.baidu.com/s/1cgmbojYboOu_A2Uux3Xjvg 提取码: lfyd。这里就能看到,原本是 4.2.1-1.2 降级到了 4.1-9。

Coco091的博客 4372

Android keymint(keymaster)一RKP

Android RKP

weixin_47139576的博客 1万+

LSF调度实战:如何用bsub命令实现多队列资源抢占与公平调度

本文深入探讨了LSF作业调度系统的高级实战技巧,重点解析如何通过配置`lsb.queues`文件与灵活运用`bsub -R`命令,构建一套兼顾效率与公平的多队列资源抢占与调度体系。文章详细介绍了队列优先级设计、公平共享机制、资源感知调度以及抢占策略的实施,帮助集群管理员解决高优先级任务等待、资源分配不均等常见问题,实现计算资源的精细化管理和高效利用。

vvv99的博客 218

为ubuntu配置WiFi

换一下ubuntu的软件中的系统源(如果觉得自己sudo apt-get install *app,之类的下载安装东西觉得自己网速慢了,那就可以试试换一下源,有时候不一定是清华的源比阿里的好…0.网卡的驱动是不是装了(一般原本正常能用wifi,突然某天不能用了,驱动一般是好的!完全没有安装过网卡的,适合刚刚安装好ubuntu系统,而电脑的网卡不能显示的情况。我完成了这几步后,wifi出现了,但是不能使用,WiFi是一个空心WiFi的形状。的方式去除disable,注意wlo1是我这里的名称。

大家好我说家盛 1万+

告别WSL!实测AMD ROCm7预览版在Windows下跑ComfyUI,速度提升与避坑全记录

本文详细记录了在Windows原生环境下部署AMD ROCm7+PyTorch+ComfyUI的全流程,相比WSL环境性能显著提升。涵盖硬件兼容性确认、开发环境配置、Python环境搭建、ComfyUI部署优化及性能对比测试,为AI绘图爱好者提供实用指南。

weixin_42528090的博客 672

Ubuntu双系统安装过程中出现无WiFi适配器的解决方法

Ubuntu双系统安装过程中出现无WiFi适配器的解决方法 前言 电脑型号:联想拯救者Y7000P 2020H ,在win10的基础上, 一、pandas是什么? 示例:pandas 是基于NumPy 的一种工具,该工具是为了解决数据分析任务而创建的。 二、使用步骤 1.引入库 代码如下(示例): import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import warnin

lele_god的博客 5655

Oracle监听配置

Oracle监听配置## 标题 选择“监听程序配置”,然后下一步。 选择重新配置,然后下一步/。 不用管,按下一步。 下一步。 选择“否”,下一步。 选择"本地net服务名配置",然后下一步。 选择“重新配置”,然后下一步。 服务名 是"Oracle",然后下一步。 主机为你的IP地址,在doc系统下通过"ipconfig"获取IP地址。然后输入,然后下一步。 选择“是,进行测试...

m0_46079215的博客 807

S32K3的STCU2模块详解:从硬件FSM到MCAL配置,搞懂BIST在线测试全流程

本文深入解析S32K3系列MCU的STCU2模块,从硬件FSM架构到MCAL配置,详细讲解BIST在线测试全流程。通过分区的安全策略和实战代码示例,帮助开发者掌握汽车电子系统中的功能安全实现,提升系统可靠性和安全性。

weixin_42525328的博客 447

新笔记本安装ubuntu2004后wifi找不到无蓝牙解决方法之一 + zsh配置

新电脑回来后安装2004,发现各种不适配,有网上的常见问题:无法调整亮度、没有wifi蓝牙等、additional driver为空,还出现触摸板无法使用。先按照通用方法升级内核:升级前内核版本:5.15.0使用mainline工具快速切换内核:使用图形化界面直接切换最新内核:重启切换后解决亮度和触控板问题,仍然无法解决wifi问题不断查找后找到一个可用方法,向/lib/firmware/mediatek/中添加一些bin文件。

qq_33673253的博客 862

保研考研机试攻略:python笔记(4)

保研考研机试攻略:python笔记(4)二分法+最大公约数+最小公倍数+素数判断+幂次方mod方法+匹配问题+哈希算法+哈夫曼编码+二叉树

qq_63349644的博客 1097

解决vmware虚拟机安装ubuntu 无法连接wifi找不到wifi适配器问题

试了很多博主的方法都没有作用,已经快放弃了,却意外的在同学的帮助下发现通过这种方式,只需几步,竟然可以解决,真的好开心!!!

weixin_42251474的博客 4万+

50、压电微泵与技术设备驱动的研究分析

本文研究了压电微泵在弹性微通道中的流体流动特性及技术设备驱动的振动行为。通过建立轴对称流固耦合模型,利用FreeFem++进行数值模拟,分析了不同数量压电致动器和频率对微泵流量的影响,发现多个致动器按特定时序压缩可产生净正向流量,并提出了稳态流量的近似解析公式。同时,针对技术设备驱动系统,探讨了周期性负载引起的强迫振动特性,明确了共振条件及影响因素,并比较了主动、被动和优化设计等振动控制策略。最后展望了实验验证、多物理场耦合与智能控制等未来研究方向,为相关设备的优化设计与高效运行提供了理论支持。

convnet3designer的博客 148

2026年数学建模国赛B题无线电干扰源的快速自动定位与清除 论文详细解析

数学建模竞赛论文无线电干扰源的快速自动定位与清除2026 年高教社杯全国大学生数学建模竞赛 B 题完整求解论文交会定位、极大极小测点优化、自适应多频道搜索与定向源恢复的统一建模模型、算法、代码、图表与验证一体化交付本文研究圆形目标区域中多个未知无线电干扰源的快速检测、定位与清除问题,建立了由误差楔交会模型、角度观测信息模型、分层勘测模型、鲁棒射线交会模型和定向覆盖反馈模型组成的统一求解框架。模型同时覆盖题目中的四个子问题:多测向射线形成的多边形定位区域及直径、第二个测点的极大极小优选、全向源自动搜索清除策略

YOLO 360

Ubuntu20.04 intel ax201双系统没有wifi蓝牙,驱动激活教程

Ubuntu20.04 intel ax201双系统没有wifi蓝牙,驱动激活教程

-Mingo的博客 1万+

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

【Ubuntu18.04 解决蓝牙wifi 之ax201无线网卡驱动安装】

台式机安装了双系统win11+Ubuntu18.04系统,发现没有无线网卡和蓝牙,经查阅资料发现由于网卡刚没多久,Ubuntu没有集成ax201网卡驱动,需自己安装ax201网卡驱动。首先确定内核kernels版本是否大于5.2,然后去官网下载驱动,重启电脑就可以啦!

vor234的博客 8374

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

WINCC7.3破解文件

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

ubuntu 未发现WIFI适配器的多种情况分析

本人的情况是wifi突然消失,没有列表但是还能看见wifi图表并且蓝牙可用,wifi界面显示未找到wifi适配器。

weixin_44061195的博客 1万+

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

上一篇: Ubuntu 25.10 无法外接显示器解决方案
ZGUIZ
博客等级 码龄10年 106粉丝 49原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值