Retrieval-Augmented-Visual-Question-Answering

Retrieval-Augmented-Visual-Question-Answering

细粒度后期交互多模态检索视觉问答系统

这个项目开发了一个基于细粒度后期交互多模态检索的视觉问答系统。系统在OK-VQA等多个基准数据集上实现了先进的检索和问答性能。它采用模块化架构,包含预训练映射网络、FLMR检索器和BLIP2读取器等关键组件。项目提供完整的代码库,支持训练和评估,并发布了预训练模型和处理后的数据集,便于研究人员进行后续研究。

FLMR视觉问答多模态检索预训练模型基准测试Github开源项目

Retrieval-augmented Visual Question Answering with Fine-grained Late-interaction Multi-modal Retrieval

PWC PWC PWC PWC

This is the official repository of the Retrieval Augmented Visual Question Answering (RAVQA) project. The project covers RAVQA and RAVQA-v2 (equipped with Fine-grained Late-interaction Multi-modal Retrieval).

🔥🔥News

  • [10/08/2024] We received many requests regarding adding multilingual abilities to PreFLMR. We announce that we are now training the Chinese version of PreFLMR and will release it very soon. Stay tuned!
  • [05/06/2024] 🔥🔥🔥The PreFLMR paper has been accepted to appear at ACL 2024! The camera-ready version of the paper has been updated here to include more details and analyses. Along with the acceptance, we have made some important updates to help you use the model and extend your research easier:
    • Added an evaluation script that reproduces the results in the PreFLMR paper here
    • Added the updated benchmark results with the transformer implementation here
    • Added an example script to fine-tune PreFLMR on a custom retrieval dataset here
    • IMPORTANT: fixed the OVEN data splits in the M2KR benchmark, and updated each entry with a fixed instruction to ensure the evaluation result is not affected by random sampling of instructions. Please delete your local cache and download the dataset again.
  • [13/04/2024] 🔥 We highlight another valuable and concurrent research on training instruction-following, universal, multi-task multi-modal retrievers: UniIR: Training and Benchmarking Universal Multimodal Information Retrievers, which was done by the researchers of the University of Waterloo. They also shared the M-Beir benchmark which can be used to train and evaluate multi-modal universal information retrievers. In the near future, we may collaborate to combine the two benchmarks together to facilitate the advance of this field.
  • [06/03/2024] 🔥🔥🔥The implementation based on huggingface-transformers is now available here!
  • [20/02/2024] 🔥🔥🔥 The PreFLMR project page has been launched! Explore a captivating demo showcasing PreFLMR_ViT-G, our largest model yet. Additionally, access pre-trained checkpoints and the M2KR benchmark, designed for assessing general-purpose knowledge retrievers. Stay tuned as we will soon upload a huggingface-compatible implementation along with example scripts for indexing and retrieval, providing effortless access via FLMRModelForRetrieval.from_pretrained(...).
  • [14/02/2024] 🔥Our follow-up work, PreFLMR, is now available here! PreFLMR is a general-purpose retriever that was pre-trained on more than ten million multi-modal retrieval data and achieved strong performance across a wide range of knowledge-intensive tasks. It can also serve as a strong foundation retrieval model that can be fine-tuned to fit any downstream retrieval tasks. We will release the model through huggingface-transformers very soon, which allows quick deployment in minutes.
  • [31/01/2024] 🔥We are happy to announce that the training and testing code for FLMR is now released! For the legacy RAVQA-v1 and the code for FVQA, please checkout to legacy_v1 or tag v1.0. We are also preparing a new FLMR implementation for Huggingface transformers, which will be released as plug-in-and-play models.🔥
  • [03/10/2023] Our follow-up work "Fine-grained Late-interaction Multi-modal Retrieval for Retrieval Augmented Visual Question Answering" has been accepted to appear at NeurIPS 2023! The paper can be found here here. If you prefer a 3-minute technical summary, look at this post. The code will be released in this repository soon. We are happy to announce that we have made a major change to our code framework such that experiment management and data processing are more flexible.
  • [01/05/2023] FVQA 2.0 is released here.
  • [08/02/2023] Our work for creating adversarial samples for the FVQA dataset is accepted to appear at EACL 2023. The dataset and codes will be released here soon.
  • [01/01/2023] We released an initial version of our work. The framework supports:
    • RA-VQA-NoDPR (T5 baseline)
    • RA-VQA-FrDPR (DPR retriever + T5 reader)
    • RA-VQA (joint training of DPR + T5)
    • TRiG (Our replication of TRiG)
    • Datasets: OK-VQA and F-VQA
  • [19/12/2022] We plan to release the code within Dec, 2022. The author is currently overwhelmed by internship work. Thanks for waiting!
  • [12/12/2022] We plan to release the code of our reproduced TRiG system as well.

