基于dragonboard 410c的智能魔镜设计(9)——UI交互控制逻辑实现

反激开关电源设计全解析:从CCM/DCM原理到PCB布局实战 开关电源作为现代电子设备的能量转换核心,其核心原理是通过高频开关动作实现高效的电能变换。反激拓扑因其结构简单、成本低廉且易于实现电气隔离,成为小功率离线式电源的主流选择。其技术价值在于通过变压器耦合实现能量存储与传递,解决了安全隔离与多路输出等关键需求,广泛应用于充电器、适配器及家电供电等场景。本文聚焦反激电路,深入剖析其CCM与DCM两种工作模式的原理差异及选型考量,并结合伏秒平衡定律与RCD钳位等热词,详解从变压器计算到MOSFET选型的完整工程设计流程。 阅读详情

      在http://blog.youkuaiyun.com/andymfc/article/details/54580647和http://blog.youkuaiyun.com/andymfc/article/details/54581209两个blog中已经跟大家介绍了整个智能魔镜端的交互UI的设计原型和实现的python脚本及方式,这里将进一步教大家如何实现整个UI交互的逻辑控制程序,根据http://blog.youkuaiyun.com/andymfc/article/details/53926845设计方案,智能魔镜交互主要是依托摄像头、超声波和显示屏与用户进行交互,智能魔镜依托超声波模块实时的监控镜子前面的人体动态,在有人靠近的时候启动摄像头,然后通过图像识别来处理和识别当前的用户身份,最后根据用户身份启动显示模块控制显示,将指定的用户消息推送显示在当前使用镜子的用户面前。

      以上就是在智能魔镜中的显示控制逻辑设计中需要完成的内容,在具体实现的过程中,对于显示逻辑控制这一块,主要是通过构建了一个magic_mirroWindows.py文件来实现,在这里实现了对魔镜的交互UI类的实例化,同时创建了一个magic_mirroWindows类来实现魔镜UI控制的各个逻辑控制功能,其中主逻辑是通过实例化该类来启动魔镜的UI交互程序,在UI交互程序控制中,首先会通过函数调用刷新页面的公共显示信息,然后调用定时器对执行过程进行控制,定时的检测当前镜子前面的情况,然后根据定时检测的结果来执行相应的刷新程序,具体的代码设计如下:

     class magic_mirroWindows(QtWidgets.QWidget):  
    def __init__(self):  
        super(magic_mirroWindows,self).__init__()  
        self.new=Ui_MainWindow()
        self.new.setupUi(self)
 
        #save user video Info
        self.push_video_userID=[]
        self.videoPathList=[]
        
        #self.viedoMsg.setWindowFlags(
        self.zhishuUpdateTime=0
        #set Text
        self.tp=QtGui.QPalette(self)
        self.tp.setColor(QtGui.QPalette.WindowText,QtGui.QColor(255,255,255))
        self.movie=QtGui.QMovie()      
        #default userID =0 ,camera and face model not find user Infomation
        self.current_userID=0
        self.currentUserName=""
        #default supper sound sensor status, suppper sound sensor not find people
        self.curren_su_status=1
        #self.showPushInfo(4)
        #set html view is black
        self.new.webMessageText.setHtml("<body bgcolor=black></body>")
        self.new.webMemorandum.setHtml("<body bgcolor=black></body>") 
        self.new.webZhishu.setHtml("<body bgcolor=black></body>")   
        self.img=QtGui.QImage()
        self.manager = QtNetwork.QNetworkAccessManager()
        #self.weather=getWeatherInfo()
        self.weather_updateOK=0
        self.new.helloWelcome.setText("<h3>hello,welcom2...</h3>")
        self.Reply=self.manager.get(QtNetwork.QNetworkRequest(QtCore.QUrl("http://wthrcdn.etouch.cn/WeatherApi?city=%E6%B7%B1%E5%9C%B3")))
        self.Reply.finished.connect(self.replayFinished)
        forecast_date_list.append(self.new.forecast_0_date)
        forecast_date_list.append(self.new.forecast_1_date)
        forecast_date_list.append(self.new.forecast_2_date)
        forecast_date_list.append(self.new.forecast_3_date)
        forecast_date_list.append(self.new.forecast_4_date)
        forecast_temp_list.append(self.new.forecast_0_temp)
        forecast_temp_list.append(self.new.forecast_1_temp)
        forecast_temp_list.append(self.new.forecast_2_temp)
        forecast_temp_list.append(self.new.forecast_3_temp)
        forecast_temp_list.append(self.new.forecast_4_temp)

        forecast_type_list.append(self.new.forecast_0_type)
        forecast_type_list.append(self.new.forecast_1_type)
        forecast_type_list.append(self.new.forecast_2_type)
        forecast_type_list.append(self.new.forecast_3_type)
        forecast_type_list.append(self.new.forecast_4_type)
#定时刷新
        self.timer=QtCore.QTimer(self)
        #self.count=0
        self.timer.timeout.connect(self.timerControl)
        # test button
        self.new.closeButton.setStyleSheet("QPushButton {border-image:url(:/images/close);}QPushButton:hover{border-image:url(:/images/close_on);}QPushButton:hover:pressed{border-image:url(:/images/close);}")
        time = QtCore.QDateTime.currentDateTime()
        self.new.date.setPalette(self.tp)
        self.new.date.setText(time.toString("yyyy-MM-dd"))
    
        palette1 = QtGui.QPalette(self)
        palette1.setColor(self.backgroundRole(),QtGui.QColor(0,0,0))
        self.setPalette(palette1)
        self.setWindowTitle('w')
        self.setWindowFlags(Qt.FramelessWindowHint) 
        
    def paintEvent(self,QPaintEvent):
        painter=QtGui.QPainter(self)
        #painter.drawPixmap(0, 0, pixmap)    #绘制UI
            
    def replayFinished(self):
        global weather
        print("weather replayFinished")
        qbyte = self.Reply.readAll()
        pbyte = bytes(qbyte.data())
        str(pbyte, encoding = "utf-8") 
        weatherInfo = bytes.decode(pbyte)
        weather=getWeatherInfo(weatherInfo)
        self.updateUIdata(weather)
    def updateUIdata(self,weatherResult):
        for i in range(0,5):
            forecast_date_list[i].setPalette(self.tp)
            forecast_date_list[i].setText(weatherResult.forecast_weather_info_date[i])
            forecast_temp_list[i].setPalette(self.tp)
            forecast_temp_list[i].setText(weatherResult.forecast_weather_info_low[i][3:6]+"~"+weatherResult.forecast_weather_info_high[i][3:6])
            forecast_type_list[i].setPalette(self.tp)
            forecast_type_list[i].setPixmap(QtGui.QPixmap(":/images/"+weatherResult.forecast_weather_info_dtype[i]))
        self.new.city.setPalette(self.tp)
        self.new.city.setText(weatherResult.weather_city)
        self.new.temp.setPalette(self.tp)
        self.new.temp.setText(weatherResult.weather_wendu+"℃")
        
        self.new.fengli.setPalette(self.tp)
        self.new.fengli.setText(weatherResult.weather_fengli)
        self.new.fengxiang.setPalette(self.tp)
        self.new.fengxiang.setText(weatherResult.weather_fengxiang)
        self.new.shidu.setPalette(self.tp)
        self.new.shidu.setText(weatherResult.weather_shidu)
        self.new.label_3.setPalette(self.tp)
        self.new.label_3.setText("湿度")
        self.updateZhishu()       
        self.timer.start(1000)
     def updateZhishu(self):
        global weather
        if self.zhishuUpdateTime == 0:
            i=random.randint(0,5)
            format="<body bgcolor=black><h3><font color = red> %s:</font></h3><p><font color = white>  %s</p></font> <body>"
            values=(weather.weather_zhishu_name[i],weather.weather_zhishu_data[i])
            result= format % values
            self.new.webZhishu.setHtml(result)
            self.zhishuUpdateTime=5
        else:
            self.zhishuUpdateTime=self.zhishuUpdateTime-1       
    # start Personalized Display by userID when system detect someone in front of the magic mirror
    def startPersonalizedDisplay(self,userID):       
        self.showPushInfo(userID)
        #display user video msg        
    def detectPeople(self):
        MMDB=MagicMirrorDB("./db.sqlite3")
        #get System Status
        #statusName peopeleInfront
        #statusValue{0,1,2},0 no people in front,1 have people in front of mirror but no detect people ID
        #2 have people in front of mirror and detect people ID  return ID
        result=MMDB.getSystemStatusValue("peopleInfront")
        print("peopleInfront")
        print(result)
        if result[0]==1:
            return 0
        elif result[0]==2:
            print("front people ID:")
            print(result[1])
            return result[1]  #return userID
        else:
            return -1
    def timerControl(self):
        #self.updateZhishu()
        # test have people
        detectResult=self.detectPeople()
        if detectResult==-1:
            print("no people")
            self.hide()
        elif detectResult==0:
            self.showNormalInfo()
            self.show()
            print("have people but no ID")
        else:
            self.show()
            print(detectResult)
            print("in front of magicmirror")
            if self.current_userID!=detectResult:
                self.startPersonalizedDisplay(detectResult)
                self.current_userID=detectResult
            else:
                return        
    def showNormalInfo(self):
        self.new.webMessageText.setHtml("<body bgcolor=black></body>")
        self.new.webMemorandum.setHtml("<body bgcolor=black></body>")
        self.new.helloWelcome.setText("<h3>hello,welcom2...</h3>")
          
    def showPushInfo(self,userID):
        
        MMDB=MMDB=MagicMirrorDB("db.sqlite3")
        #update welcome info by userID
        userName=MMDB.getUserName(userID)
        format="<h3><font color = white> Hello %s Welcome...</font></h3>"
        values=(userName)
        result=format % values
        self.new.helloWelcome.setText(result)
        #update pushInfo
        #infoID,pushID,infoSubject,infoContent,pushTime
        msgList=MMDB.getTextMessageList(userID)
        print("test0")
        print(msgList)
        print("hello")
        i=0
        pushName=""
        msg_info=""
        pushTime=""
        msgStr=""
        selfMsgStr=""
        if msgList!=None:
            for msg in msgList:
                print(msg)
                print("test1")
                print(msg)
                pushName=MMDB.getUserName(msg[1])
                msg_info=msg[3]
                pushTime=msg[4]
                if msg[1]!=userID:
                    msgStr+=("<h3><font color=red>"+pushTime+"</font></h3>"+"<h3><font color=red>"+pushName+"to you:"+"</font></h3><p>"+msg_info+"</p>")
                else:
                    selfMsgStr+=("<h3><font color=red>"+msg_info+"</font></h3>")
        
            self.new.webMessageText.setHtml("<body bgcolor=black><marquee loop=-1 direction=up scrollamount=5 height=210 width=300 bgcolor=black><font color=white>"+msgStr+"</marquee></body>")
            self.new.webMemorandum.setHtml("<body bgcolor=black><marquee loop=0 direction=up scrollamount=5 height=160 width=300 bgcolor=black><font color=white>"+selfMsgStr+"</marquee></body>")   
        videoMsgList=MMDB.getUserVideoMessageList(self.current_userID)
        print("videoMsgList")
        print(videoMsgList)
        
        #show message end get video message info
        if videoMsgList!=None:
            print("start play video msg")
            i=0
            for videoMsg in videoMsgList:
                if i%2==0:
                    print(videoMsg)
                    self.push_video_userID.append(videoMsg)
                else:
                    print(videoMsg)
                    self.videoPathList.append(videoMsg)
                i=i+1
        videocmd="mplayer -vo x11 -playlist "
        for video in self.videoPathList:
             videocmd=videocmd+' '+video
        os.system(videocmd) 

      最后,只需要将主函数写入该文件中,启动该类进行实例化即可完成整个交互逻辑控制程序的启动,也就是整个UI交互程序的启动,具体的主函数代码如下:

