+
+**L2-normalization得到了单位向量,其L2距离就和cos相似度成正比。**
+
### Loss
#### 1.Contrastive loss
![image](./md_imgs/DML/Contrastive loss.jpg)
**contrastive loss只考虑了输入样本对本身的相似性**
+
+
#### 2.Triplet loss
![image](./md_imgs/DML/Triplet loss.jpg)
**Triplet-Loss的效果比Contrastive Loss的效果要好,因为他考虑了正负样本与锚点的距离关系。**
-#### 3.Triplet loss
+
+#### 3.N-pair-ms loss
+![image](./md_imgs/DML/N-pair-ms loss.jpg)
+#### other
+Margin Based Loss, Lifted Struct loss, Proxy NCA loss, Ranked list loss, Multi-Similarity loss
+
### Sampling matters
**提高数据的利用率来加速网络收敛**
-### Experiment Setting
+#### 1.Naive sampling
+按loss里面的项每一对样本都算距离,那么就是NXN对. 对triplet loss来说就是正样本两两之间然后再随机采样一个负样本,也是NXN个triplet
+#### 2.Semi-hard sampling
+在距离margin()里,对一个anchor,loop所有剩下正样本就构建了N个正样本对,然后每对正样本对采样一个负样本
+#### 3.N-pairs sampling
+基于anchor,loop后在每个负类中挑(一般是1)个
+#### other
+Softhard Sampling, Distance weighted sampling...
+![image](./md_imgs/DML/Sampling.jpg)
+### Experiment Setting
+* Dataset: Stanford Online Products, CARS196, and the CUB200-2011
+* Eval:一般是Recall@K和NMI(一般用k-means聚类)(For Recall@K,Each test image (query) first retrieves K nearest neighbors from the test set and receives score 1 if an image of the same class is retrieved among the K nearest neighbors and 0 otherwise. Recall@K averages this score over all the images \cite{lifted}.NMI is normalized mutual information to evaluate the clustering result with given ground truth clustering . and denotes mutual information and entropy respectively.)
## Reference
[1]打个酱油, Deep Metric Learning, https://zhuanlan.zhihu.com/p/68200241
[2]赵赫 Mccree, Face Recognition Loss on Mnist with Pytorch, https://zhuanlan.zhihu.com/p/64427565
[3]杨旭东, 深度度量学习中的损失函数, https://zhuanlan.zhihu.com/p/82199561
[4]find goo, 支付宝是怎么做到快速从数亿张脸中找到我的脸的?,https://www.zhihu.com/question/359431172/answer/935555297
-[5]face_recognition, ageitgey, https://github.com/ageitgey/face_recognition#face-recognition
\ No newline at end of file
+[5]ageitgey, face_recognition, https://github.com/ageitgey/face_recognition#face-recognition
+[6]NIPS'2016, Improved Deep Metric Learning with Multi-class N-pair Loss Objective
+[7]ICCV'2017, Sampling Matters in Deep Embedding Learning
+[8]Confusezius, Deep-Metric-Learning-Baselines, https://github.com/Confusezius/Deep-Metric-Learning-Baselines
\ No newline at end of file
diff --git a/Notes/github.md b/Notes/github.md
index e9e5c6d6a8d3e1d13d7ca75ebbc4f3f5677d4e8b..d38304909f43eee94725c19ee3bd40b27da5f2a7 100644
--- a/Notes/github.md
+++ b/Notes/github.md
@@ -75,17 +75,19 @@ git merge online_repo1
## 插入链接图片
[百度](http://baidu.com)
-插入网络图片:![](网络图片链接地址),即叹号!+方括号[]+括号(),如果不加叹号!就会变成普通文本,方括号里可以加入一些 标识性的信息
+* 插入网络图片:![](网络图片链接地址),即叹号!+方括号[]+括号(),如果不加叹号!就会变成普通文本,方括号里可以加入一些 标识性的信息
![baidu](http://www.baidu.com/img/bdlogo.gif "百度logo")
-插入GITHub仓库里的图片:![](图片链接地址),即叹号!+方括号[]+括号(),URL写法:http://github.com/自己的用户名/项目名/raw/分支名/存放图片的文件夹/文件夹里的图片名字
-
-给图片加上超链接:即点击一个图片进入指定网页,方括号里写自己起的标识名称,上下两行标识要一致。
+* 插入GITHub仓库里的图片:![](图片链接地址),即叹号!+方括号[]+括号(),URL写法:http://github.com/自己的用户名/项目名/raw/分支名/存放图片的文件夹/文件夹里的图片名字
+* 给图片加上超链接:即点击一个图片进入指定网页,方括号里写自己起的标识名称,上下两行标识要一致。
[![baidu]](http://baidu.com)
-[baidu]:http://www.baidu.com/img/bdlogo.gif "百度Logo"
-
+[baidu]:http://www.baidu.com/img/bdlogo.gif "百度Logo"
+* 图片居中
+