Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
PommesPeter committed Oct 26, 2023
2 parents 4545b9a + 0a353d6 commit 3cfe3fe
Show file tree
Hide file tree
Showing 21 changed files with 248 additions and 8,005 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,6 @@ dist

docs/privated
blog/privated
.vscode
.vscode

yarn.lock

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: Prior Bias for Unbiased Scene Graph Generation
authors: [peter]
tags: [SceneGraphGeneration]
---

import SumCard from '@site/src/components/SumCard';

<SumCard
title="Resistance Training using Prior Bias: toward Unbiased Scene Graph Generation"
authors="Chao Chen / Yibing Zhan / Baosheng Yu / Liu Liu / Yong Luo / Bo Du"
abstract="Scene Graph Generation (SGG) aims to build a structured representation of ascene using objects and pairwise relationships, which benefits downstreamtasks. However, current SGG methods usually suffer from sub-optimal scene graphgeneration because of the long-tailed distribution of training data. To addressthis problem, we propose Resistance Training using Prior Bias (RTPB) for thescene graph generation. Specifically, RTPB uses a distributed-based prior biasto improve models' detecting ability on less frequent relationships duringtraining, thus improving the model generalizability on tail categories. Inaddition, to further explore the contextual information of objects andrelationships, we design a contextual encoding backbone network, termed as DualTransformer (DTrans). We perform extensive experiments on a very popularbenchmark, VG150, to demonstrate the effectiveness of our method for theunbiased scene graph generation. In specific, our RTPB achieves an improvementof over 10% under the mean recall when applied to current SGG methods.Furthermore, DTrans with RTPB outperforms nearly all state-of-the-art methodswith a large margin."
url="http://arxiv.org/abs/2201.06794"/>

## Motivation

- 使用 resistance bias 为了加强联系关联性差距比较大的两个关系的能力
- 使用 dual Transformer 加强对于关系的识别的全局上下文的特征,使得编码器编码的特征信息更充分
2 changes: 1 addition & 1 deletion blog/authors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ slorber:

peter:
name: PommesPeter
title: CVer | Latex Writer | Genshiner
title: Researching for Multi-Modal && Coding
url: https://memo.pommespeter.space
image_url: https://github.com/PommesPeter.png
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
---
title: 基础概念
tags:
- 基础概念
- 深度学习
---

# 基础概念

## 数据样本相关
Expand Down Expand Up @@ -67,4 +74,4 @@ $$

横坐标就是FPR,而纵坐标就是TPR,因此可以想见,当 TPR越大,而FPR越小时,说明分类结果是较好的。

![img](src/02.基础概念补充/ZL433%DS_JHKSMVG7T_Z2NC.png)
![img](src/02.基础概念补充/image-2333.png)
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,23 @@ tags:

## Abstract

现在主流的序列翻译模型都是基于循环神经网络或者卷积神经网络来做的,也就是包含了 encoder 和 decoder。现阶段最好的模型也是通过注意力机制将 encoder 和 decoder 连接起来。所以我们提出了一种仅用注意力机制的简单结构,完全不使用 CNN 和 RNN。我们的架构在其他领域也非常适用。
现在主流的序列翻译模型(序列到序列的生成模型)都是基于循环神经网络或者卷积神经网络来做的,也就是包含了 encoder 和 decoder。现阶段最好的模型也是通过注意力机制将 encoder 和 decoder 连接起来。所以我们提出了一种仅用注意力机制的简单结构,完全不使用 CNN 和 RNN。我们的架构在其他领域也非常适用。(使用机器翻译领域作为验证)

## Introduction

循环语言模型和 encoder-decoder 模型是当时使用频率较高的两种解决方案。输出结构化信息比较多的情况下会使用 encoder-decoder 架构来解决这类问题(比较通用)。提出了两种模型的问题:

1. 对于语言模型的解决方案通常会使用 RNN 进行学习,第 $t$ 个词的状态由前面的 第 $t-1$ 个词的状态得到。但这个过程是串行的,难以并行地进行运算,性能较差;并且对于早期的状态信息可能会在训练后期丢失(记忆)。
2. encoder-decoder 也是有类似的问题,结构化的信息较多的情况下彼此之间的具有强相关的关系,难以解耦,导致学习的过程比较粗糙,不利于收敛。

将上述的两种结构进行优化,不使用 RNN,而是用 attention 的方式替代,解决无法并行的问题

## Background

传统的 seq2seq 任务中,

## Conclusion

第一个仅用注意力机制实现序列转换模型,将 encoder-decoder 架构中的循环层替换成多头自注意力。对于翻译任务 Transformer 的训练速度也比循环层或卷积层快。
第一个仅用注意力机制实现序列转换模型,将 encoder-decoder 架构中的循环层替换成多头自注意力。对于翻译任务 Transformer 的训练速度也比循环层或卷积层快。收敛速度快。

我们的模型可以应用其他任务上,在任何基于 attention 的模型都是适用的。Transformer 可以应对不同的数据类型的输入都是适用的,例如图像、音频、视频。
我们的模型可以应用其他任务上,在任何基于 attention 的模型都是适用的。Transformer 可以应对不同的数据类型的输入都是适用的,例如图像、音频、视频。
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: Grounded Language-Image Pre-training
tags:
- VLMs
---

# Grounded Language-Image Pre-training

## Abstract

学习对象级、语言感知和语义丰富的视觉表示。GLIP 将目标检测和 phrase grounding 统一起来进行预训练。好处在于:

1. 它允许 GLIP 从检测和接地数据中学习以改进任务并引导良好的接地模型;
2. GLIP 可以通过自我训练的方式生成接地框来利用海量的图像-文本对,使学习的表示语义丰富。

学习的表征对各种对象级识别任务具有很强的零样本和少样本可迁移性,适合用于处理 zero-shot 和 few-shot 任务。实验结果也表明我们效果最好。

## Motivation

提高模型的 zero-shot 和 few-shot 能力,利用目前的 pre-trained 大模型来实现。

## Method how to use?

![Alt text](./src/01.Grounded_Language-Image_Pre-training/image.png)

目标检测任务中的对每个区域进行分类的任务转换成将每个区域对齐到文本 prompt 中的 c 个短语,将视觉检测定义为 grounding task。输入一些 image-text pair,将其融合后使得图像上的物体和文本描述中的 prompt 对应的单词对齐来完成分类的任务。(带检测模块的 CLIP)

1. 定义好新的范式以及如何利用 prompt 作为特征信息的一部分。

2. 设计好对应的 image encoder 和 text encoder。本文使用的 image encoder 为 DyHead (Dynamic Head: Unifying Object Detection Heads with Attentions),使用的 text encoder 为 BERT。

3. 除此之外还要设计一个 cross-modality multi-head attention module (X-MHA)。每个头部通过关注另一个模态来计算一个模态的上下文向量。

4. 最后再准备大量数据进行 pre-training 的训练。

5. 迁移到其他 benchmark 进行验证训练。

## Heuristic Thinking

`GLIP 统一了 phrase grounding 和目标检测任务,因为目标检测可以被视为上下文无关的 phrase grounding,而 phrase grounding 可以被视为上下文化的目标检测任务。`
是否能够利用 phrase grounding 增强其视觉的语义丰富度?(增强 context)

是否可以通过 prompt 提示出 visual feature (ROI feature, union feature, etc.) 中的关系呢,通过设计 prompt?

之前的工作中已经有用 glove 使用其 phrase feature 来提高 zero-shot 的能力。是否可以说明 nlp 当中的模型天生具备比较强的 zero-shot 学习能力呢?
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ RTPB 在训练过程中为模型分配一个针对类别的阻力,其中每一

## Methods

![image-20220902225008558](src/02.Resistance-Training-using-Prior-Bias-toward-Unbiase-Scene-Graph-Generation/image-20220902225008558.png)
![image-20220902225008558](src/01.Resistance-Training-using-Prior-Bias-toward-Unbiase-Scene-Graph-Generation/image-20220902225008558.png)

主要是引入了两种方法,对于信息提取使用 Dual Transformer,对于关系之间的计算使用阻力偏置的方式训练偏置项,用偏置项来优化最后的关系分类结果。

Expand Down Expand Up @@ -179,15 +179,15 @@ $$

- Resistence Bias 的超参数

![image-20220903105545356](src/02.Resistance-Training-using-Prior-Bias-toward-Unbiase-Scene-Graph-Generation/image-20220903105545356.png)
![image-20220903105545356](src/01.Resistance-Training-using-Prior-Bias-toward-Unbiase-Scene-Graph-Generation/image-20220903105545356.png)

- Soft Resistence Bias

![image-20220903105604556](src/02.Resistance-Training-using-Prior-Bias-toward-Unbiase-Scene-Graph-Generation/image-20220903105604556.png)
![image-20220903105604556](src/01.Resistance-Training-using-Prior-Bias-toward-Unbiase-Scene-Graph-Generation/image-20220903105604556.png)

其他 cost-sensitive 方法:

![image-20220903105632704](src/02.Resistance-Training-using-Prior-Bias-toward-Unbiase-Scene-Graph-Generation/image-20220903105632704.png)
![image-20220903105632704](src/01.Resistance-Training-using-Prior-Bias-toward-Unbiase-Scene-Graph-Generation/image-20220903105632704.png)

## Conclusion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ SGG 的目标是生成一个摘要图 $\mathcal G$,以高度一般化给定图

### Overall Framework

![image-20220905130446979](src/03.Stacked-Hybrid-Attention-and-Group-Collaborative-Learning-for-Unbiased-Scene-Graph-Generation/image-20220905130446979.png)
![image-20220905130446979](src/02.Stacked-Hybrid-Attention-and-Group-Collaborative-Learning-for-Unbiased-Scene-Graph-Generation/image-20220905130446979.png)

- Proposal Network

Expand Down Expand Up @@ -246,9 +246,9 @@ $$

表1和表2分别显示了在VG150和GQA200上进行的不同方法的性能。

![image-20220906175828193](src/03.Stacked-Hybrid-Attention-and-Group-Collaborative-Learning-for-Unbiased-Scene-Graph-Generation/image-20220906175828193.png)
![image-20220906175828193](src/02.Stacked-Hybrid-Attention-and-Group-Collaborative-Learning-for-Unbiased-Scene-Graph-Generation/image-20220906175828193.png)

![image-20220906175835499](src/03.Stacked-Hybrid-Attention-and-Group-Collaborative-Learning-for-Unbiased-Scene-Graph-Generation/image-20220906175835499.png)
![image-20220906175835499](src/02.Stacked-Hybrid-Attention-and-Group-Collaborative-Learning-for-Unbiased-Scene-Graph-Generation/image-20220906175835499.png)

我们有以下一些观察结果:

Expand All @@ -265,7 +265,7 @@ $$
- w/o CKD:为了评估 CKD 在 GCL 中的有效性,我们删除了CKD的损失,但保留了所有的分类器来计算PCO的损失。
- w/o CA或w/o SA:为了评估 SHA 的有效性,我们在每个 SHA 层中删除了交叉注意(CA)单元或自我注意(SA)单元。

![image-20220906175816281](src/03.Stacked-Hybrid-Attention-and-Group-Collaborative-Learning-for-Unbiased-Scene-Graph-Generation/image-20220906175816281.png)
![image-20220906175816281](src/02.Stacked-Hybrid-Attention-and-Group-Collaborative-Learning-for-Unbiased-Scene-Graph-Generation/image-20220906175816281.png)

表3为所有消融模型的结果。我们有以下几个观察结果:

Expand All @@ -274,13 +274,13 @@ $$
3. 与 w/o-CKD 相比,我们看到 SHA+GCL 有明显的性能提高。此外,我们还比较了w/o-CKD和SHA+GCL对VG150上每个谓词类的详细精度。如图 5b 所示,CKD 有效地阻止了模型在头部类上牺牲很多东西,并实现了与尾部预测相当的性能。结果表明,“强约束”,即知识转移范式,可以通过保留先前学习到的识别能力,有效地补偿头部类的欠拟合,从而有利于实现合理的权衡。
4. 从表 3 的最后三行中,我们可以看到,无论是在删除 CA 单元还是 SA 单元时,性能都出现了明显的下降。验证了结合两种注意可以有效缓解模态融合不足,从而得到更准确的预测。

![image-20220906175742694](src/03.Stacked-Hybrid-Attention-and-Group-Collaborative-Learning-for-Unbiased-Scene-Graph-Generation/image-20220906175742694.png)
![image-20220906175742694](src/02.Stacked-Hybrid-Attention-and-Group-Collaborative-Learning-for-Unbiased-Scene-Graph-Generation/image-20220906175742694.png)

### 参数分析

如前所述,阈值 $\mu$ 和组织策略会影响 GCL 的效果。如图 6 所示,对于前者,我们设置了 $\mu=3, 4, 5$,并分别得到了 6, 5 和 4 个组的划分。对于后者,我们提供了两种选择,即相邻策略和自上而下策略,它们的区别在于每个分类器是可以从其最近的前任(相邻)还是从所有的前任(自上向下)学习知识。表4给出了性能比较,其中 $\mu=4$ 和自上而下的策略是最好的组合。

![image-20220906175700599](src/03.Stacked-Hybrid-Attention-and-Group-Collaborative-Learning-for-Unbiased-Scene-Graph-Generation/image-20220906175700599.png)
![image-20220906175700599](src/02.Stacked-Hybrid-Attention-and-Group-Collaborative-Learning-for-Unbiased-Scene-Graph-Generation/image-20220906175700599.png)

## Conclusion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ tags:

## Methodology

![image-20220907175030776](src/04.Semantic-Compositional-Learning-for-Low-shot-Scene-Graph-Generation/image-20220907175030776.png)
![image-20220907175030776](src/03.Semantic-Compositional-Learning-for-Low-shot-Scene-Graph-Generation/image-20220907175030776.png)

图 2 说明了我们的整体框架,其中的上半部分通常描述了约定的 SGG 模型,而下半部分显示了我们提出的组合策略。我们的策略可以分为两个阶段:

Expand Down Expand Up @@ -218,7 +218,7 @@ $$

在这三个任务上,类间和类内的组合对模型性能都有积极的贡献,但它们具有不同的任务特定效果。更具体地说,是关于 RR 的主要任务。类内组合优于类间关系,因为测试集中的大部分关系由共同关系组成,只有一小部分关系被训练模型看不到。因此,类内组成在 RR 任务中起着更重要的作用。对于 FR 的任务,由于所有的关系都只有很少的样本,类内策略可以组成许多额外的相同的关系,从而导致显著的改进。

![image-20220908204449065](src/04.Semantic-Compositional-Learning-for-Low-shot-Scene-Graph-Generation/image-20220908204449065.png)
![image-20220908204449065](src/03.Semantic-Compositional-Learning-for-Low-shot-Scene-Graph-Generation/image-20220908204449065.png)

最后,对于简单地评估不可见关系的ZR任务,类间组合精确地创建了新的关系样本,并显示出比类内组合更好的有效性。此外,当我们将相似度度量改为随机策略时,我们可以看到两种组合策略对这三个任务都无效,这证明了我们提出的相似度计算方法是有效的。

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ tags:

为了实现这一目标,我们将 HOI 检测表示为集合预测的形式。在本节中,我们首先讨论将目标检测[2]的 triplet 预测结构直接扩展到 HOI 检测的问题。然后,我们提出了我们的架构 HOTR,它并行地预测了一组 object,并将交互中的人和对象关联起来,而 Transformer 中的自注意力则模拟了交互之间的关系。最后,我们给出了我们的模型的训练细节,包括匈牙利匹配的HOI检测和我们的损失函数。