if __name__=="__main__":  
    import sys
    import os  
  
    app=QtWidgets.QApplication(sys.argv)

    pixmap = QtGui.QPixmap(":/images/UI1")
    myshow=weatherWindows()
    myshow.show() 
 
    sys.exit(app.exec_())  

  在这种设计中,我们将整个魔镜的UI设计和数据设计进行了分离,最终在整合的过程中,只需要在启动超声波、摄像头监控程序和数据库程序,然后启动UI交互程序即可完成整个智能魔镜的模的整合。

【地图模块算法】二维全局地图的开源方案及对比--gmapping、hector、karto、cartographer 系列文章目录 提示:这里可以添加系列文章的所有文章的目录,目录需要自己手动添加 TODO:写完再整理 文章目录系列文章目录前言一、gmapping算法建图【基于Raoo-Blackwellized粒子滤波(RBPF)算法】1.gmapping理论(1)gmapping的工作原理(2)gmapping的算法流程(3)gmapping论文理论2.gmappingROS工程框架解析(1)gmapping的功能包架构(2)gmapping订阅和发布的话题(3)gmapping算法建图参数(4)gmapping源码 阅读详情

相关推荐

Python实战:5分钟搞定N-CMAPSS航空发动机数据集解析(附完整代码)

本文提供了一份针对N-CMAPSS航空发动机数据集的快速解析实战指南。通过Python的h5py库,详细演示了如何读取HDF5文件结构、理解数据分类(如传感器、健康参数、场景描述符)并加载为Pandas DataFrame。文章还澄清了数据集中常见的变量数量疑惑,并给出了从数据加载到构建剩余使用寿命预测模型预处理流水线的完整代码,帮助工程师和研究人员高效入门航空发动机预测性维护分析。

