Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

✨✨Woodpecker: Hallucination Correction for Multimodal Large Language Models

NotificationsYou must be signed in to change notification settings

BradyFU/Woodpecker

Repository files navigation


Hallucination is a big shadow hanging over the rapidly evolving Multimodal Large Language Models (MLLMs), referring to the phenomenon that the generated text is inconsistent with the image content. In order to mitigate hallucinations, existing studies mainly resort to an instruction-tuning manner that requires retraining the models with specific data. In this paper, we pave a different way, introducing a training-free method named Woodpecker. Like a woodpecker heals trees, it picks out and corrects hallucinations from the generated text. Concretely, Woodpecker consists of five stages: key concept extraction, question formulation, visual knowledge validation, visual claim generation, and hallucination correction. Implemented in a post-remedy manner, Woodpecker can easily serve different MLLMs, while being interpretable by accessing intermediate outputs of the five stages. We evaluate Woodpecker both quantitatively and qualitatively and show the huge potential of this new paradigm. On the POPE benchmark, our method obtains a 30.66%/24.33% improvement in accuracy over the baseline MiniGPT-4/mPLUG-Owl.

This is the first work to correct hallucination in multimodal large language models. If you have any question, please feel free to emailbradyfu24@gmail.com or add weChat ID xjtupanda.

🌋 Evaluation

We perform experiments based on four baseline models:

The experimental results are shown below. For more details, please check outour paper.

📍 POPE Result

This part focuses on object-level hallucinations.

📍 MME Result

This part focuses on both object- and attribute-level hallucinations.

📍 LLaVA-QA90 Result

We also propose to perform open-ended evaluation directly via the recently opened GPT-4V interface. We design two metrics: accuracy and detailedness.

▶️ Demo

Please feel free to try ourOnline Demo!

🛠️ Preliminary

  1. Create conda environment
conda create -n corrector python=3.10conda activate correctorpip install -r requirements.txt
  1. Install required packages and models
  • Installspacy and relevant model packages, following the instructions inLink. This is used for some text processing operations.
pip install -U spacypython -m spacy download en_core_web_lgpython -m spacy download en_core_web_mdpython -m spacy download en_core_web_sm
  • For ourOpen-set Detector. Install GroundingDINO following the instructions inLink.

⭐ Usage

1. Inference

To make corrections based on an image and a text output from MLLM, run the inference code as follows:

python inference.py \        --image-path {path/to/image} \        --query"Some query.(e.x. Describe this image.)" \        --text"Some text to be corrected." \        --detector-config"path/to/GroundingDINO_SwinT_OGC.py" \        --detector-model"path/to/groundingdino_swint_ogc.pth" \        --api-key"sk-xxxxxxx" \

The output text will be printed in the terminal, and intermediate results saved by default as./intermediate_view.json.


2. Demo setup

We use mPLUG-Owl as our default MLLM in experiments. If you wish to replicate the online demo, please clone theproject and modify the variables in

sys.path.append('path/to/mPLUG-Owl')
and
'detector_config':"path/to/GroundingDINO/groundingdino/config/GroundingDINO_SwinT_OGC.py",
'detector_model_path':"path/to/GroundingDINO/weights/groundingdino_swint_ogc.pth",

Then simply run:

CUDA_VISIBLE_DEVICES=0,1 python gradio_demo.py

Here we put the corrector components on GPU with id 0 and mPLUG-Owl on GPU with id 1.

🌻 Acknowledgement

This repository benefits frommPLUG-Owl,GroundingDINO,BLIP-2, andLLaMA-Adapter. Thanks for their awesome works.

📑 Citation

If you find our project helpful to your research, please consider citing:

@article{yin2024woodpecker,  title={Woodpecker: Hallucination correction for multimodal large language models},  author={Yin, Shukang and Fu, Chaoyou and Zhao, Sirui and Xu, Tong and Wang, Hao and Sui, Dianbo and Shen, Yunhang and Li, Ke and Sun, Xing and Chen, Enhong},  journal={Science China Information Sciences},  volume={67},  number={12},  pages={220105},  year={2024},  publisher={Springer}}

About

✨✨Woodpecker: Hallucination Correction for Multimodal Large Language Models

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp