Stanford CS231N

2024-04-07 19:58
文章标签 cs231n stanford

本文主要是介绍Stanford CS231N,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

文章目录

  • 1 introduction to convolutional neural network
  • 2 Image classification pipeline
    • 2.1 nearest neighbors classifier/KNN
    • 2.2 Linear classification
  • 3 loss function and optimization
    • 3.1 loss function of multclass SVM
    • 3.2 Softmax Classifier(Multinomial Logistic Regression)
    • 3.3 optimization
    • 3.4 Image Features
  • 4 Introduction to neural networks
    • 4.1 backforward propagation
    • 4.2 neural network
  • 5 convolutional neural networks
    • 5.1 convolutional layer
    • 5.2 pooling layer
  • 6 training neual network 1
    • 6.1 activation function
    • 6.2 weight initialization
    • 6.3 batch normalization
  • 7 training neual network 2
    • 7.1 hyperparameter search
    • 7.2 fancier opitimization

1 introduction to convolutional neural network

image segmentation:
object recognition
face detection
SIFT: some features tend to remain diagnostic and invariant to changes
PASCAL visual object challenge
ImageNet:22k categories and 14M images: ImageNet large-scale visual recogniton challenge
http://cs231n.github.io/gec-tutorial

2 Image classification pipeline

challenge:
semantic gap(语义)
viewpoint variation
illumination
deformation
occlusion
intraclass variation

data-driven approach

  1. collect a dataset of images and labels
  2. use machine learning to train a classifier
  3. evaluate

CIFAR10
10 classes
50,000 training images
10,000 testing images
each image is 32323

2.1 nearest neighbors classifier/KNN

时间复杂度:
Train: O(1)
predict: O(N)
改进:KNN: K-Nearest Neighbors,按照majority vote原则
缺点:
very slow ate test time
distance are not informative

距离
Manhattan distance:正方形
Euclidean distance:圆形

超参数hyperparameter: depend on problem and data
Setting Hyperparameters: cross-validation

2.2 Linear classification

f ( x , W ) = W x + b f(x,W)=Wx+b f(x,W)=Wx+b
http://cs231n.github.io/assignments0217

3 loss function and optimization

3.1 loss function of multclass SVM

