ARTICLE DETAIL

资讯详情

深耕网站建设、视觉设计与SEO优化的一线实战洞察。

GLaMM

GLaMM 最值得抓住的一条主线language generation pixel grounding即模型一边生成自然语言一边把语言里提到的实体/短语直接绑定到图像中的像素级区域。论文并不是单纯“LLM 后面接一个 SAM”而是专门设计了一套语言 token → 分割 prompt → mask的连接机制把“说什么”和“分哪里”统一到同一次生成过程中。1. 论文想解决什么问题1缺少pixel-level grounding以前的多模态大模型如 LLaVA、MiniGPT-4 等主要解决的是image → language输入一张图问“这张图里有什么”模型回答“一栋白色建筑红色屋顶周围有草坪和树木。”模型虽然“说对了”但没有说“建筑”、“红色屋顶”、“草坪”、“树木”具体在哪些像素有语言理解但语言和图像空间没有真正绑定。2缺少自然语言生成和复杂对话能力传统 segmentation 模型如 SAM可以输出 mask但不具备自然语言生成和复杂对话能力。GLaMM 想做的就是既让模型会说又让它知道自己说的东西到底对应图像中的哪一片像素。2. GLaMM 最核心的输出形式可以把 GLaMM 想成LMM segmentation decoder但不是简单并列是通过特殊 token 联系起来。如模型生成A pman/pSEG and a pboy/pSEG sit on a pbench/pSEG.这里有两个非常重要的概念1p ... /p表示这个文本片段是需要被视觉 grounding 的 phrase。如pman/p表示“man”这个短语需要对应图像中的某个区域。2SEG表示请为前面这个 phrase 生成一个 segmentation mask。论文在 GCGGrounded Conversation Generation输出表示中采用p、/p和SEG这些特殊 token用来把语言片段和对应的区域 mask 联系起来。整个生成过程可以理解成生成语言 → 遇到SEG→ 同时触发像素级分割。这就是 language generation 和 pixel grounding 最直接的接口。grounding 是“建立文本和视觉区域之间的对应关系”生成 mask 是“把这个对应关系具体落实成像素级区域”。比如一句话pman/pSEG这里可以拆成两件事pman/p“man”是一个需要被定位到图像中的 phrase也就是要 grounding。SEG要求模型进一步输出这个 “man” 对应的像素级 segmentation mask。grounding 找到“这个词说的是图里的谁/哪里”mask generation 把“哪里”精确到每一个像素grounding 可以用很多方式表达如bounding box、point、region、segmentation mask因此grounding 是一个更大的概念mask 只是 grounding 的一种更精细的表示形式。GLaMM 里做的是pixel-level grounding所以最终 grounding 的结果就是 segmentation mask。也就是说这篇论文里两者关系可以写成grounding 是目标mask 是实现 grounding 的像素级形式。3. 整个 GLaMM 架构论文把 GLaMM 分为五个核心组件Global Image EncoderRegion EncoderLLMGrounding Image EncoderPixel Decoder可以简单画成┌───────────────┐ Image ────────────► Global Encoder │ └───────┬───────┘ │ ▼ LLM │ natural language tokens │ SEG │ ▼ L-P Projection │ ▼ Image ───► Grounding Image Encoder ───► Pixel Decoder │ ▼ Mask这里真正完成统一的是中间这一条LLM hidden state ofSEG→ segmentation prompt → Pixel Decoder4. language generation语言部分先用一个全局图像编码器ViT-H/14 CLIP将输入图像编码成视觉特征。记为然后通过一个Vision-to-Language projection layerV-L projection把视觉特征映射到 LLM 的语言特征空间。最后 LLM 同时接收image features 和 text instruction并生成文本Image ↓ CLIP ↓ Visual features ↓ V-L Projection ↓ LLM embedding space ↓ LLM ↓ language tokens这一部分跟普通 LMM 很像。如Image “Describe this image.” ↓ LLM ↓ “A large hot air balloon is flying over the river...”因此单看这一部分GLaMM 本质上仍然是一个 image-conditioned language model。5. pixel grounding为了得到像素级 maskGLaMM另外引入Grounding Image Encoder、Pixel DecoderGrounding Image Encoder 用pretrained SAM encoderPixel Decoder 用类似 SAM decoder 的架构。Image → SAM image encoder → dense visual feature map这套视觉特征与 CLIP 的作用完全不同。CLIP 主要负责“图里有什么”SAM image encoder 主要负责“这些东西具体在哪些像素”可以粗略理解成CLIP feature → semantic understanding SAM feature → spatial / pixel representation6. 语言是怎么变成 segmentation mask 的GLaMM 在 LLM 的 vocabulary 里面新增了一个SEGtoken如用户问Please segment the man in red.LLM 可能生成Sure, it is SEG.这里的SEG不是普通 token。模型取出SEG在 LLM 最后一层对应的 hidden embedding然后通过一个Language-to-Prompt ProjectionL-P projection记作把语言 embedding 映射到 segmentation decoder 能理解的 prompt space。最后其中LLM 中SEGtoken 的 hidden statelanguage-to-prompt projectionSAM grounding image encoder 特征Ppixel decoderM最终 segmentation mask论文就是这样定义 pixel-level grounding 的。整个核心过程其实可以压缩成language meaning ↓ SEG hidden state ↓ L-P projection ↓ segmentation prompt ↓ SAM-like mask decoder ↓ pixel mask这就是language generation pixel grounding 的真正连接点。7. 为什么SEGhidden state 能表示“要分割谁”假设模型生成A pred car/pSEG虽然SEG本身只是一个 token但它前面的 language context 是A red carTransformer 的 self-attention后SEG的 hidden state 并不是“SEG 这个符号”的静态 embedding。它实际上已经吸收了上下文信息red、car、当前图像内容、前面所有文本、多模态视觉信息所以可以理解成“当前这次 segmentation 到底应该找什么”的语义表示。如pred car/pSEG得到一个 hidden staterepresentation of: “the red car referred to in this image”而pperson wearing blue/pSEG得到的是另一个 hidden staterepresentation of: “the person wearing blue”然后 L-P projection 把这个语言语义表示变成 SAM decoder 能理解的 prompt。所以本质上LLM 负责决定“要找什么”SAM decoder 负责决定“它具体在哪”。8. 这与直接使用文本 prompt 做 segmentation 有什么区别与“ 把‘red car’直接输入 SAM 吗”的区别SAM 原始的 prompt 主要是point、box、mask并不是复杂自然语言。而 GLaMM 是整段自然语言上下文 ↓ LLM ↓ SEG contextual hidden state ↓ projection ↓ SAM decoder prompt所以真正送给 decoder 的不是字符串red car而是已经经过 LLM 多模态推理后的语义 embedding。因此理论上它可以表达更复杂的东西。如the smaller cup它不是单纯类别“cup”。模型需要理解cup multiple cups size comparison which one is smaller然后SEGhidden state 承载这个经过上下文消歧后的语义再交给 pixel decoder。论文的 Figure 5 就展示了类似的多轮对话先问“Can you segment the McDonalds cup?” 然后继续问“Can you please segment the smaller cup now?”说明 segmentation target 可以受到对话上下文影响。9. “统一”到底统一在哪里这里可以分成三个层次理解。第一层输出形式统一传统VLM: image → text Segmentation: image prompt → maskGLaMMimage text → language sequence segmentation masks即文本和 mask 出现在同一个 response 里。第二层语义表示统一更关键的是mask 的 prompt 来自 LLM 的 token hidden state。也就是说语言模型中的语义直接变成视觉分割的 prompt所以 language space 和 segmentation space 被连接起来LLM language space ↓ L-P projection ↓ segmentation prompt space这才是架构意义上的统一。第三层任务统一GLaMM 提出的Grounded Conversation Generation, GCG更进一步。它不再把这些任务分别处理captioning、referring segmentation、phrase grounding、region understanding、conversation而是统一成image natural language interaction ↓ grounded natural language response例如A manSEG and a boySEG sit on a benchSEG next to an old white carSEG.一句 caption 本身同时完成image captioning、phrase grounding、segmentation、dense scene understanding10. 两套 image encoderGlobal Image EncoderCLIP ViT-H/14Image → CLIP → high-level semantic features → LLM主要服务language generation / scene understanding如“这里有一栋建筑旁边有树。”Grounding Image EncoderSAM encoderImage → SAM encoder → dense spatial feature map → mask decoder主要服务pixel grounding如“建筑到底是哪几个 pixel。” 所以可以把它理解为┌── semantic branch ──► language Image ────┤ └── spatial branch ───► segmentation而SEGhidden state 是连接这两个 branch 的桥梁。SEGhidden state 把 LLM 中“要分割什么”的语义信息传递给 Pixel Decoder让像素分支知道应该在图像中寻找哪个目标。11. Region Encoder除此之外还有一个Region Encoder。它解决的是用户指出某个区域让模型理解这个区域。如Can you describe this region?然后用户给一个 bounding box。GLaMM 会CLIP intermediate features ↓ feature pyramid ↓ RoIAlign ↓ region feature ↓ V-L projection ↓ LLM论文用四个CLIP层构建hierarchical feature pyramid再通过RoIAlign得到的区域特征。所以 GLaMM 实际上有三个粒度对应三个encoderScene-level → Global Image Encoder Region-level → Region Encoder Pixel-level → SAM encoder Pixel Decoder这也是这篇论文设计很完整的一点。12. GCG 任务为什么重要作者认为只做“segment the dog”还不能真正体现 LMM 的优势。因为这实际上还是传统 referring segmentation。所以他们提出了Grounded Conversation GenerationGCG要求模型生成自然语言同时把语言中重要的 phrase 都对应到 mask。例如A man and a boy sit on a bench next to an old white car.不只是输出这句话而是变成pA man/pSEG and pa boy/pSEG sit on pa bench/pSEG next to pan old white car/pSEG每个SEG都有自己的 pixel mask。所以 GCG 实际上要求语言生成过程中持续发生 grounding。而不是先生成整句话再用另一个模型去 phrase grounding13. 怎么理解它的“统一”语言负责语义分割负责空间SEGtoken 负责桥接。更具体一点Image semantic features ↓ LLM ↓ “what should be segmented?” ↓ SEG hidden state ↓ L-P projection ↓ segmentation prompt ↓ SAM visual features ↓ Pixel Decoder ↓ “where is it?”LLM 解决 WHATSAM-like decoder 解决 WHERE。但是二者不是独立运行而是通过SEG的 contextual representation 连接。14. 和之前看的 LISA 有什么关系如果之前已经理解了 LISA那么 GLaMM 就很好理解。LISA 的核心也是LLM → SEG → hidden embedding → SAM decoder → maskGLaMM 延续了这个核心范式但做得更进一步LISA 更偏 reasoning segmentation / referring segmentationquestion → determine target → one segmentation mask而 GLaMM 把它扩展成自然语言生成 多个 phrase 多个 masks region input multi-turn conversation所以从任务上看LISAlanguage → mask而 GLaMM 更强调language generation ↔ pixel grounding也就是在一整段自然语言生成过程中可以不断插入 grounding。15. 有一个值得注意的地方虽然论文称之为“统一”但是从 architecture 上看其实不是一个完全统一的视觉表示模型。因为仍然有CLIP image encoder SAM image encoder两套视觉 backbone。所以更准确地说GLaMM 统一的是 language generation 和 segmentation 的交互接口与训练目标而不是彻底统一底层视觉表示。也就是说它做的是language representation ↓ shared semantic interface ↓ pixel decoder而不是one universal representation simultaneously generates text and pixels这个区别对你后面看更现代的 pixel-grounded VLM 很重要。16. 最后给一个最精炼的理解如果只记住这篇论文的核心机制建议记这条链Image ↓ CLIP → LLM → natural language ↓ SEG ↓ SEG hidden state ↓ L-P projection ↓ Image → SAM Encoder → Pixel Decoder ↓ mask所以所谓language generation pixel grounding真正实现统一的关键就是让 LLM 在生成语言时产生一个特殊SEGtoken并把该 token 的上下文化 hidden state 当成 segmentation prompt送入 SAM-like pixel decoder从而让“生成的语言语义”直接驱动“对应目标的像素级分割”。而 GCG 则进一步把这种机制扩展到一段自然语言中的多个 phrasephrase₁ → SEG₁ → mask₁ phrase₂ → SEG₂ → mask₂ phrase₃ → SEG₃ → mask₃ ...因此GLaMM 的真正贡献可以理解为不再让模型只回答“图里是什么”而是让模型在回答“是什么”的同时也回答“它在哪里”。网络结构图解释这张图基本就是把 GLaMM 的三层能力串起来了scene-level understanding → region-level understanding → pixel-level grounding它最核心的主线还是图像/区域 → LLM 生成语言 → 语言中的特定语义再去驱动 mask 生成。左侧输入模型接收一张图像同时也可额外接收用户指定的区域比如图中的红框区域。整张图像会先送入Global Image Encoder提取全局视觉语义如果用户还指定了某个 region这个区域会通过Region Encoder得到更细粒度的区域特征。Global Image Encoder看整张图是什么场景。Region Encoder重点看用户圈出来的这一块是什么。这些图像特征和区域特征会形成Image-region prompts。但由于视觉和语言空间的特征维度、语义分布不同这些特征不能直接送进 LLM要经过V-LVision-to-Languageprojectionvisual features → LLM 能理解的 language-space embeddings于是 LLM 接收到的输入就可以写成图像特征 / 区域特征 用户文本问题 → LLM例如图里的问题Can you give a detailed description of this image?LLM 就可以生成A large, colorful hot air balloon is flying over the river.The sky is overarching the river, trees, and buildings.到这里为止和普通 VLM 比较接近图像 → 语言生成。真正体现 GLaMM 特点的是右半部分Grounding Image Encoder Pixel Decoder。同一张原始图像还会走另一条视觉分支Image → Grounding Image Encoder → dense image featuresGrounding Image Encoder 使用适合像素级定位的视觉编码器负责保留更细致的空间信息为后面生成 segmentation mask 做准备。两套 encoderGlobal Image Encoder → 偏语义理解 → 给 LLM 用 Grounding Image Encoder → 偏空间 / 像素信息 → 给 Pixel Decoder 用接下来就是整张图最重要的连接L-PLanguage-to-Promptprojection。LLM 在生成语言时如果某个 phrase 需要对应到图像区域比如hot air balloon、river、sky、trees、buildings模型为需要 grounding 的内容产生相应的 segmentation-related token本质上就是SEG。LLM 中SEG对应的 hidden embedding包含了当前语言上下文的语义比如“我要找的是那个 hot air balloon”再通过L-P projection把语言 embedding 转成 Pixel Decoder 可接受的 prompt embedding。所以右侧可以理解为LLM → SEG hidden state → L-P projection → Output prompt → Pixel Decoder而 Pixel Decoder 同时还接收Grounding Image Encoder 提取的图像特征于是最终它做的是“我要找什么” “整张图每个位置长什么样” ↓ Pixel Decoder ↓ segmentation mask语言负责告诉 decoder找谁。Grounding Image Encoder 负责告诉 decoder图像空间在哪里。这两者共同决定最终的 mask。把整条主流程压缩一下就是┌→ Global Image Encoder Image ──────────────────┤ │ ↓ │ V-L projection │ ↓ Text question ───────────────→ LLM ↓ language response ↓ SEG ↓ L-P projection ↓ mask prompt ↓ Image → Grounding Image Encoder → Pixel Decoder ↓ mask这里V-L和L-P是两个非常关键、方向相反的桥梁V-L: Vision → Language 让 LLM 看懂图像 L-P: Language → Prompt 让 segmentation decoder 看懂语言意图可以把 GLaMM 的整个结构理解成一个闭环Vision → Language → Pixel这也正是它把 language generation 和 pixel grounding 统一起来的地方。再看图下方的几个任务会更容易理解为什么设计成这样。Image Level Captioning只需要Global Image Encoder → LLM → text不需要生成 mask。Region Level Captioning则多了用户指定区域Image → Region Encoder → LLM → region description比如用户框住热气球问Could you tell me more about this region?模型回答A yellow, red and blue hot air balloon.Referring Expression Segmentation则正好反过来“segment the balloon” ↓ LLM ↓ SEG ↓ L-P projection ↓ Pixel Decoder ↓ balloon mask这时候语言只是为了确定目标最终主要输出 mask。Phrase Grounding则是“A hot air balloon over the river”要分别把 hot air balloon、river 对应到图像中的区域所以一段文本中可能产生多个 grounding。而图中央橙色框里的Grounded Conversation GenerationGCG其实就是把这些能力全部合在一起。生成一句自然语言A large, colorful hot air balloon is flying over the river. The sky is overarching the river, trees, and buildings.同时其中多个 phrasehot air balloon、river、sky、trees、buildings都可以产生各自的 segmentation mask。所以它不是生成一句话然后另一个模型再去分析这句话然后再分割而是更接近LLM 一边生成 ↓ 遇到需要 grounding 的 phrase ↓ 产生 SEG ↓ 立刻把对应 hidden state 送给 Pixel Decoder ↓ 生成对应 mask这就是图里所谓的interleaved language and masks。如果你现在在读这篇论文我建议你重点记住这四个模块之间的分工模块主要作用Global Image Encoder提供整图高级语义Region Encoder提供用户指定区域的细粒度语义LLM理解问题、生成语言、确定要 grounding 的概念Grounding Image Encoder Pixel Decoder把语言概念落实到具体像素两个 projection 就是整个系统的桥V-L图像语义进入语言模型。L-P语言语义进入分割模型。这张结构图最核心的一句话就是GLaMM 先让视觉信息进入 LLM 完成语义生成再把 LLM 中与 grounding 相关的语义表示转成 segmentation prompt由像素解码器输出 mask。也就是Image → Language → Pixel。
返回列表