暑假第一天 the fisrt day of my holiday

今天是暑假第一天,我学习了CS231n_2019_spring的课程

Lecture 1 (Course Introduction)

对于Lecture 1 就没什么好说的,就是一些CV的历史,但是我认为这也很重要,对以后创造出自己的model很有帮助。

Lecture 2(Image Classification)

  1. K-nearest neighbor
  2. Linear classification

Intro to Image Classification, data-driven approach, pipeline
这是官方给的note里面的,其实总结起来就一句话:
机器视觉并不是那么容易解决,它受各种复杂的因素影响,但可以通过大量数据来很好的解决,文中称之为Data-driven approach.

Nearest Neighbor Classifier(最邻近分类器)

这里有用到一个很重要的数据集CIFAR-10 总共有10类,具体的描述可以点击这个
这是一个很直观的想法:假设让你判断一张未知的照片属于什么类,那么直观的想法就是这张照片与已有的类差多少,找到差别最小的。在image中,这个‘多少’也就是距离,在 这里是L1距离(也叫做麦哈顿距离)

L1距离很如容易计算(看一张图就明白):
在这里插入图片描述L1:
d 1 ( I 1 , I 2 ) = p I 1 p I 2 p d_1 (I_1, I_2) = \sum_{p} \left| I^p_1 - I^p_2 \right|
计算距离的方法千千万这是使用的更多的一种L2距离:
d 2 ( I 1 , I 2 ) = p ( I 1 p I 2 p ) 2 d_2 (I_1, I_2) = \sqrt{\sum_{p} \left( I^p_1 - I^p_2 \right)^2}
L1 vs. L2. It is interesting to consider differences between the two metrics. In particular, the L2 distance is much more unforgiving than the L1 distance when it comes to differences between two vectors. That is, the L2 distance prefers many medium disagreements to one big one. L1 and L2 distances (or equivalently the L1/L2 norms of the differences between a pair of images) are the most commonly used special cases of a p-norm.

k - Nearest Neighbor Classifier

You may have noticed that it is strange to only use the label of the nearest image when we wish to make a prediction. Indeed, it is almost always the case that one can do better by using what’s called a k-Nearest Neighbor Classifier. The idea is very simple: instead of finding the single closest image in the training set, we will find the top k closest images, and have them vote on the label of the test image. In particular, when k = 1, we recover the Nearest Neighbor classifier. Intuitively, higher values of k have a smoothing effect that makes the classifier more resistant to outliers:

用人话来说就是:
直接用最近的图的类作未知图的类可能不太靠谱,你想想狗和狼其实差不多,如果用此方法很容易将狗和狼分为一类。
下面三幅图与originald的L2都是相同的:
在这里插入图片描述
所以我们可以多看一些,把distance排行榜的top-k拿出来,看看这k类中,是狗多还是狼多。
K-NN classifier
在实际中,我们都是用的K-NN Classifier,那么问题来了:K取多少合适
The idea is to split our training set in two: a slightly smaller training set, and what we call a validation set
Cross-validation
由于以上内容在我数据结构大作业中已经有使用,所以就不多说了,看图:
在这里插入图片描述

Pros and Cons of Nearest Neighbor classifier(最近邻分类器的优缺点)

  1. 训练成本为0,测试成本高,世界中的种类太多了
  2. 一个问题是,图像是高维对象(即它们通常包含许多像素),而高维空间上的距离可能是非常不直观的

Linear Classification

大作业实际操作过,就简单总结一下:
Linear classifier:
score function:
f ( x i , W , b ) = W x i + b f(x_i, W, b) = W x_i + b

x_i为被flattened out之后的column vector. shape[Dx1] D就是所有像素的总数
W 是一个matrix size[KxD] .K 就是class的数量
b .shape[Dx1]

不多说,看图:

在这里插入图片描述

问题汇总

  1. pipeline 怎么翻译

英文翻译

indicate 表示
trivial 微不足道的
geometric 几何学
euclidean 欧几里得
deploy 调整
arguably 可论证地; 可以说; 按理说;
flattened out 压平

发布了29 篇原创文章 · 获赞 14 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_43343116/article/details/93509590
今日推荐