cs229会讲SVM
L i = ∑ j ≠ y i { 0 i f s y i > s j + 1 s j − s y i + 1 L_i=\sum_{j \neq y_i}{\left\{\begin{matrix} 0& if s_{y_i}>s_j +1\\ s_j-s_{y_i}+1& \end{matrix}\right.} Li=j̸=yi{0sjsyi+1ifsyi>sj+1
= ∑ j ≠ y i m a x ( 0 , s j − s y i + 1 ) =\sum_{j \neq y_i}{max(0,s_j-s_{y_i}+1)} =j̸=yimax(0,sjsyi+1)
where s y i s_{y_i} syiis the predicted score of true category
损失函数最小值是0,最大值是正无穷
在这里插入图片描述在这里插入图片描述

3.2 Softmax Classifier(Multinomial Logistic Regression)

L i = − l o g P ( Y = k ∣ X = x i ) = − l o g e s k ∑ j e s j L_i=-logP(Y=k|X=x_i)=-log\frac{e^{s_k}}{\sum_j{e^{s_j}}} Li=logP(Y=kX=xi)=logjesjesk
希望 P ( Y = k ∣ X = x i ) P(Y=k|X=x_i) P(Y=kX=xi)接近1,所以希望 − l o g P ( = k ∣ X = x i ) -logP(=k|X=x_i) logP(=kX=xi)接近0
损失函数都最大值是正无穷,最小值是0

3.3 optimization

  • random search: 最愚蠢最简单的做法
  • 梯度下降:便利所有训练集计算得到梯度
while True:weights_grad=evaluate_gradient(loos_fun,data,weights)weights+=-step_size*weights_grad

其中step_size就是学习率

  • 随机梯度下降:用一部分(x,y)来预估gradient,称为一个batch,以此减少计算量

3.4 Image Features

分类器的输入最好是图像的特征,而不是像素点
坐标变换、有向梯度直方图、词袋

4 Introduction to neural networks

4.1 backforward propagation

在这里插入图片描述
patterns in back gradient
max gate: 只传给最大的那个值
gradients add at branches
对于graph structure要有forward()和backward()

4.2 neural network

一个简单的2-layer neural network: f = W 2 m a x ( 0 , W 1 x ) f=W_2 max(0,W_1 x) f=W2max(0,W1x)

5 convolutional neural networks

5.1 convolutional layer

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

5.2 pooling layer

downsampling

  • max pooling
  • average pooling

6 training neual network 1

6.1 activation function

在这里插入图片描述

6.2 weight initialization

W初始化太大:激活函数会饱和
W初始化太小:输出太小,约等于0
最好的情况是每一层都是高斯分布的
在这里插入图片描述

6.3 batch normalization

usually inserted after fully connected or convolutional layers, and before nonlinearity
x ′ = x − E [ x ] v a r [ x ] x'=\frac{x-E[x]}{\sqrt{var[x]}} x=var[x] xE[x]

7 training neual network 2

7.1 hyperparameter search

在这里插入图片描述

7.2 fancier opitimization

在这里插入图片描述
noise can be averaged

这篇关于Stanford CS231N的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/883527

相关文章

深度学习 --- stanford cs231学习笔记四(训练神经网络的几个重要组成部分之一,激活函数)

训练神经网络的几个重要组成部分 一 1,激活函数(activation functions) 激活函数是神经网络之于线性分类器的最大进步,最大贡献,即,引入了非线性。这些非线性函数可以被分成两大类,饱和非线性函数和不饱和非线性函数。 1,1 饱和非线性函数 1,1,1  Sigmoid 原函数: 函数的导数:  sigmoid函数的性质:

深度学习 --- stanford cs231学习笔记五(训练神经网络的几个重要组成部分之二,数据的预处理)

训练神经网络的几个重要组成部分 二 2 Data Preprocessing数据的预处理 数据预处理的几种方法 2,1 数据的零点中心化         数据的零点中心化的目的就是为了把数据的整体分布拉回到原点附近,也就是让数据的整体均值变为0。 ​  2,2 数据的标准化         数据的标准化这个词比较难理解,从统计学的角度讲,经过这一步的处理,原

深度学习 --- stanford cs231 编程作业(assignment1,Q3: softmax classifier)

stanford cs231 编程作业(assignment1,Q3: softmax classifier         softmax classifier和svm classifier的assignment绝大多部分都是重复的,这里只捡几个重点。 1,softmax_loss_naive函数,尤其是dW部分 1,1 正向传递 第i张图的在所有分类下的得分

Llama模型家族之Stanford NLP ReFT源代码探索 (三)reft_model.py代码解析

LlaMA 3 系列博客 基于 LlaMA 3 + LangGraph 在windows本地部署大模型 (一) 基于 LlaMA 3 + LangGraph 在windows本地部署大模型 (二) 基于 LlaMA 3 + LangGraph 在windows本地部署大模型 (三) 基于 LlaMA 3 + LangGraph 在windows本地部署大模型 (四) 基于 LlaMA 3

Llama模型家族之Stanford NLP ReFT源代码探索 (二)Intervention Layers层

LlaMA 3 系列博客 基于 LlaMA 3 + LangGraph 在windows本地部署大模型 (一) 基于 LlaMA 3 + LangGraph 在windows本地部署大模型 (二) 基于 LlaMA 3 + LangGraph 在windows本地部署大模型 (三) 基于 LlaMA 3 + LangGraph 在windows本地部署大模型 (四) 基于 LlaMA 3

Llama模型家族之Stanford NLP ReFT源代码探索 (一)数据预干预

LlaMA 3 系列博客 基于 LlaMA 3 + LangGraph 在windows本地部署大模型 (一) 基于 LlaMA 3 + LangGraph 在windows本地部署大模型 (二) 基于 LlaMA 3 + LangGraph 在windows本地部署大模型 (三) 基于 LlaMA 3 + LangGraph 在windows本地部署大模型 (四) 基于 LlaMA 3

深度学习 --- stanford cs231 编程作业(assignment1,Q2: SVM分类器)

stanford cs231 编程作业之SVM分类器 写在最前面:         深度学习,或者是广义上的任何学习,都是“行千里路”胜过“读万卷书”的学识。这两天光是学了斯坦福cs231n的一些基础理论,越往后学越觉得没什么。但听的云里雾里的地方也越来越多。昨天无意中在这门课的官网上无意中看到了对应的assignments。里面的问题和code都设计的极好!自己在做作业的时候,也才

Keras深度学习框架实战(3):EfficientNet实现stanford dog分类

1、通过EfficientNet进行微调以实现图像分类概述 通过EfficientNet进行微调以实现图像分类,是一个使用EfficientNet作为预训练模型,并通过微调(fine-tuning)来适应特定图像分类任务的过程。一下是对相关重要术语的解释。 EfficientNet:这是一个高效的卷积神经网络(CNN)架构,旨在通过统一缩放网络深度、宽度和分辨率等维度来优化性能和效率。Effi

使用Stanford-CoreNLP命令行进行分词

接上文 https://blog.csdn.net/guotong1988/article/details/136652691 java -cp "stanford-corenlp-4.5.6/*" edu.stanford.nlp.international.arabic.process.ArabicTokenizer normArDigits,normArPunc,normAlif,remo

StanFord ML 笔记 第十部分

第十部分:   1.PCA降维   2.LDA 注释:一直看理论感觉坚持不了,现在进行《机器学习实战》的边写代码边看理论