Table of Content

Benchmarks

Benchmark Results for PreFLMR in the dedicated FLMR codebase

ModelWIT Recall@10IGLUE Recall@1KVQA Recall@5MSMARCO Recall@5OVEN Recall@5LLaVA Recall@1EVQA Recall@5EVQA Pseudo Recall@5OKVQA Recall@5OKVQA Pseudo Recall@5Infoseek Recall@5Infoseek Pseudo Recall@5
LinWeizheDragon/PreFLMR_ViT-G🤗0.6190.7180.4190.7830.6430.7260.6250.7210.3020.6740.3920.577
LinWeizheDragon/PreFLMR_ViT-L🤗0.6050.6990.4400.7790.6080.7290.6090.7080.3140.6900.3740.578
LinWeizheDragon/PreFLMR_ViT-B🤗0.4270.5740.2940.7860.4680.6730.5500.6630.2720.6580.2600.496

Note: We converted the checkpoints from PyTorch to Huggingface-transformers, whose benchmark results differ from the numbers reported in the original paper slightly. You can reproduce the results in the above paper by referring to the instructions in this document.

Benchmark Results for FLMR in this codebase

Using the provided codebase, it is expected to obtain the following results.

ModelRecall@5Notes
FLMR (9 ROIs)89.20
FLMR (9 ROIs)89.28Using the pretrained ckpt
ModelVQA ScoreNotes
RA-VQA54.51In the previous paper
RA-VQA-v261.86with FLMR

Since we refactored the codebase significantly in clean-up, these numbers may not match exactly to what were reported in the paper.

Resources

We host the data required for running this system in Huggingface and Baidu Cloud (coming soon).

The data contains:

  • Packed pre-extracted data for OK-VQA (including OCR features, VinVL object detection features, Oscar captioning features)
  • FLMR with the mapping network pretrained on WIT (batch size 30, in-batch negative sampling, 1 GPU, grad accumulation 4)
  • FLMR pretrained on OK-VQA and Google Search dataset (batch size 30, in-batch negative sampling, 1 GPU, grad accumulation 4)

You can download these resources from Huggingface altogether: Combined Download on Huggingface.

wget https://huggingface.co/datasets/BByrneLab/RAVQAV2Data/resolve/main/RAVQA_v2_data.tar.gz?download=true

After downloading and extracting the tar.gz, you need to unzip all .zip files under okvqa folder and okvqa/pre-extracted/OCR.zip.

After otaining all these resources, you should:

  • Change the data paths in configs/okvqa/okvqa_data_config.libsonnet
  • Change the paths to TokenizerModelVersion in configs/okvqa/FLMR_with_ROI.jsonnet
  • Change the paths to EncoderModelVersion and TokenizerModelVersion in configs/okvqa/FLMR_base_preload_vision_features.jsonnet

By downloading the provided OK-VQA data, you must comply with the OK-VQA license and MS COCO license.

Detailed Instructions

Overview

The framework was designed and implemented by Weizhe Lin, University of Cambridge. All rights are reserved. Use with research purposes is allowed. This framework is designed for research purpose, with flexibility for extension. It is not a perfect framework for production, of course.

The training and testing are backboned by pytorch-lightning. The pre-trained Transformer models are from Huggingface-transformers. The training platform is Pytorch.

In this release, we designed a new framework that wraps the data processing/training/testing utilities - Runway For ML. It is a highly efficient framework that enables flexible experimentation and data processing. Data processing is formulated as a Directional Acyclic Graph, on which the framework traverses through nodes to prepare data. This framework enables efficient data processing at million scale. For more details, please refer to the README of the framework. When cloning this repository, please use the kbvqa_dev branch.

The indexing and searching of FLMR is supported by FAISS and ColBERT. The ColBERT engine is plugged into this project as a third-party package. We fixed many errors in this package following LI-RAGE.

Structure

