LLaVA UHD:一种可感知任意纵横比和高分辨率图像的LMM

news2024/10/7 13:24:50

LLaVA-UHD: an LMM Perceiving Any Aspect Ratio and High-Resolution Images (2024-03-18)

文章概要
作者: Ruyi Xu; Yuan Yao; Zonghao Guo; Junbo Cui; Zanlin Ni; Chunjiang Ge; Tat-Seng Chua; Zhiyuan Liu; Maosong Sun; Gao Huang
期刊: arXiv 预印版
DOI: 10.48550/arXiv.2403.11703
摘要: Visual encoding constitutes the basis of large multimodal models (LMMs) in understanding the visual world. Conventional LMMs process images in fixed sizes and limited resolutions, while recent explorations in this direction are limited in adaptivity, efficiency, and even correctness. In this work, we first take GPT-4V and LLaVA-1.5 as representative examples and expose systematic flaws rooted in their visual encoding strategy. To address the challenges, we present LLaVA-UHD, a large multimodal model that can efficiently perceive images in any aspect ratio and high resolution. LLaVA-UHD includes three key components: (1) An image modularization strategy that divides native-resolution images into smaller variable-sized slices for efficient and extensible encoding, (2) a compression module that further condenses image tokens from visual encoders, and (3) a spatial schema to organize slice tokens for LLMs. Comprehensive experiments show that LLaVA-UHD outperforms established LMMs trained with 2-3 orders of magnitude more data on 9 benchmarks. Notably, our model built on LLaVA-1.5 336x336 supports 6 times larger (i.e., 672x1088) resolution images using only 94% inference computation, and achieves 6.4 accuracy improvement on TextVQA. Moreover, the model can be efficiently trained in academic settings, within 23 hours on 8 A100 GPUs (vs. 26 hours of LLaVA-1.5).
GitHub链接: https://github.com/thunlp/LLaVA-UHD

📜 研究核心


“(1) An image modularization strategy that divides native-resolution images into smaller variable-sized slices for efficient and extensible encoding, (2) a compression module that further condenses image tokens from visual encoders, and (3) a spatial schema to organize slice tokens for LLMs. Comprehensive experiments show that LLaVA-UHD outperforms established LMMs trained with 2-3 orders of magnitude more data on 9 benchmarks.”

(1)一种图像模块化策略,将原生分辨率图像划分为更小的可变大小切片,以实现高效和可扩展的编码,
(2)一个压缩模块,进一步压缩来自视觉编码器的图像标记
(3)一个空间模式,用于组织LLM的切片标记。
综合实验表明,LLaVA-UHD的性能优于已建立的LMM,在9个基准测试中训练了2-3个数量级的数据。

⚙️ 内容

“High-Resolution Image Partition Strategy. The goal of image slicing strategy is to determine a split of high-resolution images, with minimal changes to the resolutions of each slice. Given an image in resolution (WI , HI ) and a ViT pretrained in resolution (Wv, Hv), we first determine the number of slices (i.e., the ideal computation) needed to process the image: N = ⌈ WI×HI Wv×Hv ⌉. Then we factorize the slice number N into m columns and n rows: CN = {(m, n)|m × n = N, m ∈ N, n ∈ N}. To select the most appropriate partition, we define a score function to measure the deviation from the standard pretraining setting of ViT:”

高分辨率图像分区策略。图像切片策略的目标是确定高分辨率图像的拆分,同时对每个切片的分辨率进行最小的更改。给定分辨率(WI,HI)的图像和分辨率预训练的ViT(Wv,Hv),我们首先确定处理图像所需的切片数(即理想计算):N = ⌈ WI×HI Wv×Hv ⌉。然后我们将切片编号 N 分解为 m 列和 n 行:CN = {(m, n)|m × n = N, m ∈ N, n ∈ N}。为了选择最合适的分区,我们定义了一个评分函数来衡量与 ViT 标准预训练设置的偏差:
S ( W I , H I , W v , H v , m , n ) = − ∣ log ⁡ W I × n H I × m − log ⁡ W v H v ∣ , S\left(W_{I}, H_{I}, W_{v}, H_{v}, m, n\right)=-\left|\log \frac{W_{I} \times n}{H_{I} \times m}-\log \frac{W_{v}}{H_{v}}\right|, S(WI,HI,Wv,Hv,m,n)= logHI×mWI×nlogHvWv ,

其中,得分越高 S(·) 表示与 ViT 标准设置的偏差较小,因此,分区可以按如下方式获得:

