ECE4179 - Neural Networks and Deep Learning

AI对战五子棋——深度学习策略网络 在本篇博文中,我们完成了:✔ 构建一个 CNN 五子棋策略网络✔ 让神经网络输出落子概率✔ 使用 Policy Gradient 强化学习训练 AI✔ 让 AI 实现人与 AI、AI 自对弈博弈。 阅读详情

ECE4179 - Neural Networks and Deep Learning

Deep Learning and Neural Networks

Assignment

Calculation Exercises - General Comments

For the calculation exercises, ensure that you document any calculations/working-out. You can use a word editor to format your answers properly. You will receive a 0 if you do not provide calculations/working-out.

Calculation Exercise 1: Multilayer Perceptron (MLP)

1.  Consider the MLP network in Figure 1. Table 1 shows  the value of each of the parameters of the network. The activation functions for all neurons are shown in Table 2. The neurons in the input layer, i.e. neuron 1 and neuron 2, do not use any activation function and simply pass in the input to the network.  All the neurons in the hidden layer use a ReLU activation function,  i.e., a3 (x) = a4 (x) = a5 (x) = ReLU(x) = max(0, x).  The neuron in the output layer uses a Sigmoid activation function, i.e., a6 (x) = σ(x) = 1/ (1 + exp(−x)).  For cross entropy loss, ensure you use loge.  Answer the following questions.

Figure 1: An MLP with one hidden layer (Question 1).

Table 1: Parameter values of the MLP (Figure 1).

Table 2: Activation functions of the MLP (Figure 1).

1.1. [4 points]  Compute the output of the network for x = (x1 , x2 )T  = (1, 2)T

1.2. [2 points]  Assume the label of x = (x1 , x2 )T  = (1, 2)T  is y = 0. If we use the Binary Cross Entropy (BCE) loss to train our MLP, what will be the value of the loss for (x, y)?

1.3. [2 points]  Now assume the label of x = (x1 , x2 )T  =  (1, 2)T  is y = 1.  For BCE loss, what will be the value of the loss for  (x, y)?  Do you expect the loss to be bigger or smaller compared to the previous part? Why? Explain your answer and your observation.

1.4. [6 points]  Assume the learning rate of the SGD is lr = 0 .1.  For a training sample x = (x1 , x2 )T  = (1, 2)T  and y = 0, obtain the updated value of w3 ,6 .

1.5. [6 points]  Using  the  assumptions from the previous part  (i.e.,  the  learning rate of the  SGD is lr = 0.1, the training sample is x = (x1 , x2 )T  =  (1, 2)T  and y = 0), obtain the updated value of w2 ,5 .

Calculation Exercise 2: Activation Function

2.  [10 points]  Consider the following activation function:

We stack 1,000 of z, to form. where ◦ denotes function composition. What would be the response of z1000 to x ∈ R? You need to discuss the behaviour of z1000(x) for x ∈ R. We plot the activation function in Equation (1) along with the 45-degree line in Figure 2 for your convenience.

Figure 2: Activation function for Question 2.

Coding Exercises - General Comments

You will code up these exercises with the provided skeleton notebooks. The results and discussions you obtain from the notebook can stay within the notebook without going into a separate PDF. Each task will have its own discussion questions.

Linear and Logistic Regression

3.  [25 points]  You are probably thinking, these models again!  Okay you are right, but there will be addi- tional ideas presented here.

In the first subtask, you will explore the effects of outliers in your dataset and how that can affect your model performance.  You will apply a weighted linear regression model so that the resulting model is more robust.

In the second subtask, you will be exploring ways to model non-linearities in the dataset with a linear regression model by transforming your inputs to a linearised space and performing classification in the transformed space with a technique called decay learning rate.

Task 1.1. Weighted linear regression

In this coding exercise, we study the iterative weighted linear regression model.  In some problems, every data point might not have the same importance.  Having weights associated to samples will provide us with a principal way to model such problems.  Consider a data set in which each data point (xi , yi ), xi  ∈ Rn , yi  ∈ R is associated with a weighting factor 0 < αi ≤ 1. Define the loss of a linear model with parameters w ∈ Rn as the weighted sum-of-squares error:

It can be shown that the optimal weights can be obtained as:

Here, X is a matrix of size m × n where every row is one input sample (i.e., row i in X is xi ).  Similarly, Y is an m dimensional vector storing yi  and A is a diagonal matrix of size mm with A[i,i] = αi.

