Den Oord A V, Li Y, Vinyals O, et al. Representation Learning with Contrastive Predictive Coding.[J]. arXiv: Learning, 2018.

Henaff O J, Srinivas A, De Fauw J, et al. Data-Efficient Image Recognition with Contrastive Predictive Coding[J]. arXiv: Computer Vision and Pattern Recognition, 2019.

@article{den oord2018representation,

title={Representation Learning with Contrastive Predictive Coding.},

author={Den Oord, Aaron Van and Li, Yazhe and Vinyals, Oriol},

journal={arXiv: Learning},

year={2018}}

@article{henaff2019data-efficient,

title={Data-Efficient Image Recognition with Contrastive Predictive Coding},

author={Henaff, Olivier J and Srinivas, Aravind and De Fauw, Jeffrey and Razavi, Ali and Doersch, Carl and Eslami, S M Ali and Den Oord, Aaron Van},

journal={arXiv: Computer Vision and Pattern Recognition},

year={2019}}

与其说是无监督, 不如用表示学习或者特征提取更为贴切. 感觉监督学习的一个瓶颈就是, 你直接告诉了神经网络它应该到达的终点, 那么它就会找一条最容易的路子去, 所以在训练中, 可以发现训练的精度很快就能达到100%, 而在测试集上的精度就差强人意了. 当然, 这错不在网络, 毕竟它已经尽可能地完成了我们交代给他的任务, 困难在于, 我们自己不知道该如何给这种兼顾泛化性的任务下达准确的定义(平移不变, 旋转不变等等只是泛化的冰山一角).

而表示学习的工作实际上就是比简单的分类损失等更具打磨的空间, 不同的先验知识可以融入其中. 这篇论文的观点就是, encoder提取的特征应当具有可预测性, 也就是说, 只有能够预测别的特征的才是好特征. 当然, 这个是对具有序(时域或者空间)的数据有意义, 对于图片可以认为构造这种数据, 个人认为这才是有趣的地方.

主要内容

从具有序的数据讲起

如上图, 在不同的时间点, 有数据\(x_t\), 其经过第一个encoder \(g_{\mathrm{enc}}\)得到隐变量(特征表示)\(z_t\). 到此打住, 如果是以前, 那可能再来一个decoder, 然后希望解码后数据和原始数据能够吻合. 不过作者认为, 这种方式有点太过勉强了, 其实一个好的特征并不是既低维度(高能量密度)又能够藏住大部分的信息, 一个好的特征应该是抓住最最最主要的信息, 如果是用于分类, 那就是抓住最具有区分度的信息(虽然这个很难下准确的定义).

作者的做法是, 将\(z_i, i\le t\)作为输入, 构造一个回归模型\(g_{\mathrm{ar}}\)(比如用RNN), 得到一个实际上具有之前数据信息的一个特征表示\(c_t\). 作者希望利用\(c_t\)来预测之后的\(x_{t+1},\ldots, x_{t+k},\ldots\), 或者\(z_{t+1},\ldots, z_{t+k},\ldots\), 自然最好的是有一个条件概率模型\(p(x_{t+k}|c_t)\), 然后最大化互信息

\[\tag{1}
I(x;c)=\sum_{x,c} p(x,c)\log \frac{p(x|c)}{p(x)}.
\]

Contrastive Predictive Coding (CPC)

作者并没有打算构建条件概率模型(感觉这样就像VAE一样需要超多假设了), 只是用

\[\tag{3}
f_k(x_{t+k}, c_t)=\exp(z_{t+k}^TW_kc_t),
\]

来衡量二者的关系, 可以把\(W_kc_t\)看成是一个预测\(\hat{z}_{t+k}\).

接下来就要用到对比学习的概念了, 文中说是利用了负样本采样, 但是我用负样本采样的那个推导实在推不出来他的函数, 但是是有一点类似的(感觉只是套用了负采样这个思想?). 即从\(p(x_{t+k}|c_t)\)中采样正样本\(x_{t+k}\), 从一般的分布\(p(x)\)中采样N-1个负样本\(x_j\), 然后最小化下式

\[\tag{4}
\mathcal{L}_N=- \mathbb{E}_X [\log \frac{f_k(x_{t+k},c_t)}{\sum_{x_j \in X} f_k(x_j,c_t)}].
\]

其中\(X=\{x_1,\ldots, x_N\}\)(注, 这里\(X\)是固定的, 已知的).

把\(\frac{f_k(x_i,c_t)}{\sum_{x_j \in X} f_k(x_j,c_t)}\)看成是第\(i\)个采样点是正样本的概率\(\hat{p}_i,i=1, \ldots,N\), 则上面的式子实际上就是一个交叉熵

\[\mathcal{L}_N = -\sum_{i=1}^N p_i \log \hat{p}_i,
\]

故令损失最小的概率为\(\hat{p}_i=p_i:=p(d=i|X, c_t)\), 即正样本在第\(i\)个位置的概率. 又

\[\begin{array}{ll}
p(d=i|X, c_t)
& = \frac{p(x_i|c_t) \prod_{l\not= i} p(x_l)}{\sum_{j=1}^N p(x_j|c_t)\prod_{l\not= j}p(x_j)} \\
&= \frac{\frac{p(x_i|c_t)}{p(x_i)}}{\sum_{j=1}^N\frac{p(x_j|c_t)}{p(x_j)} }.
\end{array}
\]