m ∗ , n ∗ = arg ⁡ max ⁡ ( m , n ) ∈ C ˉ S ( W I , H I , W v , H v , m , n ) , m^*,n^*=\arg\max_{(m,n)\in\bar{\mathbb{C}}}S(W_I,H_I,W_v,H_v,m,n), m,n=arg(m,n)CˉmaxS(WI,HI,Wv,Hv,m,n),

“where the candidate set C¯ = CN. In practice, we notice that in some cases, there might be only a few possible factorization schemes for N , especially for prime numbers, which can lead to limited choices and therefore extreme partitions of images. For example, N = 7 has only two extreme partition choices, 1:7 and 7:1. To address the issue, in addition to the ideal slice number N , we also allow a modest change of slice numbers N − 1, N + 1 to incorporate more plausible partition choices. Therefore, the final partition is given by Equation 2, where C¯ = CN−1 ∪ CN ∪ CN+1.”

其中候选集 C ̄ = CN。在实践中,我们注意到,在某些情况下,N 可能只有几种可能的因式分解方案,尤其是对于素数,这可能导致有限的选择,从而导致图像的极端分区。例如,N = 7 只有两个极端的分区选择,即 1:7 和 7:1。为了解决这个问题,除了理想的切片数 N 之外,我们还允许对切片数 N − 1, N + 1 进行适度的更改,以包含更合理的分区选择。因此,最终的分区由等式 2 给出,其中 C ̄ = CN−1 ∪ CN ∪ CN+1。

“Theoretically, we show that the partition strategy guarantees minor expected changes and modest worst-case changes with respect to standard pretraining resolution (Wv, Hv) for each slice. Specifi- cally, we show that for input images where N ≤ 20 and aspect ratio in [1 : 6, 6 : 1], the aspect ratio of each slice resides within [1 : 2, 2 : 1], and the area of each slice resides within [0.33WI HI , 1.5WI HI ]. We refer readers to Section B for full proof details.”

从理论上讲,我们表明,分区策略保证了每个切片的标准预训练分辨率(Wv、Hv)的微小预期变化和适度的最坏情况变化。具体来说,我们表明,对于 N ≤ 20 且纵横比为 [1 : 6, 6 : 1] 的输入图像,每个切片的纵横比位于 [1 : 2, 2 : 1] 以内,每个切片的面积位于 [0.33WI HI , 1.5WI HI ] 以内。

💡 创新点

“these experimental findings shed light on GPT-4V’s potential vulnerabilities in highresolution image processing, warranting further investigation into the implications of these weaknesses and the development of strategies to counter potential adversarial attacks on LMMs.”

这些实验结果(前置试点实验,可看原始论文)揭示了GPT - 4V在高分辨率图像处理中的潜在弱点,值得进一步研究这些弱点的影响,并开发对抗LMMs潜在对抗攻击的策略。

“Combining the results with the public information from OpenAI, we hypothesize the most likely cause is that, there are overlaps in the slices of GPT-4V when the image resolution is not divisible by 512”

结合实验结果和OpenAI公开信息,我们猜测最有可能的原因是,当图像分辨率不可分割为512时,GPT - 4V的切片存在重叠。

总的来说,针对这些问题,该研究提出一种自适应可变大小的图像分块方法,可处理不同宽高比的图片,其在ViT-L/14(336×336)中,最高分辨率达672 × 1008,最低分辨率达336×336。同时为减低图像Token增加所带来的平方级复杂度增加,采用交叉注意力将图像Token数量重新采样到合适的范围,此外,压缩策略不仅减低了高分辨图像输入的计算成本,同时进一步促使ViT原始要求分辨率图像输入的计算成本。

在适应LLM模型输入方面,还有一个问题需要解决,不同宽高比图像的划分是动态的,如何将这种动态信息合理地告知?该研究采用一个简单的方案:使用 “,” 分隔一行中的切片表示,并使用 “\n” 分隔不同的行。

🧩 不足

分辨率限制:最高分辨率达672 × 1008,最低分辨率达336×336(ViT预训练尺寸)

图像切片独立编码,仅在LLM存在相互作用,并未在视觉编码层建立有效链接作用

🔁 研究内容


💧 数据

“We adopt 9 popular benchmarks to evaluate our model, including: (1) General visual question answering benchmarks such as VQA-V2 [4], GQA [18], ScienceQA [30], and VizWiz [15]; (2) Optical character based visual question answering benchmark such as TextVQA [36]; (3) Hallucination benchmark such as POPE [22]; (4) Comprehensive benchmarks such as MME [14], MMBench [29], and MMBench-CN [29].”

(1) 通用视觉问答基准,如 VQA-V2 [4]、GQA [18]、ScienceQA [30] 和 VizWiz [15];