The purpose of this task is to train an iterative linear regression model that will weigh the samples as the model is being trained.  You need to develop the mechanism to weigh each sample as the model is being iteratively trained. Here, the diagonal matrix A is updated by using the following equation:

where σ is a hyperparemeter you will tune.

You are supposed to implement a weighted linear regression model to explain the data.  The data for this question has two sets, a training set  (X trn , Y trn(no)isy ) and a validation set  (X val, Y val ). You are supposed to use only the training set  (X trn , Y trn(no)isy ) to train your model.  Note that the training set is noisy (i.e., Y trn(no)isy  is noisy). You will use the validation set to evaluate your model and as you might have noticed, the validation set is noise free.

Since in this case, the weight of each sample is not provided, you need to develop a mechanism to approximate how noisy a sample is.  One way of doing this is to first fit a linear regression model to your data and then check and see which samples your model cannot explain well (i.e., the prediction is not good). For such samples, you need to devise a way to assign a reduced sample weight. Once you attain the weights according to the error of your predictions, you can fit a weighted linear regression model and repeat this process a few times till you obtain a model that can explain the validation data well.

Implement the aforementioned strategy and report your error on the validation set. For your convenience, a sketch of a possible solution is provided in Algorithm 1.

Hints.

• You will craft new non-linear features.

• The error of the validation set is

Here, ˆ(y)i(val) = wxi(v)al  is the prediction of your model for a validation sample and m is the number of

samples within your validation set.

• You have to tune σ yourself.

• You have to choose a stopping condition.

Algorithm 1: Iterative Weighted Linear Regression

Data: The training set X trn ∈ Rm ×n , Y trn(no)isy ∈ Rm

Data: The validation set X val  ∈ Rp ×n , Y val  ∈ Rp

Result: The parameters of the optimal model w*  ∈ Rn

A ← 1;

for iter in max-iter do

w ← Fit a weighted linear regression model using Xtrn,Y noisy trn , A ; /* Use ?? and note that

A is a diagonal matrix keeping the sample weights ai */

yˆi = w⊤x trn i ;

/* Evaluate your model on all training samples */

aˆi = exp

end

w*  ← the model with the minimum validation error

Task 1.2. Using non-linear features and learning rate decay for better classification

You have been given a set of samples x = (x1 , x2 )T  ∈ R2 .  In this task, you will apply the knowledge you learned from previous labs to train a logistic model via Gradient Descent and try to improve the performance by implementing a decaying learning rate.

Decaying learning rate can be simply implemented as:

lrnew  = (1 − α) * lrold ,                                                              (6)

where 0 < α < 1 is a hyperparameter. In this task, we use α = 0.1% for the learning rate decay.

You will follow the standard procedure of first loading in your data and visualising it.  From there, you will apply nonlinear transformations to your data via GD. You can then visualise your decision boundary and write a decaying learning rate functino to further improve your model.

You can reuse functions sigmoid, compute loss and grad and predict from your previous labs for this task.  Plot the decision boundary for above on test data.   Compute the accuracy of the resulting model on the test data (X test, y test).

Task 2. Denoising autoencoder (DAE) with Face Data

Whenever you measure  a signal,  noise  creeps  in.   Denoising  (aka  noise  reduction)  is  the  process  of removing noise from a signal and is a profound and open engineering problem. In this exercise, you will learn and implement a Denoising AutoEncoder (DAE) to remove additive random noise from images.

Autoencoders. An autoencoder is a neural model that is trained to attempt to copy its input to its output.  Internally, it has a hidden layer z that describes a code used to represent the input.  To be precise, an autoencoder realizes two functions/networks, a function fenc  to transform the input x ∈ Rn to a new representation z ∈ Rm , followed by a function fdec , which converts the new representation z back into the original representation.  We call these two functions the encoder and the decoder  (see Figure 3 for an illustration).

You may ask yourself if an autoencoder succeeds in simply learning to set fdec (fenc (x)) = xeverywhere, then what  is it useful  for?   The  short  answer  to  that  is,  the  new  representation z learned  by  the autoencoder captures useful information about the structure of the data in a compact form that is friendly to ML algorithms.  But that is not all. In deep learning, we can borrow the idea of autoencoding and design many useful solutions, denoising being one.

DAE. In a DAE, instead of showing x to the model, we show a noisy input as x(˜) = x + ϵ .  The noise ϵ is task specific. If you are working with MRI images, this noise should model the noise of an MRI machine. If you are working on speech signals, the noise could be the babble noise recorded in a cafe.  What you will ask your DAE to do is now to generate clean samples, i.e. x(ˆ) = x (see Figure 3 for an illustration).