The framework consists of:

  1. main.py: the main program. It loads a config file and override some entries with command-line arguments. It initialises a RunwayExperiment instance to execute training and testing.
  2. Data Ops: it loads the data according to configs specified in data_pipeline. The details of this feature can be found in here
  3. Datasets: they are automatically loaded by the data loader wrapper. .collate_fn is defined to collate the data. An decorator class ModuleParser is used to help generate the training inputs. This decorator class generates input dict according to configs (config.model_config.input_modules/decorder_input_modules/output_modules).
  4. **Model

编辑推荐精选

Manus

Manus

全面超越基准的 AI Agent助手

Manus 是一款通用人工智能代理平台,能够将您的创意和想法迅速转化为实际成果。无论是定制旅行规划、深入的数据分析,还是教育支持与商业决策,Manus 都能高效整合信息,提供精准解决方案。它以直观的交互体验和领先的技术,为用户开启了一个智慧驱动、轻松高效的新时代,让每个灵感都能得到完美落地。

飞书知识问答

飞书知识问答

飞书官方推出的AI知识库 上传word pdf即可部署AI私有知识库

基于DeepSeek R1大模型构建的知识管理系统,支持PDF、Word、PPT等常见文档格式解析,实现云端与本地数据的双向同步。系统具备实时网络检索能力,可自动关联外部信息源,通过语义理解技术处理结构化与非结构化数据。免费版本提供基础知识库搭建功能,适用于企业文档管理和个人学习资料整理场景。

Trae

Trae

字节跳动发布的AI编程神器IDE

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

TraeAI IDE协作生产力转型热门AI工具
酷表ChatExcel

酷表ChatExcel

大模型驱动的Excel数据处理工具

基于大模型交互的表格处理系统,允许用户通过对话方式完成数据整理和可视化分析。系统采用机器学习算法解析用户指令,自动执行排序、公式计算和数据透视等操作,支持多种文件格式导入导出。数据处理响应速度保持在0.8秒以内,支持超过100万行数据的即时分析。

使用教程AI工具酷表ChatExcelAI智能客服AI营销产品
DeepEP

DeepEP

DeepSeek开源的专家并行通信优化框架

DeepEP是一个专为大规模分布式计算设计的通信库,重点解决专家并行模式中的通信瓶颈问题。其核心架构采用分层拓扑感知技术,能够自动识别节点间物理连接关系,优化数据传输路径。通过实现动态路由选择与负载均衡机制,系统在千卡级计算集群中维持稳定的低延迟特性,同时兼容主流深度学习框架的通信接口。

DeepSeek

DeepSeek

全球领先开源大模型,高效智能助手

DeepSeek是一家幻方量化创办的专注于通用人工智能的中国科技公司,主攻大模型研发与应用。DeepSeek-R1是开源的推理模型,擅长处理复杂任务且可免费商用。

KnowS

KnowS

AI医学搜索引擎 整合4000万+实时更新的全球医学文献

医学领域专用搜索引擎整合4000万+实时更新的全球医学文献,通过自主研发AI模型实现精准知识检索。系统每日更新指南、中英文文献及会议资料,搜索准确率较传统工具提升80%,同时将大模型幻觉率控制在8%以下。支持临床建议生成、文献深度解析、学术报告制作等全流程科研辅助,典型用户反馈显示每周可节省医疗工作者70%时间。

Windsurf Wave 3

Windsurf Wave 3

Windsurf Editor推出第三次重大更新Wave 3

新增模型上下文协议支持与智能编辑功能。本次更新包含五项核心改进:支持接入MCP协议扩展工具生态,Tab键智能跳转提升编码效率,Turbo模式实现自动化终端操作,图片拖拽功能优化多模态交互,以及面向付费用户的个性化图标定制。系统同步集成DeepSeek、Gemini等新模型,并通过信用点数机制实现差异化的资源调配。

AI IDE
腾讯元宝

腾讯元宝

腾讯自研的混元大模型AI助手

腾讯元宝是腾讯基于自研的混元大模型推出的一款多功能AI应用,旨在通过人工智能技术提升用户在写作、绘画、翻译、编程、搜索、阅读总结等多个领域的工作与生活效率。

AI 办公助手AI对话AI助手AI工具腾讯元宝智能体热门
Grok3

Grok3

埃隆·马斯克旗下的人工智能公司 xAI 推出的第三代大规模语言模型

Grok3 是由埃隆·马斯克旗下的人工智能公司 xAI 推出的第三代大规模语言模型,常被马斯克称为“地球上最聪明的 AI”。它不仅是在前代产品 Grok 1 和 Grok 2 基础上的一次飞跃,还在多个关键技术上实现了创新突破。

下拉加载更多