(2)基于光学字符的视觉问答基准,如TextVQA [36];

(3)幻觉基准,如POPE[22];

(4)MME[14]、MMBench[29]、MMBench-CN[29]等综合基准测试。评估指标。

除了在流行基准测试中的性能外,我们还报告了在支持的最大分辨率下处理图像的计算成本 (TFLOP)。计算成本由视觉编码器、投影仪和 LLM 汇总而来。我们还报告了累积的多模态训练数据量以供参考,其中包括相关和指令调整期间使用的图像-文本对。对于在现有多模态模型上作为主干进行后训练的模型,这也包括主干的训练数据基线。

🔬 实验

“(1) General baselines. We adopt Qwen- VL [5], LLaVA-1.5 [27], MiniGPT-v2 [7], Shikra [8], BLIP-2 [21] and InstructBLIP [11] as representative general baselines. Since the implementation of LLaVA-UHD is highly aligned with LLaVA-1.5, it serves as the most direct baseline. (2) High-resolution LMMs. SPHINX [24] and mPLUG-Owl2 [43] encode images in fixed resolutions; Ureader [42] and Monkey [23] support enumerated resolution types (several predefined fixed-shape slices); Fuyu-8B [6] and OtterHD-8B [20] can encode images in any resolutions.”

(1)一般基线。我们采用 Qwen-VL [5]、LLaVA-1.5 [27]、MiniGPT-v2 [7]、Shikra [8]、BLIP-2 [21] 和 InstructBLIP [11] 作为具有代表性的一般基线。由于 LLaVA-UHD 的实现与 LLaVA-1.5 高度一致,因此它是最直接的基线。

(2)高分辨率LMM。 SPHINX [24]和mPLUG-Owl2 [43]以固定分辨率对图像进行编码;Ureader [42] 和 Monkey [23] 支持枚举分辨率类型(几个预定义的固定形状切片);Fuyu-8B [6] 和 OtterHD-8B [20] 可以对任何分辨率的图像进行编码。

请添加图片描述

消融实验

“Ablation Study. In Table 2, we conduct ablation studies on alternative components. (1) We replace the padding strategy of LLaVA-1.5 with the adaptive encoding strategy of LLaVA-UHD, supporting arbitrary aspect ratios while maintaining identical maximum resolutions. We can observe consistent improvement since wasted computation from padding is avoided. (2) We replace the perceiver resampler of LLaVA-UHD with the 2-layer MLP of LLaVA-1.5. We observe that perceiver resampler achieves comparable or better performance than MLP, using only 12.9% computation cost. (3) We further replace the LLaVA-UHD image partition strategy with the naive partition strategy [24] (i.e., fixed 2 × 2 slices).”

在表2中,我们对替代成分进行了消融研究。

( 1 )我们将LLaVA - 1.5的填充策略替换为LLaVA - UHD的自适应编码策略,在保持相同的最大分辨率的同时支持任意的纵横比。由于避免了从填充中浪费的计算,我们可以观察到持续的改进。

( 2 )将LLaVA - UHD的感知重采样器替换为LLaVA - 1.5的2层MLP。我们观察到感知重采样器取得了与MLP相当或更好的性能,仅使用了12.9 %的计算开销。

( 3 )我们进一步将LLaVA - UHD图像划分策略替换为朴素划分策略[ 24 ] (即固定2 × 2切片)。

请添加图片描述

表3:对极端宽高比图像的实验结果。报告了与表2中标准基准相比的绝对性能和退化情况。

表4:视觉编码器在不同训练阶段的调优效果。

请添加图片描述

📜 结论

“We report the main experimental results in Table 1, from which we have the following observations: (1) LLaVA-UHD outperforms strong baselines on popular benchmarks. This includes strong general baselines trained on 2-3 orders of magnitude more data such as Qwen-VL and InstructBLIP, and also high-resolution LMMs that require significantly more computation such as Fuyu-8B, OtterHD-8B, Monkey and SPHINX-2k. The results show that LLaVA-UHD can properly deal with native-resolution images for strong performance, as well as good data and computation efficiency. (2) LLaVA-UHD achieves significant improvements over the LLaVA-1.5 backbone. Notably, by simply perceiving images in native high-resolution, LLaVA-UHD achieves 6.4 accuracy improvement on TextVQA and 3.2 accuracy improvement on POPE. The reason is that the blurred content in low-resolution images can prevent LMMs from accurately identifying the challenging fine-grained objects and optical characters. The results demonstrate the fundamental role of perceiving native high-resolution images in various multimodal tasks, and the effectiveness of LLaVA-UHD in addressing the problem. (3) In terms of resolution and efficiency, compared with LLaVA-1.5 associated fixed 336 × 336 resolution, LLaVA-UHD supports 672×1088 resolution images in any aspect ratio using only 94% inference computation. The”

