本周的课程还是很有意思的,可以让人知道神奇的照片凡高化是怎么做出来的。在创新地应用上,最重要的还是如何让问题形式化。问题能够定义清楚就成功了一大半。
1. Face Recognition
1.1 定义
(Face) Verification
- Input image, name/ID
- Output whether the input image is that of claimed person
(Face) Recognition
- Has a database of K persons
- Get an input image
- Output ID if the image is any of the K persons (or “not recognized”)
难点:One Shot Learning.
Learning from one example to recognize the person again. 只提供一张图片就能完成后续的识别。
1.2 Siamese Network
Learning a similarity function
if d(image1, image2) ≤τ, “same”
else d(image1, image2) >τ, “different”
1.2.1 Encoding of image

d(x(1),x(2))=∥∥∥f(x(1))−f(x(2))∥∥∥22
1.2.2 Loss
-
Triplet Loss
APN - Anchor/Positive/Negative
∥f(A)−f(P)∥2+α≤∥f(A)−f(N)∥2
α is margin, 能够让正负样本之间的距离更明显。
L(A,P,N)=max(∥f(A)−f(P)∥2−∥f(A)−f(N)∥2+α,0)
J=i=1∑mL(A(i),P(i),N(i))
Choose triplets that are “hard” to train on.
-
Binary Classification
或者说将这个问题转换成一个二分类问题

y^=σ(k=1∑128wi∣∣∣f(x(i))k−f(x(j))k∣∣∣+b)
2. Neural Style Transfer
定义: Content/Sytle/Generated image,将C按照S生成G。

Cost Function
J(G)=αJcontent(C,G)+βJstyle(S,G)
代价函数由两部分构成。
一部分是内容相似的得分:计算隐藏层的activation输出
Jcontent=21∥∥∥a[l](C)−a[l][G]∥∥∥
一部分是风格流派分:
定义Style:Correlation between activations across channels.
Gkk′[l]=i=1∑nH[l]i=j∑nW[l]aijk[l]aijk′[l]
G[l]是nc[l]×nc[l]的Gram Matrix,k/k’都是channel上的。l表示是在第l层的activation上。然后分别在S和G上计算:
Jstyle[l](S,G)=(2nH[l]nW[l]nC[l])21∥∥∥G[l][S]−G[l][G]∥∥∥F2
最后,在多个隐层上进行计算。
3. What are deep ConvNets learning?
浅层学到的是基础特征:第一层不同的filter就是在提取不同的边特征;
深层学到的是组合程度更强的:比如耳朵、鼻子之类的局部组件。