![image-20221020165828724](src/06.HOTR-End-to-End-Human-Object-Interaction-Detection-with-Transformers/image-20221020165828724.png)
![image-20221020165828724](src/05.HOTR-End-to-End-Human-Object-Interaction-Detection-with-Transformers/image-20221020165828724.png)

### Architecture

Expand All @@ -72,7 +72,7 @@ HOTR的总体结构如图 2 所示。我们的架构的特点是一个 Transform

图 3 说明了 HO 指针如何将来自 instance 解码器和 interaction 解码器的并行预测关联起来的概念性概述。HO指针(即,Human Pointer 和 Object Pointer)包含交互中的人和 object 的相应实例表示的索引。

![image-20221020183721595](src/06.HOTR-End-to-End-Human-Object-Interaction-Detection-with-Transformers/image-20221020183721595.png)
![image-20221020183721595](src/05.HOTR-End-to-End-Human-Object-Interaction-Detection-with-Transformers/image-20221020183721595.png)

在 interaction decoder 转换 $K$ 个 interaction queries 成 $K$ 个 interaction 表征之后,interaction 表征 $z_i$ 传入到两个 FFN 中,分别表示为:$\text{FFN}_h:\mathbb{R}^d\rarr\mathbb{R}^d,\text{FFN}_o:\mathbb{R}^d\rarr\mathbb{R}^d$。为了得到向量 $v_i^h$ 和 $v_i^o$。也就是 $v_i^h=\text{FFN}_h(z_i)$ 和 $v_i^h=\text{FFN}_o(z_i)$。最后得到相似度得分最高的 instance 表征的索引 $\hat c_i^h$ 和 $\hat c_i^o$。
$$
Expand Down Expand Up @@ -187,14 +187,14 @@ HOTR的总体结构如图 2 所示。我们的架构的特点是一个 Transform

我们的 HOTR 在 V-COCO 和 HICO-DET 数据集上实现了一个新的最先进的性能,同时是最快的并行检测器。表 1 显示了我们在同时包含场景 1 和场景 2 的 V-COCO 数据集上的结果。HOTR 在场景 1 中优于最先进的并行 HOI 检测器[30],其边际为 4.2mAP。

![image-20221022142515623](src/06.HOTR-End-to-End-Human-Object-Interaction-Detection-with-Transformers/image-20221022142515623.png)
![image-20221022142515623](src/05.HOTR-End-to-End-Human-Object-Interaction-Detection-with-Transformers/image-20221022142515623.png)

表2显示了每个 Full/Rare/Non-Rare 的默认设置中的 HICO-DET 中的结果。由于 HICO-DET 数据集中的对象的噪声标记,对 HICO-DET 训练集上的预训练对象检测器进行微调提供了一个有利于整体性能[1]的先验。因此,我们评估我们的性能在 HICO-DET 数据集在两个条件下:

1. 使用预先训练的权重 MS-COCO 训练期间冻结(记为 COCO 探测器列)
2. 性能后微调预先训练探测器 HICO-DET 训练集(记为 HICO-DET 探测器列)。在这两种情况下,我们的模型分别比最先进的并行 HOI 检测器优越于 4.1mAP 和 4mAP。

![image-20221022142644323](src/06.HOTR-End-to-End-Human-Object-Interaction-Detection-with-Transformers/image-20221022142644323.png)
![image-20221022142644323](src/05.HOTR-End-to-End-Human-Object-Interaction-Detection-with-Transformers/image-20221022142644323.png)

下面,我们将对我们的性能进行更详细的分析。

Expand All @@ -216,7 +216,7 @@ HOTR的总体结构如图 2 所示。我们的架构的特点是一个 Transform

消融实验结果如下:

![image-20221022142821194](src/06.HOTR-End-to-End-Human-Object-Interaction-Detection-with-Transformers/image-20221022142821194.png)
![image-20221022142821194](src/05.HOTR-End-to-End-Human-Object-Interaction-Detection-with-Transformers/image-20221022142821194.png)

- 是否使用 HO Pointer

Expand Down
Loading

1 comment on commit 3cfe3fe

@vercel
Copy link

@vercel vercel bot commented on 3cfe3fe Oct 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.