在表1中报告了主要的实验结果,从中,我们得到了以下观察结果:

(1)LLaVA-UHD在流行的基准测试中表现优于强大的基线。这包括在 Qwen-VL 和 InstructBLIP 等 2-3 个数量级的数据上训练的强大通用基线,以及需要更多计算的高分辨率 LMM,例如 Fuyu-8B、OtterHD-8B、Monkey 和 SPHINX-2k。结果表明,LLaVA-UHD能够正确处理原生分辨率图像,具有较强的性能,以及良好的数据和计算效率。

(2)LLaVA-UHD在LLaVA-1.5骨干网的基础上取得了显著的改进。值得注意的是,通过简单地感知原生高分辨率的图像,LLaVA-UHD 在 TextVQA 上实现了 6.4 的精度提升,在 POPE 上实现了 3.2 的精度提升。原因是低分辨率图像中的模糊内容会阻止LMM准确识别具有挑战性的细粒度物体和光学字符。结果表明,感知原生高分辨率图像在各种多模态任务中发挥了重要作用,LLaVA-UHD在解决该问题方面具有有效性。

(3)在分辨率和效率方面,与LLaVA-1.5相关的固定336×336分辨率相比,LLaVA-UHD仅使用94%的推理计算,支持任意宽高比的672×1088分辨率图像。结果表明,LLaVA-UHD在未来可能具有更大的分辨率。

💭 思考启发

部分大型多模态语言模型存在一定的视觉幻觉问题一部分原因来自对于图像编码的处理策略问题之上。图像编码策略如果采用重叠图片块,可能导致类似于图片物品计数问题的出错,而其他对于图片进行变形操作的策略,更会导致模型对于图片小目标、低分辨率的误判。合理且适应多种分辨率的图像编码策略是有必要的。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1684437.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Python 全栈体系【四阶】(五十二)

