MasterThesis/paper_log.md

789 lines
35 KiB
Markdown
Raw Permalink Normal View History

2024-07-09 14:18:11 +02:00
图片/文字/公式都是一条线已经能把method experiment表达清楚
2024-07-15 15:18:12 +02:00
[toc]
2024-07-09 14:18:11 +02:00
## Writing
1. introduction 1- 3
current trending?
2. related work & background knowledge 5050 10-15
数学背景/例子
公式 + 例子
1. 罗列,
1. a文章里在b文章里克服了缺陷可能在另一个问题里
2. 可以写成表格都用到了diffusion related work 都做了什么
3. 为什么会有这么多文章呢在related work里
1. 讨论讨论异同通常情况下大家都会用到diffusion怎么看待condition应该加在unet上还是加到latent space上用一个抽象的东西去做讨论看文章做总结
1. quantum circuits vqc分成3个部分通常情况下。。。
2. 能少用字少用字,字和图表是相辅相成的
3. method
1. 要有一个pipeline从头到尾有一个框架input/output是什么维度的
2. 图上的东西在公式上应该有体现,看图/看文字/看公式都能对应起来,删了某一套,看其他的可能不清晰?
2024-07-15 15:18:12 +02:00
4. ###### experiment
2024-07-09 14:18:11 +02:00
1. 跑通
2. 看在各种数据集上能不能跑?
3. 做出来result之后为什么要选定这些超参数? role a hyperparameter
4. 做出来烂图可以用于比较
5. ablation study比如说我们用了 feature encoder告诉别人有这个东西和没这东西是效果不一样的
6. 可解释性?没必要知道,
可以知道
含糊的提供一些方向 could might be
告诉别人,我是怎么看待这个算法的可解释性的
5. conclusion
1. 好的实验limitation是什么
2. 提一些我们认为这个领域上面有可能有什么限制之类的,当时还没来得及实验的部分
考虑image这件事
你可以从这篇paper 开始,总结比如 1. key reseaech question 2.相比于前人的方法什么是他的创新点他是在文章的哪个部分介绍这些创新点的在introductionrelated work method3. experiment有哪些 4.实验结果是用图,表格还是什么形式展现的,可以想想在你看来这种方式帮助读者了解了什么重要信息
## Graph-DiT 2401.13858
### Key research question
将合成分数和气体渗透率等多种属性作为条件约束集成到diffusion模型中
integrating multiple properties such as synthetic score and gas permeability as condition constraints into diffusion models remains unexplored
graph dit是用来多条件分子生成用的
### Innovation Point
#### abstract
1. **Condition encoder** to learn the representation of numerical and categorical properties
条件编码器来学习数字和分类属性的表示
2. Utilises a **Transformer-based graph denoiser** to achieve molecular graph denoising under conditions.
2024-07-15 15:18:12 +02:00
2024-07-09 14:18:11 +02:00
使用一个基于transformer的图解噪器来达到有条件的分子图解噪
3. propose a graph-dependent noise model for training Graph DiT
提出一个基于图的噪声模型来训练GraphDiT之前是针对原子和键在前向diffusion过程中分别添加噪声。
这个噪声模型是用来准确估计图相关的噪声
designed to accurately estimate graph-related noise in molecules
#### Introduction
1. Existing work converted multiple conditions into a single one and solved the task as a single-condition generation
现有的工作是将多个条件变成一个条件,然后将任务当作是单条件的生成
坏处是属性有很多种,变成单个条件模型没法平衡条件
多条件由分类属性和数值属性混合而成,加法和乘法不足以组合
2. 通过*learning*将多种属性投射到representation中从而指导分子生成的diffusion过程这个是由condition encoder来完成
**condition encoder**使用一个基于聚类**clustering-based方法对于数值属性****one-hot编码对于分类属性来学习多属性表示**
3. **Graph-denoiser**首先集成(integrates)点和边features到一个图tokens然后用ADaLN来解噪这些tokens到Transformer层。ADaLN在各个隐藏层中替换化合物的统计均值和方差为条件的表示。 effectively outperforming other predictor-based and predictor-free conditioning methods,这种方法高效于其他基于predictor的和predictorfree的条件方法。
4. 我们观察到现有的前向扩散过程 [42, 22] 将噪声分别应用于原子和键,这可能会损害 Graph DiT 在噪声估计中的准确性。因此,我们提出了一种**新颖的图相关噪声模型** Graph-dependent Noise Mode该模型可以有效地应用根据图中原子和键之间的依赖性定制的噪声。
#### Multi-Conditional Diffusion Model
1. Graph-dependent Noise Model, 使用一个$Q_G$来表示转移矩阵,一个单独的矩阵$X_G$来表示图tokens
$Q_{EV},Q_{VE}=\alpha \mathbf{I}+(1-\alpha^t)\mathbf{1}m'_{EV}$,其中$m'_{EV}$​表示原子和键的共同出现概率
2. Denoising Generation with Graph Diffusion Transformer
条件编码器将时间步t视为特殊条件获得具有正弦编码的D维表示t数值/分类条件c_i用不同的编码操作来获得D维表示。分类用one-hot数值用聚类编码。把c_i赋值给clustersTransforming the soft assignment vector of condition values into the representation。可以用Linear(Softmax(Linear(c_i)))来实现。最后我们可以得到条件的表示为c=encode(c_i) for i in range(1, M)。 For numerical conditions, we evaluate our
proposed clustering-based approach against alternatives like direct or interval-based encodings
3. Graph Denoiser: Transformer Layers
在时间步t的noisy graphgraph tokens首先被encoded到hidden space中比如$\mathbf{H}=Linear(X_G^t)$然后我们用self-attention 和mLP来调整标准的transformer layer
![image-20240707180530040](http://ff.mhrooz.xyz:4080/2024/07/07/df1baca03148a.png)
$\gamma(),\beta()$表示$f_\theta$的神经网络模块每个都包含两个SiLU激活。对于残差网络我们有
![image-20240707181139857](http://ff.mhrooz.xyz:4080/2024/07/07/31b0bafce3db2.png)
我们应用0来初始化$\alpha, \beta,\gamma$
4. 在最后的Transformer 阿里也让后我们有H然后MLP可以用来预测在t=0时点的概率和边的概率
$$
X_G^0=AdaLN(MLP(H),c)
$$
最终得到的$X_G$​表示原则和键
将生成的图形转换为分子的一种常见方法是只选择最大的连接部分[ 42 ],在我们的模型中称为图形 DiT-LCC。对于 DiT 图形,我们通过随机选择原子来连接所有组件。与图 DiT-LCC 相比,它对生成结构的改变最小,能更准确地反映模型性能。
#### related work not innovation point
- Diffusion models have also been used for molecular property prediction [27], for conformation [47] and molecule generation with atomic coordinates in 3D [ 18 , 48, 3].
- DiGress[42]引入了离散噪声作为基于原子和键类型的边缘分布的转移矩阵。DiGress和GDSS研究了额外的预测模型来指导生成过程。
### experiment
#### abstract
1. We extensively validate the Graph DiT for multi-conditional polymer and small molecule generation. A polymer inverse design task for gas separation with feedback from domain experts further demonstrates its practical utility
我们大量验证了多条件聚合物和小分子的生成。气体分离聚合物逆向设计任务以及领域专家的反馈进一步证明了其实用性。
#### Introduction
1. 传统的多条件生成用100个数据点每个数据点有三个属性可合成性O2和N2的渗透率。单条件diffusion模型生成最多30张图三个条件生成总共90张图。把每个set的30张图用聚合物属性Oracle排序。然后我们检查是否可以在不同的条件集中识别满足多属性约束的共享聚合物结构。如果我们找到该聚合物其排名 K其中 K 介于 1 到 30 之间表明考虑到所有条件集它在列表中出现的位置。找不到就设置成30.
结果是超过一半的聚合物没有满足多种条件。
2. GraphDiT是生成一个图然后吧这个图分别对三个条件根据Oracle排序
#### experiment
dataset分成622训练验证testing
然后使用一些指标:
- molecular validity -- Validity
- heavy atom coverage -- Coverage
- internal diversity among the generated examples -- Diversity
- fragment-based similarity with the reference set -- Similarity
- ChemNet Distance with the reference set -- Distance
- MAE/Acc 对于分类/数值任务条件property)
- synthetic accessibility score (Synth.)
RQ2 dataset一共60916个用来做测试/reference剩下的用来training和validation生成1000个化合物
RQ3消融实验把AdaLN和Cluster换掉看看
#### results presentation method
表格
![image-20240707182656073](http://ff.mhrooz.xyz:4080/2024/07/07/781ebf12aae09.png)
环形图
![image-20240707183420457](http://ff.mhrooz.xyz:4080/2024/07/07/e33e73f62ea3b.png)
## Lift Your Molecules 2406.10513
### key research question
molecular graph generation with 3d generative models
Synthetice Coordinate Embedding(SYCo)把分子图映射到欧几里得点云Euclidean point clouds通过synthetic conformer coordinates,使用EGNN学习逆映射
将图生成问题转化为了点云生成问题
## RAFT 2003.12039
> 4D成本体积可以理解为一个四维矩阵用于存储图像中所有像素对的相似性信息。假设我们有两幅图像I1和I2它们的大小都是H×W则4D成本体积C的维度是H×W×H×W。
>
> - **前两个维度H, W**表示图像I1中的每个像素位置。
> - **后两个维度H, W**表示图像I2中的每个像素位置。
>
> 对于每一个像素对 (i1, j1) in I1 和 (i2, j2) in I2在4D成本体积中的对应位置 (i1, j1, i2, j2) 存储了这两个像素的特征相似性。
>
> Correlation Volume相关体积
>
> 定义
>
> 相关体积是一个多维矩阵,用于存储图像中所有像素对之间的相似性信息。在光流估计中,相关体积通过计算特征向量的内积来衡量像素对之间的相似性。
>
> 计算方法
>
> 假设我们有两幅图像 I1I1I1 和 I2I2I2它们的大小都是 H×WH \times WH×W。首先通过特征提取网络如卷积神经网络从两幅图像中提取每个像素的特征向量。然后对每对像素计算它们特征向量的内积从而得到相关体积。
>
> 公式上,假设 F1F1F1 和 F2F2F2 分别是图像 I1I1I1 和 I2I2I2 的特征图,它们的维度是 H×W×DH \times W \times DH×W×D则相关体积 CCC 的计算公式为:
>
> C(i1,j1,i2,j2)=F1(i1,j1)⋅F2(i2,j2)C(i1, j1, i2, j2) = F1(i1, j1) \cdot F2(i2, j2)C(i1,j1,i2,j2)=F1(i1,j1)⋅F2(i2,j2)
>
> 这里,⋅\cdot⋅ 表示特征向量的内积操作。
>
> 特点
>
> - **高维度**:对于每对像素,都计算一个相似性值,结果是一个四维矩阵。
> - **全局信息**:包含所有像素对的相似性信息,提供了全局视角。
> Cost Volume成本体积
>
> 定义
>
> 成本体积通常用于立体匹配或光流估计中,表示图像中像素匹配的代价或不相似度。成本体积通过计算特征向量之间的某种距离度量(如绝对差异或平方差异)来衡量像素对之间的不相似度。
>
> 计算方法
>
> 与相关体积类似,成本体积也是通过计算图像中所有像素对的匹配度来构建的。不同之处在于,成本体积通常使用距离度量而不是内积。
>
> 公式上,假设 F1F1F1 和 F2F2F2 分别是图像 I1I1I1 和 I2I2I2 的特征图,则成本体积 VVV 的计算公式为:
> $$
> V(i1,j1,i2,j2)=∥F1(i1,j1)F2(i2,j2)∥V(i1, j1, i2, j2) = \| F1(i1, j1) - F2(i2, j2) \|V(i1,j1,i2,j2)=∥F1(i1,j1)F2(i2,j2)∥
> $$
>
>
>
>
> 这里,∥⋅∥\|\cdot\|∥⋅∥ 表示特征向量之间的距离度量如L2范数欧氏距离
>
> 特点
>
> - **高维度**:类似于相关体积,成本体积也是一个四维矩阵。
> - **匹配度量**:通过计算特征向量之间的不相似度来表示匹配代价。
>
> 总结
>
> - **相关体积Correlation Volume**:用于表示像素对之间的相似性,通常通过计算特征向量的内积来实现。
> - **成本体积Cost Volume**:用于表示像素对之间的匹配代价,通常通过计算特征向量之间的距离度量来实现。
>
> 两者都在光流估计和立体匹配中扮演关键角色,通过捕捉图像中像素对的匹配信息,帮助算法更准确地估计光流场或深度图。
### Key Research Question
一种新的光流深度网络架构。RAFT
### Innovation Point
#### abstract
RAFT提取每像素特征为所有的像素对构建多尺度4D correlation volumes并且迭代更新流场通过RNN,这个RNN执行查找相关性的体积(corrlation volumns)
#### Introduction
> 问题:快速移动的物体,遮挡,运动模糊,无纹理表面。之前的是光流是一对图像之间密集位移场空间(space of dense displacement fields between a pair of images) 的手工创建的优化问题。
>
> 定义的优化目标包含一个权衡在数据项和正则化项之间
>
> 数据项鼓励视觉上相似的图像区域的对齐,正则化项对运动的合理性施加先验
RAFT的优势准确度强泛化性高效率。
新颖性:
1. **高分辨率维护和更新单个固定流场**。在单个高分辨率流场上运行,克服了从粗到细级联的几个限制:在粗分辨率下从错误中恢复的困难,错过小型快速移动物体的倾向,和许多训练迭代需要多阶段级联
2. 比较轻量: 使用更简单的细化模块在推理过程中应用100多次迭代而不会出分歧。构建没有扭曲和固定分辨率更新的成本量 namely the construction of the cost volume without warping and fixed resolution updates.Devon使用dilated cost volume来处理大位移这个方法是在多个分辨率下汇集correlation volume
3. **卷积GRU**4D多尺度相关体积查找。
RAFT的构成
- 特征编码器feature encoder, 为每个像素提取特征向量
- 相关层 correlation layer, 为所有像素对生成4D相关体积然后进行池化来生成较低分辨率的体积
- 基于GRU的recurrent更新算子(update operator),从相关体积中检索值并迭代更新初始化为零的流场。
- t
#### 特征提取
1. 卷积网络,规模/8D=256, i.e. H x W x 3 => H / 8 x W / 8 x D
2. 特征编码器六个残差块2个为1/2分辨率2个为1/4分辨率2个为1/8分辨率
3. 上下文网络,从第一个输入图像中提取特征,和特征提取网络架构相同。特征网络$g_\theta$+上下文网络$h_\theta$=第一阶段,只执行一次
#### 计算视觉相似度
![image-20240708180245088](http://ff.mhrooz.xyz:4080/2024/07/08/410888a43a323.png)
##### Corrlation Pyramid
把上面的相速度换成H x W x H/2^k x W/2\^k,来生成$\{C^1,C^2,C^3,C^4\}$
##### Correlation lookup
$L_C$查找运算符从Correlation pyramid中进行索引来生成特征图。
给定光流$(f^1,f^2)$的当前估计,我们将$I_1$中的每个像素$x=(u,v)$映射到$I_2$中的估计对应关系(estimated correspondence in $I_2$)$\mathbf{x'} = (u+f^1(u),v+f^2(v))$
$$
\mathcal{N}(x') = \{x'+dx|dx\in\Z,||dx||+1\leq r\}
$$
使用L1距离的r单位内偏移量的集合使用局部淋雨从相关量汇总进行索引双线性采样
使用网格$\mathcal{N}(x'/2^k)_r$对级别k,c^k^的相关量进行索引
##### 高分辨率图像的高校计算
![image-20240708224745104](http://ff.mhrooz.xyz:4080/2024/07/08/cce4a853ba46d.png)
### 3.3 Iterative Updates
![image-20240708224935527](http://ff.mhrooz.xyz:4080/2024/07/08/ee582a46764f8.png)
## CoTracker: It is Better to Track Together 2307.07635
2024-07-15 15:18:12 +02:00
### code
predictor中的class CotrackerPredictor将会调用build_cotracker()来创建一个位于cotracker.py中的CoTracker2(nn.Module).
CotrackerPredictor.\_compute\_sparse\_tracks()将会预测tracks以及visibilities
2024-07-09 14:18:11 +02:00
### key research question
optical flow
### Innovation Point
### abstract
virtual tracks, allows cotracker to track 70k points jointly and simultaneously.
operates causally on short windows, online tasks,
### Cotracker
#### transformer formulation
transformer的目标**是改进track的initial estimate**
conv nn提取d维特征分辨率降低4倍
##### track features
特征向量$Q_i^t\in\R^d$
##### correlation features
相关性向量$C_t^i$是通过堆叠内积获得的。
##### tokens
![image-20240708232239918](http://ff.mhrooz.xyz:4080/2024/07/08/5b71c3335ab78.png)
![image-20240708233539989](http://ff.mhrooz.xyz:4080/2024/07/08/ac8a2fed0e46b.png)
![image-20240708233559704](http://ff.mhrooz.xyz:4080/2024/07/08/ea2fb004c88ba.png)
2024-07-15 15:18:12 +02:00
## diffusionNAG 2305.16943
### key research question
repetitive sampling and training of many task-irrelvant architectures.
> sufferfrom the high search cost
>
> proposed to utilize parameterized property predictors without training
>
> NAS waste of a time to explore an extensive search space
>
> the property predictors mostly play a passive role such as evaluators that rank architecture candidates provided by a search strategy to simply filter them out during the search process.
### Innovation Point
#### Abstract
1. proposed a novel conditional **Neural Architecture Generation(NAG)** framework based on diffusion models
2. the guidance of parameterized predictors => task optimal architectures => sampling from a region that is more likely to satisfy the properties.
#### Introduction
1. diffusion generative models.
2. **train** the base diffusion generative model **without requiring expensive label information**. e.g. accuracy
3. deploy the trained diffusion model to diverse downstream tasks, while controlling the generation process with **property predictors**.
4. we leverage **gradients** of **parameterized predictors** to guide the generative model toward the space of architectures with desired properties.
5. our approach facilitates efficient search by **generating architectures that follow the specific distribution of interest within the search space**
6. utilizes the predictor for both NAG and evaluation purposes
7. we can swap out the predictors in a plug-and-play manner without retraining the base generative model
8. design a score network for na
9. previously, na represented as directed acyclic graphs to model the computation flow, now undirected graphs, to represent structure information of graphs completely ignoring the directional relationships between nodes. introduce a score network that encodes the **positional information** of nodes to capture t**heir order connected by directed edges.**
Summary:
先训练一个生成式diffusion出来然后生成的时候解噪的时候把预测器加进来根据任务不同训练预测器从而生成高质量的网络。
### Method
- Neural Architecture $\mathbf{A}$ with $N$ nodes defined by **operator type matrix** $\mathbf{\mathcal{V}}\in\R^{N\times F}$ and upper triangular adjacency matrix $\mathbf{\mathcal{E}}$, $\mathbf{A}=(\mathbf{\mathcal{V}},\mathbf{\mathcal{E}})$, $F$ is the number of predefined operator sets
- Search Space $\mathcal{A}$
- Score Network $s_\theta$
- desired property $y$
##### forward process
$$
d\mathbf{A}_t = \mathbf{f}_t(\mathbf{A}_t)\text{d}t+g_t\text{d}\mathbf{w}
$$
$ \mathbf{f}_t$是一个线性的drift系数从一个$\mathcal{A}$指向另一个$\mathcal{A}$.
$ \mathbf{g}_t$是一个线性的drift系数从一个$\mathcal{A}$指向另一个$\R$.
##### Reverse process
$$
d\mathbf{A}_t = [\mathbf{f}_t(\mathbf{A}_t)-g_t^2\nabla{A_t}\log p_t(A_t)]\text{d}\bar t + g_t\text{d}\bar{\mathbf{w}}
$$
we discretize the entries of the architecture matrices usingthe operator 1>0.5 to obtain discrete 0-1 matrices after generating samples by simulating the reverse diffusion process.
![image-20240713184159898](http://ff.mhrooz.xyz:4080/2024/07/13/0081ae053d589.png)
来近似$\nabla{A_t}\log p_t(A_t)$
##### score network
goal/object: dependency between nodes 2. accurate position of each layer
L transformer blocks(T) attention mask M = the dependency between nodes
上三角矩阵来参数化score network
$Emb_{pos}$捕获层之间的拓扑关系
![image-20240713185634435](http://ff.mhrooz.xyz:4080/2024/07/13/ab839f143c566.png)
##### conditional neural architecture generation
generate neural architectures from the conditional distribution $p_t(A_t|y)$ by soving, which is the reverse time SDE and a conditional probability
![image-20240713221223102](http://ff.mhrooz.xyz:4080/2024/07/13/b806fcf0842d1.png)
decompose $\nabla{A_t}\log p_t(A_t|y)$
![image-20240713221449468](./assets/image-20240713221449468.png)
前者用score network求解后者用predictor $f_\phi(y|A_t)$, $\phi$是参数,可以把上面的式子拆分成
![image-20240713222701170](http://ff.mhrooz.xyz:4080/2024/07/13/6863bf889dcd8.png)
这样的话只需要训练一次score network之后针对不同任务只需要训练predictor就可以
##### Transferable
数据集级别的predictor$f_\phi(D,A_t)$predictor是meta-leraned 的
![image-20240713224546871](./assets/image-20240713224546871.png)
![image-20240713224026605](http://ff.mhrooz.xyz:4080/2024/07/13/2f4c83d7362ab.png)
### Experiments
#### Abstract
1. Transferable NAS and Bayesian Optimization(BO)-based NAS. Speedups of up to 35x
2. integrated into a BO-based algorithm, outperforms
#### Introduction
1. Transferable NAS and Bayesian Optimization(BO)-based NAS.
1. Transferable NAS use transferable dataset-aware predictors
2. DiffusionNAG demonstrates superior generation quality compared to MetaD2A
3. This is because DiffusionNAG overcomes the limitation of existing BO-based NAS, which **samples low-quality architectures during the initial phase**, by sampling from the space of the architectures that satisfy the given properties.
#### experiments
predictor is trained by the mbv3 and nb201
#### express methods
tables
![image-20240713225652194](./assets/image-20240713225652194.png)
##### bar plots
![image-20240713225711345](./assets/image-20240713225711345.png)
### Questionable Point
#### Introduction
1. various types of NAS tasks (e.g., latency or robustness-constrained NAS)
## DiGress 2209.14734
### key research question
- discrete denoising diffusion model for generating graphs with **categorical** node and edge attributes
### Innovation point
#### absctract
- **discrete diffusion process**, progressively edits graphs with noise
- **graph transformer** = denoiser , turn distribution learning over graphs into a sequence of node and edge classification tasks.
- **Markovian noise model**, preserves the marginal distribution of node and edge types during diffusion
- Procedure for conditioning the generation on graph-level features.
#### Introduction
- previous, add **Gaussion noise** to node features and `adj_matrix`, continuous diffusionmay destroys the graphs's sparsity and creates complete noisy graphs
- DiGress. Noise = graphs edits(edge addition or deletion)
- graph transformer denoiser predict the clean graph from a noisy input, result admits an elbo for likelihood estimation
- **guidance procedure** for conditioning graph generation on **graph-level properties**
### method
noise model $q$
data point $x$
a sequences of increasingly noisy data points $(z^1,...,z^T)$, where $q(z^1,...,z^T|x) = q(z^1|x)\prod_{t=2}^Tq(z^t|z^{t-1})$
denoising nn. $\phi_\theta$
#### Diffusion models
噪声从先验分布中采样,然后迭代地通过应用解噪网络解噪
denoising network is not trained to directly predict $z^{t-1}$
when $\int q(z^{t-1}|z^t,x)dp_\theta(x)$ tractable, $x$ can be used as the target of the denoising network, which removes an important source of label noise
### experiments
#### abstract
- 3x validity improvement on a planar graph dataset
- scale to the large GuacaMol dataset containing 1.3M drug-like molecules without the use of molecule-specific representations.
diffusion 模型
前向加噪
$q(x^tx^{t1})=\mathcal{N}(x^t;\sqrt{1β_t}x_{t1},β_tI)$
![image-20240715110316386](http://ff.mhrooz.xyz:4080/2024/07/15/69ee7d7a6da94.png)
后向减噪
![image-20240715110401055](./assets/image-20240715110401055.png)
训练是通过数据集,学习一个减噪器
![image-20240715110519427](./assets/image-20240715110519427.png)
生成从latent space中采样然后减噪
![image-20240715110545716](./assets/image-20240715110545716.png)
2024-07-09 14:18:11 +02:00
## Appendix
### Bilinear Sampling
双线性采样Bilinear Sampling是一种在图像处理和计算机视觉中常用的插值方法用于从连续的图像数据中估算出非整数位置的像素值。这种方法通过对周围的四个最近邻像素进行加权平均从而实现对目标位置像素值的平滑估计。
#### 双线性采样的原理
假设我们要估算图像中某个非整数位置 \( (x, y) \) 的像素值,而该位置周围的四个最近邻像素位于整数坐标 \( (i, j), (i+1, j), (i, j+1), (i+1, j+1) \) 处。双线性采样通过以下步骤计算非整数位置的像素值:
1. **确定权重**:计算目标位置 \( (x, y) \) 与其最近邻的四个像素的水平和垂直距离。
2. **加权平均**:利用计算出的权重,对这四个最近邻像素的值进行加权平均,得到目标位置的估算值。
#### 数学公式
假设我们有图像 \( I \),需要估算位置 \( (x, y) \) 处的像素值。其最近邻的四个像素分别位于 \( I(i, j) \)、\( I(i+1, j) \)、\( I(i, j+1) \)、和 \( I(i+1, j+1) \),则双线性采样的过程如下:
1. **计算水平和垂直距离**
\[dx = x - i\]\[dy = y - j\]
2024-07-15 15:18:12 +02:00
2024-07-09 14:18:11 +02:00
2. **加权平均**
\[
I(x, y) \approx (1 - dx) (1 - dy) I(i, j) + dx (1 - dy) I(i+1, j) + (1 - dx) dy I(i, j+1) + dx dy I(i+1, j+1)
\]
#### 应用场景
1. **图像变换**:在图像缩放、旋转、平移等几何变换中,双线性采样用于估算变换后新位置的像素值,从而生成新的图像。
2. **纹理映射**:在计算机图形学中,将纹理映射到三维模型时,双线性采样用于计算非整数纹理坐标的像素值,以实现平滑的纹理显示。
3. **光流估计**在光流估计算法中例如RAFT通过双线性采样在相关体积中查找像素对应位置的相似性值从而实现光流场的更新。
#### 具体例子
假设我们有一个图像 \( I \),需要估算位置 \( (2.5, 3.5) \) 处的像素值,其最近邻像素位于 \( (2, 3) \)、\( (3, 3) \)、\( (2, 4) \)、和 \( (3, 4) \) 处。对应的像素值分别为 \( I(2, 3) = 10 \)、\( I(3, 3) = 20 \)、\( I(2, 4) = 30 \)、和 \( I(3, 4) = 40 \)。
1. 计算水平和垂直距离:
\[
dx = 2.5 - 2 = 0.5
\]
\[
dy = 3.5 - 3 = 0.5
\]
2. 加权平均:
$$\[
2024-07-15 15:18:12 +02:00
2024-07-09 14:18:11 +02:00
$$
I(2.5, 3.5) \approx (1 - 0.5)(1 - 0.5) \cdot 10 + 0.5(1 - 0.5) \cdot 20 + (1 - 0.5)0.5 \cdot 30 + 0.5 \cdot 0.5 \cdot 40
= 0.25 \cdot 10 + 0.25 \cdot 20 + 0.25 \cdot 30 + 0.25 \cdot 40
= 2.5 + 5 + 7.5 + 10
2024-07-15 15:18:12 +02:00
= 25
2024-07-09 14:18:11 +02:00
$$
所以,位置 \( (2.5, 3.5) \) 的估算像素值为 25。
2024-07-15 15:18:12 +02:00
双线性采样通过上述方法有效地平滑了图像在非整数位置的值,广泛应用于各种图像处理和计算机视觉任务中。
### 分布
**条件分布**
$P(A|B)=\frac{P(AB)}{P(B)}$
**先验**
$P(\theta)$ 它反映了在没有观察到数据之前,我们对参数值的主观信念或知识。
**后验**
$P(\theta|x) = \frac{P(x|\theta)P(\theta)}{P(x)}$
**似然**
给定一个模型和参数,我们使用似然函数来衡量参数给定数据的可能性。与概率不同,似然是关于参数的函数,而不是关于数据的函数。
$L(\theta|x)=P(x|\theta)$
**边缘分布**
$P(A) = \int P(A,B)dB = \int P(A|B)P(B)dB$
### 闭式表达式Closed-Form Formula
**闭式表达式**Closed-Form Formula是指一个数学表达式可以通过有限的、通常涉及基本算术运算如加、减、乘、除、幂、根、指数、对数以及已知函数如三角函数来表示和计算。换句话说闭式表达式允许我们在有限步内精确计算出结果而不需要通过数值方法或迭代过程。
如果$ q(z^t | x)$是一个闭式表达式,那么我们可以直接计算出结果,而不需要迭代或数值近似。
### ELBO Evidence Lower Bound
证据下界Evidence Lower Bound, ELBO是变分推断中的一个重要概念通常用于近似后验分布和优化概率模型。ELBO 的主要目的是通过优化一个可计算的下界,来近似原本难以直接计算的后验分布。
#### 背景
在贝叶斯推断中,我们希望计算后验分布 \( p(z | x) \),其中 \( z \) 是潜在变量, \( x \) 是观测数据。然而,直接计算后验分布通常是不可行的,因为它需要计算边缘似然 \( p(x) \),而边缘似然涉及对所有可能的潜在变量 \( z \) 进行积分或求和:
\[ p(x) = \int p(x, z) \, dz \]
#### 变分推断
变分推断通过引入一个简单的分布 \( q(z) \) 来近似复杂的后验分布 \( p(z | x) \),并通过优化使两者尽可能接近。具体来说,我们希望最小化 \( q(z) \) 和 \( p(z | x) \) 之间的差异,通常使用 Kullback-Leibler 散度KL 散度)来度量这种差异:
\[ \text{KL}(q(z) \| p(z | x)) \]
#### 证据下界ELBO
ELBO 是一个优化目标,最大化 ELBO 等价于最小化 KL 散度。通过最大化 ELBO我们可以间接地使 \( q(z) \) 和 \( p(z | x) \) 变得尽可能接近。ELBO 的推导如下:
#### 1. 目标函数
我们希望最大化对数边缘似然 \( \log p(x) \)
$ \log p(x) = \log \int p(x, z) \, dz $
#### 2. 引入变分分布 \( q(z) \)
我们引入变分分布 \( q(z) \),并通过 Jensen 不等式得到下界:
$ \log p(x) = \log \int q(z) \frac{p(x, z)}{q(z)} \, dz$
$\geq \int q(z) \log \frac{p(x, z)}{q(z)} \, dz$
这个不等式即为 ELBO
$\text{ELBO} = \mathbb{E}_{q(z)} \left[ \log \frac{p(x, z)}{q(z)} \right] $
#### 3. 进一步分解
ELBO 可以进一步分解为重构误差和 KL 散度两部分:
$\text{ELBO} = \mathbb{E}_{q(z)}[\log p(x | z)] - \text{KL}(q(z) \| p(z))$
其中:
- $\mathbb{E}_{q(z)}[\log p(x | z)]$ 是重构误差项,表示在给定潜在变量 \( z \) 的情况下观测数据 \( x \) 的对数似然的期望值。
- $\text{KL}(q(z) \| p(z))$是 KL 散度项,表示 \( q(z) \) 和 \( p(z) \) 之间的差异。
#### 直观解释
- **重构误差**:这个项衡量的是模型在给定潜在变量 \( z \) 的情况下重构观测数据 \( x \) 的能力。我们希望这个值尽可能大,表示模型能够很好地解释数据。
- **KL 散度**:这个项衡量的是近似分布 \( q(z) \) 与先验分布 \( p(z) \) 之间的差异。我们希望这个值尽可能小,表示 \( q(z) \) 和 \( p(z) \) 之间的差异最小化。
#### 在变分自编码器VAE中的应用
在变分自编码器VAEELBO 被用作目标函数进行优化。VAE 的目标是学习一个生成模型 \( p(x | z) \) 和一个近似后验 \( q(z | x) \)。优化目标是最大化 ELBO
$ \mathcal{L}_{\text{ELBO}} = \mathbb{E}_{q(z | x)}[\log p(x | z)] - \text{KL}(q(z | x) \| p(z))$
#### 总结
证据下界ELBO是变分推断中的一个核心概念通过最大化 ELBO可以有效地近似后验分布。ELBO 由重构误差和 KL 散度两部分组成分别衡量模型的重构能力和近似分布与先验分布之间的差异。在实际应用中如变分自编码器中ELBO 被用作优化目标,帮助模型学习更好的潜在表示和生成能力。
希望这对你理解 ELBO 有所帮助。如果你有进一步的问题或需要更多的解释,请告诉我。
### KL散度
KL散度Kullback-Leibler Divergence又称相对熵Relative Entropy是一个在信息论和概率论中用于度量两个概率分布之间差异的非对称性度量。它衡量的是从分布 \( Q \) 到分布 \( P \) 的信息损失。
#### KL散度的定义
给定两个概率分布 \( P \) 和 \( Q \),它们定义在相同的样本空间 \( \mathcal{X} \) 上KL散度 \( D_{KL}(P \| Q) \) 定义为:
$D_{KL}(P \| Q) = \sum_{x \in \mathcal{X}} P(x) \log \frac{P(x)}{Q(x)}$
对于连续型概率分布KL散度定义为
$D_{KL}(P \| Q) = \int_{-\infty}^{\infty} P(x) \log \frac{P(x)}{Q(x)} \, dx$
#### 直观理解
KL散度可以理解为在分布 \( Q \) 下编码分布 \( P \) 的数据所需的额外信息量。也就是说,如果我们用 \( Q \) 作为近似分布来编码实际上由 \( P \) 生成的数据KL散度度量了这种近似所带来的信息损失。
#### 性质
1. **非负性**
$D_{KL}(P \| Q) \geq 0$
KL散度总是非负的即使 \( P \) 和 \( Q \) 完全一样KL散度也为0。这是因为对数函数的性质以及Jensen不等式。
2. **非对称性**
$ D_{KL}(P \| Q) \neq D_{KL}(Q \| P)$
KL散度一般不对称这意味着从 \( P \) 到 \( Q \) 的信息损失不等于从 \( Q \) 到 \( P \) 的信息损失。
3. **唯一性**
当且仅当 \( P \) 和 \( Q \) 在所有点上都相等时KL散度为零。
#### 应用
KL散度在信息论、统计学和机器学习中有广泛应用。以下是一些典型应用
#### 1. 变分推断
在变分推断中KL散度用于衡量近似后验分布 \( q(z|x) \) 与真实后验分布 \( p(z|x) \) 之间的差异。优化目标通常是最小化这种差异:
$\text{KL}(q(z|x) \| p(z|x))$
通过最大化ELBO证据下界变分推断间接地最小化了这个KL散度。
### 示例
假设我们有两个离散概率分布 \( P \) 和 \( Q \)
\[ P = \{0.4, 0.6\} \]
\[ Q = \{0.5, 0.5\} \]
那么KL散度 \( D_{KL}(P \| Q) \) 计算如下:
\[ D_{KL}(P \| Q) = 0.4 \log \frac{0.4}{0.5} + 0.6 \log \frac{0.6}{0.5} \]
\[ = 0.4 \log 0.8 + 0.6 \log 1.2 \]
\[ = 0.4 \cdot (-0.2231) + 0.6 \cdot 0.1823 \]
\[ = -0.08924 + 0.10938 \]
\[ = 0.02014 \]
这个结果表示用 \( Q \) 来近似 \( P \) 的信息损失。
#### 总结
KL散度是衡量两个概率分布之间差异的一个重要工具在许多领域都有广泛的应用。它提供了一种量化分布间信息差异的方法并在变分推断、信息论和机器学习等方面起到关键作用。希望这些解释能帮助你更好地理解KL散度。如果你有进一步的问题或需要更多的解释请随时告诉我。
### words
gas permeability 气体渗透率
conformation 构象
Auxiliary 辅助性的