So in essence, knowing about the problem and associated noise will enable you to simulate it. This will give you a very task-specific solution, which is in many cases desirable.

Figure 3: Top. An autoencoder is comprised of two subnetworks, an encoder and a decoder.  In its vanilla form, the goal is to extract useful structure and information about the input. Bottom. In a DAE, you feed the network with a noisy input and train the model to produce clean outputs.

4.  [25 points]  In this task, you will implement a DAE to reduce the amount of noise within the dataset. Table 3 shows the hyperparameters and network architecture that you will be using.

Table 3: Hyperparameters for the DAE model. Note that some of the hyperparameters have been replaced with ” ??? ”

You will need to Compute Peak Signal-to-Noise Ratio (PSNR) for test dataset. The PSNR isa commonly used metric to measure the quality of areconstructed or denoised signal or image. The PSNR is calculated as the ratio of the peak signal power to the noise power, typically measured in decibels (dB). PSNR can be defined as

Where:

• PSNR is the Peak Signal-to-Noise Ratio in dB.

• MAX is the maximum possible pixel value (e.g., 255 for an 8-bit image).

•  MSE is the Mean Squared Error between the original and the reconstructed (or denoised) image. It’s calculated as the average of squared pixel-wise differences between the two images.

You will be asked to show the PSNR values for:

1.  Between the noisy image and original image

2.  Between the reconstructed image and original image

We provide you a handy class torchmetrics.image.PeakSignalNoiseRatio for PSNR calculation.

Note: To create the noisy data, you will inject random noise into the data samples during the training step within your network.  This is shown in the skeleton code.  You will also need to reshape the output predictions to visualize the output image.

Task 3. Speech Command Recognition

5.  [20 points]  In this final task of your assignment, you will be loading a speech recognition model from the following options:

• Word2Vec2

• Whisper

• HuBERT

And using it to extract feature representations from audio files.  The goal is to train a model that can recognize ten different voice commands, including ”Yes”, ”No”, ”Down”, and more.

To accomplish this task, you will follow these steps:

• Dataset: You will work with the Speech Commands dataset, which consists of audio recordings of various command words.  The dataset is divided into three folders: Train, Validation, and Test. The Train folder contains audio files for training the models, the  Validation  folder contains audio files for hyperparameter tuning, and the Test folder contains audio files for final predictions.

• Preprocessing: You will preprocess the audio data by extracting meaningful features using your model of choice. You can choose a pre-trained model that has been trained on labeled speech data and can effectively capture spoken language patterns and features effectively.  The pre-processing model normally comes with the pre-trained model that we have listed above.

• Model Training: You will train a simple MLP  (Multi-Layer Perceptron) model to predict the labels of the voice commands. The MLP model will take the extracted features as input and learn to classify the voice commands into ten different classes.

• Evaluation: You will evaluate the performance of your trained model using accuracy as the eval- uation metric. Accuracy measures the percentage of correctly predicted labels.

• Testing: Finally, you will make predictions on the test dataset using your trained model and submit your results to Kaggle (instruction is provided in the notebook).

• Marking:

– 10/20 points are allocated to the notebook quality.

– 10/20 points are allocated to the Kaggle Competition results. You need to achieve at least 85% accuracy on the test set.  The competition marks will be linearly awarded from 0 to 5 points according to accuracy from 85% to highest accuracy in this competition.

Kaggle  Competition: The  link to the  competition  is provided  here: https://www.kaggle.com/ competitions/ecse-4179-5179-6179-2024-s-2-assignment-1

• Your student email has been registered for the competition.

• You should create aKaggle account with your student email address and then attempt the compe- tition.

• You have access to the dataset from Data tab in the Kaggle page.

By completing this task, you will gain hands-on experience in speech recognition using the pre-trained speect recognition models and learn how to train a model to recognize voice commands.   This  skill has wide-ranging applications, including voice-controlled systems for smart home devices, navigation systems, and automotive applications.

LiveKit 本地部署实战:从零搭建安全实时通信环境(Caddy+HTTPS) 本文详细介绍了如何从零开始搭建LiveKit本地部署环境,结合Caddy服务器实现HTTPS安全通信。通过环境准备、证书生成、服务配置到前端客户端集成的完整流程,帮助开发者快速构建实时音视频应用,特别适合需要安全实时通信的场景。 阅读详情

相关推荐

D类功放LC滤波器实战:从Q值0.707到EMI优化的完整设计流程