weixin_29057065的博客 422

【RaspberryPi4】SmartMonitor&&MagicMirror

​ 由人盯着监视屏幕,人总有疲劳限度的。研究表明,监控操作人员盯着电视墙屏幕超过10分钟后将漏掉90%的视频信息。由于人工筛选数据的低效率和低可靠性,视频监控系统不能局限于被动地提供视频画面,要求集成智能算法,能够自动识别不同的物体,发现监控画面中的异常情况,实现不再要人去盯、用计算机代替人进行监控,即实现“自动监控”或“智能监控”。智能视频监控是基于机器视觉对视频信号进行处理、分析和理解,在不需要人工干预的情况下,通过对序列图像自动分析对监控场景中的变化进行定位、识别和跟踪,并在此基础上分析.

liudongdong_jlu 2386

使用 Python 获取实时港股行情数据

在本教程中,你将学习如何通过 Infoway API 获取港股实时行情数据,具体以腾讯控股(0700.HK)和汇丰控股(0005.HK)为例,使用 Python 进行数据请求和解析。

kk_stoper的博客 1517

基于dragonboard 410c的智能魔镜设计(7)——UI原型设计

前面在相关的blog中已经对如何实现智能魔镜的消息检索、视频消息播放等进行了详细介绍,但是只是给出了相应的算法和设计逻辑代码,最终我们如果想在魔镜上进行消息的显示和视频播放,还需要构建UI系统来完成,这里我们前面  《Dragonbaord 410c Python交互设计》系列blog中对于在dragonboard 410c中的UI交互设计进行了介绍,并且教大家如何使用pyQt来构建自己的交互系统

ANDYMFC的博客 2872

全差分运放+开关电容共模反馈