也就是说, 此时

\[f_k(x_{t+k},c_t) \propto \frac{p(x_{t+k}|c_t)}{p(x_{t+k})}.
\]

图片构建序



如图所示, 一张256x256的图片, 均匀分成7x7张, 每张大小为64x64, 两者最多有50%的重叠部分. 从上到下, 从左往右, 依次可以对其排序, 用前几行的patches出来的\(z\)来预测后面的\(z\).

疑问: 这个负样本的采样空间, 是一个图片所有的patches还是一个batch的所以的patches呢?

Representation Learning with Contrastive Predictive Coding的更多相关文章

  1. 论文解读(SUGRL)《Simple Unsupervised Graph Representation Learning》

    Paper Information Title:Simple Unsupervised Graph Representation LearningAuthors: Yujie Mo.Liang Pen ...

  2. (转)Predictive learning vs. representation learning 预测学习 与 表示学习

    Predictive learning vs. representation learning  预测学习 与 表示学习 When you take a machine learning class, ...

  3. PredNet --- Deep Predictive coding networks for video prediction and unsupervised learning --- 论文笔记

    PredNet --- Deep Predictive coding networks for video prediction and unsupervised learning   ICLR 20 ...

  4. 论文解读(MVGRL)Contrastive Multi-View Representation Learning on Graphs

    Paper Information 论文标题:Contrastive Multi-View Representation Learning on Graphs论文作者:Kaveh Hassani .A ...

  5. 论文解读(GRACE)《Deep Graph Contrastive Representation Learning》

    Paper Information 论文标题:Deep Graph Contrastive Representation Learning论文作者:Yanqiao Zhu, Yichen Xu, Fe ...

  6. 论文解读(S^3-CL)《Structural and Semantic Contrastive Learning for Self-supervised Node Representation Learning》

    论文信息 论文标题:Structural and Semantic Contrastive Learning for Self-supervised Node Representation Learn ...

  7. 论文解读(MERIT)《Multi-Scale Contrastive Siamese Networks for Self-Supervised Graph Representation Learning》

    论文信息 论文标题:Multi-Scale Contrastive Siamese Networks for Self-Supervised Graph Representation Learning ...

  8. 翻译 Improved Word Representation Learning with Sememes

    翻译 Improved Word Representation Learning with Sememes 题目 Improved Word Representation Learning with ...

  9. (zhuan) Notes on Representation Learning

    this blog from: https://opendatascience.com/blog/notes-on-representation-learning-1/   Notes on Repr ...

随机推荐

  1. abandon, aboard, abolish

    abandon Abandon is a 2002 American psychological thriller drama film [惊悚片] ... Waiting for Handler o ...

  2. 零基础学习java------37---------mybatis的高级映射(单表查询,多表(一对一,一对多)),逆向工程,Spring(IOC,DI,创建对象,AOP)

    一.  mybatis的高级映射 1  单表,字段不一致 resultType输出映射: 要求查询的字段名(数据库中表格的字段)和对应的java类型的属性名一致,数据可以完成封装映射 如果字段和jav ...

  3. 【AWS】【TroubleShooting】EC2实例无法使用SSH远程登陆(EC2 failure for SSH connection)

    1. Login AWS web console and check the EC2 instance.

  4. 【Linux】【Services】【SaaS】Docker+kubernetes(6. 安装和配置ceph)

    1. 简介 1.1. 这个在生产中没用上,生产上用的是nfs,不过为了显示咱会,也要写出来 1.2. 官方网站:http://ceph.com/ 1.3. 中文网站:http://docs.ceph. ...

  5. Layui:select下拉框回显

    一..需求场景分析 基于Thymeleaf模板下的layui下选框回显. 二.获得一个Layui标配的下拉框,我们需要在html中填写的内容如下 <div class="layui-f ...

  6. 莫烦python教程学习笔记——利用交叉验证计算模型得分、选择模型参数

    # View more python learning tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: ht ...

  7. Linux 目录结构及详细操作

    目录 Linux 目录结构及详细操作 目录结构 目录结构的特点 目录结构挂载 目录结构发展 关闭selinux(了解) 重要目录说明(etc目录说明) 1.网卡配置文件 2.解析配置文件 3.主机名称 ...

  8. logcplus(2)

    (一)log4cplus是C++编写的开源的日志系统,功能非常全面,用到自己开发的工程中会比较专业的,:),本文介绍了log4cplus基本概念,以及如何安装,配置.  ### 简介 ### log4 ...

  9. Vs code配置Go语言环境-Mac

    背景:最近受朋友介绍,学习Go语言.那么开始吧,首先从配置环境开始. 电脑:Mac Air,Vs code已经安装 一.Go下载和安装 下载地址:https://golang.google.cn/dl ...

  10. 使用批处理文件(.bat)启动多个CMD窗口并执行命令

    由于每次启动本机的kafka都需要打开2个cmd窗口,分别启动zookeeper服务和kafka服务,操作相对繁琐,于是想起了批处理来帮忙一键启动. 在桌面新建一个txt文件,改后缀名为.bat,并加 ...