本文详细解析了D类功放LC滤波器的完整设计流程,从确定截止频率与Q值0.707的理论基础出发,到参数计算、仿真验证及关键元器件选型,并提供了应对EMI超标和过流保护等实际问题的进阶调试策略。文章强调,精准的LC滤波器设计是平衡音质、稳定性与电磁兼容性的关键,尤其需关注电感饱和电流与电容直流偏置等细节。

e4f5g6h7的博客 1038

ECE4179 Deep Learning and Neural Networks Python

σ(x)−1)Why?••σyourself.∈Rm×n∈×n/* Use??test, yDenoisingAutoE??Where:•••Word2Vec2•Whisper•HuBERT•••。

leijunming2的博客 707

ArcGIS License Server点击启动没反应,许可管理器无法启动怎么办

4 当我们再打开ArcGIS License Server Administrator的时候。3 在【服务】中找到【ArcGIS License Manager】双击。无法启动ArcGIS License Server的情况。在使用ArcGIS的过程中,我们经常会遇到。专注GIS领域知识分享,交流行业软件技巧。欢迎关注,不定期分享GIS各种问题和技巧。1 右击我的电脑——【管理】服务状态——启动,确定即可。启动类型选择——自动。

GIS蒲公英的博客 2万+

RNNoise-SpeexDSP-WebRTC使用说明

本文介绍RNNoise、SpeexDSP与WebRTC音频处理库的下载、调用及参数配置方法,适用于Android语音工程集成。RNNoise基于深度学习,适合非稳态噪声降噪,需48kHz输入;SpeexDSP支持多采样率与回声消除,适用于全双工场景;WebRTC提供轻量级窄带处理。三者可串联使用:麦克风信号先经前级降噪(RNNoise或SpeexDSP),再进入WebRTC媒体引擎进行编码。重点说明各库的典型应用场景、接口调用方式、关键参数调节策略及采样率转换注意事项,帮助开发者高效集成与优化语音处理链路。

知识共享,你我皆是知识的搬运工 239

WinServer 2012 R2 搭建 AD 单域多站点 及 DNS各站点的子网掩码排序调整

WinServer 2012 R2 搭建 AD 单域多站点 及 DNS各站点的子网掩码排序调整

一直被模仿,从未被超越 5536

Jetson Nano摄像头选型与配置全攻略:CSI与USB接口实战指南

在嵌入式视觉与边缘计算项目中,摄像头作为核心传感器,其选型与配置直接影响系统性能。CSI(Camera Serial Interface)和USB(Universal Serial Bus)是两种主流接口,前者通过MIPI CSI-2协议直接与SoC通信,具备低延迟、高带宽特性,适合实时性要求高的应用;后者基于通用串行总线标准,即插即用,通用性强。在NVIDIA Jetson Nano平台上,合理选择摄像头接口并优化驱动配置,能充分发挥其GPU加速优势,提升图像处理流水线效率。本文聚焦Jetson Nano

weixin_29190651的博客 324

Transformer 为什么能取代 RNN?从自注意力讲起

2017 年谷歌在《Attention Is All You Need》中提出 Transformer,核心是。它如今是 GPT、BERT、ChatGPT 的共同底座。

anew___的博客 979

【ESP32-IDF笔记】20-配置以太网网络(W5500)

基于ESP32IDF和官方的ethernet驱动,配置W5500以太网驱动芯片,实现ESP32的有线网络

别看了,就这些信息 3475

基于深度学习的商品评论情感分析系统-毕业设计

面向商品评论的中文情感分析系统,支持单条预测、批量分析、情感分布与关键词、报告导出。TextCNN、BiLSTM、Transformer 在同一词表、同一数据切分、同一种子与超参下公平对比,测试集 F1 分别为 0.9101、0.9089、0.9075。结论是这一规模下模型复杂度未带来收益,但误差结构不同。附技术栈、截图、文档预览与演示视频。

csbysj2020 158

Android 13.0 双屏时触摸失效问题排查与修复

摘要:本文记录了RK3588 Android12开发板上主屏触摸失效问题的排查与解决过程。通过分析发现,USB触摸设备被错误关联到辅屏(displayId=3)而非主屏(displayId=0)。解决方案是修改TouchInputMapper.cpp,强制触摸设备使用INTERNAL viewport(主屏),并保持设备在viewport不活跃时仍启用。该修改涉及约40行代码,有效解决了多显示器环境下触摸设备错误映射的问题,同时提供了详细的调试方法和注意事项。

ip0417的博客 355

【AirPlay】苹果认证MFI学习

配件认证是一个过程,通过这个过程,可验证其配件符合MFi技术规范,并通过苹果指定的任何认证测试。MFi门户中的产品计划 "认证 "页面将指导你完成特定配件所需的认证步骤,并指出何时完成所有要求。在完成所有MFi认证要求之前,你不得制造、分发或销售任何配件。在开始MFi认证过程之前,你必须测试你的配件,以确保它符合最新的MFi技术规范,通过产品计划 "测试计划 "上的所有适用测试,并与它将声称具有兼容性的每个苹果设备兼容。

天天的博客 2278

【原创深度学习项目】基于深度学习的建筑工地防护装备检测系统|安全帽与反光衣检测系统(RT-DETR-L 模型)

本文设计并实现了一套基于RT-DETR-L的建筑工地防护装备检测系统,采用Django+Vue前后端架构,实现对安全帽、反光背心等7类装备及“无PPE”“未戴安全帽”等缺失状态的精准识别。系统支持图片、视频、摄像头实时检测,具备参数可调、数据可视化与统计分析功能,有效解决小目标漏检、误检及管理难问题,助力智慧工地安全管理落地。文末可获取源码。

qq_1445749146的博客 232

2025年09月中国电子学会青少年软件编程(Python)等级考试试卷(三级)答案 + 解析

2025年09月中国电子学会青少年软件编程(Python)等级考试试卷(三级)答案 + 解析

伶俐角少儿编程 519

图解循环神经网络(RNN)

RNN(循环神经网络)就是“带记忆的网络”:让网络拥有一块“记忆”,在处理当前数据时,能同时参考之前看过的内容;它不一次性看完全部输入,而是像人读书一样,一个字一个字地读,每读一个字就更新一次脑子里的记忆,然后用这份记忆去理解当前这个字。但便签一直在被改写,新信息不断挤占旧信息,传到第 40 步时,“巴黎”的痕迹已经淡得几乎没了。读到“贵”的时候,网络并没有重新去查“好看”这个词——但“好看”的影响已经融在了便签里(那个 1.5)。这三个困难的共同点:答案不在当前这一个字里,而在“前面那串东西”里。

技术管理两手抓,两手都要硬. 427

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

假人有限元模型

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

神经网络入门指南:从 CNN、RNN 到 Attention

神经网络的学习,本质是“预测—比较—纠错”的循环;CNN 通过局部连接与权重共享理解图像;RNN 通过隐藏状态传递上下文;LSTM 和 GRU 用门控机制管理记忆;Encoder–Decoder 把理解与生成拆成两个阶段;Attention 则让模型在每一步都能主动寻找最相关的信息。到这里,我们已经走完了从普通神经网络到 Attention 的完整路线。下一篇将正式进入 Transformer,看看它如何摆脱 RNN 的顺序计算,又如何让每个 Token 直接找到与自己相关的信息。

爱敲代码的小黄 397

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

AI 学习第 15 课:变长序列不 pack 直接喂 RNN,隐状态全被 0 污染

NLP 的 batch 里句子长短不一,短句垫 0 补齐后直接喂 RNN,看似能跑,实际上每个 0 垫步都在更新隐状态——短序列的最后一步输出根本不是它真实句子的结果。这一课用 torch 2.15(

aifannihao的博客 161

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

CNN 卷积神经网络深度解析:卷积、池化与特征提取的底层原理

卷积核(Kernel),也叫滤波器(Filter),本质上是一个可以训练的权重矩阵。1 0 -11 0 -11 0 -1这个卷积核可以对图像中的局部像素进行加权计算。不同的卷积核能够提取不同类型的特征:水平边缘特征垂直边缘特征纹理特征角点特征局部形状特征在传统图像处理中,滤波器通常由人工设计。而在 CNN 中,卷积核的权重通过训练数据和反向传播自动学习得到。这也是 CNN 能够自动提取图像特征的关键。# 第一层卷积padding=1# 第二层卷积padding=1。

2503_90237586的博客 295

图解常用深度学习优化器

来隐式构造 Hessian 逆的近似,从而直接估计出“谷底在哪”,而非仅仅判断“哪边最陡”。即SGD/Adam 主要看“当前坡度”,LBFGS 还会看“最近几步坡度怎么变”,像用局部地形图来规划路线。训练 Transformer 时,有些层梯度大,有些层梯度小。如果用 Adam + L2,梯度大的参数反而可能被“少衰减”,正则效果不稳定;:你要下山,但每次迈步前都要派侦察兵把整座山的每一个坡面都测量一遍,算出“绝对最陡”的方向才走一步。:还是下山,但这次你只问身边一个路人“哪边最陡”,然后就走。

技术管理两手抓,两手都要硬. 219

【无标题】无人机视角道路坑洞坑洼目标检测数据集深度学习 目标检测 无人机航拍 道路坑洞 路面病害 YOLO格式 数据集发布9032期

(一)类别构成该数据集聚焦单一类别——坑洞(类别 ID 为 0),任务指向明确,围绕无人机俯视视角下的道路坑洞目标开展检测标注。类别体系精简,与公路路面病害巡检的实际需求高度契合,图像中的坑洞样本可直接作为路面破损识别的核心正样本,便于对接道路养护排查流程。(二)数据数量数据集规模为 3285 张无人机俯视航拍图像,采用标准 YOLO txt 标注格式,标注框总计 4457 个,其中带有效标注的图片 2007 张,全部图片均带有有效标注。

qq_2529413168的博客 187

第 05/24 期:计算图与自动微分:深度学习如何计算梯度

本文系统阐述了神经网络训练中梯度计算的本质:损失对参数的敏感性。通过构建计算图,将复杂函数分解为基本运算,利用链式法则实现反向传播。核心在于反向模式自动微分——以一次前向计算为基础,通过传播输出对中间变量的敏感性,高效求得所有参数梯度。相比前向模式,反向模式在参数多、目标为标量的场景下更高效。计算图不仅适用于神经网络,也广泛适用于任意可微程序。关键思想是:梯度是局部导数与上游敏感性的乘积,分支路径的贡献需累加,从而保证导数计算的正确性与效率。

weixin_47502228的博客 332

基于深度学习的猫图像目标检测方法研究:YOLOv8s模型海选、多种子对比训练与Django+ONNX部署实现详解

本课题基于深度学习研究猫图像目标检测问题。数据集含1000张猫图像、1188个标注框,按固定比例划分并冻结清单;训练前在多个候选族中短训海选,确定YOLOv8s为主模型,经学习率搜索与显存标定后完成150轮训练,验证集mAP50达到0.92,并以7个随机种子的对比实验验证稳定性。最优权重导出为ONNX接入Django系统,提供图片、视频、摄像头三种识别方式,配套识别记录管理与统计大屏,形成从训练到应用的完整闭环。

WEIXIN_JSJBSZDS的博客 221

【深度学习项目实战·30】PM2.5短期预测:用LSTM构造没有未来信息的滑动窗口

本文基于北京PM2.5数据,使用LSTM实现从最近24小时历史观测预测下一小时PM2.5。重点解决时间切分、因果填补、滑动窗口构建与标准化等关键问题,确保模型仅依赖过去信息,避免未来泄漏。通过滚动单步预测与持续性基线对比,评估在原始单位下的MAE/RMSE,验证模型有效性。强调时间顺序与数据完整性,为时序预测提供可复现的实践框架。

银尘博客 519

深度学习 目标检测 无人机巡检 防震锤 电力设备 YOLO格式 数据集发布

深度学习 目标检测 无人机巡检 防震锤 电力设备 YOLO格式 数据集发布 9038期

qq_2529413168的博客 335

无人机巡检道路路面异常检测数据集 深度学习 目标检测 无人机巡检 道路病害 路面异常 YOLO格式 数据集发布9028期

无人机巡检道路路面异常检测数据集 深度学习 目标检测 无人机巡检 道路病害 路面异常 YOLO格式 数据集发布9028期

qq_2529413168的博客 213

AI 学习第 14 课:CNN 训 6 轮卡在 0.5352,数据没打乱

第 13 课把 Conv2d 的参数量和池化后的尺寸算清了,这课把卷积块拼成一个能训练的完整网络,跑满 6 个 epoch。第一版直接卡死:loss 从 2.6104 掉到 0.6989 就再也不动,

aifannihao的博客 252

深度学习基本原理:从数学基础到神经网络训练

深度学习训练的核心,是先确定模型结构,再通过前向计算得到损失,利用链式法则和反向传播计算梯度,最后借助优化器与学习率不断更新参数。真正理解这条链路,后续学习更复杂的网络结构才有可靠的基础。

chh563的博客 170
上一篇: CIBC 5003: Environmental Impact
下一篇: Cassava Bacterial Blight (CBB)
wx____codehelp
博客等级 码龄2年 538粉丝 99原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值