设计一种CMOS全差分折叠式共源共栅结构的运放,其共模反馈用的是开关电容(SC-CMFB)。 下面分别是主运放、偏置电路和开关电容共模反馈电路图 在设计时碰到的问题: 1、增益怎么测? 2、输出波形不平滑? 3、开关的时序频率设置多高? 解答: 1、先设计好主运放和偏置电路,使得运放的输出接近VDD/2,且主运放的管子都工作在饱和区,然后再参考何乐年的《模拟集成电路设计与仿真》仿增益。 2、增益仿完后,仿真瞬态,看电路的工作情况,于是将偏置电路上接Vb4与主运放断开,接到共模反馈上的Vbia上,然后就

qq_36686804的博客 1万+

基于CANoe的Basic Diagnostics ECU (UDS)

基于CANoe的Basic Diagnostics ECU (UDS)

farmer00的博客 9155

基于Dragonboard 410c的自动感应调色灯软件方案设计

敬请期待。。。。

s_jason的博客 489

基于STM32的心电图监测系统设计

本论文旨在设计一种基于 STM32 微控制器的心电图监测系统,通过对人体心电信号的采集、处理和分析,实现对心电图的实时监测与显示。系统采用高精度的心电信号采集模块,结合 STM32 强大的数据处理能力,能够有效去除噪声干扰,提取出准确的心电信号特征。同时,利用 LCD 显示屏实现心电波形的实时显示,并通过蓝牙模块实现数据的无线传输,方便医护人员远程监测。经测试,该系统具有较高的精度和稳定性,能够满足临床心电图监测的基本需求,为医学诊断提供可靠的数据支持。

道亦无名 1350

魔镜VR,如何使UI在视野中左右静止,上下旋转

最近发现市场上很多app使用这个技术,最开始我思考自己做,但是实现效果不好,最后发现暴风魔镜自带的一个Demo就是我想要的效果,demo名字为:360PhotoDemo下面就对这个demo做个改造,以达到我们想要UI的效果简单的调整下图 中UI的位置,使其正在屏幕的中央现在运行一下场景,观察一下那个UI,我们要的效果已经轻松实现!记得有人问过,说能不能使头盔在左右旋转时,UI有一个缓慢移动的效果,可

海涛高软 1523

Raspberry Pi Pico SDK开发-Timer-定时

RP2040 由 Raspberry Pi 设计,具有双核 Arm Cortex-M0+ 处理器和 264KB 内部 RAM,并支持高达 16MB 的片外闪存。 广泛的灵活 I/O 选项包括 I2C、SPI 和独特的可编程 I/O (PIO)。 本实例将演示如何使用Timer的定时功能。

视觉与物联智能 2041

Detector-Free SfM 项目复现完整指南:从环境搭建到代码解析与可视化

本文提供了Detector-Free SfM项目的完整复现指南,涵盖技术背景、环境配置、代码解析和可视化方案。重点包括: 技术背景:Detector-Free SfM通过两阶段策略(粗重建+迭代精化)解决了传统SfM在弱纹理区域的瓶颈问题,采用深度学习匹配器替代传统特征点检测。 环境配置: 详细硬件要求与推荐配置(GPU/CPU/内存) 完整的Ubuntu系统设置步骤 Conda环境创建与依赖安装流程 关键组件安装指南(PyTorch、COLMAP等) 常见错误解决方案 项目特点: 支持多种Detector

huanghm88的专栏 121

基于dragonboard 410c的智能魔镜设计(1)——整体方案设计

本系列bolg将向大家分享,如何应用dragonboard 410c平台,设计一款融入人脸识别和web通信技术的智能魔镜,在使用镜子的时候,镜子会通过自身的摄像头检测出使用者身份,根据使用者身份ID推送预先定制的备忘信息,同时还会实时的显示天气和室内外温度信息等,并且基于web技术实现镜子与其他家庭智能设备及手机的互联,用户可以将自己的提示信息和备忘信息,以及给家人的爱心贴等推送到镜子,镜子会在相

ANDYMFC的博客 3625

OpenOCD入门到精通:第 0 章 教程导读