第五章 深度学习 十二、光学字符识别(OCR) 2. 文字检测技术 2.1 CTPN(2016) 2.1.1 概述 CTPN全称Detecting Text in Natural Image with Connectionist Text Proposal Network(基于连接文本提议网络的自然图像文本…

uniappx 安卓保活(多种技术;UTS版) Ba-KeepAlive-U

简介(下载地址) Ba-KeepAlive-U 是一款android原生保活插件,UTS版本(同时支持uniapp和uniappx),支持市面上大部分机型,Android4.4到Android14(**注意:**不保证支持所有机…

Go-zero(api部分)

目录 api的语法: type:用于定义请求/响应体 service:定义HTTP服务 server:控制生成HTTP服务时候的meta信息 根据api文档生成最小HTTP服务 目录结构 api响应封装 api的语法: 首先定义一个api文档 type&#xff…

电磁兼容(EMC):时钟电路PCB设计

目录 1. 布局 2. 布线 时钟电路做为产品内部的强辐射源,在设计阶段已经选用展频或者分频方案后,见另外接下来就需要对PCB的耦合路径进行规划设计。时钟电路具体的PCB设计具体要求如下: 1. 布局 结构干涉:时钟电路的晶振和法拉电…

K8s之ku-be admin部署安装

目录 一、环境配置 1、机器部署 2、部署大致流程 二、实验环境配置 1、所有节点关闭防火墙核心防护以及关闭swap交换 2、所有节点安装docker 3、所有节点安装kubeadm,kubelet和kubectl 4、部署K8s集群 5、设定kubectl 6、所有节点部署网络插件flannel 7、…

身份证实名认证API接口对接流程

该接口传入姓名、身份证号,核验二要素是否一致,返回生日、性别、籍贯等信息。 应用于各类线上平台和服务的身份认证验证,以保障用户信息的真实性和交易的安全性。 首先找到提供接口的平台供应商,注册账号后获取免费套餐&#xff…

正点原子[第二期]Linux之ARM(MX6U)裸机篇学习笔记-16讲 EPIT定时器

前言: 本文是根据哔哩哔哩网站上“正点原子[第二期]Linux之ARM(MX6U)裸机篇”视频的学习笔记,在这里会记录下正点原子 I.MX6ULL 开发板的配套视频教程所作的实验和学习笔记内容。本文大量引用了正点原子教学视频和链接中的内容。…

Php composer 基础教程

一、什么是Composer? Composer 是 PHP 中的依赖管理工具。它允许声明项目所依赖的库,并且它将为您管理(安装/更新)它们。 二、如何安装? Linux 系统和 MacOS 系统 直接下载最新稳定版: 然后执行下列命令&…

nss刷题(关于ssti)

1、[HNCTF 2022 WEEK2]ez_SSTI 首先是注入${7*7}没有回显出49的情况,再次注入{{7*7}}如果还是没有回显49就代表这里没有模板注入;如果注入{{7*7}}回显了49代表执行成功,继续往下走注入{{7*7}},如果执行成功回显7777777…

图生代码,从Hello Onion 代码开始

从Hello Onion 代码开始 1,从代码开始 原生语言采用java 作为载体。通过注解方式实现“UI可视化元素"与代码bean之间的映射. 转换示例 2,运行解析原理 在执行JAVA代码期间,通过读取注解信息,转换为前端的JSON交由前端JS框…

【linux性能分析】perf分析CPU占用详情

文章目录 1. 如何使用perf工具1.1 perf安装1.2 首次使用perf报错1.3 添加测试程序1.4 编译并执行指令生成perf.data文件1.5 添加-g选项能查看call graph调用信息1.6 查看perf.data1.7 perf工作流1.8 sudo perf record -F 99 -p 2512 -g -- sleep 60 2. 如何生成火焰图2.1 安装火…

技术前沿 |【自回归视觉模型ImageGPT】

自回归视觉模型ImageGPT 引言一、ImageGPT的基本原理与创新之处二、ImageGPT在图像生成、理解等视觉任务上的应用三、ImageGPT对后续视觉Transformer模型发展的影响四、ImageGPT的深入应用 引言 在人工智能的飞速发展中,视觉模型作为其中一个重要的分支&#xff0c…

Qt运行时,如何设置第一个聚焦的控件

问题:Qt第一个聚焦的控件,如何自行设置? 尝试: 1.在代码中设置 lineEdit->setFocus() 。无效! 2.Qt Designer–打开form1.ui–菜单栏下一行–Edit Tab Order–按顺序点击–菜单栏下一行–Edit Widgets–退出。无效…

JDBC、datasource、数据库驱动、持久层框架之间的区别

1、jdbc Java Database Connectivity(JDBC)是Java平台下的一个标准API,它定义了一组用于连接各种数据库系统、执行SQL语句和处理结果集的接口和类。使用JDBC API,开发人员可以编写能够访问不同数据库系统的应用程序,而…

react组件传参 父传子可以传字符串,布尔值,数组,对象,jsx,

在react中&#xff0c;父传子组件 props的灵活性是很强大的&#xff0c;可以传字符串&#xff0c;布尔值&#xff0c;数组&#xff0c;对象&#xff0c;jsx&#xff0c; function Son(props) {console.log(props,"props的值")return(<div>这是儿子组件 {props.…

论文精读-SRFormer Permuted Self-Attention for Single Image Super-Resolution

论文精读-SRFormer: Permuted Self-Attention for Single Image Super-Resolution SRFormer:用于单图像超分辨率的排列自注意 Params&#xff1a;853K&#xff0c;MACs&#xff1a;236G 优点&#xff1a; 1、参考SwinIR的RSTB提出了新的网络块结构PAB&#xff08;排列自注意力…

非授权人员进入报警系统

非授权人员进入报警系统基于智能视频分析技术和深度学习技术&#xff0c;非授权人员进入报警系统通过现场已经装好的监控摄像头针对人体进行精准检测&#xff0c;并根据设置的禁入区范围进行判断。通过图像处理和人体识别算法&#xff0c;非授权人员进入报警系统可以在实时监测…

适用于当下的红色系统可视化大屏,大量图。

特定场合下使用红色系可视化大屏是可以的&#xff0c;但是千万要注意时间和场合&#xff0c;平时最好别用。

【Linux系统】文件与基础IO

本篇博客整理了文件与文件系统、文件与IO的相关知识&#xff0c;借由库函数、系统调用、硬件之间的交互、操作系统管理文件的手段等&#xff0c;旨在让读者更深刻地理解“Linux下一切皆文件”。 【Tips】文件的基本认识 文件 内容 属性。文件在创建时就有基本属性&#xff0…

简单快捷的图片格式转换工具:认识webp2jpg-online

经常写博客或记笔记的朋友们可能会碰到图床不支持的图片格式或图片太大需要压缩的情况。通常&#xff0c;我们会在浏览器中搜索在线图片格式转换器&#xff0c;但这些转换器往往伴有烦人的广告或要求登录&#xff0c;并且支持的转换格式有限。最近&#xff0c;我在浏览 GitHub …