摘要:本教程是OpenOCD嵌入式调试工具的完整指南,适合从新手到资深工程师的学习需求。内容涵盖基础配置、调试技巧、Flash编程、TCL脚本自动化、源码解析和二次开发,共8大部分30章。教程提供5种学习路线,可根据角色和目标灵活选择,配套资源包含示例代码和配置文件。通过系统学习,读者将掌握OpenOCD从使用到扩展的全套技能,成为嵌入式调试领域的专家。

从事嵌入式linux android驱动开发,拥有全栈能力 1941

基于dragonboard 410c的智能魔镜设计(8)——UI的python脚本实现

在http://blog.youkuaiyun.com/andymfc/article/details/54580647中,已经跟大家介绍如何智能魔镜的UI原型设计,并且采用designer.exe工具完成了原始的魔镜UI界面设计,可以看出,整个魔镜的UI设计非常简单,但是如果要实心较好的效果,我们单独使用designer.exe工具很难完成,这就需要我们在完成原型设计后得到的xml文件进行进一步的修改和细化

ANDYMFC的博客 2088

深度学习工具包 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&#39;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(&#39;DeepLearnToolbox&#39;));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(&#39;state&#39;,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&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,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 = &#39;sigm&#39;;%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, &#39;Too big error&#39;);```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(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;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)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;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, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% 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&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 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, &#39;Too big error&#39;);```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(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % 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, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);%% 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(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

智能魔镜是什么

有一面魔镜,是无数人的梦想,它会告诉你穿的美不美,它会向你推荐更加适合的裤子和颜色,它会帮你比较哪套衣服更适合今天的约会,最后,他会说,你是这个世界上最美的女人。魔镜,魔镜,谁是世界上最美丽的女人?魔镜开启了好友验证,你还不是他(她)好友……鑫飞智能三宝:识别、摄像、AR数据显示,73%的人会在网上搜索做功课,最后到实体店买他们心仪的东西,所以,实体店的销售体验,成为每一个品牌最终销量转化的关键。...

a1877893657的博客 3658

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

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

动手制作智能化家居“魔镜”

原文:How to make a Smart Mirror using an old monitor, a Chromecast, a picture frame, and too much time on your hands. 作者:Colin Mansfield 译者:蒋春华 审校:苏宓 最近我已深深陷入“家庭自动化”而无法自拔了。如果你对家庭自动化不熟的话,你可能听...

csdnvr的博客 8748

Unity 工具类 之 简单的UI管理框架/仅通过UIWidget(UI元素组件)名即可添加UI对应事件(简单的MVC思路管理UI与逻辑)

Unity 工具类 之 简单的UI管理框架/仅通过UIWidget(UI元素组件)名即可添加UI对应事件(简单的MVC思路管理UI与逻辑) 一、简单介绍 Unity 工具类,自己整理的一些游戏开发可能用到的模块,单独独立使用,方便游戏开发。 一个简单的UI管理框架管理类,管理各个UIPanelzhon,只要传一个音频名字即可实现播放和停止。 ...

仙魁XAN 1348

基于dragonboard 410c的智能魔镜设计(2)——数据库设计与实现

本篇blog将在http://blog.youkuaiyun.com/andymfc/article/details/53926845整体方案的基础上,完成对基于dragonboard 410c的智能魔镜的数据库的设计,首先我们根据方案分析,可以知道,在智能魔镜上需要保持用户信息、保持消息信息,因此,基本可以构建一个用户表userInfo和一个消息表pushInfo两个表就可以对整个智能魔镜的数据进行管理,可

ANDYMFC的博客 2222

View组件及UI界面控制方法

View及ViewGroup类介绍 UI界面控制方法 使用XML布局文件控制UI界面View及ViewGroup类介绍Android应用的所有UI组件都继承了View类,View组件非常类似于Swing编程中的JPanel,它代表了一个空白的矩形区域。Android采用了”组合器“设计模式来设计View和ViewGroup,ViewGroup作为View的重要子类,通用作为其它组件的容器使用。UI界

细雨潜行 3228

基于dragonboard 410c的智能魔镜设计(3)——文本消息检索及自动显示

在前两个blog中已经跟大家介绍了如何应用dragonbaord 410c来搭建智能魔镜,对系统的整体设计方案和数据库的构建方案进行了分析和设计,给出了详细的设计框架和部分数据库的实现代码,本节将在此基础上向大家介绍,如何实现在镜子上根据不同的用户播放不同的消息的功能。                   根据前面的设计,我们已经搭建好了数据库,并且在数据库中构建了一张pushInfo表来管理

ANDYMFC的博客 1556

基于dragonboard 410c的智能魔镜设计(4)——视频消息检索及自动播放

前面给大家介绍了如何自动的检索指定用户的文本消息,并且采用html模板方式在qt控件上自动循环的播放文本消息,但是在智能魔镜中我们还可以向指定用户推送视频消息,实时显示视频消息,这里进一步向大家介绍如何在基于dragonboard 410c的智能魔镜上实现视频消息的自动检索和播放。            与检索文本消息类似,在我们构建的智能魔镜数据库中的pushInfo表中保存了视频消息的路径

ANDYMFC的博客 1693

基于dragonboard 410c的智能魔镜设计(6)——人脸检测及身份识别启动模块封装

前面blog中已经向大家介绍了如何构建用于智能魔镜的获取人脸getFac.py和检测人脸detectedIdentification.py两个模块,借助着两个模块我们可以方便的进行人脸检测保存人脸图像,和根据检测到的人脸图像读取人脸身份ID,但是在智能魔镜中,我们还需要根据超声波的状态来决定是否启动摄像头模块进行人脸检测,并且在有人来的时候还需要将检测结果告知到UI程序,启动UI程序执行相应的消息

ANDYMFC的博客 2337

魔镜计划

哈哈,我给这个想法起了个好酷的名字:魔镜计划。 魔镜计划的目标: 为每天的穿搭搭配打分,并给出perfect的搭配方案。 可行性:爱美是本性,魔镜计划可以非常好的服务于所有爱美的男士和女士们 实施: 有一个形体扫描装置,扫描出的影像更接近人们的真实身高和身体比例。手机上安装一个APP,该APP可以推荐该客户曾网购的服装的perfect组合搭配; 该APP根据当前用户的穿搭给出打分,

1084

基于dragonboard 410c的智能魔镜设计——硬件搭建

前言:就最近制作完成的一个基于dragonboard410c的智能魔镜为大家介绍一下此demo的一个硬件组成以及环境搭建过程。 先来一个成品的靓照吧! 一、准备工作

Winston 1250

基于dragonboard 410c的智能魔镜设计(5)——基于人脸的用户身份识别

根据前面的设计方案,在设计的基于dragonboard 410c的智能魔镜中,需要根据超声波检测到有人靠近的时候,通过USB摄像头采集人脸数据,然后根据数据库中的人脸数据进行人脸匹配,识别用户的身份,最终根据用户身份显示不同的消息和推送不同的内容,这期blog将重点向大家介绍智能魔镜中的人脸检测和识别处理实现的原理和过程。           需要进行基于人脸的用户身份识别,首先需要检测出人脸,

ANDYMFC的博客 1895

无人机光流定位系列——(一)原理剖析

这次参加深圳的高交会,在qualcomm展区看到了多款mini无人机,大家稍微细心一点就可以发现这些无人机都使用了一种叫光流定位的技术,很多人可能都还不明白光流定位是个什么东西,是如何进行定位的,今天就带大家一起来了解一下光流定位的原理。       在无人机上光流定位通常是借助于无人机底部的一个摄像头采集图像数据,然后采用光流算法计算两帧图像的位移,进而实现对无人机的定位,这种定位手段

ANDYMFC的博客 5万+
上一篇: 基于dragonboard 410c的智能魔镜设计(8)——UI的python脚本实现
下一篇: 在dragonboard 410c上使用python进行GPS报文解析获取位置信息
ANDYMFC_No1
博客等级 码龄17年 125粉丝 66原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值